

<div class="row">
    <div class="container">

        <ol class="breadcrumb">
            <li><a href="#">المنتجات</a></li>
            <li><a href="productController.php?do=show">عرض المنتجات</a></li>
            <li class="active">طباعه باركود</li>
        </ol>


        <div class="panel panel-default panel-m">
            <div class="panel-heading">
                <h3 class="panel-title"> طباعه الباركود</h3>
            </div>
            <div class="panel-body">

                <div id="productdiv" style="display:none">
                    {foreach $allproduct as $myallproduct}
                    <option value="{$myallproduct->productId}">{$myallproduct->productName}</option>
                    {/foreach}
                </div>
                {literal}
                <form class="nameToBeChecked form-horizontal" role="form" action="printparcode.php" method="post" id="printParcodeForm">

                    {/literal}
                    <input type="hidden" name="searchvalue" id="searchvalue" value="{$Programsettingdata->searchvalue}"/>


                    <input name="itr" id="itr" type="hidden" value="{$countall}">


                    <div class="table-responsive">
                        <table class="table table-black" id="producttabel">
                            <tr>
                                <!--td colspan="1">   <button type="button"  class="btn" onClick="addproduct();">اضافه منتج</button></td-->
                                <td colspan="6"> <p>
                                        <label for=""></label>
                                        <input name="name" type="text" id="name" value="{$companyname}" />
                                        <input name="size" type="text" id="size" value="14" />
                                        <input name="currency" type="text" id="currency" value="L.E" />
                                    </p>
                                    <p>
                                        <label class='color-black'>
                                            <input value="0" class="noradioR parcodeTypeToPrint" name="parcodeTypeToPrint" id="parcodeTypeToPrint0" type="radio" onchange="changeParcode2(0);"/>
                                            استخدام الباركود </label>
                                        <label class='color-black'>
                                            <input value="1" class="noradioR parcodeTypeToPrint" name="parcodeTypeToPrint" id="parcodeTypeToPrint1" type="radio" onchange="changeParcode2(1);"/>
                                            استخدام الباركود المتخصص </label>
                                        <label class='color-black'>
                                            <input value="1" class="noradioR parcodeTypeToPrint" name="parcodeTypeToPrint" id="parcodeTypeToPrint2" type="radio" onchange="changeParcode2(2);"/>
                                            استخدام تكويد المنتجات </label>


                                        <label style="padding-right: 6em;">
                                            <input type="checkbox" name="unSerializedParcodesOnly" id="unSerializedParcodesOnly" value="1" checked onchange="changeunSerializedParcodesOnly($('#unSerializedParcodesOnly').is(':checked'))"> الباركودات الغير مكوده فقط </label>
                                    </p>
                                    <!--p>طباعه السعر التجزئة
                                      <input name="pricOption" type="checkbox" value="1" />
                                      <br>
                                      طباعه السعر الجمله <input name="pricOption1" type="checkbox" value="1" />
                                  </p--></td>
                            </tr>
                            <tr>
                                <th>المنتج</th>
                                <th>السعر</th>
                                <th>الباركود</th>
                                <th>عدد مرات الطباعه</th>
                                <th>حذف</th>

                            </tr>
                            {assign var=i value=1}
                            {foreach $allproductbuy as $all}
                            <tr>
                                <td>
                                    <div class="form-group">

                                        <input type="text" name="productname{$i}" id="productname{$i}"  value="{$all->productName}"/>

                                    </div>
                                    </div>


                                </td>
                                <td>
                                    <div class="form-group">

                                        <input name="price{$i}"  id="price{$i}" type="text"  value="{$all->productSellUnitPrice}">
                                        <input name="pricen{$i}"  id="pricen{$i}" type="hidden"  value="{$all->productSellHalfPrice}">
                                        <input name="pricenen{$i}"  id="pricenen{$i}" type="hidden"  value="{$all->productSellAllPrice}">
                                        <input name="catname{$i}"  id="catname{$i}" type="hidden"  value="{$all->productCatName}">

                                    </div>
                                    </div>


                                </td>

                                <td><input name="productbarcode{$i}"  id="productbarcode{$i}" type="text" value="{$all->parcode}">
                                    <div id="updatebarcod{$i}">
                                    </div>
                                </td>
                                <td><input name="productnum{$i}"  value="{$all->productquantity}"  type="text"></td>

                                <td><a onClick="javascript:removebarcodProduct({$i})" type="button" class="btn btn-default btn-lg removeicon"></a></td>

                            </tr>
                            {capture assign=i}{$i+1}{/capture}
                            {/foreach}
                        </table>
                        <table width="100%" class="table-black">
                            <tr> <td colspan="4">   <!--button type="button"  class="btn" onClick="addproduct();">اضافه منتج</button--></td></tr>
                            <tr>
                                <td colspan="2" width="30%">&nbsp;  </td>
                                <td colspan="2">
                                    <p>
                                        <input name="showComp" type="checkbox" id="showComp" value="1" onchange="localStorage.setItem('showComp', $(this).is(':checked'))"/>
                                        <label for="">إظهار اسم الشركة</label>
                                    </p>

                                    <p>
                                        <input name="cat" type="checkbox" id="cat" value="1" onchange="localStorage.setItem('cat', $(this).is(':checked'))"/>
                                        <label for="">طباعة التصنيف</label>
                                    </p>
                                    <p>
                                        <input name="pricOption" type="radio" id="pricOption" value="0" onchange="localStorage.setItem('pricOption', this.value)"/>
                                        <label for="">طباعه بدون سعر</label>
                                        <br />
                                    <p>
                                        <input name="pricOption" type="radio" id="pricOption1" value="1" onchange="localStorage.setItem('pricOption', this.value)"/>
                                        <label for="speparcode"> طباعه السعر الجمله</label>
                                        <br />
                                    <p>
                                        <input name="pricOption" type="radio" id="pricOption1" value="2" onchange="localStorage.setItem('pricOption', this.value)"/>
                                        <label for="speparcode"> طباعه السعر نصف الجملة </label>
                                        <br />
                                    <p>
                                        <input name="pricOption" type="radio" id="pricOption" value="3" onchange="localStorage.setItem('pricOption', this.value)"/>
                                        <label for="">طباعه السعر التجزئة</label>
                                        <br />
                                    <p>
                                        <input name="speparcode" type="checkbox" id="speparcode" value="1" onchange="localStorage.setItem('speparcode', $(this).is(':checked'))"/>
                                        <label for="speparcode" >طابعة باركود متخصصه</label>
                                        <br />
                                        <input name="double" type="checkbox" id="double" value="1" onchange="localStorage.setItem('double', $(this).is(':checked'))"/>
                                        <label for="double" >طباعة زوجية</label>
                                    </p>
                                    <p>
                                        <input name="showProName" type="checkbox" id="showProName" value="1" onchange="localStorage.setItem('showProName', $(this).is(':checked'))"/>
                                        <label for="showProName">إظهار اسم المنتج</label>
                                        <br />
                                        <input name="showBarcodeImg" type="checkbox" id="showBarcodeImg" value="1" onchange="localStorage.setItem('showBarcodeImg', $(this).is(':checked'))"/>
                                        <label for="showBarcodeImg">إظهار صورة الباركود</label>
                                    </p>
                                </td>
                            </tr>
                        </table>

                    </div>

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






                    <div class="modal fade" id="myModa_barcode" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close pull-left" data-dismiss="modal" aria-hidden="true">&times;</button>
                                    <h4 class="modal-title">تعديل الباركود</h4>
                                </div>
                                <div class="modal-body">


                                    <div class="input-group">
                                        <input type="text" class="form-control" id="newbarcod">

                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">اغلاق</button>
                                    <button type="button" class="btn btn-primary savemodel_barcode">حفظ البيانات</button>
                                </div>
                            </div><!-- /.modal-content -->
                        </div><!-- /.modal-dialog -->
                    </div>


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

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <!--p>
                                <input name="speparcode" type="checkbox" id="speparcode" value="1" />
                                <label for="speparcode">طابعة باركود متخصصه</label>
                                <br />
                                  <input name="double" type="checkbox" id="double" value="1" />
                                <label for="double">طباعة زوجية</label>
                              </p-->
                            <button type="submit"  class="btn btn-primary pull-left">طباعه </button>
                        </div>
                    </div>


                </form>
            </div>
        </div>




    </div>
