<script type="text/javascript" src="modules/EcmReports/javascript/jquery.js"></script>
<link rel="stylesheet" href="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/css/theme.blue.min.css">
<script type="text/javascript"
        src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.js"></script>
<script type="text/javascript"
        src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.widgets.js">
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.js"></script>
<script type="text/javascript"
        src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/widgets/widget-filter-formatter-select2.min.js">
</script>
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.blockUI.js"></script>
<script type="text/javascript" src="modules/EcmReports/BimIT-Reports/productionSchedule/productionSchedule.js"></script>

<!-- HEADER -->
<table id="tableMenu" cellspacing="0" cellpadding="0">
    <tbody>
    <tr>
        <td>
            <img src="themes/Sugar5/images/CaseReports.gif" style="margin-top: 3px; margin-right: 3px;" width="16"
                 height="16">
        </td>
        <td>
            <h2>Harmonogram Produkcji</h2>
        </td>
    </tr>
</table>
<br>

<!-- SEARCH -->
<form action="index.php" method="get" name="searchProductBySales">
    <input type="hidden" name="module" value="EcmReports"/>
    <input type="hidden" name="action" value="index"/>
    <input type="hidden" name="reportName" value="productionSchedule"/>
    <table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0"
           cellspacing="0">
        <tr>
            <td class="dataLabel" width="5%" nowrap="nowrap">
                Data produkcji: od
                &nbsp;
                <input id="date_from" name="date_from" type="text" maxlength="10" size="11" tabindex="" title=""
                       value="{$dateFrom}" autocomplete="off">
                <img id="date_from_trigger" src="themes/default/images/jscalendar.gif">
                <script language="JavaScript" type="text/javascript">
                    Calendar.setup({ldelim}
                        inputField: "date_from",
                        daFormat: "%d.%m.%Y",
                        button: "date_from_trigger",
                        singleClick: true,
                        dateStr: "",
                        step: 1
                        {rdelim}
                    );
                </script>
                &nbsp;
                do
                &nbsp;
                <input autocomplete="off" name="date_to" id="date_to" value="{$dateTo}" title="" tabindex="" size="11"
                       maxlength="10" type="text">
                <img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_to_trigger">
                <script language="JavaScript" type="text/javascript">
                    Calendar.setup({ldelim}
                        inputField: "date_to",
                        daFormat: "%d.%m.%Y",
                        button: "date_to_trigger",
                        singleClick: true,
                        dateStr: "",
                        step: 1
                        {rdelim}
                    );
                </script>
                &nbsp;&nbsp;<input class="button" id="submitForm" name="submit" value="Filtruj" type="submit">
            </td>
        </tr>
    </table>
</form>

<input class="button" id="duplicateBtn" value="Duplikuj" type="button">
<input class="button" id="deleteBtn" value="Usuń" type="button">&nbsp;&nbsp;&nbsp;
<input class="button" id="excelBtn" value="Excel" type="button">
<input class="button" id="pdfBtn" value="PDF" type="button">
<input class="button" value="Utwórz zamówienie wewnętrzne" type="button" id="createInsideOrder"/>
<form action="index.php?module=EcmInsideOrders&action=EditView&fromProductsBySalesReport=true" method="post"
      target="_blank" id="createInsideOrderForm">
    <input id="insideOrderProducts" name="insideOrderProducts" type="hidden" value=""/>
</form>

