<style>
    td.details-control {
        background: url('../views/default/images/details_open.png') no-repeat center center;
        cursor: pointer;
    }

    tr.details td.details-control {
        background: url('../views/default/images/details_close.png') no-repeat center center;
    }


    .mStyle {
        width: 90px;
        text-align: center;
    }

    a:link,
    a:visited,
    a:hover,
    a:active {
        text-align: center !important;
    }

    .product-image-overlay {
        /*        position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0, 0, 0, 0.9);
                z-index: 9999;
                display: none;*/

        position: fixed;
        top: 15%;
        left: 40%;
        /* text-align: center; */
        width: 30%;
        height: 50%;
        background: rgba(4, 0, 0, 0.38);
        z-index: 9999;
        border-radius: 45px;
        display: none;
    }

    .product-image-overlay .product-image-overlay-close {
        display: block;
        position: absolute;
        top: 20px;
        left: 20px;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: 1px solid #eee;
        line-height: 35px;
        font-size: 20px;
        color: #eee;
        text-align: center;
        cursor: pointer;
    }

    .product-image-overlay img {
        width: auto;
        max-width: 80%;
        position: absolute;
        top: 50%;
        left: 50%;
        -webkit-transform: translate(-50%, -50%);
        -moz-transform: translate(-50%, -50%);
        -o-transform: translate(-50%, -50%);
        transform: translate(-50%, -50%);
    }

    @media print {
        .no-print {
            display: none
        }
    }
</style>

