<div class="form-group">
    <label class="col-lg-2 control-label">تصنيف المنتج</label>
    <div class="col-lg-4">
        {foreach $alldata as $data }
        {if $productsData->productCatId eq $data->productCatId}{$data->productCatName}{/if}
        {/foreach}
    </div>

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

    <table id="product_Table" class="table table-black">
        <tr>
            <td colspan="2"><label class="control-label">الإسم</label></td>

            {if $userGroupData->hideproductcatid == 0}<td><label class="control-label">سعر الشراء</label></td>{/if}
            <td><label class="control-label">الخصم المرجح</label></td>
            <td><label class="control-label">سعر الجمله</label></td>
            <td><label class="control-label">سعر نصف الجمله</label></td>
            <td><label class="control-label">سعر التجزئة</label></td>
        </tr>
        <tr>

            <td colspan="2">{$productsData->productName}</td>
            {if $userGroupData->hideproductcatid == 0}<td>{$productsData->productBuyPrice}</td>{/if}
            <td>{$productsData->weightedDiscount}</td>
            <td>{$productsData->productSellAllPrice}</td>
            <td>{$productsData->productSellHalfPrice}</td>
            <td>{$productsData->productSellUnitPrice}</td>
        </tr>
        <tr>
            <td class=" check_tr {if {$Programsettingdata->parcode} eq 1} hidden {/if}"><label
                    class="control-label">الباركود</label></td>
            <td {if {$Programsettingdata->expiredate} eq 1} hidden {/if}><label class="control-label">مدة
                    الصلاحية</label> </td>
            <td><label class="control-label">الكمية</label></td>
            <td class="{if {$Programsettingdata->date} eq 1} hidden {/if}"><label class="control-label">التاريخ</label>
            </td>
            <td class=" {if {$Programsettingdata->limitamount} eq 1} hidden {/if}"><label class="control-label">الحد
                    الأدنى للمنتج</label></td>
            <td class="{if $Programsettingdata->isCaf != 1 && $Programsettingdata->isRestaurent != 1} hidden {/if}">
                <label class="control-label">فى المنيو</label>
            </td>
            <td><label class="control-label">آخر مورد</label></td>
        </tr>
        <tr>
            <td class=" check_tr {if {$Programsettingdata->parcode} eq 1} hidden {/if}">
                {$productsData->parcode}
            </td>
            <td {if {$Programsettingdata->expiredate} eq 1} hidden {/if}>
                {$productsData->expireDate} <span
                    style="float: left;margin-top: -27px; color: white;font-size: 15px;font-weight: bold;">يوم</span>
            </td>
            <td>{$productsData->sumProductQuantity}</td>
            <td class="{if {$Programsettingdata->date} eq 1} hidden {/if}">
                {$productsData->productDate}
            </td>
            <td class=" {if {$Programsettingdata->limitamount} eq 1} hidden {/if}">{$productsData->limitamount}</td>
            <td class="{if $Programsettingdata->isCaf != 1 && $Programsettingdata->isRestaurent != 1} hidden {/if}">
                <div class="form-group">
                    <div class="col-lg-12">
                        {if {$productsData->inMenu} eq 0}
                        نعم
                        {else}
                        لا
                        {/if}
                    </div>
                </div>
            </td>
            <td>{$lastSupplierName}</td>
        </tr>

        <tr>
            <td colspan="3" class="check_tr_description {if {$Programsettingdata->description} eq 1} hidden {/if}">
                <label class="control-label">التعليق</label>
            </td>
            {if $userGroupData->hideproductcatid == 0}<td><label class="control-label">متوسط سعر الشراء</label></td>
            {/if}
            {if $userGroupData->hideproductcatid == 0}<td><label class="control-label">اخر سعر شراء</label></td>{/if}
            <td><label class="control-label">خدمة</label></td>
            <td class=" check_tr_production {if {$Programsettingdata->production} eq 1} hidden {/if}"><label
                    class="control-label">تصنيع</label></td>

        </tr>
        <tr>


            <td colspan="3" class=" check_tr_description {if {$Programsettingdata->description} eq 1} hidden {/if}">
                {$productsData->productDescription}
            </td>
            {if $userGroupData->hideproductcatid == 0}<td>{$productsData->meanbuyprice}</td>{/if}
            {if $userGroupData->hideproductcatid == 0}<td>{$productsData->lastbuyprice}</td>{/if}
            <td>
                {if {$productsData->isService} eq 1}
                نعم
                {else}
                لا
                {/if}
            </td>
            <td class=" check_tr_production {if {$Programsettingdata->production} eq 1} hidden {/if}">
                {if {$productsData->type} eq 1}
                نعم
                {else}
                لا
                {/if}
            </td>

        </tr>

        <tr>
            {if isset($lastSellDataOfProduct)}
            <td colspan="2"><label class="control-label">اخر خصم بيع</label></td>
            <td><label class="control-label">اخر سعر بيع</label></td>
            {/if}
            {if isset($lastBuyDataOfProduct) && $lastBuyDataOfProduct->discountvalue > 0}
            <td colspan="2"><label class="control-label">اخر خصم شراء</label></td>
            {/if}
        </tr>
        <tr>
            {if isset($lastSellDataOfProduct)}
            <td colspan="2">{$lastSellDataOfProduct->discountvalue} ({$lastSellDataOfProduct->discounttype}%)</td>
            <td>{$lastSellDataOfProduct->sellbilldetailprice}</td>
            {/if}
            {if isset($lastBuyDataOfProduct) && $lastBuyDataOfProduct->discountvalue > 0}
            <td colspan="2">{$lastBuyDataOfProduct->discountvalue} ({$lastBuyDataOfProduct->discounttype}%)</td>
            {/if}
        </tr>

        <tr>
            <td colspan="3"><label class="control-label">صورة</label></td>
            <td colspan="2"></td>
            <td colspan="2"></td>
        </tr>
        <tr>
            <td colspan="3">
                {if $productsData->logo !="" &&$productsData->logo!="."}<img
                    src="../views/default/images/product_image/{$productsData->logo}" alt=""
                    width="{$productsData->displayWidth}" height="{$productsData->displayHeight}"
                    style="cursor: pointer;" onclick="window.open($(this).attr('src'))" />{/if}
            </td>
            <td colspan="2"></td>
            <td colspan="2"></td>
        </tr>
        {if $userGroupData->hideproductcatid == 0}
        <tr>
            <td colspan="10">
                <div id="lastBuyPricesDiv1">
                    <div class="table-responsive">
                        <table id="unitsTable1" class="table table-black">
                            <tr>
                                <td>
                                    <label class="control-label">التاريخ</label>
                                </td>
                                <td>
                                    <label class="control-label">السعر</label>
                                </td>
                                <td>
                                    <label class="control-label">المورد</label>
                                </td>
                            </tr>
                            {foreach $buyPricesData as $data}
                            <tr>
                                <td>
                                    <div>
                                        {$data->buybilldate|date_format:"%d-%m-%Y  %H:%M"}
                                    </div>
                                </td>
                                <td>
                                        <div>{$data->buybilldetailprice}</div>
                                </td>
                                <td>
                                    <div>
                                        <div>{$data->note}</div>
                                    </div>
                                </td>
                                {/foreach}
                        </table>
                    </div>
                    <!--end unitsTable-->
                </div>
            </td>
        </tr>
        {/if}
        <tr>
            <td colspan="10"><!--------------------------------  adding units   ----------------------------->

                <div id="addUnitsDiv1" class="{if {$Programsettingdata->measuringunit} eq 1} hidden {/if}">
                    <div class="table-responsive">
                        <table id="unitsTable1" class="table table-black">
                            {assign var=j value=1}
                            {foreach $productUnitsData as $proUnit}
                            <tr>
                                <td>
                                    <div>
                                        <label class="control-label">وحدة القياس</label>
                                        <div>
                                            {foreach $unitsData as $unit}
                                            {if $proUnit->unitid eq $unit->unitId}{$unit->unitName}{/if}
                                            {/foreach}
                                        </div>
                                    </div>
                                </td>
                                <td>
                                    <div>
                                        <label class="control-label">عدد الوحدات</label>
                                        <div>{$proUnit->productnumber}</div>
                                    </div>
                                </td>
                                <td>
                                    <div>
                                        <label class="control-label">الباركود</label>
                                        <div>{$proUnit->proUnitParcode}</div>
                                    </div>
                                </td>
                                {if $userGroupData->hideproductcatid == 0}
                                <td>
                                    <div>
                                        <label class="control-label">سعر الشراء</label>
                                        <div>{$proUnit->proUnitBuyPrice}</div>
                                    </div>
                                </td>
                                {/if}
                                <td>
                                    <div>
                                        <label class="control-label">سعر الجملة</label>
                                        <div>{$proUnit->proUnitSellAllPrice}</div>
                                    </div>
                                </td>
                                <td>
                                    <div>
                                        <label class="control-label">سعر نص جملة</label>
                                        <div>{$proUnit->proUnitSellHalfPrice}</div>
                                    </div>
                                </td>
                                <td>
                                    <div>
                                        <label class="control-label">سعر قطاعى</label>
                                        <div>{$proUnit->proUnitSellUnitPrice}</div>
                                    </div>
                                </td>
                            </tr>
                            {capture assign=j}{$j+1}{/capture}
                            {/foreach}
                        </table>
                    </div>
                    <!--end unitsTable-->
                </div>

                <!-------------------------------- end adding units   -------------------------->
            </td>
        </tr>
        {if $isCollective == 1}
        <tr>
            <td colspan="10"><!--------------------------------  adding units   ----------------------------->
                <div class="panel panel-default panel-m">
                    <div class="panel-heading">
                        <h3 class="panel-title">المكونات</h3>
                        <input type="hidden" name="isCollective" id="isCollective" value="1" />
                    </div>
                    <div class="panel-body">
                        <table class="table billtable table-bordered table-black col-lg-4" id="table">
                            <thead>
                                <tr>
                                    <th class="wdt400">المنتجات الخام</th>
                                    <th class="wdt200"><span class="sr-only">وحدة القياس</span></th>
                                    <!--<th  class="wdt200">نسبة المشاركة </th>-->
                                    <th class="wdt200">عدد الوحدات</th>
                                </tr>
                            </thead>
                            <tbody>
                                {assign var=i value=1}
                                {assign var=y value=1}
                                {foreach $Productionrateproduct as $x}
                                <tr>
                                    <td>
                                        {foreach $rows as $material}
                                        {if {$material->productId}=={$x->ingridientId}}{$material->productName}{/if}
                                        {/foreach}
                                    </td>
                                    <td>
                                        {foreach $productUnitData{$y} as $myUnit}
                                        {if {$myUnit->productunitid}=={$x->unitId}}{$myUnit->unitName}{/if}
                                        {/foreach}
                                    </td>
                                    <!--                                    <td><div id="table">
                                                                                <input type="text" name="input{$i}" id="input{$i}"  class="form-control check" value="{$x->rate}" tabindex=""  />
                                                                            </div></td>-->
                                    <td>{$x->quantity}</td>
                                </tr>
                                {capture assign=i}{$i+1}{/capture}
                                {capture assign=y}{$y+1}{/capture}
                                {/foreach}
                            </tbody>
                        </table>
                        <p>&nbsp; </p>
                        {if $userGroupData->hideproductcatid == 0}
                        <div>
                            <!--h4><u>حساب تكلفة المنتج من المكونات</u></h4-->
                            <button type="button" class="btn btn-primary ft-nor"> التكلفة بسعر الشراء
                                <span class="badge wht-clo">
                                    <div id="productBuyPrice">{$productsData->productBuyPrice}</div>
                                </span></button>
                            &nbsp;
                            <button type="button" class="btn btn-primary ft-nor"> التكلفة باخر سعر شراء
                                <span class="badge wht-clo">
                                    <div id="lastbuyprice">{$productsData->lastbuyprice}</div>
                                </span></button>
                            &nbsp;
                            <button type="button" class="btn btn-primary ft-nor"> التكلفة باخر سعر شراء مع الخصم
                                <span class="badge wht-clo">
                                    <div id="lastbuyprice_withDiscount">{$productsData->lastbuyprice_withDiscount}</div>
                                </span></button>
                            &nbsp;
                            <button type="button" class="btn btn-primary ft-nor"> التكلفة بمتوسط سعر الشراء
                                <span class="badge wht-clo">
                                    <div id="meanbuyprice">{$productsData->meanbuyprice}</div>
                                </span></button>
                            &nbsp;
                            <button type="button" class="btn btn-primary ft-nor"> التكلفة بمتوسط سعر الشراء مع الخصم
                                <span class="badge wht-clo">
                                    <div id="meanbuyprice_withDiscount">{$productsData->meanbuyprice_withDiscount}</div>
                                </span></button>
                        </div>
                        <br />
                        {/if}
                        <div class="clearfix"></div>
                    </div>
                </div>
            </td>
        </tr>
        {/if}
        {if $productsData->hasSizeAndColor == 1}
        <input name="hasSizeAndColor" type="hidden" value="1">
        <tr>
            <td colspan="10"><!--------------------------------  adding units   ----------------------------->
                <div class="panel panel-default panel-m">
                    <div class="panel-heading">
                        <h3 class="panel-title">المقاسات والالوان</h3>
                        <input type="hidden" name="isCollective" id="isCollective" value="1" />
                    </div>
                    <div class="panel-body">
                        <div class="row" id="quantity_div">
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th>الباركود</th>
                                        <th>المقاس</th>
                                        <th>اللون</th>
                                    </tr>
                                </thead>
                                <tbody id="SizeColorTB">
                                    {assign var=i value=1}
                                    {foreach $sizeColorStoreDetail as $data}
                                    <tr>
                                        <td>{$data->parcode}</td>
                                        <td>{$data->sizeName}</td>
                                        <td>{$data->colorName}</td>
                                    </tr>
                                    {assign var=i value=$i+1}
                                    {/foreach}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
        {/if}
    </table>