
<style>
    .wdthpre13{
        width: 13%;
    }
    .deserialize{
        display:none;
        opacity: unset;
        color:white!important;
    }
    .repeated{
        background-color: yellow;
    }
    .repeated2{
        background-color: rgb(204, 58, 58);
    }

</style>

<div style="overflow-x: scroll">
    <table class="table table-black">
        <thead>
            <tr>
                <th>إسم المنتج</th>
                <th class="{if {$Programsettingdata->parcode} eq 1} hidden {/if}">الباركود</th>
                <th>الكمية الحالية</th>
                <th>المخزن</th>
                <!--<th>تاريخ آخر إعادة جرد</th>-->
            </tr>
        </thead>
        <tbody>

            {assign var=x value=1}
            {assign var=allitr value=1}
            {foreach $productData as $pro}

            <tr style="background-color: #ceefff;">
                <td>{$pro->productName}</td>
                <td class="{if {$Programsettingdata->parcode} eq 1} hidden {/if}">{$pro->parcode}</td>
                <td>{$pro->productquantity}</td>
                <td>{$pro->storeName}
                    {if $pro->productquantity neq '0'}
                    <button type="button" class="btn btn-primary pull-left" data-x="{$x}" onclick="addRow($(this).data('x'))">+</button>
                    {/if}
                </td>
                <!--<td>{$pro->lastInventoryDate}</td>-->
            </tr>
            {if $pro->productquantity neq '0'}
            <tr>
                <td colspan = "4">
                    <table style="width:100%;">
                        <tr data-proitr="{$x}" style="background-color: #f5f4f4">
                            <th class="wdthpre13">السيريال</th>
                            <th class="wdthpre13">الكميه</th>
                            <th class="wdthpre13">التعليق</th>
                            <th class="wdthpre13">تاريخ البدايه</th>
                            <th class="wdthpre13">تاريخ النهايه</th>
                            {if $Programsettingdata->isCarBill == 1}
                            <th class="wdthpre13 carClass">رقم الشاسيه</th>
                            <th class="wdthpre13 carClass">رقم الموتور</th>
                            <th class="wdthpre13 carClass">اللون</th>
                            {/if}
                        </tr>

                        <tr data-proitr="{$x}">
                            <td  colspan="{if $Programsettingdata->isCarBill == 1}8{else}5{/if}">
                                <table width="100%" class="table-black" id="serialSTable{$x}">
                                    {assign var=z value=1}
                                    {foreach $pro->serialData as $serialData}<!--serialized product-->

                                    <tr>
                                        <td><input type="hidden" name="productserailid{$z}_{$x}" id="productserailid{$z}_{$x}" value="{$serialData->productserailid}"/>
                                            <input name="serialnumber{$z}_{$x}" id="serialnumber{$z}_{$x}" value="{$serialData->serialnumber}" class="myserial" data-allitr="{$allitr}" type="text"></td>
                                        <td><input name="quantity{$z}_{$x}" id="quantity{$z}_{$x}" value="{$serialData->don}" type="text" onkeyup="gettotal({$x});"></td>
                                        <td><textarea name="comment{$z}_{$x}" >{$serialData->comment}</textarea></td>
                                        <td><input name="stratdate{$z}_{$x}" value="{$serialData->startdate}"  type="text" class="stratdate awdatepicker"></td>
                                        <td><input name="enddate{$z}_{$x}"  value="{$serialData->enddate}"  type="text" class="enddate awdatepicker"></td>
                                        {if $Programsettingdata->isCarBill == 1}
                                        <td><input name="chassisNo{$z}_{$x}"  value="{$serialData->chassisNo}"  type="text" class="chassisNo"></td>
                                        <td><input name="motorNo{$z}_{$x}" value="{$serialData->motorNo}"  type="text" class="motorNo"></td>
                                        <td><input name="theColor{$z}_{$x}"  value="{$serialData->theColor}"  type="text" class="theColor"></td>
                                        {/if}
                                        <td>
                                            <!--{*if {$countmyusedserial} > 0*}-->
                                            {if $serialData->quantity > 0}
                                            لا يمكن حذفه
                                            {else}
                                            <input type="button" data-itr="{$z}_{$x}" class="deleteitr" value="حذف" />
                                            {/if}
                                        </td>
                                    </tr>
                                    {capture assign=z}{$z+1}{/capture}
                                    {assign var=allitr value=$allitr+1}
                                    {/foreach}

                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr data-proitr="{$x}">
                <td colspan="4">
                    <input name="productid{$x}" id="productid{$x}" value="{$pro->productid}" type="hidden">
                    <input name="sizeid{$x}" id="sizeid{$x}" value="{$pro->sizeid}" type="hidden">
                    <input name="colorid{$x}" id="colorid{$x}" value="{$pro->colorid}" type="hidden">
                    <input name="storeid{$x}" id="storeid{$x}" value="{$pro->storeid}" type="hidden">
                    <input name="totalproduct{$x}" id="totalproduct{$x}" value="{$pro->productquantity}" type="hidden">
                    <input name="itr{$x}" id="itr{$x}" data-e="0" value="{$z}" type="hidden">
                    <input type="hidden" name="delIds{$x}" id="delIds{$x}" value=""/>
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="button"  class="btn btn-primary pull-left" data-proitr="{$x}" id="subbtn{$x}">حفظ</button>
                        </div>
                    </div>
                </td>
            </tr>
            {/if}
            {capture assign=x}{$x+1}{/capture}
            {/foreach}

        </tbody>
    </table>
</div>
<input type="hidden" name="delIds" id="delIds" value=""/>
<input type="hidden" name="itr" id="itr" value="{$x}"/>
<script>
    $('.awdatepicker').datepicker({
        format: "yyyy-mm-dd",
        autoclose: true,
    });
</script>