<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=add"
                      method="post" id="spform" enctype="multipart/form-data">

                    {/literal}

                    <div class="form-group">
                        <span style="   font-size: 17px; color: red;text-align: center;margin-right: 211px;"> {if
                            !empty($msg)}{$msg}{/if}</span>
                    </div>


                    <div class="form-group">
                        <label for="txtName" class="col-lg-2 control-label">اسم العميل</label>
                        <div class="col-lg-4">
                            <input required="required" type="text" name="txtName" id="txtName" class="form-control"
                                   placeholder="اسم العميل" />
                            <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" />
                            <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">

                            <input type="text" name="txtDebt" id="txtDebt"
                                   class="form-control {if $clientnegative==1}numberinput{else}positivefloat{/if}"
                                   placeholder="0" />

                        </div>
                        <!--span style="   font-size: 17px; color: red;text-align: center;">  {if !empty($checkNo)}{$checkNo}{/if}</span-->
                    </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" {if $Programsettingdata->clientfieldrequired eq 1}
                                required="required" {/if} name="txtPhone" id="txtPhone" class="form-control positiveNo"
                                placeholder="رقم التليفون"/>
                                <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" {if $Programsettingdata->clientfieldrequired eq 1}
                                required="required" {/if} name="txtMobile" id="txtMobile" class="form-control
                                positiveNo" placeholder="رقم الموبايل"/>
                                <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" {if $Programsettingdata->clientfieldrequired eq 1}
                            required="required" {/if} id="txtAddress" class="form-control" placeholder="العنوان"/>
                        </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" {if $Programsettingdata->clientfieldrequired eq 1}
                            required="required" {/if} id="txtAddress2" class="form-control" placeholder="العنوان2"/>
                        </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" {if $Programsettingdata->clientfieldrequired eq 1}
                            required="required" {/if} id="txtAddress3" class="form-control" placeholder="العنوان3"/>
                        </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" {if $Programsettingdata->clientfieldrequired eq 1}
                            required="required" {/if} id="country" class="form-control" placeholder="الدولة"/>
                        </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=" اسم   الكامل  للمنشأه " />
                            <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="البريد الالكترونى" />
                            <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="{$Programsettingdata->clientDefaultDebtLimit}" />
                        </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">اختر نوع السعر </option>
                                    {if $Programsettingdata->showpriceall eq 1}
                                    <option value="0">جملة</option>
                                    {/if}
                                    {if $Programsettingdata->showpriceunit eq 1}
                                    <option value="1">تجزئة</option>
                                    {/if}
                                    {if $Programsettingdata->showpricehalf eq 1}
                                    <option value="2">نصف جملة</option>
                                    {/if}
                                    {if $Programsettingdata->showprice4 eq 1}
                                    <option value="4">سعر4</option>
                                    {/if}
                                    {if $Programsettingdata->showprice5 eq 1}
                                    <option value="5">سعر5</option>
                                    {/if}
                                    {if $Programsettingdata->showprice6 eq 1}
                                    <option value="6">سعر6</option>
                                    {/if}
                                    {if $Programsettingdata->showprice7 eq 1}
                                    <option value="7">سعر7</option>
                                    {/if}
                                    {if $Programsettingdata->showprice8 eq 1}
                                    <option value="8">سعر8</option>
                                    {/if}
                                    {if $Programsettingdata->showprice9 eq 1}
                                    <option value="9">سعر9</option>
                                    {/if}
                                    {if $Programsettingdata->showprice10 eq 1}
                                    <option value="10">سعر10</option>
                                    {/if}
                                    {if $Programsettingdata->showprice11 eq 1}
                                    <option value="11">سعر11</option>
                                    {/if}
                                    {if $Programsettingdata->showprice12 eq 1}
                                    <option value="12">سعر12</option>
                                    {/if}
                                    {if $Programsettingdata->showprice13 eq 1}
                                    <option value="13">سعر13/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}">{$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="المندوب" />
                            <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>





                    {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 {if $Programsettingdata->clientfieldrequired eq 1} required="required" {/if}
                            type="text" name="clientcode" id="clientcode" class="form-control"
                            placeholder="{$Programsettingdata->clientcodname}" value="{*if
                            $Programsettingdata->tamweenBakery eq 1*}{$nextId}{*/if*}"/>
                            <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>
                                <h4>رسالة خطا</h4>
                                <p>هذا الكود مستخدم من قبل</p>

                                <div class="clearfix"></div>
                            </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" {if $Programsettingdata->clientfieldrequired eq 1}
                            required="required" {/if} disabled id="clientid" class="form-control" value="{$nextId}"/>

                            <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" {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" />
                            <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" />
                            <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="" />
                        </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" 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" 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" />
                                <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"
                                   required="required" />
                        </div>
                    </div>
                    {/if}

                    <!-- =================================================   -->
                    <!--                    <div class="form-group">
                                            <label for="txtAddress" class="col-lg-2 control-label">المحافظة </label>
                                            <div class="col-lg-4">
                                                <span id="spryselect1">
                                                    <select name="clientgovernmentid" id="clientgovernmentid"  data-placeholder="اختر " class="select2 wdt100">


                                                        <option value="0">اختر المحافظة </option>
                                                        {foreach $allGovernment as $government}
                                                        <option value="{$government->governmentid}">{$government->governmentname} </option>
                                                        {/foreach}
                                                    </select>
                                                    <span class="selectInvalidMsg">اختر المحافظة</span></span>

                                            </div>
                                        </div>-->
                    <!-- =================================================   -->


                    <!-- =================================================   -->
                    <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 {if $Programsettingdata->clientfieldrequired eq 1} required="required" {/if}
                                type="hidden" name="clientareaid" value="0" id="clientareaid"/>
                                <span class="selectInvalidMsg">اختر الشركة - المنطقة</span></span>

                        </div>
                    </div>

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


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

                    <div class="form-group">
                        <label class="col-lg-2 control-label"> عدد الايام الاجلة</label>
                        <div class="col-lg-4">
                            <input type="text" name="postponeDays" class="form-control positiveNo" id="postponeDays"
                                   value="" />
                        </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">كل العلامات المرتبطة</option>
                                        {foreach $allTags as $tag}
                                        <option value="{$tag.id}">{$tag.tagname}</option>
                                        {/foreach}
                                    </select>
                            </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" />
                        </div>
                        <div style="display: none" 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="" />
                            </div>
                        </div>
                    </div>
                    <!-- =================================================   -->

                    <div class="form-group">
                        <label class="col-lg-2 control-label">صورة البطاقة</label>
                        <div class="col-lg-4">
                            <input type="file" name="file" id="file" />
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label">صورة البطاقة الضريبية</label>
                        <div class="col-lg-4">
                            <input type="file" name="taxfile" id="taxfile" />
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label">صورة السجل</label>
                        <div class="col-lg-4">
                            <input type="file" name="fileimg" id="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"></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="" />
                        </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="" />
                        </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"
                                           checked="checked" value="1" />
                                    كل المخازن
                                </label>
                            </div>
                            {foreach $stores as $data}
                            <div class="col-lg-3">
                                <label>
                                    <input type="checkbox" class="clientStore ckstore" name="store{$data->storeId}"
                                           id="store{$data->storeId}" checked="checked" 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"
                                           value="1" />
                                    كل انوع العملاء
                                </label>
                            </div>
                            {foreach $typeClient as $data}
                            <div class="col-lg-3">
                                <label>
                                    <input type="checkbox" class="typeClient cktype" name="type{$data->typeId}"
                                           id="type{$data->typeId}" 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"  name="egovernorate" id="egovernorate" class="form-control"
                                       value="" />
                            </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="" />
                            </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="" />
                            </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="" />
                            </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">فردى (P)</option>
                                    <option value="B">أعمال (B)</option>
                                    <option value="F">أجنبى (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" required name="eTaxNum" id="eTaxNum" class="form-control" value=""/>
                             </div>
                         </div> -->
                        <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="{$today_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="{$today_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="" />
                        </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="" />
                        </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="" />
                        </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="" />
                        </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="" />
                        </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="" />
                        </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="" />
                        </div>
                        <label class="col-lg-2 control-label"> الحجر </label>
                        <div class="col-lg-4">
                            <input type="text" name="pants_stone" class="form-control " value="" />
                        </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="" />
                        </div>
                        <label class="col-lg-2 control-label"> الركبة </label>
                        <div class="col-lg-4">
                            <input type="text" name="pants_knee" class="form-control " value="" />
                        </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="" />
                        </div>
                        <label class="col-lg-2 control-label"> الرجل </label>
                        <div class="col-lg-4">
                            <input type="text" name="pants_man" class="form-control " value="" />
                        </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="" />
                        </div>
                        <label class="col-lg-2 control-label"> الطول </label>
                        <div class="col-lg-4">
                            <input type="text" name="pants_length" class="form-control " value="" />
                        </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="" />
                        </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="" />
                        </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="" />
                        </div>
                    </div>
                    <input type="hidden" name="clientdetail" value="{$Programsettingdata->clientdetail}" />
                    {/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"
                                           checked="checked">
                                    عميل محلى </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1" class="radioR" name="clientTypeForTree" type="radio">
                                    عميل خارجى </label>
                            </div>

                        </div>
                    </div>

                    <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 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');
        }
    });

    $('#spbutton').live('click', function (e) {


        if ($('#spform').validate().form()) {
            //ckeck name
            var tableName = 'client';
            var inputName = 'txtName';
            var name = $("#" + inputName).val();
            $.ajax({
                url: 'checkRedundantNames.php?name=' + name + '&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();
                        $.ajax({
                            url: 'checkRedundantNames.php?name=' + name + '&tablename=' + tableName,
                            success: function (data) {
                                //alert(data);
                                if (data == '0') {
                                    $("#clientcodeError").css("display", "none");
                                    //return true;
                                    var phone = $('#txtPhone').val();
                                    var mobile = $('#txtMobile').val();
                                    var cardNum = $('#cardNum').val();
                                    var uFlag = checkOtherUniquesIfExist(0, 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('عفوا لابد من اختيار مخزن على الاقل');
                                                e.preventDefault();
                                            }
                                        }
                                    } else {
                                        e.preventDefault();
                                        return false;
                                    }

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

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

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

        } else {
            // alert('xx');

            e.preventDefault();

        }




    });




</script>
{/literal}