<?php /* Smarty version Smarty-3.1.11, created on 2023-10-16 18:38:27
         compiled from "../views/default/expensesTypeview/add.html" */ ?>
<?php /*%%SmartyHeaderCode:557892681652d58f333f3c0-87827388%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '2a1d35de51a1ac89911044fd8869e6ff6ec11893' => 
    array (
      0 => '../views/default/expensesTypeview/add.html',
      1 => 1693253992,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '557892681652d58f333f3c0-87827388',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'allParents' => 0,
    'parent' => 0,
    'saves' => 0,
    'data' => 0,
    'userGroups' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_652d58f33eff86_14317404',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_652d58f33eff86_14317404')) {function content_652d58f33eff86_14317404($_smarty_tpl) {?>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#"><?php echo @EXPENSES_REVENUE;?>
</a></li>
            <li><a href="#"><?php echo @EXPENSES;?>
</a></li>
            <li class="active"><?php echo @EXPENSES_ADD_EXPENSE_TYPE;?>
</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <h3 class="panel-title"><?php echo @EXPENSES_ADD_EXPENSE_TYPE;?>
</h3>
            </div>
            <div class="panel-body">
                
                <form id="typeform" class="nameToBeChecked form-horizontal" action="expensesTypeController.php?do=add" method="post" >
                    <!--validate the form before checking name-->
                    
                    <div class="form-group">
                        <label class="col-lg-2 control-label"><?php echo @EXPENSES_TYPE_MAIN_CLASSIFICATION;?>
</label>
                        <div class="col-lg-5">
                            <select name="parent" id="parent" class="select2 wdt100">
                                <option value="-1"> -- <?php echo @EXPENSES_TYPE_CHOOSE_CATEGORY;?>
 --</option>
                                <option value="0"><?php echo @EXPENSES_TYPE_NO_MAIN_CLASSIFICATION;?>
</option>
                                <?php  $_smarty_tpl->tpl_vars['parent'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['parent']->_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['parent']->key => $_smarty_tpl->tpl_vars['parent']->value){
$_smarty_tpl->tpl_vars['parent']->_loop = true;
?>
                                <option value="<?php echo $_smarty_tpl->tpl_vars['parent']->value->expensestypeid;?>
"><?php echo $_smarty_tpl->tpl_vars['parent']->value->expensestypename;?>
</option>
                                <?php } ?>
                            </select>
                            <div id="parentError" style="display:none;"></div>
                        </div>
                    </div>

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


                    <div class="form-group" id="treeTypeDiv">
                        <label class="col-lg-2 control-label"> النوع فى شجرة الحسابات</label>
                        <div class="col-lg-5">
                            <div class="radio-inline">
                                <label><input value="2"  class="radioR" name="treeType" type="radio"/>مصروفات التشغيل</label>
                            </div>
                            <div class="radio-inline">
                                <label><input value="1"  class="radioR" name="treeType" type="radio"/>مصروفات عمومية و إدارية</label>
                            </div>
                            <div class="radio-inline">
                                <label><input value="0"  class="noradioR" name="treeType" type="radio" checked="checked"/>مصروفات بيع و تسويق</label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> <?php echo @EXPENSES_TYPE_MANUFACTURING;?>
</label>
                        <div class="col-lg-5">
                            <div class="radio-inline">
                                <label><input value="1"  class="radioR" name="type"   type="radio" /><?php echo @EXPENSES_TYPE_YES;?>
 </label>
                            </div>
                            <div class="radio-inline">
                                <label><input value="0"  class="noradioR" name="type"   checked="checked"  type="radio" /><?php echo @EXPENSES_TYPE_NO;?>
</label>
                            </div>
                        </div>
                    </div>
                    <!--==============================-->

                    <div class="form-group">
                        <label class="col-lg-2 control-label"><?php echo @EXPENSES_TYPE_NAME;?>
</label>
                        <div class="col-lg-5">
                            <input type="text" name="name" id="name" class="form-control"/>
                            <div id="nameError"  style="display:none"></div>
                        </div>
                    </div>
                    <!--==============================-->
                    <div class="form-group">
                        <label class="col-lg-2 control-label"><?php echo @EXPENSES_TYPE_SAFE;?>
</label>
                        <div class="col-lg-5">
                            <select name="saveid" id="saveid" class="select2 wdt100">
                                <option value="0"><?php echo @EXPENSES_TYPE_ALL_SAFE;?>
</option>
                                <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['saves']->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->saveid;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->savename;?>
</option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>

                    <!--==============================-->
                    <div class="form-group">
                        <label class="col-lg-2 control-label"><?php echo @EXPENSES_TYPE_USER_GROUPS;?>
</label>
                        <div class="col-lg-5">
                            <select multiple name="addOnlyGroupIds[]" id="addOnlyGroupIds" class="select2 wdt100">
                                <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['userGroups']->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->usergroupid;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->usergroupname;?>
</option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label"><?php echo @EXPENSES_TYPE_OTHER_DETAILS;?>
</label>
                        <div class="col-lg-5">
                            <textarea cols="20" rows="5" name="descripe" id="descripe" class="form-control"></textarea>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="button" id="savebtn" class="btn btn-primary pull-left"><?php echo @EXPENSES_TYPE_SAVE;?>
</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
    $('#parent').on('change', function () {
        var val = Number($(this).val());
        if (val > 0) {
            $('#treeTypeDiv').hide();
        } else {
            $('#treeTypeDiv').show();
        }
    })
</script> <?php }} ?>