<div id="1">
    <table id="allTable">
        <thead>
        <tr>
            <th>&nbsp;</th>
            <th>Indeks</th>
            <th>Nazwa</th>
            <th>Data produkcji</th>
            <th>Ilość</th>
            <th>Ilość ZS</th>
            <th>Stan</th>
            <th>ZS E5</th>
            <th>Typ</th>
            <th>Status</th>
            <th>Zamawiający</th>
            <th>Odbiorca</th>
            <th>Forma</th>
            <th>Marka</th>
            <th>Data wysyłki</th>
            <th>Uwagi</th>
        </tr>
        </thead>

        <tbody aria-live="polite" aria-relevant="all">
        {foreach from=$data item=ROW name=loop}
            <tr>
                <td>
                    <input type="checkbox" value="{$ROW.id}" class="allCheck"/>
                    <input type="hidden" id="productId-{$ROW.id}" value="{$ROW.productId}">
                    <!--
                    <img src="modules/EcmQuotes/images/add_position.gif" style="margin-top: 3px; margin-right: 3px; cursor: pointer" width="12" alt="Duplikuj" onclick="duplicatePosition('{$ROW.id}')">
                    <img src="modules/EcmQuotes/images/deleterow.gif" style="margin-top: 3px; margin-right: 3px; cursor: pointer" width="12" alt="Usuń" onclick="removePosition('{$ROW.id}')">
                    -->
                </td>
            <td>
                <a title="{$ROW.productFullCode}" target="_blank"
                   href="index.php?module=EcmProducts&action=DetailView&record={$ROW.productId}">
                    {$ROW.productCode}
                </a>
            </td>
            <td title="{$ROW.productFullName}">
                {$ROW.productName}
            </td>
                <td>
                    <input id="production-date-{$ROW.id}" name="production-date-{$ROW.id}" type="text"
                           maxlength="10" size="11" tabindex="" title="" value="{$ROW.productionDate}" autocomplete="off"
                           id="production-date-{$ROW.id}" onchange="saveProductionDate('{$ROW.id}')">
                    <img id="production-date-trigger-{$ROW.id}" src="themes/default/images/jscalendar.gif"
                         style="width: 13px;">
                    <script language="JavaScript" type="text/javascript">
                        Calendar.setup({ldelim}
                            inputField: "production-date-{$ROW.id}",
                            daFormat: "%Y-%m-%d",
                            button: "production-date-trigger-{$ROW.id}",
                            singleClick: true,
                            dateStr: "",
                            step: 1
                            {rdelim}
                        );
                    </script>
                </td>
            <td style="white-space: nowrap;">
                <div id="edit-{$ROW.id}" class="ui-icon ui-icon-pencil"
                     onclick="editQty('{$ROW.id}')" style="display: inline-block;"></div>
                <div id="save-{$ROW.id}" class="ui-icon ui-icon-check"
                     onclick="saveQty('{$ROW.id}')" style="display: none;"></div>
                <div id="qty-{$ROW.id}" style="display: inline; width: 300px;">{$ROW.qty}
                </div>
                <input id="qtyInput-{$ROW.id}" value="{$ROW.qty}" style="width: 50px; display: none;" type="number"/>
            </td>
            <td>
                {$ROW.productQty}
            </td>
            <td>
                {$ROW.productStockState}
            </td>
            <td>
                <a target="_blank" href="index.php?module=EcmSales&action=DetailView&record={$ROW.orderId}">
                    {$ROW.orderNo}
                </a>
            </td>
            <td>
                {$ROW.orderType}
            </td>
            <td>
                {$ROW.orderStatus}
            </td>
            <td>
                <a target="_blank" href="index.php?module=Accounts&action=DetailView&record={$ROW.orderParentId}">
                    {$ROW.orderParent}
                </a>
            </td>
            <td>
                {$ROW.shippingTo}
            </td>
            <td>
                {$ROW.productShape}
            </td>
            <td>
                {$ROW.productBrand}
            </td>
            <td>
                {$ROW.orderSendDate}
            </td>
            <td>
                <div id="edit-description-{$ROW.id}" class="ui-icon ui-icon-pencil"
                     onclick="editDescription('{$ROW.id}')" style="display: inline-block;"></div>
                <div id="save-description-{$ROW.id}" class="ui-icon ui-icon-check"
                     onclick="saveDescription('{$ROW.id}')" style="display: none;"></div>
                <div id="description-{$ROW.id}" style="display: inline; width: 300px;">{$ROW.description}
                </div>
                <textarea id="descriptionInput-{$ROW.id}"
                          style="display: none;">{$ROW.fullDescription}</textarea>
            </td>
            </tr>
        {/foreach}
        </tbody>
    </table>
</div>
