<script>

    //alert(666);
    //alert($("#parcode1").val());

    checkbarcodewithid($("#parcode1").val(), 1);</script>



<form action="" class="form-horizontal myform" method="post" id="productEditForm"
    onsubmit="submitEditForm(event, this);">
    <input name="productId" type="hidden" value="{$productsData->productId}" id="productId" />
    <div class="form-group">
        <label class="col-lg-2 control-label">تصنيف المنتج</label>
        <div class="col-lg-6"> <span id="spryselect1">
                <select name="productCatId" name="productCatId" class="select2_custom wdt100">
                    <option value="-1">اختر المنتج الرئيسي</option>

                    {foreach from=$alldata key=k item=v }

                    <option value="{$k}" {if $productsData->productCatId eq $k}selected{/if}>{$v}</option>

                    {/foreach}

                </select>
                <span class="selectInvalidMsg">اختر تصنيف</span><span class="selectRequiredMsg">اختر تصنيف</span></span>
        </div>
    </div>

    <!--==============================-->
    <div id="productsTable">
        <div class="form-group">
            <label class="col-lg-2 control-label">الإسم</label>
            <div class="col-lg-6"> <span id="sprytextfield7">
                    <input name="productName1" type="text" id="productName1" class="form-control" size="9"
                        value="{$productsData->productName}"
                        onchange="checkProductNameForEdit(this.value, $('#productId').val(), $('#productCatId').val());" />
                    <span class="textfieldRequiredMsg">*</span></span> </div>
        </div>

        <div
            class="form-group {if $Programsettingdata->isCaf != 1 && $Programsettingdata->isRestaurent != 1} hidden {/if}">
            <label class="col-lg-2 control-label">فى المنيو </label>
            <div class="col-lg-4">
                <div class="radio-inline">
                    <label>
                        <input value="0" class="radioR" name="inMenu1" {if {$productsData->inMenu} eq 0}
                        checked="checked" {/if} type="radio" />

                        نعم </label>
                </div>
                <div class="radio-inline">
                    <label>
                        <input value="1" class="noradioR" name="inMenu1" {if {$productsData->inMenu} eq 1}
                        checked="checked" {/if} type="radio" />
                        لا </label>
                </div>

            </div>
        </div>

        <div class="form-group check_tr_production {if {$Programsettingdata->production} eq 1} hidden {/if}">
            <label class="col-lg-2 control-label">تصنيع </label>
            <div class="col-lg-4">
                <div class="radio-inline">
                    <label>
                        <input value="1" class="radioR" name="manufacture" {if {$productsData->type} eq 1}
                        checked="checked" {/if} type="radio" />

                        نعم </label>
                </div>
                <div class="radio-inline">
                    <label>
                        <input value="0" class="noradioR" name="manufacture" {if {$productsData->type} eq 0}
                        checked="checked" {/if} type="radio" />
                        لا </label>
                </div>

            </div>
        </div>

        <div class="form-group  {if {$Programsettingdata->service} eq 1} hidden {/if}">
            <label class="col-lg-2 control-label">خدمة </label>
            <div class="col-lg-4">
                <div class="radio-inline">
                    <label>
                        <input value="1" class="radioR isserviceedit" name="isservice1" {if {$productsData->isService}
                        eq 1} checked="checked" {/if} type="radio" />

                        نعم </label>
                </div>
                <div class="radio-inline">
                    <label>
                        <input value="0" class="noradioR isserviceedit" name="isservice1" {if {$productsData->isService}
                        eq 0} checked="checked" {/if} type="radio" />
                        لا </label>
                </div>

            </div>
        </div>
        <!--==============================-->
        <div class="form-group {if {$Programsettingdata->parcode} eq 1} hidden {/if}">
            <label class="col-lg-2 control-label">الباركود</label>
            <div class="col-lg-6">
                <input name="parcode1" type="text" id="parcode1" size="9" required class="form-control"
                    value="{$productsData->parcode}" onkeyup="checkbarcodewithid(this.value, 1);" />
            </div>
        </div>
        <!--==============================-->
        <div class="form-group" {if {$Programsettingdata->expiredate} eq 1} hidden {/if} >
            <label class="col-lg-2 control-label"> مدة الصلاحية</label>
            <div class="col-lg-6"><span id="sprytextfield8">
                    <input name="expireDate1" type="text" id="expireDate1" style="width: 92%;"
                        class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput"
                        value="{$productsData->expireDate}" />
                    <span
                        style="float: left;margin-top: -27px; color: white;font-size: 15px;font-weight: bold;">يوم</span>
                    <span class="textfieldRequiredMsg"> ادخل رقم</span></span></div>
        </div>
        <!--==============================-->
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر الشراء</label>
            <div class="col-lg-6"> <span id="sprytextfield1">
                    {if $productsData->isService eq 1}
                    <input name="productBuyPrice1" type="text" id="productBuyPrice1"
                        class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value=""
                        disabled />
                    {else}
                    <input name="productBuyPrice1" type="text" id="productBuyPrice1"
                        class="form-control wd50 aw_m aw_mt aw_pp numberclic buy_price enteraction numberinput"
                        data-id="1" value="{$productsData->productBuyPrice}" />
                    {/if}
                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر الشراء الفعلى</label>
            <div class="col-lg-6"> <span id="sprytextfield1">
                    {if $productsData->isService eq 1}
                    <input style="width: 50%;float: left;" name="productbuypricereal1"
                        value="{$productsData->productbuypricereal}" type="text" id="buypricereal1"
                        data-type="pricereal" disabled
                        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="buypricereal_precentage1"
                    value="{$productsData->buypricereal_precentage}" type="text" id="productBuyPrice1"
                    data-type="pricereal" disabled
                    class="form-control precentages  aw_m aw_mt aw_pp numberclic enteraction  numberinput positivefloat buypricereal_precentage1"
                    data-id="1" width="10" />

                <!--<input name="productbuypricereal1"  type="text" id="productBuyPrice1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput"  value="" disabled />-->
                {else}
                <!--<input name="productbuypricereal1"  type="text" id="productBuyPrice1" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput"  value="{$productsData->productbuypricereal}" />-->
                <input style="width: 50%;float: left;" name="productbuypricereal1"
                    value="{$productsData->productbuypricereal}" type="text" id="buypricereal1" data-type="pricereal"
                    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="buypricereal_precentage1"
                    value="{$productsData->buypricereal_precentage}" 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" />

                {/if}
                <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                    رقم</span></span>
            </div>
        </div>
        <!--==============================-->
        {if $Programsettingdata->showpriceall == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر الجملة</label>
            <div class="col-lg-6"> <span id="sprytextfield2">
                    <!--<input name="productSellAllPrice1"   type="text" id="productSellAllPrice1" onkeyup="populateSellPrice(1);" class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value="{$productsData->productSellAllPrice}"  />-->
                    <input style="width: 50%;float: left;" name="productSellAllPrice1" type="text"
                        id="productSellAllPrice" data-type="buytotal"
                        class="form-control prices aw_m aw_mt aw_pp numberclic positivefloat buy_total1 enteraction numberinput"
                        value="{$productsData->productSellAllPrice}" data-id="1" width="10" />
                    <input style="  width: 50%;" name="buytotal_precentage1" type="text"
                        value="{$productsData->buytotal_precentage}" 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>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showpricehalf == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر نصف جملة</label>
            <div class="col-lg-6"> <span id="sprytextfield3">
                    <!--<input name="productSellHalfPrice1"   type="text" id="productSellHalfPrice1"  class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput"  value="{$productsData->productSellHalfPrice}" />-->
                    <input style="width: 50%;float: left;" name="productSellHalfPrice1" type="text" data-type="buyhalf"
                        id="productSellHalfPrice" value="{$productsData->productSellHalfPrice}"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat buy_hafe1"
                        data-id="1" width="10" />
                    <input style="  width: 50%;" name="buyhalf_precentage1" type="text" id="productBuyPrice1"
                        value="{$productsData->buyhalf_precentage}" 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>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showpriceunit == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر التجزئة</label>
            <div class="col-lg-6"> <span id="sprytextfield4">
                    <!--<input name="productSellUnitPrice1"  type="text" id="productSellUnitPrice1"  class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput"   value="{$productsData->productSellUnitPrice}"/>-->
                    <input style="width: 50%;float: left;" name="productSellUnitPrice1" type="text" data-type="buypart"
                        id="productSellUnitPrice"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat buy_part1"
                        value="{$productsData->productSellUnitPrice}" data-id="1" width="20" />
                    <input style="  width: 50%;" name="buypart_precentage1" type="text" id="productBuyPrice1"
                        data-type="buypart" value="{$productsData->buypart_precentage}"
                        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>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showprice4 == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر4</label>
            <div class="col-lg-6"> <span id="sprytextfield5">
                    <input style="width: 50%;float: left;" name="price4_1" type="text" data-type="price4" id="price4"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat price4_1"
                        value="{$productsData->price4}" data-id="1" width="20" />
                    <input style="  width: 50%;" name="price4_precentage1" type="text" id="price4_1" data-type="price4"
                        value="{(($productsData->price4/$productsData->productBuyPrice)-1)*100}"
                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat price4_precentage1"
                        data-id="1" width="10" />

                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showprice5 == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر5</label>
            <div class="col-lg-6"> <span id="sprytextfield6">
                    <input style="width: 50%;float: left;" name="price5_1" type="text" data-type="price5" id="price5"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat price5_1"
                        value="{$productsData->price5}" data-id="1" width="20" />
                    <input style="  width: 50%;" name="price5_precentage1" type="text" id="price5_1" data-type="price5"
                        value="{(($productsData->price5/$productsData->productBuyPrice)-1)*100}"
                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat price5_precentage1"
                        data-id="1" width="10" />

                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showprice6 == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر6</label>
            <div class="col-lg-6"> <span id="sprytextfield7">
                    <input style="width: 50%;float: left;" name="price6_1" type="text" data-type="price6" id="price6"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat price6_1"
                        value="{$productsData->price6}" data-id="1" width="20" />
                    <input style="  width: 50%;" name="price6_precentage1" type="text" id="price6_1" data-type="price6"
                        value="{(($productsData->price6/$productsData->productBuyPrice)-1)*100}"
                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat price6_precentage1"
                        data-id="1" width="10" />

                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showprice7 == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر7</label>
            <div class="col-lg-6"> <span id="sprytextfield8">
                    <input style="width: 50%;float: left;" name="price7_1" type="text" data-type="price7" id="price7"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat price7_1"
                        value="{$productsData->price7}" data-id="1" width="20" />
                    <input style="  width: 50%;" name="price7_precentage1" type="text" id="price7_1" data-type="price7"
                        value="{(($productsData->price7/$productsData->productBuyPrice)-1)*100}"
                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat price7_precentage1"
                        data-id="1" width="10" />

                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showprice8 == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر8</label>
            <div class="col-lg-6"> <span id="sprytextfield9">
                    <input style="width: 50%;float: left;" name="price8_1" type="text" data-type="price8" id="price8"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat price8_1"
                        value="{$productsData->price8}" data-id="1" width="20" />
                    <input style="  width: 50%;" name="price8_precentage1" type="text" id="price8_1" data-type="price8"
                        value="{(($productsData->price8/$productsData->productBuyPrice)-1)*100}"
                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat price8_precentage1"
                        data-id="1" width="10" />

                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showprice9 == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر9</label>
            <div class="col-lg-6"> <span id="sprytextfield9">
                    <input style="width: 50%;float: left;" name="price9_1" type="text" data-type="price9" id="price9"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat price9_1"
                        value="{$productsData->price9}" data-id="1" width="20" />
                    <input style="  width: 50%;" name="price9_precentage1" type="text" id="price9_1" data-type="price9"
                        value="{(($productsData->price9/$productsData->productBuyPrice)-1)*100}"
                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat price9_precentage1"
                        data-id="1" width="10" />

                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showprice10 == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر10</label>
            <div class="col-lg-6"> <span id="sprytextfield9">
                    <input style="width: 50%;float: left;" name="price10_1" type="text" data-type="price10" id="price10"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat price10_1"
                        value="{$productsData->price10}" data-id="1" width="20" />
                    <input style="  width: 50%;" name="price10_precentage1" type="text" id="price10_1" data-type="price10"
                        value="{(($productsData->price10/$productsData->productBuyPrice)-1)*100}"
                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat price10_precentage1"
                        data-id="1" width="10" />

                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showprice11 == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر11</label>
            <div class="col-lg-6"> <span id="sprytextfield9">
                    <input style="width: 50%;float: left;" name="price11_1" type="text" data-type="price11" id="price11"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat price11_1"
                        value="{$productsData->price11}" data-id="1" width="20" />
                    <input style="  width: 50%;" name="price11_precentage1" type="text" id="price11_1" data-type="price11"
                        value="{(($productsData->price11/$productsData->productBuyPrice)-1)*100}"
                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat price11_precentage1"
                        data-id="1" width="10" />

                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showprice12 == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر12</label>
            <div class="col-lg-6"> <span id="sprytextfield9">
                    <input style="width: 50%;float: left;" name="price12_1" type="text" data-type="price12" id="price12"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat price12_1"
                        value="{$productsData->price12}" data-id="1" width="20" />
                    <input style="  width: 50%;" name="price12_precentage1" type="text" id="price12_1" data-type="price12"
                        value="{(($productsData->price12/$productsData->productBuyPrice)-1)*100}"
                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat price12_precentage1"
                        data-id="1" width="10" />

                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        {/if}
        <!--==============================-->
        {if $Programsettingdata->showprice13 == 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">سعر13</label>
            <div class="col-lg-6"> <span id="sprytextfield9">
                    <input style="width: 50%;float: left;" name="price13_1" type="text" data-type="price13" id="price13"
                        class="form-control  aw_m aw_mt aw_pp numberclic prices enteraction numberinput positivefloat price13_1"
                        value="{$productsData->price13}" data-id="1" width="20" />
                    <input style="  width: 50%;" name="price13_precentage1" type="text" id="price13_1" data-type="price13"
                        value="{(($productsData->price13/$productsData->productBuyPrice)-1)*100}"
                        class="form-control  aw_m aw_mt aw_pp numberclic enteraction precentages numberinput positivefloat price13_precentage1"
                        data-id="1" width="10" />

                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        {/if}
        <!--==============================-->

        <div class="form-group">
            <label class="col-lg-2 control-label">الكمية</label>
            <div class="col-lg-6"> <span id="sprytextfield5">
                    {if $productsData->isService eq 1}
                    <input name="productquantity1" readonly="readonly" type="text" id="productquantity1"
                        class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput" value=""
                        disabled />
                    {else}
                    <input name="productquantity1" readonly="readonly" type="text" id="productquantity1"
                        class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput"
                        value="{$productsData->sumProductQuantity}" />
                    {/if}
                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        <!--==============================-->

        <div class="form-group {if {$Programsettingdata->date} eq 1} hidden {/if}">
            <label class="col-lg-2 control-label">التاريخ</label>
            <div class="col-lg-6">
                <input name="productDate1" class="form-control awdatepicker" autocomplete="off"
                    data-date-format="yyyy-mm-dd" type="text" id="productDate1" size="9" class="form-control"
                    value="{$productsData->productDate}" />
            </div>
        </div>
        <!--==============================-->

        <div class="form-group">
            <label class="col-lg-2 control-label">الحد الأدنى للمنتج</label>
            <div class="col-lg-6"> <span id="sprytextfield6">
                    <input name="limitamount1" type="text" id="limitamount1"
                        class="form-control wd50 aw_m aw_mt aw_pp numberclic enteraction numberinput"
                        value="{$productsData->limitamount}" />
                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">أدخل
                        رقم</span></span> </div>
        </div>
        <!--==============================-->
        {if $Programsettingdata->addclienttoproduct eq 1}
        <div class="form-group">
            <label class="col-lg-2 control-label">العميل</label>
            <div class="col-lg-6">
                <select name="clientid1" class="form-control">
                    <option value="0" {if $productsData->clientid eq 0}selected{/if}>كل العملاء</option>
                    {foreach $clientsData as $client}
                    <option value="{$client->clientid}" {if $productsData->clientid eq
                        $client->clientid}selected{/if}>{$client->clientname}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        {/if}
        <!--==============================-->
        <div class="form-group {if {$Programsettingdata->description} eq 1} hidden {/if}">
            <label class="col-lg-2 control-label">الوصف</label>
            <div class="col-lg-6">
                <textarea name="productDescription1" id="productDescription1" cols="5" rows="5"
                    class="form-control">{$productsData->productDescription}</textarea>
            </div>
        </div>
        <!--==============================-->

        <div class="form-group">
            <label class="col-lg-2 control-label">إخفاء</label>
            <div class="col-lg-6">
                <div class="radio-inline">
                    <label>
                        <input name="conditions" type="radio" value="1" {if {$productsData->
                        conditions} eq 1} checked="checked" {/if} />
                        نعم </label>
                </div>
                <div class="radio-inline">
                    <label>
                        <input name="conditions" type="radio" {if {$productsData->
                        conditions} eq 0} checked="checked" {/if} value="0" />
                        لا </label>
                </div>
            </div>
        </div>
        <!--==============================-->

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

        <div id="addUnitsDiv1">
            <table id="unitsTable1" class="table-black">
                {assign var=j value=1}
                {foreach $productUnitsData as $proUnit}
                <tr>
                    <td>
                        <div>
                            <label class="control-label">وحدة القياس</label>
                            <select name="productunit1{$j}" id="productunit1{$j}" data-placeholder="اختر"
                                class="select2_custom wdt100 chosenproduct">
                                <option value="-1">اختر وحدة القياس</option>
                                {foreach $unitsData as $unit}
                                <option value="{$unit->unitId}" {if $proUnit->unitid eq
                                    $unit->unitId}selected{/if}>{$unit->unitName}</option>
                                {/foreach}
                            </select>
                        </div>
                    </td>
                    <td>
                        <div>
                            <label class="control-label">عدد الوحدات</label>
                            <input name="productnumber1{$j}" readonly="readonly" id="productnumber1{$j}"
                                class="form-control" type="text" value="{$proUnit->productnumber}" />
                            <input name="productunitid{$j}" id="productunitid{$j}" type="hidden"
                                value="{$proUnit->productunitid}" />
                        </div>
                    </td>
                    <td>
                        <div>
                            <label class="control-label">الباركود </label>
                            <input name="proUnitParcode1{$j}" id="proUnitParcode1{$j}" class="form-control positiveNo"
                                type="text" value="{$proUnit->proUnitParcode}" data-unit-itr="{$j}"
                                data-unitid-itr="{$j}"
                                onblur="checkUnitbarcodewithid(this.value, $(this).data('unitid-itr'), $(this).data('unit-itr'));" />
                        </div>
                    </td>
                    <td>
                        <div>
                            <label class="control-label">سعر الشراء </label>
                            <input name="proUnitBuyPrice1{$j}" id="proUnitBuyPrice1{$j}"
                                class="form-control positivefloat" type="text" value="{$proUnit->proUnitBuyPrice}" />
                        </div>
                    </td>
                    <td>
                        <div>
                            <label class="control-label">سعر الجملة </label>
                            <input name="proUnitSellAllPrice1{$j}" id="proUnitSellAllPrice1{$j}"
                                class="form-control positivefloat" type="text"
                                value="{$proUnit->proUnitSellAllPrice}" />
                        </div>
                    </td>
                    <td>
                        <div>
                            <label class="control-label">سعر نص جملة </label>
                            <input name="proUnitSellHalfPrice1{$j}" id="proUnitSellHalfPrice1{$j}"
                                class="form-control positivefloat" type="text"
                                value="{$proUnit->proUnitSellHalfPrice}" />
                        </div>
                    </td>
                    <td>
                        <div>
                            <label class="control-label">سعر قطاعى </label>
                            <input name="proUnitSellUnitPrice1{$j}" id="proUnitSellUnitPrice1{$j}"
                                class="form-control positivefloat" type="text"
                                value="{$proUnit->proUnitSellUnitPrice}" />
                        </div>
                    </td>
                    <td><a id="remove1{$j}" onclick="removeUnits(1, {$j});" class="removeUnits">X</a></td>
                </tr>
                {capture assign=j}{$j+1}{/capture}
                {/foreach}
            </table>
            <!--end unitsTable-->
        </div>
        <input class="addUnits btn btn-success" onclick="addUnits(1);" type="button" value="إضافة وحدة قياس" />
        <input name="unitsItr1" id="unitsItr1" type="hidden" value="{$countProductUnits}" />

        <!-------------------------------- end adding units   -------------------------->
        </td>
    </div>
    <!--end productsTable -->

    <input name="productItr" id="productItr" type="hidden" value="1" />
    <div class="form-group">
        <div class="col-lg-offset-2 col-lg-6" id="myxdiv">
            <button type="submit" id="submit" class="btn btn-primary pull-left">حفظ</button>
        </div>
    </div>
</form>
<div id="productUnitsDiv" style="display:none;">
    <option value="-1">اختر وحدة القياس</option>
    {foreach $unitsData as $unit}
    <option value="{$unit->unitId}">{$unit->unitName}</option>
    {/foreach}
</div>
<div id="result"></div>
{literal}
<script type="text/javascript">
    /*
     var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "real");
     var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "real");
     var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "real");
     var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "real");
     var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "integer");
     var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "integer");
     var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7");
     var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8","integer");
     var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {invalidValue:"-1"});*/
</script>
{/literal}