<?php /* Smarty version Smarty-3.1.11, created on 2024-07-15 17:18:07
         compiled from "..\views\default\productCatview\add.html" */ ?>
<?php /*%%SmartyHeaderCode:1710766953daf3f8110-93148674%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '642f2c01fed07e5df30cc16a5d8eccd29b34197f' => 
    array (
      0 => '..\\views\\default\\productCatview\\add.html',
      1 => 1701074585,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1710766953daf3f8110-93148674',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'allParents' => 0,
    'parent' => 0,
    'categories' => 0,
    'data' => 0,
    'currency' => 0,
    'Programsettingdata' => 0,
    'unitsData' => 0,
    'unit' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_66953daf5ae494_43463498',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_66953daf5ae494_43463498')) {function content_66953daf5ae494_43463498($_smarty_tpl) {?><style>
    .new_prices {
        border-right: 0;
        border-bottom-right-radius: 0;
        border-top-right-radius: 0;
        font-weight: bold;
        padding: 4px 12px;
        font-size: 14px;
        font-weight: bold;
        line-height: 1;
        text-align: center;
        background-color: #eee;
        border: 1px solid #ccc;
        border-radius: 4px;
        width: 66px;
        white-space: nowrap;
        vertical-align: middle;
        display: table-cell;
        border-radius: 0px;
        border-bottom-left-radius: 4px;
        border-top-left-radius: 4px;
    }
</style>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#"><?php echo @PRODUCTS;?>
</a></li>
            <li><a href="productCatController.php?do=show"><?php echo @PRODUCTS_CATEGORIES;?>
</a></li>
            <li class="active"><?php echo @ADD_MAIN_CATEGORY;?>
</li>
        </ol>
        <div class="panel panel-default panel-m">
            <div class="panel-heading">
                <h3 class="panel-title"><?php echo @ADD_MAIN_CATEGORY;?>
</h3>
            </div>
            <div class="panel-body"> 
                <form class="nameToBeChecked form-horizontal" role="form" action="productCatController.php?do=add2"
                    method="post" enctype="multipart/form-data" id="spform">
                    
                    <!--                    <div class="form-group">
                                            <label for="parent" class="col-lg-2 control-label">التصنيف الرئيسى</label>
                                            <div class="col-lg-4">
                                                <select class="select2 wdt100" name="parent" id="parent">
                                                    <option value="0">لا يوجد تصنيف رئيسي</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->productCatId;?>
"><?php echo $_smarty_tpl->tpl_vars['parent']->value->productCatName;?>
</option>


                                                    <?php } ?>


                                                </select>
                                            </div>
                                        </div>-->

                    <div class="form-group">
                        <label class="col-lg-2 control-label"><?php echo @PRODUCT_CATEGORY;?>
</label>
                        <div class="col-lg-4">
                            <input type="hidden" data-level="0" name="parent" id="productCatId0">

                            <!-- <select class="select2 wdt300 productCat" data-level="0"  name="parent" id="productCatId0" >
                                                            <option value="-1"><?php echo @CHOOSE_CATEGORY;?>
</option>
                                                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['categories']->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->productCatId;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->productCatName;?>
</option>
                                                            <?php } ?>
                                                        </select>-->
                        </div>
                        <input type="hidden" id="level" name="level" value="0">
                    </div>
                    <input type="hidden" id="thecurrency" value="<?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
" />
                    <!-- =================================================   -->

                    <div class="form-group">
                        <label for="productCatName" class="col-lg-2 control-label"><?php echo @CATEGORY_NAME;?>
</label>
                        <div class="col-lg-4"> <span id="sprytextfield1">
                                <input type="text" name="productCatName" id="productCatName"
                                    onkeyup="checkName(event, 'productcat', 'productCatName')"
                                    placeholder="<?php echo @CATEGORY_NAME;?>
" class="form-control" />
                                <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><?php echo @WRONG_MESSAGE;?>
</h4>
                                <p><?php echo @NAME_ALREADY_TAKEN;?>
</p>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label class="col-lg-2 control-label"><?php echo @IN_MENU;?>
</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input value="0" class="radioR" checked="checked" name="inMenu" type="radio">

                                    <?php echo @CATEGORY_YES;?>
 </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1" class="noradioR" name="inMenu" type="radio">
                                    <?php echo @CATEGORY_NO;?>
 </label>
                            </div>

                        </div>
                    </div>

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

                    <div class="form-group">
                        <label for="discounttype" class="col-lg-2 control-label"><?php echo @DISCOUNT_TYPE;?>
</label>
                        <div class="col-lg-4">
                            <select class="select2 wdt100" name="discounttype" id="discounttype"
                                onchange="chechdata();">
                                <option value="-1"> <?php echo @CHOOSE_TYPE;?>
</option>
                                <option value="0"> <?php echo @CATEGORY_DIRECT;?>
</option>
                                <option value="1"><?php echo @CATEGORY_RATE;?>
</option>
                            </select>
                        </div>
                    </div>

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

                    <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->isOpticProg==1){?>style="display:none;"<?php }?>>
                        <label for="discounttype"
                            class="col-lg-2 control-label"><?php echo @OPTICAL_SERVICES;?>
</label>
                        <div class="col-lg-4">
                            <select class="select2 wdt100" name="opticServices[]" id="opticServices" multiple>
                                <option value="Single vision">Single vision</option>
                                <option value="polycarbonate">polycarbonate</option>
                                <option value="Hi index">Hi index</option>
                                <option value="Contact lenses Plano">Contact lenses Plano</option>
                                <option value="Contact lenses power">Contact lenses power</option>
                                <option value="Sunglasses">Sunglasses</option>
                                <option value="Medical frame">Medical frame</option>
                                <option value="Reading">Reading</option>
                                <option value="Accessories">Accessories</option>
                                <option value="Bifocal">Bifocal</option>
                                <option value="Multifocal/Progressive">Multifocal/Progressive</option>
                            </select>
                        </div>
                    </div>
                    <!--==============================-->

                    <div class="form-group">
                        <label for="email" class="col-lg-2 control-label"><?php echo @CATEGORY_IMAGE;?>
</label>
                        <div class="col-lg-4">
                            <input type="file" name="logo" id="logo" class="form-control"
                                placeholder="<?php echo @CATEGORY_LOGO;?>
" accept="image/*" />
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label for="selldiscount" class="col-lg-2 control-label"><?php echo @SALE_DISCOUNT;?>
</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="number" name="selldiscount" id="selldiscount" value="0"
                                    onKeyUp="chechdata();" class="form-control numberinput"
                                    placeholder="<?php echo @DISCOUNT_VALUE;?>
" />
                                <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                            </div>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label for="buydiscount" class="col-lg-2 control-label"><?php echo @BUY_DISCOUNT;?>
</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="number" name="buydiscount" id="buydiscount" value="0"
                                    onKeyUp="chechdata();" class="form-control numberinput"
                                    placeholder="<?php echo @DISCOUNT_VALUE;?>
" />
                                <span class="input-group-addon"><?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</span>
                            </div>
                        </div>
                    </div>



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

                    <div class="form-group">
                        <label for="buytotal" class="col-lg-2 control-label"><?php echo @ACTUAL_BUY_PRICE;?>
</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="number" name="buypricereal" id="buypricereal" value="0"
                                    style="width: 303px;" class="form-control numberinput"
                                    placeholder="<?php echo @ACTUAL_BUY_PRICE;?>
" />
                                <span class="new_prices">%</span>
                            </div>
                        </div>
                    </div>

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

                    <!-- =================================================   -->
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceall==1){?>
                    <div class="form-group">
                        <label for="buytotal" class="col-lg-2 control-label"><?php echo @WHOLESALE_PRICE;?>
</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="number" name="buytotal" id="buytotal" value="0" style="width: 303px;"
                                    class="form-control main_input numberinput"
                                    placeholder="<?php echo @WHOLESALE_PRICE;?>
" />
                                <span class="new_prices">%</span>
                            </div>
                        </div>
                    </div>
                    <?php }?>
                    <!-- =================================================   -->
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpricehalf==1){?>
                    <div class="form-group">
                        <label for="buyhalf" class="col-lg-2 control-label"><?php echo @HALF_WHOLESALE_PRICE;?>
</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="number" name="buyhalf" id="buyhalf" value="0" style="width: 303px;"
                                    class="form-control main_input numberinput"
                                    placeholder="<?php echo @HALF_WHOLESALE_PRICE;?>
" />
                                <span class="new_prices">%</span>
                            </div>
                        </div>
                    </div>
                    <?php }?>
                    <!-- =================================================   -->
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceunit==1){?>
                    <div class="form-group">
                        <label for="buypart" class="col-lg-2 control-label"><?php echo @RETAIL_PRICE;?>
</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="number" name="buypart" id="buypart" value="0" style="width: 303px;"
                                    class="form-control main_input numberinput"
                                    placeholder="<?php echo @RETAIL_PRICE;?>
" />
                                <span class="new_prices">%</span>
                            </div>
                        </div>
                    </div>
                    <?php }?>
                    <!-- =================================================   -->
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice4==1){?>
                    <div class="form-group">
                        <label for="buypart" class="col-lg-2 control-label"><?php echo @PRICE4;?>
</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="number" name="price4" id="price4" value="0" style="width: 303px;"
                                    class="form-control main_input numberinput" placeholder="<?php echo @PRICE4;?>
" />
                                <span class="new_prices">%</span>
                            </div>
                        </div>
                    </div>
                    <?php }?>
                    <!-- =================================================   -->
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice5==1){?>
                    <div class="form-group">
                        <label for="buypart" class="col-lg-2 control-label"><?php echo @PRICE5;?>
</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="number" name="price5" id="price4" value="0" style="width: 303px;"
                                    class="form-control main_input numberinput" placeholder="<?php echo @PRICE5;?>
" />
                                <span class="new_prices">%</span>
                            </div>
                        </div>
                    </div>
                    <?php }?>
                    <!-- =================================================   -->
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice6==1){?>
                    <div class="form-group">
                        <label for="buypart" class="col-lg-2 control-label"><?php echo @PRICE6;?>
</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="number" name="price6" id="price4" value="0" style="width: 303px;"
                                    class="form-control main_input numberinput" placeholder="<?php echo @PRICE6;?>
" />
                                <span class="new_prices">%</span>
                            </div>
                        </div>
                    </div>
                    <?php }?>
                    <!-- =================================================   -->
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice7==1){?>
                    <div class="form-group">
                        <label for="buypart" class="col-lg-2 control-label"><?php echo @PRICE7;?>
</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="number" name="price7" id="price4" value="0" style="width: 303px;"
                                    class="form-control main_input numberinput" placeholder="<?php echo @PRICE7;?>
" />
                                <span class="new_prices">%</span>
                            </div>
                        </div>
                    </div>
                    <?php }?>
                    <!-- =================================================   -->
                    <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice8==1){?>
                    <div class="form-group">
                        <label for="buypart" class="col-lg-2 control-label"><?php echo @PRICE8;?>
</label>
                        <div class="col-lg-4">
                            <div class="input-group">
                                <input type="number" name="price8" id="price4" value="0" style="width: 303px;"
                                    class="form-control main_input numberinput" placeholder="<?php echo @PRICE8;?>
" />
                                <span class="new_prices">%</span>
                            </div>
                        </div>
                    </div>
                    <?php }?>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label class="col-lg-2 control-label"><?php echo @NEGATIVE_SALES_STOP;?>
</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input value="0" class="radioR" checked="checked" name="stopNegativeSale"
                                        type="radio">

                                    <?php echo @CATEGORY_NO;?>
 </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1" class="noradioR" name="stopNegativeSale" type="radio">
                                    <?php echo @CATEGORY_YES;?>
 </label>
                            </div>

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

                    <div class="form-group">
                        <label for="productCatDescription"
                            class="col-lg-2 control-label"><?php echo @CATEGORY_COMMIT;?>
</label>
                        <div class="col-lg-4">
                            <textarea class="form-control" rows="3" name="productCatDescription"></textarea>
                        </div>
                    </div>

                    <!-- =================================================   -->
                    <!--------------------------------  adding units   ----------------------------->

                    <div id="cat_addUnitsDiv">
                        <div class="table-responsive">
                            <table id="cat_unitsTable" class="table table-black">
                                <tr>
                                    <td>
                                        <div class="form-group">
                                            <label class="col-lg-4 control-label"><?php echo @UNIT_NAME;?>
</label>
                                            <div class="col-lg-8">
                                                <select name="productcatunit1" id="productcatunit1"
                                                    data-placeholder="<?php echo @CHOOSE;?>
"
                                                    class="select2 wdt100 chosenproduct">
                                                    <option value="-1"><?php echo @CHOOSE_UNIT_NAME;?>
</option>

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

                                                    <option value="<?php echo $_smarty_tpl->tpl_vars['unit']->value->unitId;?>
"><?php echo $_smarty_tpl->tpl_vars['unit']->value->unitName;?>
</option>

                                                    <?php } ?>

                                                </select>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="form-group">
                                            <label class="col-lg-4 control-label"><?php echo @NUMBER_UNITS;?>
</label>
                                            <div class="col-lg-8">
                                                <input name="cat_productnumber1" id="cat_productnumber1" type="text"
                                                    class="form-control numberinput" />
                                            </div>
                                        </div>
                                    </td>
                                    <td><a id="cat_remove1" onClick="cat_removeUnits(1);" class="cat_removeUnits">X</a>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <!--end cat_unitsTable-->
                    </div>
                    <input class="cat_addUnits btn btn-warning" onClick="cat_addUnits();" type="button"
                        value="<?php echo @ADD_UNITS_MEASURE;?>
" />
                    <input name="cat_unitsItr" id="cat_unitsItr" type="hidden" value="1" />

                    <!-------------------------------- end adding units   -------------------------->

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="button" class="btn btn-primary pull-left"
                                id="spbutton"><?php echo @SAVE_IT;?>
</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<div id="productUnitsDiv" style="display:none;">
    <option value="-1"><?php echo @CHOOSE_UNIT_NAME;?>
</option>
    <?php  $_smarty_tpl->tpl_vars['unit'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['unit']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['unitsData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['unit']->key => $_smarty_tpl->tpl_vars['unit']->value){
$_smarty_tpl->tpl_vars['unit']->_loop = true;
?>
    <option value="<?php echo $_smarty_tpl->tpl_vars['unit']->value->unitId;?>
"><?php echo $_smarty_tpl->tpl_vars['unit']->value->unitName;?>
</option>
    <?php } ?>
</div>

<script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    $('#spbutton').live('click', function (e) {
        if (!$('#spbutton').hasClass("processing")) {
            $('#spbutton').addClass("processing");
            var myForm = document.getElementById("spform");
            var SS = Spry.Widget.Form.validate(myForm);
            if (SS == true) {
                myForm.submit();
            } else {
                $('#spbutton').removeClass("processing");
            }
        }
    });

    $(function () {
        $('#productCatId0').select2({
            placeholder: "اختر تصنيف ",
            minimumInputLength: 0,
            //  minimumInputLength: 3,
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "productControllerAjax.php?do=getallcats",
                dataType: 'json',
                data: function (term, page) {
                    //  alert(term);
                    return {
                        term: term, //search term
                        page_limit: 30, // page size
                    };
                },
                results: function (data) {
                    // alert(term);
                    return { results: data };
                }
            },
            formatResult: function (data) {
                return data.text;
            },
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = { id: item[0], text: item[1] };
                callback(data);
            }
        });
    });
</script>
<?php }} ?>