<?php /* Smarty version Smarty-3.1.11, created on 2025-12-21 01:18:39
         compiled from "..\views\default\clientview\edit.html" */ ?>
<?php /*%%SmartyHeaderCode:4769472ecf86d337-32339548%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'a1cefa18919e0a186be84620ba2324c9a571138b' => 
    array (
      0 => '..\\views\\default\\clientview\\edit.html',
      1 => 1759356796,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '4769472ecf86d337-32339548',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'loadData' => 0,
    'currency' => 0,
    'Programsettingdata' => 0,
    'allDelegate' => 0,
    'delegate' => 0,
    'tamweenClientDetail' => 0,
    'clientareaData' => 0,
    'governmentData' => 0,
    'allTags' => 0,
    'tag' => 0,
    'stores' => 0,
    'data' => 0,
    'types' => 0,
    'eclientsetting' => 0,
    'esaudiclientsetting' => 0,
    'clientdetails' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_69472ed005a504_61151948',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_69472ed005a504_61151948')) {function content_69472ed005a504_61151948($_smarty_tpl) {?><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">
                
                <form class="form-horizontal nameToBeChecked" role="form" action="clientController.php?do=update" method="post"
                      id="spform" enctype="multipart/form-data">
                    

                    <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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->clientdebt;?>
" readonly="readonly" />
                                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل رقم
                                    </span></span><span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->clientaddress;?>
" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="txtAddress2" 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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->clientaddress2;?>
" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="txtAddress3" class="col-lg-2 control-label">العنوان3</label>
                        <div class="col-lg-4">
                            <input type="text" name="txtAddress3" id="txtAddress3" class="form-control" placeholder="العنوان3"
                                   value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->clientaddress3;?>
" />
                        </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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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 <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->tamweenBakery==1){?> hidden <?php }?>">
                        <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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->debtLimit;?>
" />
                        </div>
                    </div>

                    <div class="form-group <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->tamweenBakery==1){?> hidden <?php }?>">
                        <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" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==-1){?>selected<?php }?>>اختر نوع السعر
                                    </option>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceall==1){?>
                                    <option value="0" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==0){?>selected<?php }?>>جملة
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceunit==1){?>
                                    <option value="1" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==1){?>selected<?php }?>>تجزئة
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpricehalf==1){?>
                                    <option value="2" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==2){?>selected<?php }?>>نصف جملة
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice4==1){?>
                                    <option value="4" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==4){?>selected<?php }?>>سعر4
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice5==1){?>
                                    <option value="5" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==5){?>selected<?php }?>>سعر5
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice6==1){?>
                                    <option value="6" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==6){?>selected<?php }?>>سعر6
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice7==1){?>
                                    <option value="7" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==7){?>selected<?php }?>>سعر7
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice8==1){?>
                                    <option value="8" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==8){?>selected<?php }?>>سعر8
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice9==1){?>
                                    <option value="9" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==9){?>selected<?php }?>>سعر9
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice10==1){?>
                                    <option value="10" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==10){?>selected<?php }?>>سعر10
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice11==1){?>
                                    <option value="11" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==11){?>selected<?php }?>>سعر11
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice12==1){?>
                                    <option value="12" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==12){?>selected<?php }?>>سعر12
                                    </option>
                                    <?php }?>
                                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice13==1){?>
                                    <option value="13" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->priceTypeId==13){?>selected<?php }?>>سعر13
                                    </option>
                                    <?php }?>
                                </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>
                                    <?php  $_smarty_tpl->tpl_vars['delegate'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['delegate']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allDelegate']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['delegate']->key => $_smarty_tpl->tpl_vars['delegate']->value){
$_smarty_tpl->tpl_vars['delegate']->_loop = true;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['delegate']->value['userid'];?>
" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->delegateid==$_smarty_tpl->tpl_vars['delegate']->value['userid']){?>selected<?php }?>>
                                        <?php echo $_smarty_tpl->tpl_vars['delegate']->value['employeename'];?>

                                    </option>
                                    <?php } ?>
                                </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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->dailyentryid;?>
" name="dailyentryid" />

                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientcode==1){?>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="txtName" class="col-lg-2 control-label"><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->clientcodname;?>
</label>
                        <div class="col-lg-4">
                            <input type="text" name="clientcode" id="clientcode" class="form-control"
                                   value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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>
                    <!-- =================================================   -->
                    <?php }?>

                    <!-- =================================================   -->
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientserial==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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->clientid;?>
" />

                            <div class="clearfix"></div>
                        </div>
                    </div>
                    <?php }?>
                    <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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->taxnumber;?>
" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->ebill==1){?> required <?php }?> />
                            <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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->clientRFID;?>
" />
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->tamweenBakery==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="<?php echo $_smarty_tpl->tpl_vars['tamweenClientDetail']->value->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="<?php echo $_smarty_tpl->tpl_vars['tamweenClientDetail']->value->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="<?php echo $_smarty_tpl->tpl_vars['tamweenClientDetail']->value->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="<?php echo $_smarty_tpl->tpl_vars['tamweenClientDetail']->value->cardPassword;?>
" required="required" />
                        </div>
                    </div>
                    <?php }?>
                    <!-- =================================================   -->

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

                    <!-- =================================================   -->
                    <input type="hidden" name="clientareaId" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->clientareaid;?>
" id="clientareaId" />
                    <input type="hidden" name="clientareaName" value="<?php echo $_smarty_tpl->tpl_vars['clientareaData']->value->name;?>
" id="clientareaName" />
                    <input type="hidden" name="governmentName" value="<?php echo $_smarty_tpl->tpl_vars['governmentData']->value->governmentname;?>
" id="governmentName" />
                    <div class="form-group <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->tamweenBakery==1){?> hidden <?php }?>">
                        <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">
                            <label for="tagids" class="col-lg-2 control-label">العلامة المرتبطة</label>
                            <div class="col-lg-4">
                                    <select class="select2 wdt100" name="tagids[]" id="tagids" multiple=""
                                            data-placeholder="اختر">
                                        <option value="0" <?php if (in_array(0,$_smarty_tpl->tpl_vars['loadData']->value->tagids)){?> selected="selected" <?php }?>>كل العلامات المرتبطة </option>
                                        <?php  $_smarty_tpl->tpl_vars['tag'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['tag']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allTags']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['tag']->key => $_smarty_tpl->tpl_vars['tag']->value){
$_smarty_tpl->tpl_vars['tag']->_loop = true;
?>
                                        <option value="<?php echo $_smarty_tpl->tpl_vars['tag']->value['id'];?>
" <?php if (in_array($_smarty_tpl->tpl_vars['tag']->value['id'],$_smarty_tpl->tpl_vars['loadData']->value->tagids)){?>
                                            selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['tag']->value['tagname'];?>
</option>
                                        <?php } ?>
                                    </select>
                            </div>
                        </div>
                    <!-- =================================================   -->

                    <div class="form-group <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->tamweenBakery==1){?> hidden <?php }?>">
                        <label class="col-lg-2 control-label"> خصم خاص</label>
                        <div class="col-lg-1">
                            <input type="checkbox" name="specialDiscount" id="specialDiscount" value="1" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->specialDiscount==1){?>checked<?php }?>/>
                        </div>
                        <div style=" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->specialDiscount!=1){?>display: none; <?php }?>" 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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->specialDiscountVal;?>
" />
                            </div>
                        </div>
                    </div>
                    <!-- =================================================   -->

                    <div class="form-group">
                        <label class="col-lg-2 control-label">صورة البطاقة</label>
                        <div class="col-lg-4">
                            <?php if ($_smarty_tpl->tpl_vars['loadData']->value->file!=''&&$_smarty_tpl->tpl_vars['loadData']->value->file!="."&&$_smarty_tpl->tpl_vars['loadData']->value->file!="no image"){?>
                            <img src="../upload/clientFile/<?php echo $_smarty_tpl->tpl_vars['loadData']->value->file;?>
" alt="" width="122" height="75" />
                            <?php }?>
                            <input type="file" name="file" id="file" />
                            <input type="hidden" name="oldfile" id="oldfile" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->file;?>
" />
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label">صورة البطاقة الضريبية</label>
                        <div class="col-lg-4">
                            <?php if ($_smarty_tpl->tpl_vars['loadData']->value->taxfile!=''&&$_smarty_tpl->tpl_vars['loadData']->value->taxfile!="."&&$_smarty_tpl->tpl_vars['loadData']->value->taxfile!="no image"){?>
                            <img src="../upload/clientFile/<?php echo $_smarty_tpl->tpl_vars['loadData']->value->taxfile;?>
" alt="" width="122" height="75" />
                            <?php }?>
                            <input type="file" name="taxfile" id="taxfile" />
                            <input type="hidden" name="oldtaxfile" id="oldtaxfile" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->taxfile;?>
" />
                        </div>
                    </div>
                    <!-- =================================================   -->

                    <div class="form-group">
                        <label class="col-lg-2 control-label">صورة السجل </label>
                        <div class="col-lg-4">
                            <?php if ($_smarty_tpl->tpl_vars['loadData']->value->fileimg!=''&&$_smarty_tpl->tpl_vars['loadData']->value->fileimg!="."&&$_smarty_tpl->tpl_vars['loadData']->value->fileimg!="no image"){?>
                            <img src="../upload/clientFile/<?php echo $_smarty_tpl->tpl_vars['loadData']->value->fileimg;?>
" alt="" width="122" height="75" />
                            <?php }?>
                            <input type="file" name="fileimg" id="fileimg" />
                            <input type="hidden" name="oldfileimg" id="oldfileimg" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->fileimg;?>
" />
                        </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">
<?php echo $_smarty_tpl->tpl_vars['loadData']->value->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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->password;?>
" />
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->mandobCollectionRatio!=1){?> hidden <?php }?>">
                        <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="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->mandobCollectRatio;?>
" />
                        </div>
                    </div>

                    <!-- =================================================   -->
                    <div class="form-group <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->tamweenBakery==1){?> hidden <?php }?>">
                        <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" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->clientStoreIds=="-10"){?>checked="checked"<?php }?> value="1" />
                                    كل المخازن
                                </label>
                            </div>
                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['stores']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                            <div class="col-lg-3">
                                <label>
                                    <input type="checkbox" class="clientStore ckstore" name="store<?php echo $_smarty_tpl->tpl_vars['data']->value->storeId;?>
" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->clientStoreIds=="-10"){?> disabled <?php }?>
                                    id="store<?php echo $_smarty_tpl->tpl_vars['data']->value->storeId;?>
" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->clientStoreIds=="-10"||(in_array($_smarty_tpl->tpl_vars['data']->value->storeId,$_smarty_tpl->tpl_vars['loadData']->value->clientStoreIds))){?>checked="checked"<?php }?> value="1" /> <?php echo $_smarty_tpl->tpl_vars['data']->value->storeName;?>

                                </label>
                            </div>
                            <?php } ?>
                        </div>
                    </div>

                    <!-- =================================================   -->
                    <div class="form-group <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->tamweenBakery==1){?> hidden <?php }?>">
                        <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" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->typeclientid==",-20,"){?>checked="checked"<?php }?> value="1" />
                                    كل انوع العملاء
                                </label>
                            </div>
                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['types']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                            <div class="col-lg-3">
                                <label>
                                    <input type="checkbox" class="typeClient cktype" name="type<?php echo $_smarty_tpl->tpl_vars['data']->value->typeId;?>
" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->typeclientid==",-20,"){?> disabled <?php }?>
                                    id="type<?php echo $_smarty_tpl->tpl_vars['data']->value->typeId;?>
" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->typeclientid==",-20,"||(in_array($_smarty_tpl->tpl_vars['data']->value->typeId,$_smarty_tpl->tpl_vars['loadData']->value->typeclientid))){?>checked="checked"<?php }?> value="1" /> <?php echo $_smarty_tpl->tpl_vars['data']->value->typeName;?>

                                </label>
                            </div>
                            <?php } ?>
                        </div>
                    </div>
                    <!-- =================================================   -->

                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->ebillclient==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" name="egovernorate" id="egovernorate" class="form-control"
                                       value="<?php echo $_smarty_tpl->tpl_vars['eclientsetting']->value->egovernorate;?>
" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> المركز (المدينة)</label>
                            <div class="col-lg-4">
                                <input type="text" name="ecity" id="ecity" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['eclientsetting']->value->ecity;?>
" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> الشارع</label>
                            <div class="col-lg-4">
                                <input type="text" name="estreet" id="estreet" class="form-control"
                                       value="<?php echo $_smarty_tpl->tpl_vars['eclientsetting']->value->estreet;?>
" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> رقم المبنى</label>
                            <div class="col-lg-4">
                                <input type="text" name="ebuildingNum" id="ebuildingNum" class="form-control"
                                       value="<?php echo $_smarty_tpl->tpl_vars['eclientsetting']->value->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" <?php if ($_smarty_tpl->tpl_vars['eclientsetting']->value->etaxType=="P"){?>selected="selected"<?php }?>>فردى (P)
                                    </option>
                                    <option value="B" <?php if ($_smarty_tpl->tpl_vars['eclientsetting']->value->etaxType=="B"){?>selected="selected"<?php }?>>أعمال (B)
                                    </option>
                                    <option value="F" <?php if ($_smarty_tpl->tpl_vars['eclientsetting']->value->etaxType=="F"){?>selected="selected"<?php }?>>أجنبى (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="<?php echo $_smarty_tpl->tpl_vars['eclientsetting']->value->eTaxNum;?>
"/>
                                       </div>
                                   </div> -->
                        <input type="hidden" name="eclientsetting_id" value="<?php echo $_smarty_tpl->tpl_vars['eclientsetting']->value->id;?>
" />
                        <input type="hidden" name="ebill" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->ebill;?>
" />
                    </div>
                    <?php }?>



                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->saudielectronicinvoclient==1){?>
                    <div class="tab-pane" id="ebillsaudi"><!-- start the 3rd tab -->
                        

                        <div class="form-group">
                            <label class="col-lg-2 control-label">رقم الترخيص</label>
                            <div class="col-lg-4">
                                <span>
                                    <select name="licensetype" id="licensetype" data-placeholder="اختر " class="select2 wdt100">
                                        <option value="GCC" <?php if ($_smarty_tpl->tpl_vars['esaudiclientsetting']->value->licensetype=='GCC'){?>selected<?php }?>>مجلس التعاون الخليجي</option>
                                        <option value="SAG" <?php if ($_smarty_tpl->tpl_vars['esaudiclientsetting']->value->licensetype=='SAG'){?>selected<?php }?>>ترخيص وزارة الاستثمار</option>
                                        <option value="MLS" <?php if ($_smarty_tpl->tpl_vars['esaudiclientsetting']->value->licensetype=='MLS'){?>selected<?php }?>>ترخيص وزارة الموارد البشرية والتنمية الاجتماعية</option>
                                        <option value="MOM" <?php if ($_smarty_tpl->tpl_vars['esaudiclientsetting']->value->licensetype=='MOM'){?>selected<?php }?>>ترخيص وزارة الشؤون البلدية والقروية والإسكان</option>
                                        <option value="CRN" <?php if ($_smarty_tpl->tpl_vars['esaudiclientsetting']->value->licensetype=='CRN'){?>selected<?php }?>>رقم السجل التجاري</option>
                                        <option value="TIN" <?php if ($_smarty_tpl->tpl_vars['esaudiclientsetting']->value->licensetype=='TIN'){?>selected<?php }?>>الرقم التعريفي الضريبي</option>
                                        <option value="PAS" <?php if ($_smarty_tpl->tpl_vars['esaudiclientsetting']->value->licensetype=='PAS'){?>selected<?php }?>>رقم جواز السفر</option>
                                        <option value="IQA" <?php if ($_smarty_tpl->tpl_vars['esaudiclientsetting']->value->licensetype=='IQA'){?>selected<?php }?>>رقم الإقامة</option>
                                        <option value="NAT" <?php if ($_smarty_tpl->tpl_vars['esaudiclientsetting']->value->licensetype=='NAT'){?>selected<?php }?>>رقم الهوية الوطنية</option>
                                        <option value="OTH" <?php if ($_smarty_tpl->tpl_vars['esaudiclientsetting']->value->licensetype=='OTH'){?>selected<?php }?>>أخرى</option>
                                    </select>
                                </span>
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="col-lg-2 control-label">رقم الترخيص</label>
                            <div class="col-lg-4">
                                <input type="text"  name="licensenumber" id="licensenumber" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['esaudiclientsetting']->value->licensenumber;?>
" required=""/>
                            </div>
                        </div>
                        

                        <div class="form-group">
                            <label class="col-lg-2 control-label"> اسم الشارع</label>
                            <div class="col-lg-4">
                                <input type="text"  name="streetname" id="streetname" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['esaudiclientsetting']->value->streetname;?>
" required=""/>
                            </div>
                        </div>
                         <div class="form-group">
                            <label class="col-lg-2 control-label"> رقم المبنى </label>
                            <div class="col-lg-4">
                                <input type="text"  name="buildingnumber" id="buildingnumber" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['esaudiclientsetting']->value->buildingnumber;?>
" required=""/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">الحي</label>
                            <div class="col-lg-4">
                                <input type="text"  name="neighborhood" id="neighborhood" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['esaudiclientsetting']->value->neighborhood;?>
" required=""/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">المدينه</label>
                            <div class="col-lg-4">
                                <input type="text"  name="city" id="city" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['esaudiclientsetting']->value->city;?>
" required=""/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">المنطقة البريدية</label>
                            <div class="col-lg-4">
                                <input type="text"  name="postalzone" id="postalzone" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['esaudiclientsetting']->value->postalzone;?>
" required=""/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">رمز البلد</label>
                            <div class="col-lg-4">
                                <input type="text"  name="countrycode" id="countrycode" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['esaudiclientsetting']->value->countrycode;?>
" required=""/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">اسم الشركة</label>
                            <div class="col-lg-4">
                                <input type="text"  name="companyname" id="companyname" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['esaudiclientsetting']->value->companyname;?>
" required=""/>
                            </div>
                        </div>
                        <input type="hidden" name="esaudiclientsetting_id" value="<?php echo $_smarty_tpl->tpl_vars['esaudiclientsetting']->value->id;?>
" />
                        <input type="hidden" name="ebillsaudi" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->saudielectronicinvoclient;?>
" />


                    </div>
                    <?php }?>



                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientdetail==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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->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="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->sudairi_length;?>
" />
                        </div>
                    </div>
                    <input type="hidden" name="clientdetail" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->clientdetail;?>
" />
                    <input type="hidden" name="clientdetail_id" value="<?php echo $_smarty_tpl->tpl_vars['clientdetails']->value->id;?>
" />
                    <?php }?>

                    <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" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->clientTypeForTree==0){?>checked="checked"<?php }?>> عميل محلى
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1" class="radioR" name="clientTypeForTree" type="radio" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->clientTypeForTree==1){?>checked="checked"<?php }?>> عميل خارجى
                                </label>
                            </div>
                        </div>
                    </div>

                    <input name="id" type="hidden" id="id" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->clientid;?>
" />
                    <input name="conditions" type="hidden" id="conditions" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->conditions;?>
" />
                    <input name="webStoreType" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->webStoreType;?>
" />

                    <!-- =================================================   -->
                    <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>



<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>

 
<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>
<?php }} ?>