<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 panel-m">
            <div class="panel-heading hidden-print" style="padding:5px 15px 15px">
                <h3 class="panel-title hidden-print" style="display: inline-block;"> عرض </h3>
                <a href="{$youtubes[198]->url}" target="_blank" class="hidden-print"><img
                        src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube"
                        style="width: 2%;"></a>
                <a href="productController.php" class="hidden-print"><input type="button" id="submit"
                                                                            style="margin-left: 12px" class="btn btn-primary pull-left " value="إضافة جديد" /></a>
                                 <a href="productController.php?do=uinuseproducts"  type="button" class="btn btn-default btn-ls "> إعادة ضبط المنتجات </a>                                                            
                                                            
            </div>
            <div class="panel-body">


                <!---------- start outputString alert ----------->
                <div id="outputString" class="alert alert-block alert-success fade in" style="display:none">
                    <button type="button" class="close pull-left" data-dismiss="alert"
                            aria-hidden="true">&times;</button>
                    <p id="outputStringValue">{$outputString}</p>
                    <div class="clearfix"></div>
                </div>
                <!---------  end outputString alert ------------>
                <input type="hidden" id="changeBuyPriceChangeSellInProductCtrl"
                       value="{$Programsettingdata->changeBuyPriceChangeSellInProductCtrl}" />
                <form class="form-inline hidden-print" action="productController.php?do=show" method="post">
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">تصنيف المنتج</label>
                        </div>
                        <select class="select2 wdt300 productCat" data-level="0" name="productCatId0"
                                id="productCatId0">
                            <option value="-1">اختر تصنيف</option>
                            {foreach $catDataReport as $data}
                            <option value="{$data->productCatId}">{$data->productCatName}</option>
                            {/foreach}
                        </select>
                        <input type="hidden" id="level" name="level" value="0">
                    </div>

                    <div class="form-group">
                        <div id="manyParents">

                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-4">
                            <label class="sr-only">
                                <input type="checkbox" id="editCat" name="editCat" value="1">
                                تعديل التصنيف
                            </label>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-4">
                            <label class="sr-only">
                                <input type="checkbox" id="showQuantity" name="showQuantity" value="1">
                                عرض الكمية
                            </label>
                        </div>
                    </div>
                    <br />
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">المنتج</label>
                        </div>
                        <input type="hidden" name="searchvalue" id="searchvalue"
                               value="{$Programsettingdata->searchvalue}" />
                        <input type="hidden" id="product" name="product" class="select2product">
                    </div>
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">الباركود</label>
                        </div>
                        <input type="text" name="parcode" id="parcode" class="form-control"
                               onkeypress="getproductbyParcode(event, this.value);">
                    </div>
                    <input type="hidden" name="usergroupname" id="usergroupname" value="{$usergroupname}" />
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>
                <br />
            </div>
            <div class="panel panel-default panel-m">
                <!-- Default panel contents -->
                <div class="panel-heading">{$message}</div>
                <div class="panel-body">
                    <hr />
                    {literal}
                    <form id="form1" name="form1" method="post" action="productController.php?do=executeOperation"
                          onsubmit="if (Spry.Widget.Form.validate(this)) {
                                      return countChoosenProducts('productController');
                                  } else {
                                      return false;
                                  }
                          " enctype="multipart/form-data">
                        {/literal}
                        <div class="table-responsive" id="tableWrap">
                            {if !empty($productsData)}



                            <!-- ================================================   -->
                            <!-- Nav tabs -->
                            <ul class="nav nav-tabs hidden-print">
                                <li class="active"><a href="#tab1" data-toggle="tab">المنتجات</a></li>
                                <li><a href="#tab2" data-toggle="tab"> المنتجات الموقوفة</a></li>
                            </ul>
                            <!-- =================================================   -->
                            <!-- Tab panes -->
                            <div class="tab-content tab-product">
                                <!-- start tab1 -->
                                <div class="tab-pane active" id="tab1" style="">

                                    <!--                                    {*if {$data->conditions} eq 2*}
                                                                        tr class="danger" style="display:none !important;"
                                                                        {*elseif $data->conditions eq 1*}
                                                                        <tr style="background-color:#eed3d7!important" class="alert-danger">
                                                                        {*elseif {$data->conditions} eq 0*}

                                                                        <tr>
                                                                        {*/if*}-->

                                    <a href="javascript:;" id="toggleAll" data-status="closed"
                                       class="btn btn-default bg-black hidden-print"> فتح / إغلاق الكل</a>
                                    <table class="display table-black" id="productsTable">
                                        <!--tfoot>
                                            <tr>
                                                     <th class="hidden-print">
                                                <label>
                                                  <input type="checkbox" name="checkAll" id="checkAll"/>

                                                </label>
                                              </th>

                                             {if {$Programsettingdata->parcode} eq 0}   <th>الباركود</th>{/if}
                                              <th>اسم المنتج</th>
                                              <th>اسم التصنيف</th>
                                             {if {$Programsettingdata->priceing} eq 0}
                                              <th>سعر الجملة</th>
                                              <th>سعر النصف جملة</th>
                                              <th>سعر التجزئة</th>{/if}
                                              <th class="hidden-print">حذف/إلغاء الحذف</th>
                                              <th class="hidden-print">التعديل</th>
                                            </tr>
                                    </tfoot-->
                                        <thead>
                                            <tr>
                                                <th class="hidden-print"></th>
                                                <th class="hidden-print">
                                                    <label>
                                                        <input type="checkbox" name="checkAll" id="checkAll" />
                                                    </label>
                                                </th>
                                                <th>الصورة </th>
                                                {if {$Programsettingdata->parcode} eq 0} <th>الباركود</th>{/if}
                                                <th style="">اسم المــنتج</th>
                                                <th style="    "> اسم التصنيف </th>
                                                {if {$Programsettingdata->priceing} eq 0}
                                                <th {if $userGroupData->hideproductcatid eq 1 } class="hidden" {/if}>سعر
                                                    الشراء</th>
                                                {if $Programsettingdata->showpriceall eq 1}
                                                <th>بيع الجملة</th>
                                                {/if}
                                                {if $Programsettingdata->showpricehalf eq 1}
                                                <th>بيع النصف جملة</th>
                                                {/if}
                                                {if $Programsettingdata->showpriceunit eq 1}
                                                <th>بيع التجزئة</th>
                                                {/if}
                                                {if $Programsettingdata->showprice4 eq 1}
                                                <th>سعر4</th>
                                                {/if}
                                                {if $Programsettingdata->showprice5 eq 1}
                                                <th>سعر5</th>
                                                {/if}
                                                {if $Programsettingdata->showprice6 eq 1}
                                                <th>سعر6</th>
                                                {/if}
                                                {if $Programsettingdata->showprice7 eq 1}
                                                <th>سعر7</th>
                                                {/if}
                                                {if $Programsettingdata->showprice8 eq 1}
                                                <th>سعر8</th>
                                                {/if}
                                                {if $Programsettingdata->showprice9 eq 1}
                                                <th>سعر9</th>
                                                {/if}
                                                {if $Programsettingdata->showprice10 eq 1}
                                                <th>سعر10</th>
                                                {/if}
                                                {if $Programsettingdata->showprice11 eq 1}
                                                <th>سعر11</th>
                                                {/if}
                                                {if $Programsettingdata->showprice12 eq 1}
                                                <th>سعر12</th>
                                                {/if}
                                                {if $Programsettingdata->showprice13 eq 1}
                                                <th>سعر13</th>
                                                {/if}
                                                <th>الترتيب</th>
                                                {/if}
                                                {if $showQuantity eq 1} <th>الكمية فى المخازن </th>{/if}
                                                <th class="hidden-print">
                                                    حذف <br>
                                                    الغاء الحذف
                                                </th>
                                                <th class="hidden-print">التعديل</th>
                                                {if {$Programsettingdata->allowfinsldelete} eq 0}
                                                <th class="hidden-print">حذف </th>
                                                {/if}
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <!--                                <input name="productCatId" type="text" value="{$productCatId}" />-->
                                            {assign var=i value=1}

                                            {foreach $productsData as $data}

                                            {if {$data->conditions} eq 0}

                                            <tr
                                                data-pro="{$data->productId}{if $data->productDataSOC != ''}_SOC{/if}{if $data->productDataSAC != '[]'}_SAC{/if}{if $data->productDataING != '[]'}_ING{/if}">
                                                <td class="hidden-print"></td>
                                                <td class="hidden-print">
                                                    <label>
                                                        <input type="checkbox" name="choosedItem[]" id="checked{$i}"
                                                               class="choosenItem" value="{$data->productId}" />
                                                        <input type="hidden" name="optic_{$data->productId}"
                                                               id="optic_{$data->productId}" value="{$data->isOptic}" />
                                                    </label>
                                                </td>
                                                <td>

                                                    <img src="../views/default/images/product_image/{$data->logo}"
                                                         class="moImg" alt="" width="50" height="30" />
                                                </td>
                                                {if {$Programsettingdata->parcode} eq 0} <td> {$data->parcode} </td>
                                                {/if}
                                                <td style="width: 30%;">
                                                    {if $data->productDataSOC != ""}
                                                    <input type='hidden' name='sizecolordetails{$data->productId}_SOC'
                                                           id='sizecolordetails{$data->productId}_SOC'
                                                           value='{$data->productDataSOC}' />
                                                    {/if}
                                                    {if $data->productDataSAC != "[]"}
                                                    <input type='hidden' name='sizecolordetails{$data->productId}_SAC'
                                                           id='sizecolordetails{$data->productId}_SAC'
                                                           value='{$data->productDataSAC}' />
                                                    {/if}
                                                    {if $data->productDataING != "[]"}
                                                    <input type='hidden' name='sizecolordetails{$data->productId}_ING'
                                                           id='sizecolordetails{$data->productId}_ING'
                                                           value='{$data->productDataING}' />
                                                    {/if}

                                                    <textarea name="productName" data-isOptic="{$data->isOptic}"
                                                              data-type="name" class="m_product" style="width: -webkit-fill-available;"
                                                              data-id="{$data->productId}" id="productName"
                                                              rows="1">{$data->productName}</textarea>
                                                </td>
                                                <td>
                                                    {if $editCat eq 1}
                                                    <select name="productCatId" data-isOptic="{$data->isOptic}"
                                                            data-id="{$data->productId}" data-placeholder=""
                                                            class="select2 wdt100 m_productCat" tabindex="1">
                                                        <!--                                                        <option value="-1">اختر المنتج الرئيسي</option>-->
                                                        {foreach $alldata as $proData }
                                                        <option value="{$proData->productCatId}" {if $proData->
                                                            productCatId eq
                                                            $data->productCatId}selected{/if}>{$proData->productCatName}
                                                        </option>
                                                        {/foreach}
                                                    </select>
                                                    {else}
                                                    {$data->productCatName}
                                                    {/if}

                                                </td>
                                                {if {$Programsettingdata->priceing} eq 0}
                                                <td {if $userGroupData->hideproductcatid eq 1 } class="hidden" {/if}>
                                                    <input type="text" name="buyprice" data-isOptic="{$data->isOptic}"
                                                           data-type="buyprice" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="productName"
                                                           value='{$data->productBuyPrice}' />
                                                    <label class="hidden hidden-print"> {$data->productBuyPrice}
                                                    </label>

                                                </td>
                                                {if $Programsettingdata->showpriceall eq 1}
                                                <td>
                                                    <input type="text" name="allprice" data-isOptic="{$data->isOptic}"
                                                           data-type="allprice" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="allpriceNew_{$data->productId}"
                                                           value='{$data->productSellAllPrice}'
                                                           data-editOther="{if $Programsettingdata->editAllPrice eq 1}1{else}0{/if}" />
                                                    <label class="hidden hidden-print"> {$data->productSellAllPrice}
                                                    </label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showpricehalf eq 1}
                                                <td>
                                                    <input type="text" name="halfprice" data-isOptic="{$data->isOptic}"
                                                           data-type="halfprice" class="m_product mStyle"
                                                           data-id="{$data->productId}"
                                                           id="halfpriceNew_{$data->productId}"
                                                           value='{$data->productSellHalfPrice}' />
                                                    <label class="hidden hidden-print"> {$data->productSellHalfPrice}
                                                    </label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showpriceunit eq 1}
                                                <td>
                                                    <input type="text" name="unitPrice" data-isOptic="{$data->isOptic}"
                                                           data-type="unitPrice" class="m_product mStyle"
                                                           data-id="{$data->productId}"
                                                           id="unitPriceNew_{$data->productId}"
                                                           value='{$data->productSellUnitPrice}' />
                                                    <label class="hidden hidden-print"> {$data->productSellUnitPrice}
                                                    </label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showprice4 eq 1}
                                                <td>
                                                    <input type="text" name="price4" data-isOptic="{$data->isOptic}"
                                                           data-type="price4" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="price4New_{$data->productId}"
                                                           value='{$data->price4}' />
                                                    <label class="hidden hidden-print"> {$data->price4}</label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showprice5 eq 1}
                                                <td>
                                                    <input type="text" name="price5" data-isOptic="{$data->isOptic}"
                                                           data-type="price5" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="price5New_{$data->productId}"
                                                           value='{$data->price5}' />
                                                    <label class="hidden hidden-print"> {$data->price5}</label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showprice6 eq 1}
                                                <td>
                                                    <input type="text" name="price6" data-isOptic="{$data->isOptic}"
                                                           data-type="price6" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="price6New_{$data->productId}"
                                                           value='{$data->price6}' />
                                                    <label class="hidden hidden-print"> {$data->price6}</label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showprice7 eq 1}
                                                <td>
                                                    <input type="text" name="price7" data-isOptic="{$data->isOptic}"
                                                           data-type="price7" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="price7New_{$data->productId}"
                                                           value='{$data->price7}' />
                                                    <label class="hidden hidden-print"> {$data->price7}</label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showprice8 eq 1}
                                                <td>
                                                    <input type="text" name="price8" data-isOptic="{$data->isOptic}"
                                                           data-type="price8" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="price8New_{$data->productId}"
                                                           value='{$data->price8}' />
                                                    <label class="hidden hidden-print"> {$data->price8}</label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showprice9 eq 1}
                                                <td>
                                                    <input type="text" name="price9" data-isOptic="{$data->isOptic}"
                                                           data-type="price9" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="price9New_{$data->productId}"
                                                           value='{$data->price9}' />
                                                    <label class="hidden hidden-print"> {$data->price9}</label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showprice10 eq 1}
                                                <td>
                                                    <input type="text" name="price10" data-isOptic="{$data->isOptic}"
                                                           data-type="price10" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="price10New_{$data->productId}"
                                                           value='{$data->price10}' />
                                                    <label class="hidden hidden-print"> {$data->price10}</label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showprice11 eq 1}
                                                <td>
                                                    <input type="text" name="price11" data-isOptic="{$data->isOptic}"
                                                           data-type="price11" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="price11New_{$data->productId}"
                                                           value='{$data->price11}' />
                                                    <label class="hidden hidden-print"> {$data->price11}</label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showprice12 eq 1}
                                                <td>
                                                    <input type="text" name="price12" data-isOptic="{$data->isOptic}"
                                                           data-type="price12" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="price12New_{$data->productId}"
                                                           value='{$data->price12}' />
                                                    <label class="hidden hidden-print"> {$data->price12}</label>
                                                </td>
                                                {/if}
                                                {if $Programsettingdata->showprice13 eq 1}
                                                <td>
                                                    <input type="text" name="price13" data-isOptic="{$data->isOptic}"
                                                           data-type="price13" class="m_product mStyle"
                                                           data-id="{$data->productId}" id="price13New_{$data->productId}"
                                                           value='{$data->price13}' />
                                                    <label class="hidden hidden-print"> {$data->price13}</label>
                                                </td>
                                                {/if}
                                                <td>
                                                    <input type="text" class="sortbypro mStyle"
                                                           data-id="{$data->productId}" value='{$data->sortby}' />
                                                </td>
                                                {/if}
                                                {if $showQuantity eq 1} <td>{$data->currentQuantity}</td>{/if}
                                                <td class="hidden-print ">
                                                    {if {$data->conditions} eq 0}
                                                    <a href="productController.php?do=tempdelete&id={$data->productId}&optic={$data->isOptic}"
                                                       type="button" class="btn btn-default btn-lg removeicon"> </a>
                                                    {elseif {$data->conditions} eq 1 }
                                                    <a href="productController.php?do=returndelete&id={$data->productId}&optic={$data->isOptic}"
                                                       type="button" class="btn btn-default btn-lg correcticon"> </a>
                                                    {/if}
                                                </td>
                                                {if $data->isOptic == 2}
                                                <td class="hidden-print">
                                        <center><a
                                                href="productController.php?do=editoptid&id={$data->productId}"
                                                type="button" class="btn btn-default btn-lg editicon"></a>
                                        </center>
                                        </td>
                                        {else}
                                        <td class="hidden-print"><a
                                                href="productController.php?do=edit&id={$data->productId}"
                                                type="button" class="btn btn-default btn-lg editicon"></a></td>
                                        {/if}


                                        {if {$Programsettingdata->allowfinsldelete} eq 0}
                                        <td class="hidden-print"><a href="#" name="dd" type="button"
                                                                    class="btn btn-default btn-lg deleteicon conformdel1"
                                                                    data-position="productController.php?do=deleteFinaly&id={$data->productId}&optic={$data->isOptic}"></a>
                                        </td>
                                        {/if}
                                        </tr>

                                        {assign var=i value=$i+1}
                                        {/if}

                                        {/foreach}


                                        </tbody>

                                    </table>



                                </div>
                                <!-- start tab2 -->
                                <div class="tab-pane no-print" id="tab2" style="">

                                    <table class="display table-black dataTableClassNoPaging">
                                        <!--tfoot>
                                            <tr>
                                                     <th class="hidden-print">
                                                <label>
                                                  <input type="checkbox" name="checkAll" id="checkAll"/>

                                                </label>
                                              </th>

                                             {if {$Programsettingdata->parcode} eq 0}   <th>الباركود</th>{/if}
                                              <th>اسم المنتج</th>
                                              <th>اسم التصنيف</th>
                                             {if {$Programsettingdata->priceing} eq 0}
                                              <th>سعر الجملة</th>
                                              <th>سعر النصف جملة</th>
                                              <th>سعر التجزئة</th>{/if}
                                              <th class="hidden-print">حذف/إلغاء الحذف</th>
                                              <th class="hidden-print">التعديل</th>
                                            </tr>
                                    </tfoot-->
                                        <thead>
                                            <tr>
                                                <th class="hidden-print">
                                                    <label>
                                                        <input type="checkbox" name="checkAll" id="checkAll" />
                                                    </label>
                                                </th>
                                                <th>الصورة </th>
                                                {if {$Programsettingdata->parcode} eq 0} <th>الباركود</th>{/if}
                                                <th style="">اسم المنتج</th>
                                                <th style="    width: 142px;"> اسم التصنيف </th>
                                                {if {$Programsettingdata->priceing} eq 0}
                                                <th {if $userGroupData->hideproductcatid eq 1 } class="hidden" {/if}>سعر
                                                    الشراء</th>
                                                <th>سعر الجملة</th>
                                                <th>سعر النصف جملة</th>
                                                <th>سعر التجزئة</th>{/if}
                                                {if $showQuantity eq 1}<th>الكمية فى المخازن </th>{/if}
                                                <th class="hidden-print">
                                                    حذف <br>
                                                    الغاء الحذف
                                                </th>
                                                <th class="hidden-print">التعديل</th>
                                                {if {$Programsettingdata->allowfinsldelete} eq 0}
                                                <th class="hidden-print">حذف </th>
                                                {/if}
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <!--                                <input name="productCatId" type="text" value="{$productCatId}" />-->
                                            {assign var=i value=1}

                                            {foreach $productsData as $data}
                                            {if $data->conditions eq 1}
                                            <tr data-pro="{$data->productId}{if $data->productDataSOC != ''}_SOC{/if}{if $data->productDataSAC != '[]'}_SAC{/if}{if $data->productDataING != '[]'}_ING{/if}"
                                                style="background-color:#eed3d7!important" class="alert-danger">
                                                <td class="hidden-print">
                                                    <label>
                                                        <input type="checkbox" name="choosedItem[]" id="checked{$i}"
                                                               class="choosenItem" value="{$data->productId}" />
                                                    </label>
                                                </td>
                                                <td>

                                                    <img src="../views/default/images/product_image/{$data->logo}"
                                                         class="moImg" alt="" width="50" height="30" />
                                                </td>
                                                {if {$Programsettingdata->parcode} eq 0} <td> {$data->parcode} </td>
                                                {/if}
                                                <td>
                                                    <label class="hidden hidden-print"> {$data->productName} </label>

                                                    <!--<input type="text" name="productName" data-type="name" class="m_product mStyle" style="" data-id="{$data->productId}" id="productName" value='{$data->productName}' />-->
                                                    <textarea name="productName" data-isOptic="{$data->isOptic}"
                                                              data-type="name" class="m_product" style=""
                                                              data-id="{$data->productId}" id="productName"
                                                              rows="1">{$data->productName}</textarea>

                                                </td>
                                                <td>
                                                    <label class="hidden hidden-print"> {$data->productCatName} </label>
                                                    {if $editCat eq 1}
                                                    <select name="productCatId" data-id="{$data->productId}"
                                                            data-placeholder="" class="select2 wdt100 m_productCat"
                                                            tabindex="1">
                                                        <option value="-1">اختر المنتج الرئيسي</option>
                                                        {foreach $alldata as $proData }
                                                        <option value="{$proData->productCatId}" {if $proData->
                                                            productCatId eq
                                                            $data->productCatId}selected{/if}>{$proData->productCatName}
                                                        </option>
                                                        {/foreach}
                                                    </select>
                                                    {else}
                                                    {$data->productCatName}
                                                    {/if}
                                                </td>
                                                {if {$Programsettingdata->priceing} eq 0}
                                                <td {if $userGroupData->hideproductcatid eq 1 } class="hidden" {/if}>
                                                    <input type="text" name="buyprice" data-type="buyprice"
                                                           class="m_product mStyle" data-id="{$data->productId}"
                                                           id="productName" value='{$data->productBuyPrice}' />
                                                    <label class="hidden hidden-print"> {$data->productBuyPrice}
                                                    </label>

                                                </td>
                                                <td>
                                                    <input type="text" name="allprice" data-type="allprice"
                                                           class="m_product mStyle" data-id="{$data->productId}"
                                                           id="allpriceNew_{$data->productId}"
                                                           value='{$data->productSellAllPrice}'
                                                           data-editOther="{if $Programsettingdata->editAllPrice eq 1}1{else}0{/if}" />
                                                    <label class="hidden hidden-print"> {$data->productSellAllPrice}
                                                    </label>
                                                </td>
                                                <td>
                                                    <input type="text" name="halfprice" data-type="halfprice"
                                                           class="m_product mStyle" data-id="{$data->productId}"
                                                           id="halfpriceNew_{$data->productId}"
                                                           value='{$data->productSellHalfPrice}' />
                                                    <label class="hidden hidden-print"> {$data->productSellHalfPrice}
                                                    </label>

                                                </td>
                                                <td>
                                                    <input type="text" name="unitPrice" data-type="unitPrice"
                                                           class="m_product mStyle" data-id="{$data->productId}"
                                                           id="unitPriceNew_{$data->productId}"
                                                           value='{$data->productSellUnitPrice}' />
                                                    <label class="hidden hidden-print"> {$data->productSellUnitPrice}
                                                    </label>

                                                </td>{/if}
                                                {if $showQuantity eq 1}<td>{$data->currentQuantity}</td>{/if}
                                                <td class="hidden-print ">
                                                    {if {$data->conditions} eq 0}
                                                    <a href="productController.php?do=tempdelete&id={$data->productId}&optic={$data->isOptic}"
                                                       type="button" class="btn btn-default btn-lg removeicon"> </a>
                                                    {elseif {$data->conditions} eq 1 }
                                                    <a href="productController.php?do=returndelete&id={$data->productId}&optic={$data->isOptic}"
                                                       type="button" class="btn btn-default btn-lg correcticon"> </a>
                                                    {/if}
                                                </td>
                                                {if $data->isOptic == 2}
                                                <td class="hidden-print">
                                        <center><a
                                                href="productController.php?do=editoptid&id={$data->productId}"
                                                type="button" class="btn btn-default btn-lg editicon"></a>
                                        </center>
                                        </td>
                                        {else}
                                        <td class="hidden-print"><a
                                                href="productController.php?do=edit&id={$data->productId}"
                                                type="button" class="btn btn-default btn-lg editicon"></a></td>
                                        {/if}


                                        {if {$Programsettingdata->allowfinsldelete} eq 0}
                                        <td class="hidden-print"><a href="#" name="dd" type="button"
                                                                    class="btn btn-default btn-lg deleteicon conformdel1"
                                                                    data-position="productController.php?do=deleteFinaly&id={$data->productId}&optic={$data->isOptic}"></a>
                                        </td>
                                        {/if}
                                        </tr>

                                        {assign var=i value=$i+1}
                                        {/if}


                                        {/foreach}


                                        </tbody>

                                    </table>



                                </div>
                            </div>

                            {/if}
                            <div class="panel panel-default panel-m" style="display: none;background-color: #e3f2fd"
                                 id="MultiUpdateDiv">
                                <!-- Default panel contents -->
                                <div class="panel-heading">تعديل مجمع للمنتجات</div>
                                <div class="panel-body form-inline">

                                    <div class="form-group col-lg-3">
                                        <label class="sr-only">التصنيف</label>
                                        <select class="select2" name="productCatIdMultiUp">
                                            <option value="-1">اختر تصنيف</option>
                                            {foreach $alldata as $data}
                                            <option value="{$data->productCatId}">{$data->productCatName}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                    <div class="form-group col-lg-2">
                                        <label class="sr-only"> نسبه خصم البيع</label>
                                        <div class="input-group">
                                            <label> <input value="1" name="sellpercenttypeMultiUp" type="radio">
                                                اضافه</label>
                                            <label>
                                                <input value="2" name="sellpercenttypeMultiUp" type="radio">
                                                خصم</label>
                                        </div>
                                    </div>

                                    <div class="form-group col-lg-2">
                                        <label class="sr-only"> نسبه البيع</label>
                                        <input type="text" class="form-control" name="selldiscountpercentMultiUp">
                                    </div>
                                    <div class="form-group col-lg-2">
                                        <label class="sr-only"> نسبه خصم الشراء</label>
                                        <input type="text" class="form-control" name="buydiscountpercentMultiUp">
                                    </div>
                                    <div class="form-group col-lg-2">
                                        <label class="sr-only"> سعر الشراء</label>
                                        <input type="text" class="form-control" name="productBuyPriceMultiUp">
                                    </div>

                                    <br />
                                    <div class="form-group col-lg-2">
                                        <label class="sr-only"> سعر الجمله</label>
                                        <input type="text" class="form-control" name="productSellAllPriceMultiUp">
                                    </div>
                                    <div class="form-group col-lg-2">
                                        <label class="sr-only"> سعر نصف الجمله </label>
                                        <input type="text" class="form-control" name="productSellHalfPriceMultiUp">
                                    </div>
                                    <div class="form-group col-lg-2">
                                        <label class="sr-only"> سعر التجزئة</label>
                                        <input type="text" class="form-control" name="productSellUnitPriceMultiUp">
                                    </div>

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




                            <div class="clearfix"></div>
                        </div>
                        <hr class="hidden-print" />
                        <div class="hidden-print">
                            <div class="col-lg-12">
                                <div class="well well-sm">
                                    <div class="form-group">
                                        <div class="col-lg-4">
                                            <label for="operation"></label>
                                            <span id="spryselect1">
                                                <select name="operation" id="operation" data-placeholder="اختر العملية"
                                                        class="select2 wdt100">
                                                    <option></option>
                                                    <option value="1">حذف مؤقت</option>

                                                    <option value="2">إلغاء الحذف</option>
                                                    <option value="3">حذف نهائى</option>
                                                    <option value="5">حذف من قاعدة البيانات</option>
                                                    <option value="4">تعديل مجمع</option>
                                                </select>
                                                <span class="selectRequiredMsg">اختر العملية</span></span>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-lg-4">
                                            <input name="" class="hidden-print btn btn-primary" type="submit"
                                                   value="تنفيذ" />
                                        </div>
                                    </div>

                                    <!-----------  start noElementsError alert ------------->
                                    <div class="clearfix"></div>
                                    <div id="noElementsError" class="alert alert-danger fade in" style="display:none;">
                                        <button type="button" class="close pull-left" data-dismiss="alert"
                                                aria-hidden="true">×</button>
                                        <p>يجب اختيار العناصر أولاً</p>
                                        <div class="clearfix"></div>
                                    </div>
                                    <!----------  end noElementsError alert -------------->

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


                        <!-- Modal -->
                        <div class="hidden-print">
                            <div class="modal fade " id="myModal1" 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>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default"
                                                    data-dismiss="modal">لا</button>
                                            <button type="button" class="btn btn-primary savemodel1">نعم</button>
                                        </div>
                                    </div>
                                    <!-- /.modal-content -->
                                </div>
                                <!-- /.modal-dialog -->
                            </div>
                        </div>
                        <!-- /.modal -->

                        <div class="hidden-print">
                            <div class="col-lg-12">
                                <div class="form-group">
                                    <div class="col-lg-6">
                                        <button type="button" onclick="print_Custom('mycustomheader');"
                                                class="btn btn-success pull-right" style="margin-left:5px">طباعة</button>
                                        <button type="button" onclick="window.open('productController.php?do=productsAndProUnitsToExcel', '_blank');"
                                                class="btn btn-success pull-right">تصدير كل المنتجات ووحدات القياس لملف اكسل</button>
                                    </div>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </form>
                    <script type="text/javascript">
                        var x = document.getElementById("tableWrap").innerHTML;
                        $(document).ready(function (e) {

                            document.getElementById("data").value = x;
                        });</script>
                    <form name="jazx" id="excel" action="http://localhost/newstorex/untitled.php" method="post">
                        <input type="hidden" name="data" id="data" />
                        <br />
                        <!--input type="submit" name="button" id="button" class="btn btn-success pull-right" value="ملف اكسل" /-->
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal -->
    <div class="hidden-print modal fade" id="sucessmodel" 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>
                    <span style="font-weight:bold">تعديل المنتج</span>
                </div>
                <div class="modal-body"> لقد تم تعديل المنتج <br />
                    <span id="columupdated"></span> &nbsp; <span id="columupdatedvalue"></span>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">غلق</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->
    <script>
        var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
        $('body').on('click', '.moImg', function () {

            $('body').append('<div class="product-image-overlay"><span class="product-image-overlay-close">x</span><img src="" /></div>');
            var productImage = $('img');
            var productOverlay = $('.product-image-overlay');
            var productOverlayImage = $('.product-image-overlay img');
            productImage.click(function () {
                var productImageSource = $(this).attr('src');
                productOverlayImage.attr('src', productImageSource);
                productOverlay.fadeIn(100);
                $('body').css('overflow', 'hidden');
                $('.product-image-overlay-close').click(function () {
                    productOverlay.fadeOut(100);
                    $('body').css('overflow', 'auto');
                });
            });
        });
    </script>
    <script>

        $('.nav-tabs li').on('click', function () {
            $(".tab-product .tab-pane").toggleClass("no-print");
            // if ($(".tab-product .tap-pane" ).hasClass('no-print') ) {
            //     alert(444);
            //     console.log("the tab is already active");
            //     $("this").removeClass('no-print');

            // }
            // else {
            //     $(".tab-product .tap-pane").addClass('no-print');
            // }
        });

    </script>

    {literal}
    <script>
        $('body').on('change', '.sortbypro', function () {
            var sortbys = Number($(this).val());
            var myid = Number($(this).attr('data-id'));
            $.post('productControllerAjax.php?do=changesortby', {myid: myid, sortbys: sortbys});
        });
        $(function () {

            $(".select2product").select2({
                placeholder: "المنتج",
                minimumInputLength: document.getElementById("searchvalue").value,
                multiple: false,
                quietMillis: 100,
                containerCssClass: "wdt300",
                ajax: {
                    url: "sellbillAjaxController.php?do=getProducts2",
                    dataType: 'json',
                    data: function (term, page) {
                        //alert("sellbillAjaxController.php?do=getProducts&term="+term+"&page_limit=10&storeid="+document.getElementById("storeid").value);
                        return {
                            term: term, //search term
                            page_limit: 10, // page size,
                        };
                    },
                    results: function (data) {

                        return {results: data};
                    }
                },
                formatResult: function (data) {
                    return data.text;
                    //            if (Number(data.id) == -2) {
                    //                return  '<span class="newoption">' + data.text + '</span >';
                    //            } else {
                    //                return  '<span>' + data.text + '</span >';
                    //            }
                },
                initSelection: function (element, callback) {
                    var item = element.val().split(':');
                    var data = {id: item[0], text: item[1], productquantity: item[2], price: item[3]};
                    callback(data);
                }

            });
        });
        function getproductbyParcode(e, value) {
            //\s means "one space", and \s+ means "one or more spaces".
            value = value.replace(/\s+/g, '');//\s is the regex for "whitespace", and g is the "global" flag, meaning match ALL \s (whitespaces).
            var code = (e.keyCode ? e.keyCode : e.which);
            //to stop the submit of the form
            if (e.which == 13 && value != "") {
                var billnameid = 3;
                value = value.replace("ه", "i");//this replacement is for parcode reader
                value = value.replace("÷", "i");//this replacement is for parcode reader
                value = value.replace("/", "i");//this replacement is for parcode reader
                value = value.replace("I", "i");//this replacement is for parcode reader
                //alert(value.charAt(0));
                $.ajax({
                    url: 'sellbillAjaxController.php?do=getproductNamebyOnlyParcode&parcode=' + value + '&billnameid=' + billnameid + '',
                    success: function (data) {
                        var response = $.parseJSON(data);
                        $("#product").select2('data', {id: response.id, text: response.text});
                    }
                });
                // }
            }
        }
    </script>
    {/literal}