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

        <ol class="breadcrumb">
            <li><a href="#">خصائص عامة</a></li>
            <li><a href="clientController.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">


                {literal}
                <form class="form-horizontal nameToBeChecked" role="form" action="clientController.php?do=update"
                    method="post" id="spform" enctype="multipart/form-data">

                    {/literal}

                    <a class="btn pull-left" id="freeTheClient"><u>تحرير من الاستخدام</u></a>

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

                            <span id="sprytextfield1">

                                <input required="required" type="text" name="txtName" id="txtName" class="form-control"
                                    placeholder="اسم العميل" value="{$loadData->clientname}" />
                                <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="txtName" class="col-lg-2 control-label"> اسم العميل E</label>
                        <div class="col-lg-4">
                            <input type="text" name="txtNameE" id="txtNameE" class="form-control"
                                placeholder=" اسم العميل   E" value="{$loadData->txtNameE}" />
                            <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="txtDebt" class="col-lg-2 control-label">أصل المديونية</label>
                        <div class="col-lg-4">

                            <div class="input-group"> <span id="sprytextfield4">
                                    <input type="text" name="txtDebt" id="txtDebt" class="form-control positivefloat"
                                        placeholder="اصل المديونية" value="{$loadData->clientdebt}"
                                        readonly="readonly" />
                                    <span class="textfieldRequiredMsg">*</span><span
                                        class="textfieldInvalidFormatMsg">ادخل رقم </span></span><span
                                    class="input-group-addon">{$currency}</span>
                            </div>

                        </div>
                    </div>


                    <div class="form-group">
                        <label for="txtName" class="col-lg-2 control-label">رقم التليفون</label>
                        <div class="col-lg-4">
                            <span id="phoneError"><!-- textfieldRequiredState -->
                                <input type="text" name="txtPhone" id="txtPhone" class="form-control positiveNo"
                                    placeholder="رقم التليفون" value="{$loadData->clientphone}" />
                                <span id="phoneErrorTxt" class="textfieldRequiredMsg"></span></span>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label for="txtMobile" class="col-lg-2 control-label">رقم الموبايل</label>
                        <div class="col-lg-4">
                            <span id="mobileError"><!-- textfieldRequiredState -->
                                <input type="text" name="txtMobile" id="txtMobile" class="form-control positiveNo"
                                    placeholder="رقم الموبايل" value="{$loadData->clientmobile}" />
                                <span id="mobileErrorTxt" class="textfieldRequiredMsg"></span></span>

                        </div>
                    </div>

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

                    <div class="form-group">
                        <label for="txtAddress" class="col-lg-2 control-label">العنوان</label>
                        <div class="col-lg-4">
                            <input type="text" name="txtAddress" id="txtAddress" class="form-control"
                                placeholder="العنوان" value="{$loadData->clientaddress}" />

                        </div>
                    </div>
                    <div class="form-group">
                        <label for="txtAddress" class="col-lg-2 control-label">العنوان2</label>
                        <div class="col-lg-4">
                            <input type="text" name="txtAddress2" id="txtAddress2" class="form-control"
                                placeholder="العنوان2" value="{$loadData->clientaddress2}" />

                        </div>
                    </div>
                    <div class="form-group">
                        <label for="txtAddress" class="col-lg-2 control-label">الدولة</label>
                        <div class="col-lg-4">
                            <input type="text" name="country" id="country" class="form-control" placeholder="الدولة"
                                value="{$loadData->country}" />

                        </div>
                    </div>
                    <div class="form-group">
                        <label for="txtName" class="col-lg-2 control-label"> اسم الكامل للمنشأه </label>
                        <div class="col-lg-4">
                            <input type="text" name="facility" id="facility" class="form-control"
                                placeholder=" اسم   الكامل  للمنشأه " value="{$loadData->facility}" />
                            <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="txtName" class="col-lg-2 control-label"> البريد الالكترونى</label>
                        <div class="col-lg-4">
                            <input type="email" name="txtemail" id="txtemail" class="form-control"
                                placeholder="البريد الالكترونى" value="{$loadData->txtemail}" />
                            <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 {if $Programsettingdata->tamweenBakery eq 1} hidden {/if}">
                        <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"
                                placeholder="" value="{$loadData->debtLimit}" />
                        </div>
                    </div>





                    <div class="form-group {if $Programsettingdata->tamweenBakery eq 1} hidden {/if}">
                        <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" {if $loadData->priceTypeId == -1}selected{/if}>اختر نوع السعر
                                    </option>
                                    {if $Programsettingdata->showpriceall eq 1}
                                    <option value="0" {if $loadData->priceTypeId == 0}selected{/if}>جملة</option>
                                    {/if}
                                    {if $Programsettingdata->showpriceunit eq 1}
                                    <option value="1" {if $loadData->priceTypeId == 1}selected{/if}>تجزئة</option>
                                    {/if}
                                    {if $Programsettingdata->showpricehalf eq 1}
                                    <option value="2" {if $loadData->priceTypeId == 2}selected{/if}>نصف جملة</option>
                                    {/if}
                                    {if $Programsettingdata->showprice4 eq 1}
                                    <option value="4" {if $loadData->priceTypeId == 4}selected{/if}>سعر4</option>
                                    {/if}
                                    {if $Programsettingdata->showprice5 eq 1}
                                    <option value="5" {if $loadData->priceTypeId == 5}selected{/if}>سعر5</option>
                                    {/if}
                                    {if $Programsettingdata->showprice6 eq 1}
                                    <option value="6" {if $loadData->priceTypeId == 6}selected{/if}>سعر6</option>
                                    {/if}
                                    {if $Programsettingdata->showprice7 eq 1}
                                    <option value="7" {if $loadData->priceTypeId == 7}selected{/if}>سعر7</option>
                                    {/if}
                                    {if $Programsettingdata->showprice8 eq 1}
                                    <option value="8" {if $loadData->priceTypeId == 8}selected{/if}>سعر8</option>
                                    {/if}
                                </select>
                                <!--<span class="selectInvalidMsg">اختر المحافظة</span>-->
                            </span>

                        </div>
                    </div>


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


                                    <option value="-1">اختر </option>
                                    {foreach $allDelegate as $delegate}
                                    <option value="{$delegate.userid}" {if $loadData->delegateid ==
                                        $delegate.userid}selected{/if}>{$delegate.employeename}</option>
                                    {/foreach}
                                </select>
                                <!--<span class="selectInvalidMsg">اختر المحافظة</span>-->
                            </span>

                        </div>
                    </div>



                    <div class="form-group">
                        <label for="txtName" class="col-lg-2 control-label">المسؤول</label>
                        <div class="col-lg-4">
                            <input type="text" name="delegate" id="delegate" class="form-control" placeholder="المندوب"
                                value="{$loadData->delegate}" />
                            <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>


                    <input type="hidden" value="{$loadData->dailyentryid}" name="dailyentryid" />

                    {if $Programsettingdata->clientcode eq 1}
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="txtName" class="col-lg-2 control-label">{$Programsettingdata->clientcodname}</label>
                        <div class="col-lg-4">

                            <input type="text" name="clientcode" id="clientcode" class="form-control"
                                value="{$loadData->clientcode}" />
                            <div id="clientcodeError" 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>

                            </div>



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


                    </div>
                    <!-- =================================================   -->
                    {/if}


                    <!-- =================================================   -->
                    {if $Programsettingdata->clientserial eq 1}
                    <div class="form-group">
                        <label for="txtName" class="col-lg-2 control-label">الرقم التسلسلي</label>
                        <div class="col-lg-4">

                            <input type="text" name="clientid" disabled id="clientid" class="form-control"
                                value="{$loadData->clientid}" />

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


                    </div>
                    {/if}
                    <div class="form-group">
                        <label for="taxnumber" class="col-lg-2 control-label">الرقم الضريبى</label>
                        <div class="col-lg-4">
                            <input type="text" name="taxnumber" class="form-control" value="{$loadData->taxnumber}" {if
                                $Programsettingdata->ebill eq 1} required {/if} />
                            <div class="clearfix"></div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="taxnumber" class="col-lg-2 control-label">الرقم السجل التجارى </label>
                        <div class="col-lg-4">
                            <input type="text" name="commercial" class="form-control" value="{$loadData->commercial}" />
                            <div class="clearfix"></div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="taxnumber" class="col-lg-2 control-label">الرقم ضريبة القيمة المضافه </label>
                        <div class="col-lg-4">
                            <input type="text" name="valtaxnumber" class="form-control"
                                value="{$loadData->valtaxnumber}" />
                            <div class="clearfix"></div>
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="txtName" class="col-lg-2 control-label">RFID العميل</label>
                        <div class="col-lg-4">
                            <input type="text" name="clientRFID" id="clientRFID" class="form-control"
                                value="{$loadData->clientRFID}" />
                        </div>
                    </div>
                    <!-- =================================================   -->
                    {if $Programsettingdata->tamweenBakery eq 1}
                    <div class="form-group">
                        <label class="col-lg-2 control-label">افراد التموين</label>
                        <div class="col-lg-4">
                            <input type="text" name="noOfPersonsTamween" id="noOfPersonsTamween"
                                class="form-control positiveNo" value="{$tamweenClientDetail->noOfPersonsTamween}"
                                required="required" />
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label class="col-lg-2 control-label">افراد العيش</label>
                        <div class="col-lg-4">
                            <input type="text" name="noOfPersonsDa3m" id="noOfPersonsDa3m"
                                class="form-control positiveNo" value="{$tamweenClientDetail->noOfPersonsDa3m}"
                                required="required" />
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label class="col-lg-2 control-label">رقم البطاقة</label>
                        <div class="col-lg-4">
                            <span id="cardNumError"><!-- textfieldRequiredState -->
                                <input type="text" name="cardNum" id="cardNum" class="form-control positiveNo"
                                    value="{$tamweenClientDetail->cardNum}" />
                                <span id="cardNumErrorTxt" class="textfieldRequiredMsg"></span></span>
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label class="col-lg-2 control-label">الرقم السرى للبطاقة</label>
                        <div class="col-lg-4">
                            <input type="text" name="cardPassword" id="cardPassword" class="form-control positiveNo"
                                value="{$tamweenClientDetail->cardPassword}" required="required" />
                        </div>
                    </div>
                    {/if}
                    <!-- =================================================   -->


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






                    <!-- =================================================   -->
                    <input type="hidden" name="clientareaId" value="{$loadData->clientareaid}" id="clientareaId" />
                    <input type="hidden" name="clientareaName" value="{$clientareaData->name}" id="clientareaName" />
                    <input type="hidden" name="governmentName" value="{$governmentData->governmentname}"
                        id="governmentName" />
                    <div class="form-group {if $Programsettingdata->tamweenBakery eq 1} hidden {/if}">
                        <label for="txtAddress" class="col-lg-2 control-label">الشركة - المنطقة</label>
                        <div class="col-lg-4">
                            <span id="spryselect1">
                                <input type="hidden" name="clientareaid" id="clientareaid2" />
                                <span class="selectInvalidMsg">اختر الشركة - المنطقة</span></span>

                        </div>
                    </div>

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


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

                    <div class="form-group {if $Programsettingdata->tamweenBakery eq 1} hidden {/if}">
                        <label class="col-lg-2 control-label"> خصم خاص</label>
                        <div class="col-lg-1">
                            <input type="checkbox" name="specialDiscount" id="specialDiscount" value="1" {if
                                $loadData->specialDiscount == 1}checked{/if}/>
                        </div>
                        <div style=" {if $loadData->specialDiscount != 1}display: none; {/if}"
                            id="specialDiscountVal_div">
                            <label class="col-lg-1 control-label">النسبة </label>
                            <div class="col-lg-2">
                                <input type="text" name="specialDiscountVal" id="specialDiscountVal"
                                    class="form-control positivefloat" placeholder=""
                                    value="{$loadData->specialDiscountVal}" />
                            </div>
                        </div>
                    </div>
                    <!-- =================================================   -->

                    <div class="form-group">
                        <label class="col-lg-2 control-label">صورة البطاقة</label>
                        <div class="col-lg-4">
                            {if $loadData->file != "" && $loadData->file !="." && $loadData->file !="no image"}
                            <img src="../upload/clientFile/{$loadData->file}" alt="" width="122" height="75" />
                            {/if}
                            <input type="file" name="file" id="file" />
                            <input type="hidden" name="oldfile" id="oldfile" value="{$loadData->file}" />
                        </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">{$loadData->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="text" name="password" class="form-control" placeholder=""
                                value="{$loadData->password}" />
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group {if $Programsettingdata->mandobCollectionRatio neq 1} hidden {/if}">
                        <label class="col-lg-2 control-label">نسبة المندوب </label>
                        <div class="col-lg-4">
                            <input type="text" name="mandobCollectRatio" id="mandobCollectRatio"
                                class="form-control positivefloat" placeholder=""
                                value="{$loadData->mandobCollectRatio}" />
                        </div>
                    </div>




                    <!-- =================================================   -->
                    <div class="form-group {if $Programsettingdata->tamweenBakery eq 1} hidden {/if}">
                        <label for="textDetails" class="col-lg-2 control-label">المخزن</label>
                        <div class="col-lg-9">
                            <div class="col-lg-3">
                                <label>
                                    <input type="checkbox" class="ckstore" name="store_all" id="store_all" {if
                                        $loadData->clientStoreIds == "-10"}checked="checked"{/if} value="1" />
                                    كل المخازن
                                </label>
                            </div>
                            {foreach $stores as $data}
                            <div class="col-lg-3">
                                <label>
                                    <input type="checkbox" class="clientStore ckstore" name="store{$data->storeId}" {if
                                        $loadData->clientStoreIds == "-10"} disabled {/if} id="store{$data->storeId}"
                                    {if $loadData->clientStoreIds == "-10"||
                                    ($data->storeId|in_array:$loadData->clientStoreIds) }checked="checked"{/if}
                                    value="1" />
                                    {$data->storeName}
                                </label>
                            </div>
                            {/foreach}
                        </div>
                    </div>

                    <!-- =================================================   -->
                    <div class="form-group {if $Programsettingdata->tamweenBakery eq 1} hidden {/if}">
                        <label for="textDetails" class="col-lg-2 control-label">نوع العميل</label>
                        <div class="col-lg-9">
                            <div class="col-lg-3">
                                <label>
                                    <input type="checkbox" class="cktype" name="typeClient_all" id="typeClient_all" {if
                                        $loadData->typeclientid == ",-20,"}checked="checked"{/if} value="1" />
                                    كل انوع العملاء
                                </label>
                            </div>
                            {foreach $types as $data}
                            <div class="col-lg-3">
                                <label>
                                    <input type="checkbox" class="typeClient cktype" name="type{$data->typeId}" {if
                                        $loadData->typeclientid == ",-20,"} disabled {/if} id="type{$data->typeId}" {if
                                    $loadData->typeclientid == ",-20,"||
                                    ($data->typeId|in_array:$loadData->typeclientid) }checked="checked"{/if} value="1"
                                    />
                                    {$data->typeName}
                                </label>
                            </div>
                            {/foreach}
                        </div>
                    </div>
                    <!-- =================================================   -->

                    {if $Programsettingdata->ebillclient eq 1}
                    <div class="tab-pane" id="EBill"><!-- start the 3rd tab -->
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> المحافظة</label>
                            <div class="col-lg-4">
                                <input type="text" required name="egovernorate" id="egovernorate" class="form-control"
                                    value="{$eclientsetting->egovernorate}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> المركز (المدينة)</label>
                            <div class="col-lg-4">
                                <input type="text" required name="ecity" id="ecity" class="form-control"
                                    value="{$eclientsetting->ecity}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> الشارع</label>
                            <div class="col-lg-4">
                                <input type="text" required name="estreet" id="estreet" class="form-control"
                                    value="{$eclientsetting->estreet}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> رقم المبنى</label>
                            <div class="col-lg-4">
                                <input type="text" required name="ebuildingNum" id="ebuildingNum" class="form-control"
                                    value="{$eclientsetting->ebuildingNum}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">النوع فى الضرائب</label>
                            <div class="col-lg-4">
                                <select class="select2" required name="etaxType" id="etaxType">
                                    <option></option>
                                    <option value="P" {if $eclientsetting->etaxType == "P"}selected="selected"{/if}>فردى
                                        (P)</option>
                                    <option value="B" {if $eclientsetting->etaxType ==
                                        "B"}selected="selected"{/if}>أعمال (B)</option>
                                    <option value="F" {if $eclientsetting->etaxType ==
                                        "F"}selected="selected"{/if}>أجنبى (F)</option>
                                </select>
                            </div>
                        </div>
                        <!-- <div class="form-group">
                           <label class="col-lg-2 control-label">الرقم الضريبى</label>
                           <div class="col-lg-4">
                               <input type="text" name="eTaxNum" id="eTaxNum" class="form-control" value="{$eclientsetting->eTaxNum}"/>
                           </div>
                       </div> -->
                        <input type="hidden" name="eclientsetting_id" value="{$eclientsetting->id}" />
                        <input type="hidden" name="ebill" value="{$Programsettingdata->ebill}" />


                    </div>
                    {/if}

                    {if $Programsettingdata->clientdetail eq 0}
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> تاريخ الحجز </label>
                        <div class="col-lg-4">
                            <input type="text" name="booking_date" class="form-control awdatepicker" autocomplete="off"
                                data-date-format="yyyy-mm-dd" value="{$clientdetails->booking_date}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> تاريخ البروفه </label>
                        <div class="col-lg-4">
                            <input type="text" name="rehearsal_date" class="form-control awdatepicker"
                                autocomplete="off" data-date-format="yyyy-mm-dd"
                                value="{$clientdetails->rehearsal_date}" />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">
                            <h3>مقاس الجاكيت </h3>
                        </label>
                        <div class="col-lg-4">
                            <input type="text" name="size_jackt" class="form-control "
                                value="{$clientdetails->size_jackt}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> كتف </label>
                        <div class="col-lg-4">
                            <input type="text" name="shoulder" class="form-control "
                                value="{$clientdetails->shoulder}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> كم </label>
                        <div class="col-lg-4">
                            <input type="text" name="how_much" class="form-control "
                                value="{$clientdetails->how_much}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> طول </label>
                        <div class="col-lg-4">
                            <input type="text" name="jacket_length" class="form-control "
                                value="{$clientdetails->jacket_length}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> وسع </label>
                        <div class="col-lg-4">
                            <input type="text" name="jacket_expand" class="form-control "
                                value="{$clientdetails->jacket_expand}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> رأس الكم </label>
                        <div class="col-lg-4">
                            <input type="text" name="sleeve_head" class="form-control "
                                value="{$clientdetails->sleeve_head}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-9 offset-lg-3 control-label">
                            <h3>مقاس البنطلون </h3>
                        </label>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> الكمر </label>
                        <div class="col-lg-4">
                            <input type="text" name="pants_beam" class="form-control "
                                value="{$clientdetails->pants_beam}" />
                        </div>
                        <label class="col-lg-2 control-label"> الحجر </label>
                        <div class="col-lg-4">
                            <input type="text" name="pants_stone" class="form-control "
                                value="{$clientdetails->pants_stone}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> الهانش </label>
                        <div class="col-lg-4">
                            <input type="text" name="pants_hash" class="form-control "
                                value="{$clientdetails->pants_hash}" />
                        </div>
                        <label class="col-lg-2 control-label"> الركبة </label>
                        <div class="col-lg-4">
                            <input type="text" name="pants_knee" class="form-control "
                                value="{$clientdetails->pants_knee}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> الفخذ </label>
                        <div class="col-lg-4">
                            <input type="text" name="pants_thigh" class="form-control "
                                value="{$clientdetails->pants_thigh}" />
                        </div>
                        <label class="col-lg-2 control-label"> الرجل </label>
                        <div class="col-lg-4">
                            <input type="text" name="pants_man" class="form-control "
                                value="{$clientdetails->pants_man}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> السماناه </label>
                        <div class="col-lg-4">
                            <input type="text" name="samanah" class="form-control " value="{$clientdetails->samanah}" />
                        </div>
                        <label class="col-lg-2 control-label"> الطول </label>
                        <div class="col-lg-4">
                            <input type="text" name="pants_length" class="form-control "
                                value="{$clientdetails->pants_length}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-9 offset-lg-3 control-label">
                            <h3>مقاس السديري </h3>
                        </label>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> بطن </label>
                        <div class="col-lg-4">
                            <input type="text" name="sudairi_belly" class="form-control "
                                value="{$clientdetails->sudairi_belly}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> صدر </label>
                        <div class="col-lg-4">
                            <input type="text" name="sudairi_chest" class="form-control "
                                value="{$clientdetails->sudairi_chest}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> طول </label>
                        <div class="col-lg-4">
                            <input type="text" name="sudairi_length" class="form-control "
                                value="{$clientdetails->sudairi_length}" />
                        </div>
                    </div>
                    <input type="hidden" name="clientdetail" value="{$Programsettingdata->clientdetail}" />
                    <input type="hidden" name="clientdetail_id" value="{$clientdetails->id}" />
                    {/if}

                    <div class="form-group">
                        <label class="col-lg-2 control-label">نوع العميل فى شجرة الحسابات</label>
                        <div class="col-lg-9">
                            <div class="radio-inline">
                                <label>
                                    <input value="0" class="noradioR" name="clientTypeForTree" type="radio" {if
                                        $loadData->clientTypeForTree == 0}checked="checked"{/if}>
                                    عميل محلى </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1" class="radioR" name="clientTypeForTree" type="radio" {if
                                        $loadData->clientTypeForTree == 1}checked="checked"{/if}>
                                    عميل خارجى </label>
                            </div>

                        </div>
                    </div>

                    <input name="id" type="hidden" id="id" value="{$loadData->clientid}" />
                    <input name="conditions" type="hidden" id="conditions" value="{$loadData->conditions}" />



                    <!-- =================================================   -->
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="button" class="btn btn-primary pull-left" id="spbutton">حفظ الامر</button>
                        </div>
                    </div>




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




    </div>
