
<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="oldoffer" value="{$offerClient->id}">
        <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="number" step="any"  name="quantity{$i}" id="quantity{$i}" class="form-control  positivefloat quantity quant "  min="1" value="{$offerPro->quantity}" data-itr="{$i}">
                            </td>
                            <td class="prostore{$i}">
                                <input type="number" step="any"  name="prostore{$i}" id="prostore{$i}" class="form-control  positivefloat quantity prostore quantstore " min="1" value="{$offerPro->storequant}"  readonly   data-itr="{$i}">
                            </td>
                            <td class="proavailable{$i}">
                                <input type="number" step="any" name="proavailable{$i}" id="proavailable{$i}" class="form-control  positivefloat quantity proavailable" readonly min="1" value="{$offerPro->availablequant}"  data-itr="{$i}">
                            </td>
                            <td class="prominus{$i}">
                                <input type="number"  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="number" 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="number" 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="{$offerClient->alltotal}">
                </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="{$offerClient->allquantity}">
                    <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="{$offerClient->allquantstore}">
                    <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="{$offerClient->pricestore}">
                    <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="{$offerClient->allquantavailable}">
                    <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="{$offerClient->priceavailable}">
                    <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="{$offerClient->allquantmiun}">
                    <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="{$offerClient->pricemiun}">
                </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-success"><a href="offerclient.php?do=detail&id={$offerClient->id}" 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>

