<?php /* Smarty version Smarty-3.1.11, created on 2025-02-23 07:41:16
         compiled from "../views/default/userview/edit.html" */ ?>
<?php /*%%SmartyHeaderCode:128655372267bab4fc9acae9-17931015%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '1b0361040fa830ef85b139d5254b60f8276cb801' => 
    array (
      0 => '../views/default/userview/edit.html',
      1 => 1740000156,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '128655372267bab4fc9acae9-17931015',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'loadData' => 0,
    'loginUsergroupData' => 0,
    'loginUsergroupid' => 0,
    'UserGroupData' => 0,
    'UserGroup' => 0,
    'allbranchdata' => 0,
    'myallbranchdata' => 0,
    'Programsettingdata' => 0,
    'saveData' => 0,
    'save' => 0,
    'storData' => 0,
    'mystorData' => 0,
    'programsetting' => 0,
    'allprojectdata' => 0,
    'allproject' => 0,
    'allbankdata' => 0,
    'allbank' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_67bab4fcb46bc7_21238656',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_67bab4fcb46bc7_21238656')) {function content_67bab4fcb46bc7_21238656($_smarty_tpl) {?>

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

        <ol class="breadcrumb">
            <li><a href="#">خصائص عامة</a></li>
            <li><a href="userController.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" role="form" action="userController.php?do=update" method="post" id="spform">




                    <div class="form-group">
                        <label for="username" class="col-lg-2 control-label">اسم المستخدم</label>
                        <div class="col-lg-4">

                            <span id="name">
                                <input type="text" class="form-control" placeholder="اسم المستخدم" name="username" id="username" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->username;?>
">
                                <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="password" class="col-lg-2 control-label">كلمة المرور</label>
                        <div class="col-lg-4">

                            <span id="sprytextfield1">
                                <input type="password" name="password" class="form-control" placeholder="كلمة المرور" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->password;?>
"/>
                                <span class="textfieldRequiredMsg">*</span></span>

                        </div>
                    </div>



                    <div class="form-group">
                        <label for="employeename" class="col-lg-2 control-label">اسم الموظف</label>
                        <div class="col-lg-4">

                            <span id="sprytextfield2">
                                <input type="text" class="form-control" placeholder="اسم الموظف" name="employeename"  value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->employeename;?>
">
                                <span class="textfieldRequiredMsg">*</span></span>

                        </div>
                    </div>

                    <div class="form-group">
                        <label for="userstoreid" class="col-lg-2 control-label">السؤال السرى<span style="color: red;display: block">فى حالة نسيت كلمة المرور</span></label>
                        <div class="col-lg-4">
                            <textarea class="form-control" name="question" rows="3" required><?php echo $_smarty_tpl->tpl_vars['loadData']->value->question;?>
</textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="userstoreid" class="col-lg-2 control-label">الاجابة السرية<span style="color: red;display: block">فى حالة نسيت كلمة المرور</span></label>
                        <div class="col-lg-4">
                            <textarea class="form-control" name="answer" rows="3" required><?php echo $_smarty_tpl->tpl_vars['loadData']->value->answer;?>
</textarea>
                        </div>
                    </div>


                    <div <?php if ($_smarty_tpl->tpl_vars['loginUsergroupData']->value->editUserPrivlage!=1&&$_smarty_tpl->tpl_vars['loginUsergroupid']->value>0){?>class="hidden"<?php }?>>
                        <div class="form-group">
                            <label for="usergroupid" class="col-lg-2 control-label">المجموعة</label>
                            <div class="col-lg-4">


                                <span id="spryselect2">
                                    <select class="select2 wdt100" name="usergroupid" id="usergroupid">

                                        <?php  $_smarty_tpl->tpl_vars['UserGroup'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['UserGroup']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['UserGroupData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['UserGroup']->key => $_smarty_tpl->tpl_vars['UserGroup']->value){
$_smarty_tpl->tpl_vars['UserGroup']->_loop = true;
?>

                                        <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->usergroupid;?>
<?php $_tmp1=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['UserGroup']->value->usergroupid;?>
<?php $_tmp2=ob_get_clean();?><?php if ($_tmp1==$_tmp2){?> selected="selected" <?php }?>  value="<?php echo $_smarty_tpl->tpl_vars['UserGroup']->value->usergroupid;?>
"><?php echo $_smarty_tpl->tpl_vars['UserGroup']->value->usergroupname;?>
</option>

                                        <?php } ?>

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


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

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

                        <div class="form-group">
                            <label for="usergroupid" class="col-lg-2 control-label"> الفرع</label>
                            <div class="col-lg-4">

                                <select required  class="select2 wdt100" name="branchid" id="branchid">
                                    <option value="-1">اختر الفرع</option>
                                    <option value="0" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->branchId;?>
<?php $_tmp3=ob_get_clean();?><?php if ($_tmp3==0){?> selected="selected" <?php }?>>  كل الفروع</option>

                                    <?php  $_smarty_tpl->tpl_vars['myallbranchdata'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['myallbranchdata']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allbranchdata']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['myallbranchdata']->key => $_smarty_tpl->tpl_vars['myallbranchdata']->value){
$_smarty_tpl->tpl_vars['myallbranchdata']->_loop = true;
?>

                                    <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->branchId;?>
<?php $_tmp4=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['myallbranchdata']->value->branchId;?>
<?php $_tmp5=ob_get_clean();?><?php if ($_tmp4==$_tmp5){?> selected="selected" <?php }?>     value="<?php echo $_smarty_tpl->tpl_vars['myallbranchdata']->value->branchId;?>
"><?php echo $_smarty_tpl->tpl_vars['myallbranchdata']->value->branchName;?>
</option>
                                    <?php } ?>


                                </select>

                            </div>
                        </div>

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


                        <div class="form-group">
                            <label for="employeename" class="col-lg-2 control-label">نسبه <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==0){?> بائع <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==1){?>مندوب <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==2){?>طبيب <?php }?></label>
                            <div class="col-lg-4"><span id="sprytextfield3">
                                    <input type="text"  class="form-control" placeholder="نسبه <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==0){?> بائع <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==1){?>مندوب <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==2){?>طبيب <?php }?>" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->awardrate;?>
" name="awardrate" />
                                    <span class="textfieldRequiredMsg">***.</span><span class="textfieldInvalidFormatMsg">ادخل رقم مناسب.</span><span class="textfieldMaxValueMsg"> ادخل رقم من 0 الى 100</span><span class="textfieldMinValueMsg"> ادخل رقم من 0 الى 100</span></span></div>
                        </div>

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



                        <div class="form-group">
                            <label for="saveid" class="col-lg-2 control-label">الخزنة الافتراضية</label>
                            <div class="col-lg-4">

                                <span id="spryselect3">
                                    <select class="select2 wdt100" name="saveid" id="saveid">


                                        <?php  $_smarty_tpl->tpl_vars['save'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['save']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['saveData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['save']->key => $_smarty_tpl->tpl_vars['save']->value){
$_smarty_tpl->tpl_vars['save']->_loop = true;
?>

                                        <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->saveid;?>
<?php $_tmp6=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['save']->value->saveid;?>
<?php $_tmp7=ob_get_clean();?><?php if ($_tmp6==$_tmp7){?> selected="selected" <?php }?> value="<?php echo $_smarty_tpl->tpl_vars['save']->value->saveid;?>
"><?php echo $_smarty_tpl->tpl_vars['save']->value->savename;?>
</option>

                                        <?php } ?>


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



                      
<!-- 

                        <div class="form-group">
                            <label for="saveid" class="col-lg-2 control-label">البحث فى يوميه الخزنه</label>
                            <div class="col-lg-4">


                                <select class="select2 wdt100" name="searchinonesave" id="searchinonesave">
                                    <option   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->searchinonesave;?>
<?php $_tmp8=ob_get_clean();?><?php if ($_tmp8==0){?> selected="selected" <?php }?>  value="0">كل الخزن</option>
                                    <option <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->searchinonesave;?>
<?php $_tmp9=ob_get_clean();?><?php if ($_tmp9==1){?> selected="selected" <?php }?> value="1">خزنه المستخدم فقط</option>
                                </select>

                            </div>
                        </div> -->



                        <div class="form-group">
                            <label for="saveid" class="col-lg-2 control-label">خزن المستخدم   </label>
                            <div class="col-lg-4">
                                <div class="radio-inline">
                                    <label>
                                        <input value="0"  class="radioR searchinonesave" name="searchinonesave" type="radio" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->searchinonesave;?>
<?php $_tmp10=ob_get_clean();?><?php if ($_tmp10==0){?> checked <?php }?> />

                                        خزن متعدده</label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="1"  class="radioR searchinonesave"   name="searchinonesave"  type="radio" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->searchinonesave;?>
<?php $_tmp11=ob_get_clean();?><?php if ($_tmp11==1){?> checked <?php }?> />
                                        خزنه المستخدم فقط  </label>
                                </div>

                            </div>
                        </div>



                        <div class="form-group" id="saveidshow" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->searchinonesave;?>
<?php $_tmp12=ob_get_clean();?><?php if ($_tmp12==1){?> style="display: none;" <?php }?>>
                            <label for="userstoreid" class="col-lg-2 control-label">الخزن</label>
                            <div class="col-lg-4" >

                                <span id="spryselect4">
                                    <select class="select2 wdt100" name="saveids[]" id="saveids" multiple="" data-placeholder="اختر الخزن">
                                        <option value="0" <?php if (in_array(0,$_smarty_tpl->tpl_vars['loadData']->value->saveids)){?> selected="selected" <?php }?>  >كل الخزن </option>
                                         <?php  $_smarty_tpl->tpl_vars['save'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['save']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['saveData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['save']->key => $_smarty_tpl->tpl_vars['save']->value){
$_smarty_tpl->tpl_vars['save']->_loop = true;
?>
                                        <option value="<?php echo $_smarty_tpl->tpl_vars['save']->value->saveid;?>
" <?php if (in_array($_smarty_tpl->tpl_vars['save']->value->saveid,$_smarty_tpl->tpl_vars['loadData']->value->saveids)){?> selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['save']->value->savename;?>
</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">
                                <div class="radio-inline">
                                    <label>
                                        <input value="0"  class="radioR" name="searchinonestorebalance"  type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->searchinonestorebalance;?>
<?php $_tmp13=ob_get_clean();?><?php if ($_tmp13==0){?> checked <?php }?>/>

                                        نعم </label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="1"  class="noradioR"   name="searchinonestorebalance"  type="radio"   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->searchinonestorebalance;?>
<?php $_tmp14=ob_get_clean();?><?php if ($_tmp14==1){?> checked <?php }?>/>
                                        لا </label>
                                </div>

                            </div>
                        </div>


                        <div class="form-group">
                            <label for="userstoreidDef" class="col-lg-2 control-label">المخزن الافتراضى</label>
                            <div class="col-lg-4">

                                <span id="spryselect5">
                                    <select class="select2 wdt100" name="userstoreidDef" id="userstoreidDef" required="">
                                        <option value="-1">اختر المخزن</option>
                                        <?php  $_smarty_tpl->tpl_vars['mystorData'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['mystorData']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['mystorData']->key => $_smarty_tpl->tpl_vars['mystorData']->value){
$_smarty_tpl->tpl_vars['mystorData']->_loop = true;
?>

                                        <option value="<?php echo $_smarty_tpl->tpl_vars['mystorData']->value->storeId;?>
" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->userstoreidDef;?>
<?php $_tmp15=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mystorData']->value->storeId;?>
<?php $_tmp16=ob_get_clean();?><?php if ($_tmp15==$_tmp16){?> selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['mystorData']->value->storeName;?>
</option>

                                        <?php } ?>


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







                        <div class="form-group">
                            <label for="userstoreid" class="col-lg-2 control-label">المخزن</label>
                            <div class="col-lg-4">

                                <span id="spryselect4">
                                    <select class="select2 wdt100" name="userstoreid" id="userstoreid" required="">
                                        <option value="-1">اختر المخزن</option>
                                        <option value="0" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->userstoreid;?>
<?php $_tmp17=ob_get_clean();?><?php if ($_tmp17=='0'){?> selected="selected" <?php }?>> مخازن متعدده</option>
                                        <?php  $_smarty_tpl->tpl_vars['mystorData'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['mystorData']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['mystorData']->key => $_smarty_tpl->tpl_vars['mystorData']->value){
$_smarty_tpl->tpl_vars['mystorData']->_loop = true;
?>

                                        <option value="<?php echo $_smarty_tpl->tpl_vars['mystorData']->value->storeId;?>
" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->userstoreid;?>
<?php $_tmp18=ob_get_clean();?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['mystorData']->value->storeId;?>
<?php $_tmp19=ob_get_clean();?><?php if ($_tmp18==$_tmp19){?> selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['mystorData']->value->storeName;?>
</option>

                                        <?php } ?>


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


                         <div class="form-group" id="storeidshow" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->userstoreid;?>
<?php $_tmp20=ob_get_clean();?><?php if ($_tmp20!=0){?> style="display: none;" <?php }?>>
                            <label for="storeids" class="col-lg-2 control-label">المخازن</label>
                            <div class="col-lg-4">

                                <span id="spryselect4">
                                    <select class="select2 wdt100" name="storeids[]" id="storeids" multiple="" data-placeholder="اختر ">
                                        <option value="0" <?php if (in_array(0,$_smarty_tpl->tpl_vars['loadData']->value->storeids)){?> selected="selected" <?php }?>>كل المخازن </option>
                                         <?php  $_smarty_tpl->tpl_vars['mystorData'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['mystorData']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['mystorData']->key => $_smarty_tpl->tpl_vars['mystorData']->value){
$_smarty_tpl->tpl_vars['mystorData']->_loop = true;
?>
                                        <option value="<?php echo $_smarty_tpl->tpl_vars['mystorData']->value->storeId;?>
" <?php if (in_array($_smarty_tpl->tpl_vars['mystorData']->value->storeId,$_smarty_tpl->tpl_vars['loadData']->value->storeids)){?> selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['mystorData']->value->storeName;?>
</option>
                                        <?php } ?>
                                    </select>
                                    <span class="selectInvalidMsg"> *</span></span>
                            </div>
                        </div>
                        <!--==============================-->
                        

                        <!--==============================-->
                        <?php if ($_smarty_tpl->tpl_vars['loginUsergroupid']->value==1){?>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">حفظ مباشر "بصريات"</label>
                            <div class="col-lg-4">
                                <div class="radio-inline">
                                    <label>
                                        <input value="1"  class="radioR" name="directSaveBills"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->directSaveBills;?>
<?php $_tmp21=ob_get_clean();?><?php if ($_tmp21==1){?> checked <?php }?> type="radio" />

                                        نعم </label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="0"  class="noradioR"   name="directSaveBills" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->directSaveBills;?>
<?php $_tmp22=ob_get_clean();?><?php if ($_tmp22==0){?> checked <?php }?>   type="radio" />
                                        لا </label>
                                </div>

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

                        <!--==============================-->
                        <?php if ($_smarty_tpl->tpl_vars['programsetting']->value->mandobCollectionRatio==1){?>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">الموظف</label>
                            <div class="col-lg-4">
                                <input type="text" class="form-control" readonly value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->empName;?>
">
                            </div>
                        </div>
                        <?php }?>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">الاطلاع على العملاء</label>
                            <div class="col-lg-4">
                                <div class="radio-inline">
                                    <label>
                                        <input value="1"  class="radioR" name="viewclients"  type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->viewclients;?>
<?php $_tmp23=ob_get_clean();?><?php if ($_tmp23==1){?> checked <?php }?> />

                                        جميع العملاء </label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="0"  class="noradioR"   name="viewclients"  type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->viewclients;?>
<?php $_tmp24=ob_get_clean();?><?php if ($_tmp24==0){?> checked <?php }?>/>
                                        عملائى فقط </label>
                                </div>

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">الاطلاع على الفواتير</label>
                            <div class="col-lg-6">
                                <div class="radio-inline">
                                    <label>
                                        <input value="1"  class="radioR" name="viewbills"   type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->viewbills;?>
<?php $_tmp25=ob_get_clean();?><?php if ($_tmp25==1){?> checked <?php }?>/>

                                        جميع الفواتير</label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="0"  class="noradioR"   name="viewbills"  type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->viewbills;?>
<?php $_tmp26=ob_get_clean();?><?php if ($_tmp26==0){?> checked <?php }?>/>
                                        فواتيري فقط </label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="2"  class="noradioR"   name="viewbills"  type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->viewbills;?>
<?php $_tmp27=ob_get_clean();?><?php if ($_tmp27==2){?> checked <?php }?>/>
                                        فواتير مجموعة المستخدم </label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="3"  class="noradioR"   name="viewbills"  type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->viewbills;?>
<?php $_tmp28=ob_get_clean();?><?php if ($_tmp28==3){?> checked <?php }?>/>
                                        مخازني فقط   </label>
                                </div>

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

                        <div class="form-group">
                            <label class="col-lg-2 control-label">مشرف مخزن</label>
                            <div class="col-lg-4">
                                <div class="radio-inline">
                                    <label>
                                        <input value="1"  class="radioR" name="storeSupervisor"  type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->storeSupervisor;?>
<?php $_tmp29=ob_get_clean();?><?php if ($_tmp29==1){?> checked <?php }?> />

                                        نعم </label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="0"  class="noradioR"   name="storeSupervisor"  type="radio"  <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->storeSupervisor;?>
<?php $_tmp30=ob_get_clean();?><?php if ($_tmp30==0){?> checked <?php }?>/>
                                        لا </label>
                                </div>

                            </div>
                        </div>
                        <!--==============================-->
                        <div class="form-group" style="display: none" id="storeSupervisorStoresDiv" >
                            <label class="col-lg-2 control-label">مخازن المشرف</label>
                            <div class="col-lg-4">
                                <select class="select2" name="storeSupervisorStores[]" id="storeSupervisorStores" multiple="multiple" allowClear>
                                    <!--<option value="-1">كل المخازن</option>-->
                                    <?php  $_smarty_tpl->tpl_vars['mystorData'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['mystorData']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['mystorData']->key => $_smarty_tpl->tpl_vars['mystorData']->value){
$_smarty_tpl->tpl_vars['mystorData']->_loop = true;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['mystorData']->value->storeId;?>
" <?php if (in_array($_smarty_tpl->tpl_vars['mystorData']->value->storeId,$_smarty_tpl->tpl_vars['loadData']->value->storeSupervisorStores)){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['mystorData']->value->storeName;?>
</option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>


                        <div class="form-group">
                            <label for="userstoreid" class="col-lg-2 control-label">المشروعات</label>
                            <div class="col-lg-4">

                                <span id="spryselect4">
                                    <select class="select2 wdt100" name="projectids[]" id="projectids" multiple="" data-placeholder="اختر المشروعات">
                                        <option value="0" <?php if (in_array(0,$_smarty_tpl->tpl_vars['loadData']->value->projectids)){?>  selected="selected" <?php }?>>كل  المشروعات </option>
                                        <?php  $_smarty_tpl->tpl_vars['allproject'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['allproject']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allprojectdata']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['allproject']->key => $_smarty_tpl->tpl_vars['allproject']->value){
$_smarty_tpl->tpl_vars['allproject']->_loop = true;
?>
                                        <option value="<?php echo $_smarty_tpl->tpl_vars['allproject']->value->id;?>
" <?php if (in_array($_smarty_tpl->tpl_vars['allproject']->value->id,$_smarty_tpl->tpl_vars['loadData']->value->projectids)){?>  selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['allproject']->value->name;?>
</option>
                                        <?php } ?>

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



                  



                        <div class="form-group">
                            <label for="userstoreid" class="col-lg-2 control-label">البنوك</label>
                            <div class="col-lg-4">

                                <span id="spryselect4">
                                    <select class="select2 wdt100" name="bankids[]" id="bankids" multiple="" data-placeholder="اختر البنوك">
                                        <option value="0"  <?php if (in_array(0,$_smarty_tpl->tpl_vars['loadData']->value->bankids)){?> selected="selected" <?php }?> >كل البنوك </option>
                                        <?php  $_smarty_tpl->tpl_vars['allbank'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['allbank']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allbankdata']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['allbank']->key => $_smarty_tpl->tpl_vars['allbank']->value){
$_smarty_tpl->tpl_vars['allbank']->_loop = true;
?>
                                        <option value="<?php echo $_smarty_tpl->tpl_vars['allbank']->value->bankid;?>
" <?php if (in_array($_smarty_tpl->tpl_vars['allbank']->value->bankid,$_smarty_tpl->tpl_vars['loadData']->value->bankids)){?> selected="selected" <?php }?>  ><?php echo $_smarty_tpl->tpl_vars['allbank']->value->bankname;?>
</option>
                                        <?php } ?>

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




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

                    </div>



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





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




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




    </div>
</div>




<script type="text/javascript">
    var name = new Spry.Widget.ValidationTextField("name");
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {invalidValue: "-1", isRequired: false});
    var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {isRequired: false, invalidValue: "-1"});
    var spryselect4 = new Spry.Widget.ValidationSelect("spryselect4", {isRequired: false, invalidValue: "-1"});
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "real", {isRequired: false, invalidValue: "-1", minValue: "0", maxValue: "100"});
    var spryselect5;
    // $('#userstoreid').live('change', function () {
    //     var val = Number($(this).val());
    //     if (val == 0) {
    //         spryselect5 = new Spry.Widget.ValidationSelect("spryselect5", {isRequired: false, invalidValue: "-1"});
    //     } else {
    //         spryselect5.destroy();
    //     }
    // });
    // $('#userstoreid').change();
    $('input[name="storeSupervisor"]').live('change', function () {
        if ($('input[name="storeSupervisor"]:checked').val() == 1) {
            $('#storeSupervisorStoresDiv').show();
        } else {
            $('#storeSupervisorStoresDiv').hide();
        }
    });
    $('input[name="storeSupervisor"]').change();

    $('input[name="searchinonesave"]').live('change', function () {
        if ($('input[name="searchinonesave"]:checked').val() == 1) {
            $('#saveidshow').hide();
        } else {
            $('#saveidshow').show();
        }
    });

    $('#userstoreid').live('change', function () {
        if ($(this).val() == 0){
            $('#storeidshow').show();
        } else {
            $('#storeidshow').hide();
        }
    });

</script>


<script type="text/javascript">
    $('#spbutton').live('click', function (e) {
        //ckeck name
        var tableName = 'user';
        var inputName = 'username';
        var name = $("#" + inputName).val();
        var id = $("#userid").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");
                    var myForm = document.getElementById("spform");
                    var SS = Spry.Widget.Form.validate(myForm);
                    if (SS == true) {
                        if (!$('#spbutton').hasClass("processing"))
                        {
                            $('#spbutton').addClass("processing");
                            myForm.submit();
                            //$('#spbutton').unbind('click');
                        }
                    }

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

    });
</script>

<?php }} ?>