
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">فايده عميل </a></li>
            <li><a href="#">فايده عميل</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">

                <form action="FaidaController.php?do=add" method="post" id="form1" class="form-horizontal nameToBeChecked">
                    <div class="form-group mg-bt5">
                        <label class="col-lg-2 control-label">اسم العميل</label>
                        <div class="col-lg-4"> <span id="spryclient">
                                <div id="clientDiv">
                                    <select class="select2Supp wdt100" name="supplier" id="supplier" disabled>


                                        {foreach $clientData as $client}

                                        <option  value="{$client->clientid}"  {if $allfaida->clientId == $client->clientid} selected {/if}>{$client->clientname}</option>
                                        {/foreach}


                                    </select>
                                </div>
                                <span class="selectInvalidMsg">*</span></span> </div>
                    </div>

                    <div {if {$billsettingsData[2]->billsettingsvalue} eq 0}  {else} style="display:none" {/if} >
                        {if {$billsettingsData[26]->billsettingsvalue} eq 1}

                        <!------ {if {$billsettingsData[2]->billsettingsvalue} eq 0}  {else} style="display:none" {/if}---------------------->
                        <div class="form-group mg-bt5">


                            {if $userdata->userstoreid  eq 0}
                            <label class="col-lg-2 control-label">المخزن</label>
                            <div class="col-lg-4">
                                <select class="select2 wdt100 clientstore" name="storeid" id="storeid" disabled>
                                    {foreach $storeData as $store}
                                    <option value="{$store->storeId}" {if $allfaida->storeId eq $store->storeId} selected="selected" {/if}>{$store->storeName}</option>

                                    {/foreach}
                                </select>
                            </div>
                            {else}

                            <div style="display:none">

                                <select class="select2 wdt100 clientstore" name="storeid" id="storeid" >
                                    <option value="-1">اختر مخزن</option>

                                    {foreach $storeData as $store}


                                    <option {if {$store->storeId} eq {$userdata->userstoreid}} selected="selected"   {/if}value="{$store->storeId}">{$store->storeName}</option>


                                    {/foreach}


                                </select>
                            </div>
                            <!--input name="storeid" id="storeid"  type="hidden" value="{$userdata->userstoreid}" /-->
                            <label class="col-lg-4 control-label">المخزن</label>
                            <div class="col-lg-8 clientstoretxt">
                                {foreach $storeData as $store}
                                {if {$store->storeId} eq {$userdata->userstoreid}}{$store->storeName} {/if}
                                {/foreach}
                            </div>
                            {/if}

                        </div>
                        {else}


                        <div  style="display:none">
                            <select class="select2 wdt100 clientstore" name="storeid" id="storeid" >


                                {foreach $storeData as $store}



                                <option {if {$store->storeId} eq {$userdata->userstoreid}} selected="selected"   {/if}value="{$store->storeId}">{$store->storeName}</option>


                                {/foreach}


                            </select>
                        </div>
                        {/if}

                    </div>

                    <!-- hidden ===============================-->
                    <input type="hidden" name="billnameid" id="billnameid" value="{$billnameid}"/>
                    <input type="hidden" name="settingreturn" id="settingreturn" value="{$billsettingsData[0]->billsettingsvalue}"/>
                    <input type="hidden" name="settingclient" id="settingclient" value="{$billsettingsData[1]->billsettingsvalue}"/>
                    <input type="hidden" name="settingstore" id="settingstore" value="{$billsettingsData[2]->billsettingsvalue}"/>
                    <input type="hidden" name="settingseller" id="settingseller" value="{$billsettingsData[3]->billsettingsvalue}"/>
                    <input type="hidden" name="settingparcode" id="settingparcode" value="{$billsettingsData[4]->billsettingsvalue}"/>
                    <input type="hidden" name="settingdate" id="settingdate" value="{$billsettingsData[5]->billsettingsvalue}"/>
                    <input type="hidden" name="settingnewproduct" id="settingnewproduct" value="{$billsettingsData[6]->billsettingsvalue}"/>
                    <input type="hidden" name="settingcomment" id="settingcomment" value="{$billsettingsData[7]->billsettingsvalue}"/>
                    <input type="hidden" name="settingdiscount" id="settingdiscount" value="{$billsettingsData[8]->billsettingsvalue}"/>
                    <input type="hidden" name="settingQuantitiyFocus" id="settingQuantitiyFocus" value="{$billsettingsData[9]->billsettingsvalue}"/>
                    <input type="hidden" name="settingUnit" id="settingUnit" value="{$billsettingsData[10]->billsettingsvalue}"/>

                    <!-- end of hidden ===============================-->
                    <div class="clearfix"></div>
                    <div class="margintop"></div>

                    <!-- =================================================   -->
                    <div class="row">
                        <div class="row">
                            <hr class='hidden-print'/>
                            <div class="col-lg-6">
                                <h4>المبيعات</h4>
                            </div>
                        </div>
                        <!-- end of title row-->

                        <div class="table-responsive">
                            <table class="table billtable table-bordered table-black" id="containerpros">
                                <thead>
                                <tr>
                                    <th class="wdt60 myblack" {if {$billsettingsData[40]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if}>رقم</th>
                                    <th class="wdt60 myblack" {if {$billsettingsData[59]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} class="wdt120">الباركود</th>
                                    <th class="wdt300 myblack">اسم المنتج</th>
                                    {if {$billsettingsData[26]->billsettingsvalue} eq 0}

                                    <th  class="wdt240 myblack">المخزن</th>


                                    {/if}

                                    <th  class=" myblack hidden-print" {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} class="wdt240">ملاحظات</th>
                                    <th   class=" myblack wdt100n"  {if {$billsettingsData[53]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}">الوحدة</th>
                                    <th class="wdt100n myblack" {if {$billsettingsData[64]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>العدد</th>
                                    <th class="wdt100n check_tr_unit  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}" >{$Programsettingdata->scunitname}</th>

                                    <th class="wdt100n myblack">السعر</th>

                                    <th  class=" myblack" {if {$billsettingsData[8]->billsettingsvalue} eq 0} {else} style="display:none" {/if} class="wdt100n">الخصم</th>
                                    <th class="wdt100n myblack"> الاجمالى</th>
                                </tr>
                                </thead>
                                <tbody>

                                {assign var=x value=1}
                                {foreach $allFaidaProduct as $sellbilldetail}
                                <tr>
                                    <td  class=" myblack"  {if {$billsettingsData[40]->billsettingsvalue} eq 0}  {else} style="display:none !important;" {/if}>{$x}</td>
                                    <td  class=" myblack"  {if {$billsettingsData[59]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>
                                        <div id="productparcode1" >
                                            <p class="form-control-static"> {$sellbilldetail->parcode} </p>
                                        </div>
                                    </td>
                                    <td  class=" myblack" >
                                        <div id="productdiv1">
                                            <p class="form-control-static"> {$sellbilldetail->productName}/ {$sellbilldetail->productCatName}
                                                {if $sellbilldetail->sizeName != ''}/ {$sellbilldetail->sizeName}{/if}
                                                {if $sellbilldetail->colorName != ''}/ {$sellbilldetail->colorName}{/if}
                                            </p>
                                        </div>
                                    </td>

                                    {if {$billsettingsData[26]->billsettingsvalue} eq 0}
                                    {if {$sellbilldetail->storeName} <> ""}
                                    <td  class=" myblack" >
                                        <div id="productparcode1" >
                                            <p class="form-control-static"> {$sellbilldetail->storeName} </p>
                                        </div>
                                    </td>
                                    {else}
                                    <td  class=" myblack" >
                                        <div id="productparcode1" >
                                            <p class="form-control-static">

                                                {$sellbillData->storeName}
                                            </p>
                                        </div>
                                    </td>
                                    {/if}
                                    {/if}



                                    <td  class=" myblack  {if  $sellbilldetail->note eq ''} hidden-print{/if}"  {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else}  style="display:none !important"  {/if}>
                                        <p class="form-control-static"> {$sellbilldetail->note} </p>
                                    </td>
                                    <td  class=" myblack"  {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>
                                        <div id="productunitdiv1">
                                            <p class="form-control-static"> {$sellbilldetail->unitName} </p>
                                        </div>
                                    </td>

                                    <td  class=" myblack"  {if {$billsettingsData[64]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>
                                        <p class="form-control-static"> {$sellbilldetail->pronum} </p>
                                    </td>

                                    <td class="check_tr_quantity  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                        {$sellbilldetail->otherdetailquantity}
                                    </td>

                                    <td  class=" myblack" >
                                        <div id="propricechange1">
                                            <p class="form-control-static"> {$sellbilldetail->proprice} </p>
                                        </div>
                                    </td>

                                    <td  class=" myblack"  {if {$billsettingsData[8]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>
                                        <p class="form-control-static">
                                            {$sellbilldetail->discountvalue}
                                        </p>
                                    </td>
                                    <td  class=" myblack" >
                                        <p class="form-control-static"> {$sellbilldetail->faidaproducttotalprice} </p>
                                    </td>
                                </tr>
                                {capture assign=x}{$x+1}{/capture}
                                {/foreach}

                                </tbody>

                            </table>
                        </div>
                        <button type="button" class="btn btn-primary pull-left ft-nor"> اجمالى المبيعات <span class="badge wht-clo">
                        <div id="sellbilltotal">{$faidatotal}</div>
                    </span> </button>
                    </div>

                    <!-- end of title row-->

                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label"> المقدم</label>
                        <div class="col-lg-4">

                            <input type="text" class="form-control" name="presenter" id="presenter" readonly value="{$allfaida->presenter}">
                        </div>
                    </div>


                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label">الاقساط</label>
                        <div class="col-lg-4">
                            <select class="select2 wdt100 prem" name="Installment_duration" disabled>

                                <option value="0">اختر القسط</option>
                                <option value="{$Programsettingdata->three_months}" {if {$Programsettingdata->three_months} eq {$allfaida->installment_duration}} selected="selected"   {/if}>3 شهور</option>
                                <option value="{$Programsettingdata->six_months}" {if {$Programsettingdata->six_months} eq {$allfaida->installment_duration}} selected="selected"   {/if}>6 شهور</option>
                                <option value="{$Programsettingdata->twelve_months}" {if {$Programsettingdata->twelve_months} eq {$allfaida->installment_duration}} selected="selected"   {/if}>12 شهر</option>
                                <option value="{$Programsettingdata->eighteen_months}" {if {$Programsettingdata->eighteen_months} eq {$allfaida->installment_duration}} selected="selected"   {/if}>18 شهر</option>
                                <option value="{$Programsettingdata->twentyfour_months}" {if {$Programsettingdata->twentyfour_months} eq {$allfaida->installment_duration}} selected="selected"   {/if}> 24 شهر</option>
                                <option value="{$Programsettingdata->thirty_months}" {if {$Programsettingdata->thirty_months} eq {$allfaida->installment_duration}} selected="selected"   {/if}>30 شهر</option>
                                <option value="{$Programsettingdata->sixthirty_months}" {if {$Programsettingdata->sixthirty_months} eq {$allfaida->installment_duration}} selected="selected"   {/if}>36 شهر</option>
                                <option value="{$Programsettingdata->fortytwo_months}" {if {$Programsettingdata->fortytwo_months} eq {$allfaida->installment_duration}} selected="selected"   {/if}>42 شهر</option>
                                <option value="{$Programsettingdata->fortyeight_months}" {if {$Programsettingdata->fortyeight_months} eq {$allfaida->installment_duration}} selected="selected"   {/if}>48 شهر</option>
                            </select>

                        </div>
                    </div>


                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label">نسبه الزيادة</label>
                        <div class="col-lg-4">

                            <input type="text" class="form-control" name="premium" id="premium" value="{$allfaida->premmium}" readonly><span style="float: left;margin-top: -21px;margin-left: 8px;">%</span>
                        </div>
                    </div>


                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label">الاجمالي العام</label>
                        <div class="col-lg-4">

                            <input type="text" class="form-control" name="total_amount" id="totalafteprem" value="{$allfaida->total_amount}" readonly>
                        </div>
                    </div>



                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label">التعليق</label>
                        <div class="col-lg-4">

                            <textarea class="form-control" rows="3" name="textDetails" id="textDetails" readonly>{$allfaida->comment}</textarea>

                        </div>
                    </div>




                    <div class="row  hidden-print m10" >
                        <div class="col-lg-12 text-center">
                            <!--<button type="submit"  id="saveBtn" class="btn btn-primary">-->
                            <!--<i class="glyphicon glyphicon-ok "></i>  حفظ</button>-->

                            <a href="FaidaController.php?do=show"  id="rtnBtn" class="btn btn-primary">
                                <i class="glyphicon glyphicon-backward"></i>  رجوع</a>
                        </div>



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

                </form>


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

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

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

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


<!------------------------Client Model----------------------------->
<!-- Modal -->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content bg-modal">
            <div class="modal-header">
                <button type="button" class="close pull-left savemodel2" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">اضافة عميل</h4>
            </div>
            <div class="modal-body">
                <form id="clientInfo" action="#" method="post" class="form-horizontal">
                    <div class="form-group">
                        <label for="newclientName" class="col-lg-2 control-label">اسم العميل</label>
                        <div class="col-lg-4"> <span id="sprytextfield2">
                                <input class="form-control" placeholder="اسم العميل" id="newclientName"   name="newclientName" type="text"  required="required"/>
                                <span class="textfieldRequiredMsg">*</span></span>
                            <div id="nameError" class="alert alert-block alert-danger fade in" style="display:none">
                                <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">&times;</button>
                                <h4>رسالة خطا</h4>
                                <p>هذا الاسم مستخدم من قبل</p>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                    </div>




                    <div class="form-group">
                        <label for="clientaddress" class="col-lg-2 control-label">{$Programsettingdata->clientcodname}</label>
                        <div class="col-lg-4">
                            <input class="form-control" placeholder="{$Programsettingdata->clientcodname}" id="clientcode" name="clientcode" type="text"/>
                        </div>
                    </div>


                    <div class="form-group">
                        <label for="txtAddress" class="col-lg-2 control-label">الشركة - المنطقة</label>
                        <div class="col-lg-4">
                            <span id="spryselect1">
                                <input  {if $Programsettingdata->clientfieldrequired eq 1}  required="required" {/if} type="hidden" name="clientareaid" value="0" id="clientareaid"/>
                                <span class="selectInvalidMsg">اختر الشركة - المنطقة</span></span>

                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="newclientdebt" class="col-lg-2 control-label">المديونية</label>
                        <div class="col-lg-4"> <!--<span id="sprytextfield3">-->
                            <input class="form-control numberinput" placeholder="المديونية" id="newclientdebt" name="newclientdebt" type="text" required="required"/>
                            <!--<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل المديونية صحيحة</span></span>--> </div>
                    </div>
                    <div class="form-group">
                        <label for="clientaddress" class="col-lg-2 control-label">العنوان</label>
                        <div class="col-lg-4">
                            <input class="form-control" placeholder="العنوان" id="clientaddress" name="clientaddress" type="text"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientphone" class="col-lg-2 control-label">رقم التليفون</label>
                        <div class="col-lg-4">
                            <input class="form-control numberinput" placeholder="رقم التليفون" id="clientphone" name="clientphone" type="text"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientmobile" class="col-lg-2 control-label">رقم الموبايل</label>
                        <div class="col-lg-4">
                            <input class="form-control numberinput" placeholder="رقم الموبايل" id="clientmobile"  name="clientmobile" type="text"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="debtLimit" class="col-lg-2 control-label"> حد الدين</label>
                        <div class="col-lg-4">
                            <input type="text" name="debtLimit" class="form-control positivefloat" id="debtLimit" value="{$Programsettingdata->clientDefaultDebtLimit}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="clientdetails" class="col-lg-2 control-label">التعليق</label>
                        <div class="col-lg-4">
                            <textarea  class="form-control" rows="3" name="clientdetails" id="clientdetails"></textarea>
                        </div>
                    </div>
                    <!-- =================================================   -->


                    <div class="form-group">
                        <label for="debtLimit" class="col-lg-2 control-label"> رقم البطاقه</label>
                        <div class="col-lg-4">
                            <input type="number" name="card_number" placeholder="رقم البطاقه" class="form-control" id="card number">
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-lg-2 control-label">إرفاق ملف</label>
                        <div class="col-lg-4">
                            <input type="file" name="file_faida" id="file_faida"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label  class="col-lg-2 control-label">نوع السعر </label>
                        <div class="col-lg-4">
                            <span >
                                <select name="priceTypeId" id="priceTypeId"  data-placeholder="اختر " class="select2 wdt100">


                                    <option value="-1">اختر نوع السعر </option>
                                    <option value="0">جملة</option>
                                    <option value="1">تجزئة</option>
                                    <option value="2">نصف جملة</option>
                                </select>
                                <!--<span class="selectInvalidMsg">اختر المحافظة</span>-->
                            </span>

                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="textDetails" class="col-lg-2 control-label">المخزن</label>
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="ckstore" name="store_all" id="store_all" checked="checked" value="1" />
                                كل المخازن
                            </label>
                        </div>
                        {foreach $storeData as $data}
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="clientStore ckstore" name="store{$data->storeId}" id="store{$data->storeId}" checked="checked" disabled="disabled" value="1" />
                                {$data->storeName}
                            </label>
                        </div>
                        {/foreach}
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="texttype" class="col-lg-2 control-label">نوع العميل</label>
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="cktype" name="typeClient_all" id="typeClient_all" checked="checked" value="1" />
                                كل انوع العملاء
                            </label>
                        </div>
                        {foreach $typeClient as $data}
                        <div class="col-lg-3">
                            <label>
                                <input type="checkbox" class="typeClient cktype" name="type{$data->typeId}" id="type{$data->typeId}" checked="checked" value="1" />
                                {$data->typeName}
                            </label>
                        </div>
                        {/foreach}
                    </div>
                    <!-- =================================================   -->
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default savemodel2" data-dismiss="modal">لا</button>
                <button type="button" class="btn btn-primary savemodelclient">نعم</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->