</div>
<input type="hidden" id="userid" value="{$userid}">


{literal}
<script type="text/javascript">
    // -- Dealing with cookies -------------------------------------------------
    $(function () {
        parcodeTypeToPrint = getCookie('parcodeTypeToPrint' + $('#userid').val());
        $('.parcodeTypeToPrint').removeAttr('checked');
        if (parcodeTypeToPrint == 2) {
            $('#parcodeTypeToPrint2').attr('checked', 'checked');
        } else if (parcodeTypeToPrint == 1) {
            $('#parcodeTypeToPrint1').attr('checked', 'checked');
        } else {
            $('#parcodeTypeToPrint0').attr('checked', 'checked');
        }
        //
        unSerializedParcodesOnly = getCookie('unSerializedParcodesOnly' + $('#userid').val());
        $('#unSerializedParcodesOnly').removeProp('checked');
        if (unSerializedParcodesOnly == 1) {
            $('#unSerializedParcodesOnly').attr('checked', 'checked');
        }
    });
    function changeParcode2(val) {
        changeunSerializedParcodesOnly($('#unSerializedParcodesOnly').is(':checked'));
        setCookie('parcodeTypeToPrint' + $('#userid').val(), val);
        window.location.reload();
    }
    function changeunSerializedParcodesOnly(val) {
        var value = 1;
        if (val == false)
            value = 0;
        setCookie('unSerializedParcodesOnly' + $('#userid').val(), value);
    }

    // -- End Dealing with cookies ---------------------------------------------











    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");


    //
    if (localStorage.getItem("showComp") == "true") {
        $('#showComp').attr('checked', 'checked');
    } else {
        $('#showComp').removeAttr('checked', 'checked');
    }
    if (localStorage.getItem("cat") == "true") {
        $('#cat').attr('checked', 'checked');
    } else {
        $('#cat').removeAttr('checked', 'checked');
    }
    if (localStorage.getItem("speparcode") == "true") {
        $('#speparcode').attr('checked', 'checked');
    } else {
        $('#speparcode').removeAttr('checked', 'checked');
    }
    if (localStorage.getItem("double") == "true") {
        $('#double').attr('checked', 'checked');
    } else {
        $('#double').removeAttr('checked', 'checked');
    }
    if (localStorage.getItem("showProName") == "true") {
        $('#showProName').attr('checked', 'checked');
    } else {
        $('#showProName').removeAttr('checked', 'checked');
    }
    if (localStorage.getItem("showBarcodeImg") == "true") {
        $('#showBarcodeImg').attr('checked', 'checked');
    } else {
        $('#showBarcodeImg').removeAttr('checked', 'checked');
    }

    //
    for (var i = 0; i < 4; i++) {
        if (localStorage.getItem("pricOption") == i.toString()) {
            $('#pricOption' + i).attr('checked', 'checked');
        } else {
            $('#pricOption' + i).removeAttr('checked', 'checked');
        }
    }

</script>
{/literal}

