<?php /* Smarty version Smarty-3.1.11, created on 2023-11-10 00:22:58
         compiled from "../views/default/supplierview/add.html" */ ?>
<?php /*%%SmartyHeaderCode:1395268885654d5bc2ccfbd4-95008544%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '0fa57039603bbc725ba246f87fc9f42610ff1b08' => 
    array (
      0 => '../views/default/supplierview/add.html',
      1 => 1693253996,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1395268885654d5bc2ccfbd4-95008544',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'Programsettingdata' => 0,
    'nextId' => 0,
    'suplliernegative' => 0,
    'currency' => 0,
    'allCurrency' => 0,
    'data' => 0,
    'loadData' => 0,
    'allParents' => 0,
    'category' => 0,
    'alltypes' => 0,
    'type' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_654d5bc3267644_91121509',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_654d5bc3267644_91121509')) {function content_654d5bc3267644_91121509($_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=add" method="post" >
                    <!--validate the form before checking name-->
                    


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

                            <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['nextId']->value;?>
"/>

                            <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=""/>
                            <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"  class="getgoverarea"  data-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="namepayeecheck" class="form-control" value=""/>
                            <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=""/>
                            <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=""/>
                            <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=""/>
                            <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=""/>
                            <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=""/>
                            <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"  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"/>
                        </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" class="<?php if ($_smarty_tpl->tpl_vars['suplliernegative']->value==1){?>numberinput<?php }else{ ?>positivefloat<?php }?> form-control"/>

                                <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                            </div>
                            <div id="valueError"  style="display:none"></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="sullpierCurrencyid" id="sullpierCurrencyid">
                                <?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 echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                                <?php } ?>
                            </select>
                        </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">
                            <input type="text" name="cFactor" id="cFactor" class="form-control positivefloat calcOther" onkeyup="populateDebtAfter();" style="display: inline-block;width: 35%"/>
                            =
                            <div class="input-group" style="display: inline;">
                                <input type="text" name="otherCFactor" id="otherCFactor" class="form-control positivefloat calcOther" style="display: inline-block;width: 35%"/>
                                <span class="input-group-addon" style="display: inline-block;width: 23%"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                            </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">
                            <div class="input-group">
                                <input type="text" name="suppliercurrentDebtInCurrency" id="suppliercurrentDebtInCurrency" value="<?php echo $_smarty_tpl->tpl_vars['loadData']->value->suppliercurrentDebtInCurrency;?>
" class="form-control"/>
                                <span class="input-group-addon" id="currencyText"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                            </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"></textarea>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label for="cate" 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 echo $_smarty_tpl->tpl_vars['category']->value->productCatName;?>
</option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                    <!--==============================-->

                    <div class="form-group">
                        <label for="typs" 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 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" checked="checked" 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" 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>
                    </div>
                    <!--==============================-->
                    <?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"  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" checked="checked">
                                    مورد محلى </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1" class="radioR" name="supplierTypeForTree" type="radio">
                                    مورد خدمات  </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");
</script>



<script type="text/javascript">
    jQuery(function () {
        $("form").submit(function () {
// submit more than once return false
            $(this).submit(function () {
                return false;
            });
// submit once return true
            return true;
        });
    });


    $(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);
            },
        });


    });

</script>
<?php }} ?>