
<div class="container">
    <ol class="breadcrumb">
        <li><a href="#">شراء المنتجات</a></li>
        <li class="active">تعديل الشراء</li>
    </ol>
    <hr>
    <form class="form-horizontal " role="form" action="offerorder.php?do=add" method="post" id="sellbillForm" onsubmit="">
        <input type="hidden"  name="oldorder" value="{$offerClient->id}">
        <input type="hidden"  name="oldoffer" value="{$offerClient->oldoffer}">


        <div class="row">
            <div class="col-lg-8">
                <!-- end of form-group-->
                <div class="form-group" style="display:block">
                    <label class="col-lg-3 control-label">تاريخ تعديل الشراء</label>
                    <div class="col-lg-4"> <span id="sprydate">
                        <div class="input-group date form_datetime col-md-5" data-date=""
                             data-date-format="yyyy-mm-dd  h:i:s"
                             data-link-field="dtp_input1">
                        <input class="form-control" size="16" type="text" value="2019-09-04 11:24:00" name="mydate"
                               id="bn readonly=" "="" autocomplete="off">
                        <span class="input-group-addon "><span
                                class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                        <span class="input-group-addon"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                    </div>                                <span class="textfieldRequiredMsg">*</span></span>
                    </div>
                </div>
            </div>
            <div class="form-group mg-bt5">
                <label class="col-lg-1 ">اسم العميل</label>
                <div class="col-lg-3">
                    <input type="hidden" id="client"  name="client" class="select2client wdt100 select2-offscreen" required value="{$clientname}"  data-placeholder="" tabindex="-1" style="display: inline-block;">
                </div>
            </div>
            <div class="row">
                <div class="row">
                    <hr>
                    <div class="col-lg-6">
                        <h4>شراء المنتجات</h4>
                    </div>
                    <div class="col-lg-6">
                        <button type="button"  id="addpro" class="btn btn-primary pull-left ft-nor"> اضافة جديد</button>
                    </div>
                </div>
                <!-- end of title row-->
                <div class="table-responsive bd-gr">
                    <table class="table billtable table-bordered  table-black" id="containerpros">
                        <thead>
                        <tr>
                            <th  style="width: 40px">صورة المنتج</th>
                            <th class="wdt400">اسم المنتج</th>
                            <th class="wdt100n check_tr_quantity ">العدد المطلوب</th>
                            <th class="wdt100n check_tr_quantity ">العدد بالمخزن</th>
                            <th class="wdt100n check_tr_quantity ">العدد المتاح</th>
                            <th class="wdt100n check_tr_quantity ">العدد الناقص</th>
                            <th class="wdt100n">السعر</th>
                            <th class="wdt100n">الاجمالى</th>
                            <th>حذف</th>
                        </tr>
                        </thead>
                        <tbody id="added">
                        {assign var=i value=1}
                        {foreach $offerProduct as $offerPro}

                        <tr>
                            <td >
                                <button type="button"  data-toggle="modal" data-target=".bs-example-modal-lg" style="padding: 0" > <img style="width: 30px;height: 20px;padding: 0" src="../views/default/images/product_image/{$offerPro->prologo}" class="images" id="images{$i}" data-itr="{$i}"></button>
                            </td>
                            <td class="productdiv{$i}">
                                <input type="hidden" id="product{$i}" name="product{$i}" class="select2product{$i} wdt100 select2-offscreen" value="{$offerPro->productid}" data-itr="{$i}" data-name="{$offerPro->proname}"  data-placeholder="" tabindex="-1" style="display: inline-block;" >
                            </td>
                            <td class="quantity{$i}">

                                <input type="text"  step="any"  name="quantity{$i}" id="quantity{$i}" class="form-control  positivefloat quantity quant " value="{$offerPro->quantity}" data-itr="{$i}">
                            </td>
                            <td class="prostore{$i}">
                                <input type="text"  step="any"  name="prostore{$i}" id="prostore{$i}" class="form-control  positivefloat quantity prostore quantstore " value="{$offerPro->storequant}"  readonly   data-itr="{$i}">
                            </td>
                            <td class="proavailable{$i}">
                                <input type="text" step="any"  name="proavailable{$i}" id="proavailable{$i}" class="form-control  positivefloat quantity proavailable" readonly value="{$offerPro->availablequant}"  data-itr="{$i}">
                            </td>
                            <td class="prominus{$i}">
                                <input type="text" step="any"  name="prominus{$i}" id="prominus{$i}" class="form-control  positivefloat quantity prominus " readonly value="{$offerPro->miunquant}"  data-itr="{$i}">
                            </td>
                            <td  class="price{$i}">
                                <input type="text" step="any"  name="price{$i}" id="price{$i}" class="form-control  positivefloat quantity price " value="{$offerPro->price}"  data-itr="{$i}">
                            </td>
                            <td class="total1">
                                <input name="total{$i}" step="any"  id="total{$i}" class="form-control  positiveNo quantity total  " readonly  value="{$offerPro->total}" type="text" data-itr="{$i}">
                            </td>
                            <td class="remove{$i}">
                                <button id="remove{$i}" type="button" class="close flt-none  remove"  data-itr="{$i}" aria-hidden="true">×</button>
                            </td>
                        </tr>

                        {assign var=i value=$i+1}

                        {/foreach}
                        <input type="hidden" id="itr" name="itr" value="{$i}">


                        </tbody>

                    </table>
                </div>
                <button type="button" class="btn btn-primary pull-left ft-nor " >
                    اجمالى العرض <span class="badge wht-clo total " id="total">
                        <div id="sellbilltotal totals">{$offerClient->alltotal}</div>
                    </span>
                    <input type="hidden" name="alltotal" id="tal" class="totall" value="0">
                </button>
            </div>

            <table class="table" style="margin-top: 20px">
                <thead>
                <tr>
                    <th  style="text-align: center" colspan="2">المطلوب</th>
                    <th  style="text-align: center" colspan="2">المخزن</th>
                    <th  style="text-align: center" colspan="2">المتاح</th>
                    <th  style="text-align: center" colspan="2">الناقص</th>
                </tr>
                </thead>
                <tbody  id="">
                <tr style="text-align: center">
                    <td  style="color: blue;width: 12.5%" >الكميه <span class="allquantity" style="color: #000;padding-left:10px" >{$offerClient->allquantity}</span></td>
                    <input type="hidden" name="allquantity"  class="allquantity" value="0">
                    <td  style="color: blue;width: 12.5%" >السعر <span class="total"   style="color: #000;padding-left:10px" >{$offerClient->alltotal}</span></td>
                    <td  style="color: blue;width: 12.5%" >الكميه <span class="allquantstore" style="color: #000;padding-left:10px" >{$offerClient->allquantstore}</span></td>
                    <input type="hidden" name="allquantstore"  class="allquantstore" value="0">
                    <td  style="color: blue;width: 12.5%" >السعر <span class="pricestore" style="color: #000;padding-left:10px" >{$offerClient->pricestore}</span></td>
                    <input type="hidden" name="pricestore"  class="pricest" value="0">
                    <td  style="color: blue;width: 12.5%" >الكميه <span class="allquantavailable" style="color: #000;padding-left:10px" >{$offerClient->allquantavailable}</span></td>
                    <input type="hidden" name="allquantavailable"  class="allquantavailable" value="0">
                    <td  style="color: blue;width: 12.5%" >السعر <span class="priceavailable" style="color: #000;padding-left:10px" >{$offerClient->priceavailable}</span>السعر</td>
                    <input type="hidden" name="priceavailable"  class="priceavailable" value="0">
                    <td  style="color: blue;width: 12.5%" >الكميه <span class="allquantminus" style="color: #000;padding-left:10px" >{$offerClient->allquantmiun}</span></td>
                    <input type="hidden" name="allquantminus"  class="allquantminus" value="0">
                    <td  style="color: blue;width: 12.5%" > السعر<span class="pricestminus" style="color: #000;padding-left:10px" >{$offerClient->pricemiun}</span></td>
                    <input type="hidden" name="pricestminus" class="pricestminus" value="0">
                </tr>
                </tbody>
            </table>
        </div>
        <!-- end of second row-->
        <div style="clear: both"></div>
        <div  class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" >
            <div  style="width:500px;height:500px" class="modal-dialog modal-lg" role="document" data-dismiss="modal">
                <div class="modal-content" >
                    <div >
                        <img style="width:100%;height:100%;border: 1px solid #000" src="" id="images" >
                    </div>
                </div>
            </div>
        </div>

        <div class="row" style="padding-top: 30px;text-align: center">
            <button class="btn btn-primary"><a href="offerorder.php?do=show" >رجوع</a></button>
            <button class="btn btn-success"><a href="offerorder.php?do=detail&id={$offerClient->id}" target="_blank"> تفاصيل الشراء</a></button>
            <button class="btn btn-success"><a href="offerclient.php?do=detail&id={$offerClient->oldoffer}" target="_blank"> تفاصيل العرض</a></button>
            <button type="button" onclick="print_Custom('mycustomheader');" class="btn btn-info">طباعة</button>
            <button type="submit" id="saveBill" onclick="return addDataOnly();" class="btn btn-primary">حفظ</button>
        </div>
    </form>
</div>

