<!--to call from js-->
<!--    <div id="RawMaterials" style="display:none">
        {foreach $rows as $material}
                <option value="{$material->productId}">{$material->productName}</option>
        {/foreach}
    </div> -->
<!--    end   -->



<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">تصنيع </a></li>
            <li><a href="#">{if $simpleSettingData->taskOrderName == 1}طلبية{else}أمر شغل{/if}</a></li>
            <li class="active">تعديل</li>
        </ol>

        <div class="panel panel-default panel-m">
            <div class="panel-heading">
                <h3 class="panel-title">تعديل {if $simpleSettingData->taskOrderName == 1}طلبية{else}أمر شغل{/if}</h3>
            </div>

            <div class="panel-body">

                <form action="taskOrderController.php?do=update" method="post" id="form1" enctype="multipart/form-data">
                    <input type="hidden" name="searchvalue" id="searchvalue" value="{$Programsettingdata->searchvalue}"/>
                    <span class="form-group">
                        <input type="hidden" name="taskOrderId" id="taskOrderId" value="{$taskOrderData->id}" />
                    </span>
                    <div class="row">
                        <div class="col-lg-8">
                            <div class="form-group">
                                <label class="col-lg-4 control-label">عنوان</label>
                                <div class="col-lg-4">
                                    <input name="title" id="name" value="{$taskOrderData->title}" type="text" class="form-control" required/>
                                </div>
                            </div>
                            <br/>
                            <div class="form-group" style="margin-top:30px">
                                <label class="col-lg-4 control-label">تاريخ البداية</label>
                                <div class="col-lg-4">
                                    <input type="text" class="form-control awdatepicker" value="{$taskOrderData->startdate}" autocomplete="off" id="from" data-date-format="yyyy-mm-dd" name="from">
                                </div>
                            </div>
                            <br/>
                            <div class="form-group" style="margin-top:30px">
                                <label class="col-lg-4 control-label">تاريخ التسليم</label>
                                <div class="col-lg-4">
                                    <input type="text" class="form-control awdatepicker" value="{$taskOrderData->enddate}" autocomplete="off" id="to" data-date-format="yyyy-mm-dd" name="to">
                                </div>
                            </div>
                            <br/>

                            <div class="form-group" style="margin-top:30px">
                                </br>
                                <label class="col-lg-4 control-label">اختر اسم المنتج النهائى</label>
                                <div class="col-lg-4">
                                    <input type="hidden"  class="getFinalProductsWithOutProductionEquation wdt300" name="finalProductId" id="finalProductId" data-placeholder=" اختر منتج"  />
                                    <input id="oldfinalproduct" name="oldfinalproduct" type="hidden" value="{$oldfinalproduct}" />
                                    <input id="oldfinalproductname" name="oldfinalproductname" type="hidden" value="{$oldfinalproductname}" />
                                </div>
                            </div>

                            <div class="form-group" style="margin-top:30px">
                                <label class="col-lg-4 control-label">عدد</label>
                                <div class="col-lg-4">
                                    <input name="proNumber" id="proNumber" type="number" value="{$taskOrderData->num}" class="form-control positive" min="1"/>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                            {if $simpleSettingData->orderclient == 0}
                            <div class="form-group">
                                <label class="col-lg-4 control-label">العميل</label>
                                <div class="col-lg-4">
                                    <select class="select2 wdt100" name="clientid" id="clientid">
                                        <option value="-1"></option>
                                        {foreach $clientData as $data}
                                        <option value="{$data->clientid}" {if $taskOrderData->clientid == $data->clientid}selected{/if}>{$data->clientname}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            {/if}
                            <div class="clearfix"></div>
                            <div class="form-group" style="margin-top:30px">
                                <label for="email" class="col-lg-4 control-label">صورة</label>
                                <div class="col-lg-4"><img src="../upload/taskOrder/{$taskOrderData->file}" width="122" height="75"/>
                                    <input type="file" name="file" id="file"/>
                                    <input type="hidden" name="oldfile" id="oldfile" value="{$taskOrderData->file}"/>
                                </div>
                            </div>

                        </div>
                    </div>


                    <div class="row">
                        <div class="row">
                            <hr/>
                            <div class="col-lg-6">
                                <h4 class="col-lg-4">المكونات
                                </h4>
                            </div>
                        </div>
                        <p><!-- end of title row--></p>

                        <table class="table billtable table-bordered table-black" id="table">
                            <thead>
                                <tr>
                                    <th class="wdt400">المنتجات الخام</th>
                                    <th  class="wdt200"><span class="sr-only">وحدة القياس</span></th>
                                    <th  class="wdt200" >عدد الوحدات</th>
                                </tr>
                            </thead>
                            <tbody>
                                {foreach $taskOrderProductsData as $pro}
                                <tr>
                                    <td>
                                        <input type="hidden" readonly name="product{$pro@iteration}" value="{$pro->productid}"/>
                                        {$pro->productName}
                                    </td>
                                    <td>
                                        <input type="hidden" readonly name="unit{$pro@iteration}" value="{$pro->unitid}"/>
                                        {$pro->unitName}
                                    </td>
                                    <td>
                                        {$pro->quantity}
                                        <input type="hidden" class="quantity" name="quantity{$pro@iteration}"  data-val="{if $taskOrderData->num >1}{$pro->quantity / $taskOrderData->num}{else}{$pro->quantity}{/if}" value="{$pro->quantity}"/>
                                    </td>
                                </tr>
                                {/foreach}
                            <input type="hidden" name="rowitr" value="{count($taskOrderProductsData)}"/>
                            </tbody>
                        </table>
                        <p>&nbsp; </p>
                        <!--                        <button type="button" class="btn btn-primary pull-left ft-nor"> اجمالى النسبة <span class="badge wht-clo">
                                                        <div id="percentage">100</div>

                                                    </span></button>-->
                    </div>
                    <div class="row" align="center">
                        <button type="submit" id="save" class="btn btn-primary">حفظ</button>

                        <span style="color:#F00;font-weight:bold;font-size:120%;" > {$msg}</span>
                        <!--<button type="submit" id="saveAndNew" class="btn btn-success" onclick="return changeFormAction({$billnameid});">حفظ وجديد</button>-->
                    </div>
                </form>


            </div> <!-- end of panel-body-->

        </div>  <!-- end of panel panel-default-->

    </div> <!-- end of container-->

</div>  <!-- end of row-->