</div>

{literal}

<script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
    var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "real");
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "real");
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "real");
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", { invalidValue: "0", isRequired: false });
</script>

{/literal}
{literal}
<script type="text/javascript">

    $('#store_all').live('click', function () {
        if ($(this).attr('checked') == 'checked') {
            $('.clientStore').attr('checked', 'checked');
            $('.clientStore').attr('disabled', 'disabled');
        } else {
            $('.clientStore').removeAttr('checked');
            $('.clientStore').removeAttr('disabled');
        }
    });


    $('#typeClient_all').live('click', function () {
        if ($(this).attr('checked') == 'checked') {
            $('.typeClient').attr('checked', 'checked');
            $('.typeClient').attr('disabled', 'disabled');
        } else {
            $('.typeClient').removeAttr('checked');
            $('.typeClient').removeAttr('disabled');
        }
    });
    $('#freeTheClient').live('click', function () {
        var thisBtn = $(this);
        if (!thisBtn.hasClass('processing...')) {
            thisBtn.addClass('processing...')
            var id = $("#id").val();
            $.ajax({
                url: 'clientControllerAjax.php?do=freeClient&id=' + id,
                success: function (data) {
                    thisBtn.removeClass('processing...');

                    if (Number(data) == 1)
                        thisBtn.css('background-color', '#bcffbc');
                    else
                        thisBtn.css('background-color', '#f5bdbd');

                    setTimeout(function () {
                        thisBtn.css('background-color', 'unset');
                    }, 1500);
                }
            });
        }
    });

    $('#spbutton').live('click', function (e) {
        if ($('#spform').validate().form()) {
            //ckeck name
            var tableName = 'client';
            var inputName = 'txtName';
            var name = $("#" + inputName).val();
            var id = $("#id").val();
            $.ajax({
                url: 'checkRedundantNames.php?do=checkNameWithId&name=' + name + '&id=' + id + '&tablename=' + tableName,
                success: function (data) {
                    //alert(data);
                    if (data == '0') {
                        $("#nameError").css("display", "none");
                        //return true;
                        //check code
                        /*----------------------------------------------------*/
                        var tableName = 'clientcode';
                        var inputName = 'clientcode';
                        var name = $("#" + inputName).val();
                        var id = $("#id").val();
                        $.ajax({
                            url: 'checkRedundantNames.php?do=checkNameWithId&name=' + name + '&id=' + id + '&tablename=' + tableName,
                            success: function (data) {
                                //alert(data);
                                if (data == '0' || $("#clientcode").val() == "") {
                                    $("#clientcodeError").css("display", "none");
                                    //return true;
                                    var phone = $('#txtPhone').val();
                                    var mobile = $('#txtMobile').val();
                                    var cardNum = $('#cardNum').val();
                                    var uFlag = checkOtherUniquesIfExist(id, phone, mobile, cardNum);
                                    if (uFlag == 1) {
                                        var myForm = document.getElementById("spform");
                                        var SS = Spry.Widget.Form.validate(myForm);
                                        if (SS == true) {
                                            var aStoreIsSelected = 0;
                                            $('.ckstore').each(function () {
                                                if ($(this).attr('checked') == 'checked') {
                                                    aStoreIsSelected = 1;
                                                    return;
                                                }
                                            });
                                            if (aStoreIsSelected == 1) {
                                                if (!$('#spbutton').hasClass("processing")) {
                                                    $('#spbutton').addClass("processing");
                                                    myForm.submit();
                                                    //$('#spbutton').unbind('click');
                                                }
                                            } else {
                                                alert('عفوا لابد من اختيار مخزن على الاقل');
                                            }
                                        }
                                    } else {
                                        e.preventDefault();
                                        return false;
                                    }

                                } else if (data == '1') {
                                    $("#" + inputName).val("");
                                    $("#" + inputName).focus();
                                    $("#clientcodeError").css("display", "block");
                                    return false;
                                }
                            }
                        });

                        /*----------------------------------------------------*/

                    } else if (data == '1') {
                        $("#" + inputName).val("");
                        $("#" + inputName).focus();
                        $("#nameError").css("display", "block");
                        return false;
                    }
                }
            });
        } else {

            e.preventDefault();

        }

    });
</script>
{/literal}