<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">البصريات</a></li>
            <li><a href="#">المنتجات </a></li>
            <li class="active">إضافة منتج</li>
        </ol>
        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <h3 class="panel-title">إضافة منتج</h3>
                <a href="{$youtubes[51]->url}" target="_blank" class="hidden-print"><img
                        src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube"
                        style="width: 2%;"></a>
            </div>
            <div class="panel-body">
                <form class="nameToBeChecked form-horizontal" role="form" action="productController.php?do=addopticdata"
                    method="post" id="opticproduct-form">
                    <input type="hidden" id="opticproduct" name="opticproduct" value="1" />
                    <div class="panel panel-default panel-m">
                        <div class="panel-heading">
                            <h3 class="panel-title">بيانات أساسية</h3>
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-6" id="rightpart" style="display: inline">
                                    <div class="form-group">
                                        <label for="parent" class="col-lg-4 control-label">التصنيف</label>
                                        <div class="col-lg-8">
                                            <select class="select2 wdt100" name="opticproductcatid"
                                                id="opticproductcatid">
                                                <option value=""></option>
                                                {foreach $allParents as $parent}
                                                <option value="{$parent->productCatId}">{$parent->productCatName}
                                                </option>
                                                {/foreach}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">الاسم</label>
                                        <div class="col-lg-8">
                                            <input type="text" name="name" id="name" class="form-control" />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">الحد الأدنى</label>
                                        <div class="col-lg-8">
                                            <input type="text" name="limitamount" id="limitamount"
                                                class="form-control positiveNo limit" value="0" />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">التعليق</label>
                                        <div class="col-lg-8">
                                            <textarea class="form-control" rows="2" name="description"></textarea>
                                        </div>
                                    </div>
                                    {if $Programsettingdata->addclienttoproduct eq 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">العميل</label>
                                        <div class="col-lg-8">
                                            <input type="hidden" id="clientid1" name="clientid1"
                                                class="wdt100 select2-offscreen clientSelect"
                                                data-placeholder="اختر عميل " tabindex="-1"
                                                style="display: inline-block;" value="1" />
                                        </div>
                                    </div>
                                    {/if}
                                </div>

                                <div class="col-lg-6" id="leftpart" style="display: inline">
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر الشراء</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="productBuyPrice" id="productBuyPrice" value="0"
                                                    class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {if $Programsettingdata->showpriceall == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر البيع جملة</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="productSellAllPrice" id="productSellAllPrice"
                                                    value="0" class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showpricehalf == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر البيع نصف جملة</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="productSellHalfPrice" id="productSellHalfPrice"
                                                    value="0" class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showpriceunit == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر البيع تجزئة</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="productSellUnitPrice" id="productSellUnitPrice"
                                                    value="0" class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showprice4 == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر4</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="price4" id="price4" value="0"
                                                    class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showprice5 == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر5</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="price5" id="price5" value="0"
                                                    class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showprice6 == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر6</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="price6" id="price6" value="0"
                                                    class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showprice7 == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر7</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="price7" id="price7" value="0"
                                                    class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showprice8 == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر8</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="price8" id="price8" value="0"
                                                    class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showprice9 == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر9</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="price9" id="price9" value="0"
                                                    class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showprice10 == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر10</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="price10" id="price10" value="0"
                                                    class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showprice11 == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر11</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="price11" id="price11" value="0"
                                                    class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showprice12 == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر12</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="price12" id="price12" value="0"
                                                    class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}
                                    {if $Programsettingdata->showprice13 == 1}
                                    <div class="form-group">
                                        <label class="col-lg-4 control-label">سعر13</label>
                                        <div class="col-lg-8">
                                            <div class="input-group">
                                                <input type="text" name="price13" id="price13" value="0"
                                                    class="form-control positivefloat proprice" />
                                                <span class="input-group-addon">{$currency}</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/if}

                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="panel panel-default panel-m">
                        <div class="panel-heading">
                            <h3 class="panel-title">الوحدات</h3>
                        </div>
                        <div class="panel-body">
                            <a id="addOpticUnit" class="btn btn-primary" style="float: left"> إضافة</a>
                            <table class="table" id="opticUnitsTable">
                                <thead>
                                    <tr>
                                        <th width="50%">اسم الوحدة</th>
                                        <th width="40%">عدد القطع</th>
                                        <th>حذف</th>
                                    </tr>
                                </thead>
                                <tbody>

                                </tbody>
                            </table>
                            <input type="hidden" id="unitsitr" name="unitsitr" value="0" />
                        </div>
                    </div>
                    <input type="hidden" id="currentType" name="currentType" value="0" />
                    <div class="panel panel-default panel-m">
                        <div class="panel-heading">
                            <h3 class="panel-title">التفاصيل</h3>
                        </div>
                        <a id="changeType" class="btn btn-success" style="float: left">منتج بدون مقاسات والوان </a>
                        <div class="panel-body">
                            <div class="clearfix"></div>
                            <br />
                            <div class="panel panel-default panel-m" id="productDiv" style="display: none;">
                                <div class="panel-heading">
                                    <h3 class="panel-title">البيانات المنتج</h3>
                                </div>
                                <div class="form-group">
                                    <label class="col-lg-2 control-label">العدد</label>
                                    <div class="col-lg-4">
                                        <input type="text" name="productQuantity" id="productQuantity"
                                            class="form-control positiveNo" />
                                    </div>
                                </div>
                                <div class="form-group" {if {$Programsettingdata->parcode} eq 0} {else}
                                    style="display:none !important" {/if}>
                                    <label class="col-lg-2 control-label">الباركود</label>
                                    <div class="col-lg-4">
                                        <input type="text" name="productparcode" id="productparcode"
                                            class="form-control" value="{$generatedParcode}" />
                                    </div>
                                </div>
                            </div>
                            <div class="panel panel-default panel-m" id="sizecolorDiv">
                                <div class="panel-heading">
                                    <h3 class="panel-title">المقاسات أوالألوان</h3>
                                </div>
                                <div class="panel-body">
                                    <input type="hidden" name="type_parcode" id="type_parcode"
                                        value="{$Programsettingdata->parcode}" />
                                    <a id="addOpticSizeColor" class="btn btn-primary" style="float: left"> إضافة</a>
                                    <table class="table table-black" id="opticSizeColorTable">
                                        <thead>
                                            <tr>
                                                <th>الاسم</th>
                                                <th
                                                    class=" check_tr {if {$Programsettingdata->parcode} eq 1} hidden {/if}">
                                                    الباركود</th>
                                                <th>الكمية</th>
                                                <th>تعليق</th>
                                                <th>حذف</th>
                                            </tr>
                                        </thead>
                                        <tbody>

                                        </tbody>
                                    </table>
                                    <input type="hidden" id="sizecoloritr" name="sizecoloritr" value="0" />
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-offset-2 col-lg-4">
                                <button type="button" class="btn btn-primary pull-left" id="saveOpticProduct">حفظ
                                </button>
                            </div>
                        </div>
                </form>
                <div class="clearfix"></div>
                <br />



            </div>
            <div class="clearfix"></div>
        </div>
    </div>


    <div id="unitsDiv" style="display: none">
        <option></option>
        {foreach $unitsData as $data}
        <option value="{$data->unitId}">{$data->unitName}</option>
        {/foreach}
    </div>

    {literal}
    <script>
        $('body').on('keyup change', '#productBuyPrice', function () {
            var val = $(this).val();
            $('#productSellAllPrice').val(val);
            $('#productSellHalfPrice').val(val);
            $('#productSellUnitPrice').val(val);
            $('#price4').val(val);
            $('#price5').val(val);
            $('#price6').val(val);
            $('#price7').val(val);
            $('#price8').val(val);
            $('#price9').val(val);
            $('#price10').val(val);
            $('#price11').val(val);
            $('#price12').val(val);
            $('#price13').val(val);
        });
        $('body').on('keyup change', '#productSellAllPrice', function () {
            var val = $(this).val();
            $('#productSellHalfPrice').val(val);
            $('#productSellUnitPrice').val(val);
            $('#price4').val(val);
            $('#price5').val(val);
            $('#price6').val(val);
            $('#price7').val(val);
            $('#price8').val(val);
            $('#price9').val(val);
            $('#price10').val(val);
            $('#price11').val(val);
            $('#price12').val(val);
            $('#price13').val(val);
        });
    </script>
    {/literal}