

<div class="row">
    <div class="container">

        <ol class="breadcrumb">
            <li><a href="#"> عروض الاسعار</a></li>
            <li><a href="priceoffersController.php?do=show">عروض الاسعار</a></li>
            <li class="active">اضافة </li>
        </ol>


        <div class="panel panel-default panel-m">
            <div class="panel-heading">
                <h3 class="panel-title">اضافة </h3>
            </div>
            <div class="panel-body">

                <input type="hidden" name="searchvalue" id="searchvalue" value="{$Programsettingdata->searchvalue}"/>
                <input type="hidden" name="usedParcode" id="usedParcode" value="{$Programsettingdata->usedParcode}"/>
                <input type="hidden" name="edit_offersellbill" id="edit_offersellbill" value="1"/>
                <input type="hidden" name="path" id="path" value="{$path}"/>

                <form class="nameToBeChecked form-horizontal" role="form" action="" method="post" id="offerprice_form">

                    <div class="form-group">
                        <label class="col-lg-12 control-label"> مقدمة</label>
                        <div class="col-lg-12">
                            <textarea class="form-control" name="introductioncondition" rows="5"> {$lastcondition->introduction}</textarea>
                        </div>
                    </div>

                    <div class="clearfix"></div>

                    <div class="form-group" id="radioDiv">
                        <div class="col-lg-4">
                            <label>
                                <input value="0" {if {$offerpricedata->clientid} neq 0} checked {/if}  class="radioR" name="clienttype" id="clientyes"  checked=""  type="radio" />عميل </label>

                            <label>
                                <input value="1"  {if {$offerpricedata->clientid} eq 0} checked {/if} class="noradioR" name="clienttype" id="clientno"   type="radio" /> جديد</label>
                        </div>
                    </div>


                    <div class="row">
                        <div class="form-group">
                            <label for="clientname" class="col-lg-2 control-label">اسم العميل</label>
                            <div class="col-lg-4">
                                <div id="newn_client_div" {if {$offerpricedata->clientid} eq 0} style="display:block;" {else} style="display:none;" {/if}>
                                    <input class="form-control" placeholder="اسم العميل"   name="newclientname" id="offer_newclient" required value="{$offerpricedata->clientname}" type="text"  required  />
                                </div>

                                <div id="oldn_client_div"  {if {$offerpricedata->clientid} neq 0} style="display:block;" {else} style="display:none;" {/if}>
                                    <input type="text" name="oldclientname" id="offer_oldclient" required  class="select2product wdt100"  data-placeholder="اختر عميل" tabindex="301" required/>
                                    <input type="hidden" id="edit_hiddenclientId" name="edit_hiddenclientId" value="{$offerpricedata->clientid}"  />
                                    <input type="hidden" id="edit_hiddenclientName" name="edit_hiddenclientName" value="{$clientName}"  />
                                </div>
                            </div>

                            <!-- ===============================================buttons ==============================================================-->
                            <div class="col-lg-5">
                                <button type="button" name="addwrite_priceoffer" id="addwrite_priceoffer" class="btn btn-primary pull-left ft-nor"> اضافة كتابة</button>
                            </div>
                            <div class="col-lg-1">
                                <button type="button" name="addwrite_priceoffer" id="addpro_priceoffer" class="btn btn-primary pull-left ft-nor"> اضافة منتج</button>
                            </div>

                        </div>



                    </div>

                    <input type="hidden" name="offerhidden_itr" id="offerhidden_itr" value="{$allproductdatacount}"/>
                    <!-- ======================================Table=============================================================================================== -->
                    <div class="form-group">
                        <div class="table-responsive bd-gr">
                            <table class="table billtable table-bordered table-black" id="priceoffer_tb">
                                <thead>
                                    <tr>
                                        <th class="wdt120">الباركود</th>
                                        <th class="wdt120">اسم المنتج</th>
                                        <th class="wdt120">سعر البيع</th>
                                        <th class="wdt120"> الوصف</th>
                                        <th class="wdt120"> العدد</th>
                                        <th class="wdt120"> اجمالى السعر</th>
                                        <th class="wdt120">حذف</th>

                                    </tr>
                                </thead>
                                <tbody>

                                    {assign var=i value=1}
                                    {foreach $allproductdata as  $products}
                                    <tr>
                                        <td>
                                            <input type="text" name="parcode1" id="parcode1" value="{$products->parcode}" class="form-control txt-nonraduis" onkeypress="getproductbyParcode(event, this.value, 1);" size="3"  placeholder="الباركود" />
                                        </td>
                                        {if $products->productid neq 0}
                                        <td>
                                            <input type="hidden" name="offerproudctid{$i}" id="offer_proudctid{$i}" required  class="select2product wdt100 clas_offerproduct" data-itr='{$i}'  data-placeholder="اختر منتج" tabindex="301"/>

                                            <input type="hidden" id="edit_hiddenproductId{$i}" name="edit_hiddenproductId{$i}" value="{$products->productid}"  />
                                            <input type="hidden" id="edit_hiddenproductName{$i}" name="edit_hiddenproductName{$i}" value="{$products->productName}"  />
                                        </td>
                                        {else}
                                        <td>
                                            <input type="text" name="offerproudctname{$i}" id="offerproudctname{$i}" required  data-itr='{$i}' class="form-control"  data-placeholder=" اسم المنتج" value="{$products->productname}" tabindex="301"/>

                                        </td>
                                        {/if}
                                        <td>
                                            <input type="text" name="offerproprice{$i}" id="offerproprice{$i}" required data-itr="{$i}"  class="form-control txt-nonraduis positiveNo calcprice" value="{$products->sellprice}" />
                                        </td>
                                        <td>
                                            <textarea name="prodescrp{$i}" id="prodescrp{$i}" class="form-control">{$products->prodescrption}</textarea>
                                        </td>
                                        <td>
                                            <input type="text" name="offerpronumber{$i}" id="offerpronumber{$i}" required data-itr="{$i}"  class="form-control txt-nonraduis positiveNo calcprice" value="{$products->pronumber}" />
                                        </td>
                                        <td class="aw_totalprice_offer">
                                            <input type="text" id="div_pr_offertotal{$i}" required name="div_pr_offertotal{$i}" data-itr="{$i}"  class="form-control txt-nonraduis positiveNo finalprice" value="{$products->totalprice}"/>
                                        </td>
                                        <td>
                                            <button type="button" id="remove{$i}" class="offerprice_remove close flt-none" aria-hidden="true"  >&times;</button>
                                        </td>
                                    </tr>
                                    {capture assign=i}{$i+1}{/capture}
                                    {/foreach}
                                </tbody>
                            </table>
                        </div>


                        <button type="button" class="btn btn-primary pull-left ft-nor">
                            اجمالى الاسعار <span class="badge wht-clo">
                                <span name="totalsellbillprice" id="offer_sellbillprice">{$offerpricedata->totalprice}</span>
                                <input type="hidden" name="offer_sellbillpricenew" id="offer_sellbillpricenew" value="{$offerpricedata->realtotalprice}">
                                </button>
                                <button type="button" class="btn btn-primary pull-left ft-nor">
                                    اجمالى الاسعار كتابة <span class="badge wht-clo">
                                        <span id="offer_sellbillprice_written">{$offerpricedata->totalprice_written}</span>
                                </button>
                                </div>

                                <!-- =================================================   -->

                                <div class="form-group">
                                    <label class="col-lg-12 control-label"> شروط عامة</label>
                                    <div class="col-lg-12">
                                        <textarea class="form-control" id="ckeditor" name="generalcondition" rows="5"> {$lastcondition->detail}</textarea>
                                        <input type="hidden" name="generalconditionId" value="{$lastcondition->id}"/>
                                    </div>
                                </div>



                                <!-- =================================================   -->





                                <!-- =================================================   -->

                                <div class="form-group">

                                    <input type="hidden" name="editid" value="{$offerpricedata->id}"/>
                                    <input type="hidden" name="serialno" id="serialno" value="{$offerpricedata->serialno}"/>
                                    <input type="hidden" name="billdate" id="billdate" value="{$offerpricedata->sysdate}"/>
                                    <div class="col-lg-offset-2 col-lg-4">
                                        <input type="button"   id="offerprice_editsave" class="btn btn-primary pull-left" value="حفظ الامر">
                                        <button type="button" id="printedit_offerprice" class="btn btn-success pull-left">حفظ وطباعة</button>
                                    </div>
                                </div>


                                </form>
                                </div>
                                </div>




                                </div>
                                </div>



                                <!--{literal}

                                <script type="text/javascript">
                                    var name = new Spry.Widget.ValidationTextField("name");
                                    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "real");
                                </script>

                                {/literal}-->

