<?php /* Smarty version Smarty-3.1.11, created on 2026-05-12 03:47:45
         compiled from "..\views\default\buyBillview\addProduct.html" */ ?>
<?php /*%%SmartyHeaderCode:155946a0286c1cb3661-60317501%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '9cda7023dd709518d96ac422f149e45b60ee3a67' => 
    array (
      0 => '..\\views\\default\\buyBillview\\addProduct.html',
      1 => 1752437506,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '155946a0286c1cb3661-60317501',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'catDataReport' => 0,
    'data' => 0,
    'Programsettingdata' => 0,
    'generatedParcode' => 0,
    'today' => 0,
    'unitsData' => 0,
    'unit' => 0,
    'allSizeColor' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_6a0286c25852c6_98904884',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_6a0286c25852c6_98904884')) {function content_6a0286c25852c6_98904884($_smarty_tpl) {?><script type="text/javascript">
    $(document).ready(function (e) {
        $(".numberinput").forceNumeric();
        $(".positivefloat").forcepositivefloat();

    });
</script>
<style>
    .newoption {
        background-color:#CCCCCC !important;
        font-weight:bold !important;
    }

    #manyParents .form-group label{
        margin-left: 11px;
        margin-right: 16px;
    }

    #manyParents .form-group div{
        width: 155px;
    }
</style>
<div class="modal-body ">
    <form id="productInfo" action="#" method="post" class="form-horizontal">
        <div class="form-group">
            <label for="inputEmail1" class="col-lg-2 control-label">التصنيف الرئيسيى</label>
            <div class="col-lg-4"> <span id="spryselect4">
                    <select name="new_cat_id" id="productCatId0"  required ="required"  data-level="0"  data-placeholder="اختر" class="select2_customj wdt100 productCat" tabindex="12">
                        <option   value="">اختر تصنيف</option>
                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['catDataReport']->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>
                    <input type="hidden" id="level" name="level" value="0">
                    <span class="selectInvalidMsg">*</span></span></div>
            <div id="manyParents" class="col-lg-12">  </div>
            <span class="selectInvalidMsg">*</span>
        </div>
        <!---------------------------->


        <div class="form-group">
            <label for="inputEmail1" class="col-lg-2 control-label">الإسم</label>
            <div class="col-lg-4">
                <input name="new_productName" type="text" id="new_productName" size="50" class=" form-control  " required ="required"  />
            </div>
        </div>
        <!---------------------------->

        <div class="form-group  check_tr " <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->parcode;?>
<?php $_tmp1=ob_get_clean();?><?php if ($_tmp1==1){?>  style="display:none;" <?php }?> >
            <label for="inputEmail1" class="col-lg-2 control-label">الباركود</label>
            <div class="col-lg-4">
                <input name="new_parcode" type="text" id="new_parcode"  class=" form-control" size="50"    value="<?php echo $_smarty_tpl->tpl_vars['generatedParcode']->value;?>
" onblur="checkbarcode(this.value);"/>
            </div>
        </div>
        <div class="form-group">
            <label for="productBuyPrice" class="col-lg-2 control-label">سعر الشراء</label>
            <div class="col-lg-4"> <span id="sprytextfield5">
                    <input name="new_productBuyPrice" type="text" id="new_productBuyPrice" class="numberinput positivefloat buy_price form-control"  required ="required" data-id="1"  size="50"   />
                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل السعر صحيح</span></span></div>
        </div>
        <!---------------------------->


        <div class="form-group"  style="<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->realprice;?>
<?php $_tmp2=ob_get_clean();?><?php if ($_tmp2==1){?> display: none; <?php }?>">
            <label for="productBuyPrice" class="col-lg-2 control-label">سعر الشراء الفعلى</label>
            <div class="col-lg-4"> <span id="sprytextfield5">
                    <input style="width: 50%;float: left;" name="new_productbuypricereal" type="text" id="buypricereal1"  data-type="pricereal"  required ="required" class="form-control prices  aw_m aw_mt aw_pp numberclic enteraction  numberinput positivefloat buy_pricereal1" data-id="1" width="10"/></span>
                <input style="  width: 50%;"  name="new_buypricereal_precentage1" type="text" id="productBuyPrice1" data-type="pricereal"   class="form-control precentages  aw_m aw_mt aw_pp numberclic enteraction  numberinput positivefloat buypricereal_precentage1" data-id="1" width="10" />
                <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل السعر صحيح</span></span></div>
        </div>
        <!---------------------------->
        <div class="form-group">
            <label for="productSellAllPrice" class="col-lg-2 control-label">سعر بيع الجمله</label>
            <div class="col-lg-4"> <span id="sprytextfield6">
                    <!--<input name="productSellAllPrice" type="text" id="productSellAllPrice" class="numberinput form-control" onkeyup="populateSellPrice();"  size="50"   />-->
                    <input style=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->precentages;?>
<?php $_tmp3=ob_get_clean();?><?php if ($_tmp3==1){?> width: 100%; <?php }else{ ?> width: 50%; <?php }?> float: left;" name="new_productSellAllPrice" required ="required" type="text" id="productSellAllPrice" data-type="buytotal"  class="form-control prices aw_m aw_mt aw_pp numberclic positivefloat buy_total1 enteraction numberinput" data-id="1" width="10"/>
                    <input style=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->precentages;?>
<?php $_tmp4=ob_get_clean();?><?php if ($_tmp4==1){?> display: none; <?php }?> width: 50%;"  name="new_buytotal_precentage1" type="text" id="productBuyPrice1"   data-type="buytotal" class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat buytotal_precentage1" data-id="1" width="10"/>
                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل السعر صحيح</span></span></div>
        </div>
        <!---------------------------->

        <div class="form-group">
            <!--<label for="productSellHalfPrice" class="col-lg-2 control-label">سعر بيع الجمله التجزئة</label>-->
            <label for="productSellHalfPrice" class="col-lg-2 control-label">سعر بيع نصف الجملة </label>
            <div class="col-lg-4"> <span id="sprytextfield7">
                    <!--<input name="productSellHalfPrice" type="text" id="productSellHalfPrice" class=" form-control numberinput"   size="50"   />-->
                    <input  style="<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->precentages;?>
<?php $_tmp5=ob_get_clean();?><?php if ($_tmp5==1){?> width: 100%; <?php }else{ ?> width: 50%; <?php }?> float: left;"  required ="required" name="new_productSellHalfPrice" type="text" data-type="buyhalf" id="productSellHalfPrice"  class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat buy_hafe1" data-id="1" width="10"/>
                    <input style=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->precentages;?>
<?php $_tmp6=ob_get_clean();?><?php if ($_tmp6==1){?> display: none; <?php }?> width: 50%;"  name="new_buyhalf_precentage1" type="text" id="productBuyPrice1"  data-type="buyhalf" class="form-control  aw_m aw_mt aw_pp numberclic enteraction  precentages numberinput positivefloat buyhafe_precentage1" data-id="1" width="10"/>
                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل السعر صحيح</span></span></div>
        </div>
        <!---------------------------->

        <div class="form-group">
            <!--<label for="productSellUnitPrice" class="col-lg-2 control-label">سعر بيع الوحده</label>-->
            <label for="productSellUnitPrice" class="col-lg-2 control-label">سعر بيع التجزئة  </label>
            <div class="col-lg-4"> <span id="sprytextfield8">
                    <!--<input name="productSellUnitPrice" type="text" id="productSellUnitPrice" class=" form-control numberinput"  size="50"   />-->
                    <input  style=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->precentages;?>
<?php $_tmp7=ob_get_clean();?><?php if ($_tmp7==1){?> width: 100%; <?php }else{ ?> width: 50%; <?php }?> float: left;"  required ="required" name="new_productSellUnitPrice" type="text" data-type="buypart"  id="productSellUnitPrice"  class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat buy_part1" data-id="1"  width="20"/>
                    <input style=" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->precentages;?>
<?php $_tmp8=ob_get_clean();?><?php if ($_tmp8==1){?> display: none; <?php }?> width: 50%;"  name="new_buypart_precentage1" type="text" id="productBuyPrice1" data-type="buypart"    class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat buypart_precentage1" data-id="1" width="10"/>
                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل السعر صحيح</span></span></div>
        </div>
        <!---------------------------->

        <div class="form-group">
            <label for="inputEmail1" class="col-lg-2 control-label">الكمية</label>
            <div class="col-lg-4">
                <input name="new_productquantity" type="text" id="new_productquantity" class=" form-control numberinput"  required="required"   value="0" size="50"/>
            </div>
        </div>
        <!---------------------------->

        <div class="form-group check_tr_service " <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->service;?>
<?php $_tmp9=ob_get_clean();?><?php if ($_tmp9==1){?> style="display:none;" <?php }?>>
            <label for="inputEmail1" class="col-lg-2 control-label">خدمة</label>
            <div class="col-lg-4">

                <label class='color-black'>
                    <input value="1"  class="radioR isservice" name="new_isservice1"   type="radio" />
                    نعم </label>

                <label class='color-black'>
                    <input value="0"  class="noradioR isservice" name="new_isservice1"   checked="checked"  type="radio" />
                    لا </label>
            </div>

        </div>
        <!---------------------------->
        <div class="form-group ">
            <label for="inputEmail1" class="col-lg-2 control-label">فى المنيو</label>
            <div class="col-lg-4">
                <label>
                    <input value="0"  class="radioR" name="inMenu1"  checked="checked"  type="radio" />
                    نعم </label>
                <label>
                    <input value="1"  class="noradioR" name="inMenu1"     type="radio" />
                    لا </label>
            </div>
        </div>
        <!---------------------------->
        <div class="form-group  check_tr_production " <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->production;?>
<?php $_tmp10=ob_get_clean();?><?php if ($_tmp10==1){?>  style="display:none;" <?php }?>>
            <label for="inputEmail1" class="col-lg-2 control-label">التصنيع</label>
            <div class="col-lg-4">



                <label>
                    <input value="1"  class="radioR" name="type1"   type="radio" />

                    نعم </label>

                <label>
                    <input value="0"  class="noradioR" name="type1"   checked="checked"  type="radio" />
                    لا </label>



            </div>
        </div>
        <!---------------------------->
        <div class="form-group check_tr_date " <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->date;?>
<?php $_tmp11=ob_get_clean();?><?php if ($_tmp11==1){?> style="display:none;" <?php }?>>
            <label for="inputEmail1" class="col-lg-2 control-label">التاريخ</label>
            <div class="col-lg-4">
                <input name="new_productDate" type="text" id="new_productDate" value="<?php echo $_smarty_tpl->tpl_vars['today']->value;?>
" class=" form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" size="50" required   />
            </div>
        </div>
        <!---------------------------->

        <div class="form-group check_tr_period " <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->expiredate;?>
<?php $_tmp12=ob_get_clean();?><?php if ($_tmp12==1){?> style="display:none;" <?php }?>>
            <label for="inputEmail1" class="col-lg-2 control-label">مده انتهاء الصلاحيه</label>
            <div class="col-lg-4">
                <input name="expireDate" style="width: 83%;" type="text" id="expireDate" class=" form-control numberinput"  required="required"   value="0" size="50"/>
                <span style="float: left;margin-top: -27px; color: white;font-size: 15px;font-weight: bold;">يوم</span>

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

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

        <div id="addUnitsDiv" class = "check_tr_mesurunit " <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->measuringunit;?>
<?php $_tmp13=ob_get_clean();?><?php if ($_tmp13==1){?> style="display:none;" <?php }?>>
            <table id="unitsTable" class="table">
                <tr id="unit_row1">
                    <td>
                        <div>
                            <label for="inputEmail1" class="control-label">وحدة القياس</label>
                            <select name="productunit1" id="productunit1" data-placeholder="اختر" class="select2_customj wdt100  chosenproduct"  tabindex="12">
                                <!-- <option value="-1">اختر وحدة القياس</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>
                        <!---------------------------->
                    </td>
                    <td>
                        <div>
                            <label for="inputEmail1" class="control-label">عدد الوحدات</label>
                            <input name="productnumber1" id="productnumber1" class="numberinput form-control"  value="1" type="text" />
                        </div>
                        <!---------------------------->
                    </td>
                    <td>
                        <div>
                            <label class="control-label">الباركود</label>
                            <input name="proUnitParcode1" id="proUnitParcode1" type="text" class="form-control numberinput positiveNo" onblur="checkUnitbarcode(this.value, 1);"/>
                        </div>
                    </td>
                    <td>
                        <div>
                            <label class="control-label">سعر الشراء</label>
                            <input name="proUnitBuyPrice1" id="proUnitBuyPrice1" type="text" class="form-control positivefloat" />
                        </div>
                    </td>
                    <td>
                        <div>
                            <label class="control-label">سعر الجملة</label>
                            <input name="proUnitSellAllPrice1" id="proUnitSellAllPrice1" type="text" class="form-control positivefloat" />
                        </div>
                    </td>
                    <td>
                        <div>
                            <label class="control-label">سعر نص جملة</label>
                            <input name="proUnitSellHalfPrice1" id="proUnitSellHalfPrice1" type="text" class="form-control positivefloat" />
                        </div>
                    </td>
                    <td>
                        <div>
                            <label class="control-label">سعر قطاعى</label>
                            <input name="proUnitSellUnitPrice1" id="proUnitSellUnitPrice1" type="text" class="form-control positivefloat" />
                        </div>
                    </td>
                    <td><a id="remove1" onClick="removeUnits(1);" class="removeUnits">X</a></td>
                </tr>
            </table>
            <!--end unitsTable-->
        </div>
        <input class="addUnits btn btn-primary check_tr_mesurunit " <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->measuringunit;?>
<?php $_tmp14=ob_get_clean();?><?php if ($_tmp14==1){?> style="display:none;" <?php }?> onClick="addUnits();" type="button" value="إضافة وحدة قياس"/>
        <input name="unitsItr" id="unitsItr" type="hidden" value="1" />


        <!---------------------------->
        <div class="clearfix"></div>
        <br/>
        <div class="form-group " style="padding: 8px; line-height: 1.428571429; vertical-align: top; border-top: 1px solid #ddd;">
            <label for="inputEmail1" class="col-lg-2 control-label">بمقاسات و الوان</label>
            <div class="col-lg-4">
                <label>
                    <input value="1"  class="radioR hasSizeAndColor" name="hasSizeAndColor"  type="radio" />
                    نعم </label>
                <label>
                    <input value="0"  class="noradioR hasSizeAndColor" name="hasSizeAndColor" type="radio" checked="checked"/>
                    لا </label>
            </div>
        </div>
        <!---------------------------->
        <!-- size color ------------------------------->
        <div class="panel panel-default panel-m" id="sizeColorDiv" style="display:none">
            <div class="panel-heading">
                <h3 class="panel-title">المقاسات و الالوان</h3>
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-lg-5" id="rightpart" style="display: inline">
                        <label for="sizes" class="col-lg-4 control-label">المقاسات</label>
                        <select class="select2" name="sizes[]" id="sizes" multiple="multiple">
                            <option value="-1">كل المقاسات</option>
                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allSizeColor']->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;
?>
                            <?php if ($_smarty_tpl->tpl_vars['data']->value->type==0){?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                            <?php }?>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="col-lg-5" id="leftpart" style="display: inline">
                        <label for="colors" class="col-lg-4 control-label">الالوان</label>
                        <select class="select2" name="colors[]" id="colors" multiple="multiple">
                            <option value="-1">كل الالوان</option>
                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allSizeColor']->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;
?>
                            <?php if ($_smarty_tpl->tpl_vars['data']->value->type==1){?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->id;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->name;?>
</option>
                            <?php }?>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="col-lg-2" id="leftpart" style="display: inline">
                        <button type="button"  class="btn btn-success pull-left" id="SizeColorQuantity">ادخال الكميات </button>
                    </div>


                </div>
                <div class="clearfix"></div>
                <br/>
                <div class="row" id="quantity_div" style="display:none">
                    <table class="table">
                        <thead>
                            <tr>
                                <th>الباركود</th>
                                <th>المقاس</th>
                                <th>اللون</th>
                                <th>الكمية</th>
                                <th>حذف</th>
                            </tr>
                        </thead>
                        <tbody id="SizeColorTB">

                        </tbody>
                    </table>
                    <input type="hidden" id="sizeColorItr" name="sizeColorItr" value="0"/>
                </div>

            </div>
        </div>
        <!-- END  size color ---------------------->
        <!-------------------------------- end adding units   -------------------------->

        <input name="newLinkCurrentId" id="newLinkCurrentId" type="hidden" value="" />
        <!--        <input type="button" id="cancel" onClick="closeProductForm();" value="إلغاء" />
              <input type="button" id="insert" onClick="insertIntoTemp();" value="إضافة" />
        -->


        <div class="modal-footer">
            <button type="button" class="btn btn-default" id="cancel" onClick="closeProductForm();">إلغاء</button>
            <button type="button" class="btn btn-primary" id="insert" onClick="insertIntoTemp();">حفظ</button>
        </div>
    </form>
    
    <script>
        function checkbarcode(barcod)
        {
            if (barcod != "") {
                //alert("productControllerAjax.php?do=checkbarcode&barcod="+barcod);
                $.ajax({
                    url: "productControllerAjax.php?do=checkbarcode&barcod=" + barcod,
                    type: "get",
                    success: function (data) {
                        //alert(data)
                        if (data == 1)
                        {
                            // alert('oldbarcod'+oldbarcod);
                            alert('هذا الباركود موجود من قبل');
                            $("#new_parcode").val('');

                            $('#new_parcode').focus();

                        } else if (data == 2)
                        {


                        }

                    }
                });
            }
        }
        function checkUnitbarcode(barcod, itr)
        {
            $.ajax({
                url: "productControllerAjax.php?do=checkUnitbarcode&barcod=" + barcod,
                type: "get",
                success: function (data) {
                    //alert(data)
                    if (data == 1)
                    {
                        // alert('oldbarcod'+oldbarcod);
                        alert('هذا الباركود موجود من قبل');
                        $("#proUnitParcode" + itr).val('');
                    }

                }
            });
        }
        $('#sizes').select2();
        $('#colors').select2();
    </script>
    <?php }} ?>