<?php /* Smarty version Smarty-3.1.11, created on 2025-10-19 22:35:39
         compiled from "../views/default/supplierview/edit.html" */ ?>
<?php /*%%SmartyHeaderCode:96835917368f53d8bdd09f2-51082168%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'e4e04a6a8670c3745c6a3aacb0c7ba8b4a8bbcb3' => 
    array (
      0 => '../views/default/supplierview/edit.html',
      1 => 1693253996,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '96835917368f53d8bdd09f2-51082168',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'loadData' => 0,
    'Programsettingdata' => 0,
    'governmentname' => 0,
    'areaname' => 0,
    'currency' => 0,
    'allCurrency' => 0,
    'data' => 0,
    'allParents' => 0,
    'category' => 0,
    'alltypes' => 0,
    'type' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_68f53d8c544ab2_37434313',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_68f53d8c544ab2_37434313')) {function content_68f53d8c544ab2_37434313($_smarty_tpl) {?>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">خصائص عامة</a></li>
            <li><a href="#">الموردين</a></li>
            <li><a href="#">إدارة الموردين</a></li>
            <li class="active">تعديل مورد</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <h3 class="panel-title">تعديل مورد</h3>
            </div>
            <div class="panel-body"> 
                <form id="suppform" class="nameToBeChecked form-horizontal" action="?do=update" method="post">
                    <!--validate the form before checking name-->
                    
                    <input type="hidden" name="dailyentryid" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->dailyentryid;?>
"/>
                    <input name="id" id="id" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->supplierid;?>
" />
                    <div class="form-group">
                        <label class="col-lg-2 control-label">اسم المورد</label>
                        <div class="col-lg-4">
                            <input name="txtName" type="text" id="txtName" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->suppliername;?>
"/>
                            <input name="oldname" type="hidden" id="oldname" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->suppliername;?>
"/>

                            <div id="nameError"  style="display:none"></div>
                        </div>
                    </div>
                    <?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" disabled class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->supplierid;?>
"/>

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


                    </div>
                    <!-- =================================================   -->
                    <?php }?>
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->maintenance!=1){?>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="txtName" class="col-lg-2 control-label">كود المورد </label>
                        <div class="col-lg-4">
                            <input type="text" name="suppliercode" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->suppliercode;?>
"/>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="txtName" class="col-lg-2 control-label">المحافظه    /  المدينة  </label>
                        <div class="col-lg-4">
                            <input id="" type="text" name="goverareaid"  id="goverareaid" class="getgoverarea"  data-placeholder=" المحافظه    /  المدينة    " />
                            <input type="hidden" id="goverareaidv"  value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->goverareaid;?>
"/>
                            <input type="hidden" id="governmentname"  value="<?php echo $_smarty_tpl->tpl_vars['governmentname']->value;?>
"/>
                            <input type="hidden" id="areaname"  value="<?php echo $_smarty_tpl->tpl_vars['areaname']->value;?>
"/>



                        </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="namepayeecheck" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->namepayeecheck;?>
"/>
                            <div class="clearfix"></div>
                        </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="suppliermobile" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->suppliermobile;?>
"/>
                            <div class="clearfix"></div>
                        </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="warrantyOfficer" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->warrantyOfficer;?>
"/>
                            <div class="clearfix"></div>
                        </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="warrantymobile" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->warrantymobile;?>
"/>
                            <div class="clearfix"></div>
                        </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="sellername" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->sellername;?>
"/>
                            <div class="clearfix"></div>
                        </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="sellermobile" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->sellermobile;?>
"/>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <?php }?>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label">العنوان</label>
                        <div class="col-lg-4">
                            <input name="txtAddress" type="text" id="txtAddress"  value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->supplieraddress;?>
" class="form-control"/>
                            <div id="addressError"  style="display:none"></div>
                        </div>
                    </div>
                    <!--==============================-->

                    <div class="form-group">
                        <label class="col-lg-2 control-label">رقم التليفون</label>
                        <div class="col-lg-4">
                            <input name="txtPhone" type="text" id="txtPhone"  class="positiveNo form-control"  value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->supplierphone;?>
"/>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label">قيمة المديونية</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="text" name="txtDebt" id="txtDebt" disabled="disabled" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->suppliercurrentDebt;?>
" class="form-control"/>
                                <input type="hidden" name="debt" id="debt" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->suppliercurrentDebt;?>
" />
                                <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                                <div id="valueError"  style="display:none"></div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showCurrency!=1){?>style="display:none;"<?php }?>>
                        <label for="txtName" class="col-lg-2 control-label">عملة المورد</label>
                        <div class="col-lg-4">
                            <select class="select2" name="sullpierCurrencyidTxt" id="sullpierCurrencyidTxt" disabled>
                                <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allCurrency']->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;
?>
                                <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
" data-cfactor="<?php echo $_smarty_tpl->tpl_vars['data']->value->conversionFactor;?>
" data-othercfactor="<?php echo $_smarty_tpl->tpl_vars['data']->value->otherconversionFactor;?>
"
                                        <?php if ($_smarty_tpl->tpl_vars['loadData']->value->sullpierCurrencyid==$_smarty_tpl->tpl_vars['data']->value->id){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                <?php } ?>
                            </select>
                            <input type="hidden" name="sullpierCurrencyid" id="sullpierCurrencyid" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->sullpierCurrencyid;?>
" />
                        </div>
                    </div>
                    <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showCurrency!=1){?>style="display:none;"<?php }?>>
                        <label for="txtName" class="col-lg-2 control-label">قيمة المديونية بعملته</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="text" name="suppliercurrentDebtInCurrencyTxt" id="suppliercurrentDebtInCurrencyTxt" disabled="disabled" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->suppliercurrentDebtInCurrency;?>
" class="form-control"/>
                                <input type="hidden" name="suppliercurrentDebtInCurrency" id="suppliercurrentDebtInCurrency" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->suppliercurrentDebtInCurrency;?>
" />
                                <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                                <div id="valueError"  style="display:none"></div>
                            </div>
                        </div>
                    </div>
                    <!--==============================-->

                    <div class="form-group">
                        <label class="col-lg-2 control-label">تفاصيل أخرى</label>
                        <div class="col-lg-4">
                            <textarea name="textDetails" cols="" rows="" id="textDetails" class="form-control"><?php echo $_smarty_tpl->tpl_vars['loadData']->value->supplierdetails;?>
</textarea>
                        </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 name="conditions" type="radio" value="1" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->conditions;?>
<?php $_tmp1=ob_get_clean();?><?php if ($_tmp1==1){?> checked="checked" <?php }?> />
                                    نعم </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="conditions" type="radio" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['loadData']->value->conditions;?>
<?php $_tmp2=ob_get_clean();?><?php if ($_tmp2==0){?> checked="checked" <?php }?> value="0" />
                                    لا </label>
                            </div>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label for="comments" class="col-lg-2 control-label">التصنيفات</label>
                        <div class="col-lg-4">

                            <select class="js-example-basic-multiple" id="check" name="category_id[]" multiple="multiple">
                                <?php  $_smarty_tpl->tpl_vars['category'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['category']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allParents']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['category']->key => $_smarty_tpl->tpl_vars['category']->value){
$_smarty_tpl->tpl_vars['category']->_loop = true;
?>
                                <option value="<?php echo $_smarty_tpl->tpl_vars['category']->value->productCatId;?>
" <?php if (in_array($_smarty_tpl->tpl_vars['category']->value->productCatId,$_smarty_tpl->tpl_vars['loadData']->value->category_id)){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['category']->value->productCatName;?>
</option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label for="comments" class="col-lg-2 control-label">نوع المورد</label>
                        <div class="col-lg-4">

                            <select class="js-example-basic-multiple" name="typesupplier[]" multiple="multiple">
                                <?php  $_smarty_tpl->tpl_vars['type'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['type']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['alltypes']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['type']->key => $_smarty_tpl->tpl_vars['type']->value){
$_smarty_tpl->tpl_vars['type']->_loop = true;
?>
                                <option value="<?php echo $_smarty_tpl->tpl_vars['type']->value->typeId;?>
" <?php if (in_array($_smarty_tpl->tpl_vars['type']->value->typeId,$_smarty_tpl->tpl_vars['loadData']->value->typesupplier_id)){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['type']->value->typeName;?>
</option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                    <input type="hidden" id="suppIsClientTooSetting" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->suppIsClientToo;?>
"/>
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->suppIsClientToo==1){?>
                    <!--==============================-->
                    <div class="form-group">
                        <label for="typs" class="col-lg-2 control-label">المورد عميل ايضا</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input name="suppIsClientToo" id="suppIsClientToo0" type="radio" class="suppIsClientToo" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->linkedClientId<1){?>checked="checked"<?php }?> value="0">لا
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="suppIsClientToo" id="suppIsClientToo1" type="radio" class="suppIsClientToo" value="1">عميل جديد بنفس الاسم
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="suppIsClientToo" id="suppIsClientToo2" type="radio" class="suppIsClientToo" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->linkedClientId>=1){?>checked="checked"<?php }?> value="2">عميل موجود
                                </label>
                            </div>
                        </div>
                    </div>
                    <!--==============================-->
                    <div class="form-group" id="suppIsClientTooDiv">
                        <label for="typs" class="col-lg-2 control-label">المورد عميل ايضا</label>
                        <div class="col-lg-4">
                            <input type="hidden" name="client" id="client" value=""/>
                        </div>
                        <input type="hidden" name="oldClientId" id="oldClientId" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->linkedClientId;?>
"/>
                        <input type="hidden" name="oldClientName" id="oldClientName" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->linkedClientName;?>
"/>
                    </div>
                    <!--==============================-->
                    <?php }else{ ?>
                    <input type="hidden" name="suppIsClientToo" id="suppIsClientToo" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->linkedClientId;?>
"/>
                    <input type="hidden" name="oldClientId" id="oldClientId" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->linkedClientId;?>
"/>
                    <input type="hidden" name="client" id="client" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->linkedClientId;?>
"/>
                    <?php }?>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">الرقم الضريبى</label>
                        <div class="col-lg-4">
                            <input name="taxnumber" type="text" id="taxnumber"  value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->taxnumber;?>
" class="form-control"/>
                            <div id="taxnumberError"  style="display:none"></div>
                        </div>
                    </div>
                    <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="supplierTypeForTree" type="radio" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->supplierTypeForTree==0){?>checked="checked"<?php }?>>
                                    مورد محلى </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1" class="radioR" name="supplierTypeForTree" type="radio" <?php if ($_smarty_tpl->tpl_vars['loadData']->value->supplierTypeForTree==1){?>checked="checked"<?php }?>s>
                                    مورد خدمات  </label>
                            </div>

                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button name="saveIncBtn" type="button" id="saveIncBtn" class="btn btn-primary pull-left">حفظ</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "real");


    $(document).ready(function () {
        $('.js-example-basic-multiple').select2();
        $(".getgoverarea").select2({
            allowClear: true,
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: 'maintenancesuppliers.php?do=getgoverarea',
                dataType: 'json',
                type: "POST",
                data: function (term) {

                    return {
                        searchTerms: term,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: function (data) {
                return  '<span>' + data.text + '</span >';

            },
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            },
        });
        $(".getgoverarea").select2("data", {id: $('#goverareaidv').val(), text: $('#governmentname').val() + '/' + $('#areaname').val()});


    });
</script>
<?php }} ?>