<style>
    @media (min-width: 768px){
        .form-horizontal .form-group {
            margin-right: -10px;
            margin-left:-10px;
        }

        .m10{
            margin: 10px
        }
        h4{
            font-size: 17px;
            font-weight: bold;
            color: #000000;
            margin: 10px 0 15px;
            font-family: sans-serif;
        }
        hr {
            margin: 20px ;
            border: 0;
            border-top: 2px solid #d7d7d7;

        }
        .card{
            box-shadow: 0 4px 16px rgba(0,0,0,.12);
            padding: 10px;
            margin: 40px 0;
            border-radius: 5px
        }

    }
    .wdt230{
        width:230px
    }
    .billtable thead>tr>th {
        color: #eeecda;
        background-color: #0081a8;
    }
    .add i{
        font-size: 20px;
        color: #607D8B;
    }
    .wdt50{
        width:50px
    }
    .mt-10{
        margin-top: 10px
    }
    .data-search{
        margin: 10px 15px 0;
    }
    .btn-dark {
        color: #fff;
        background-color: #636262;
        border-color: #646464;
    }
    .data-search .form-control{
        border-radius:3px
    }
    .eqName{
        color: #eeecda;background-color: #0081a8;padding: 5px; vertical-align: middle; text-align: center;font-weight: bold;width:60%;
    }
</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">
                <h3 class="panel-title">تعديل</h3>
            </div>

            <div class="panel-body">

                <form action="productionOutController.php?do=update" method="post" id="form1" class="form-horizontal nameToBeChecked">
                    <input type="hidden" name="searchvalue" id="searchvalue" value="{$Programsettingdata->searchvalue}"/>
                    <div class="data-search">
                        <div class="row">

                            <div class="col-lg-4">
                                <div class="form-group">
                                    <label>مخزن المدخلات</label>
                                    <select class=" select2" id="outStore" name="outStore">
                                        {foreach $allStore as $store}
                                        <option value="{$store->storeId}" {if $productionOutData->outStore == $store->storeId}selected{/if}>{$store->storeName}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-4">
                                <div class="form-group">
                                    <label>مخزن المخرجات</label>
                                    <select class=" select2" id="inStore" name="inStore">
                                        {foreach $allStore as $store}
                                        <option value="{$store->storeId}" {if $productionOutData->inStore == $store->storeId}selected{/if}>{$store->storeName}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-4">
                                <div class="form-group">
                                    <label>المورد</label>
                                    <input type="hidden" name="supplier" id="supplier" class="select2Supp"/>
                                    <input type="hidden" name="oldsupplierid" id="oldsupplierid" value="{$productionOutData->supplier}"/>
                                    <input type="hidden" name="oldsuppliername" id="oldsuppliername" value="{$productionOutData->suppliername}"/>
                                </div>
                            </div>

                            <br>

                            <div class="col-lg-4">
                                <div class="form-group">
                                    <label> المنتج المدخل</label>
                                    <input type="hidden" id="productOut" name="productOut"  class="select2productout wdt100" tabindex="7" />
                                    <input type="hidden" name="oldproductOutid" id="oldproductOutid" value="{$productionOutData->productid}"/>
                                    <input type="hidden" name="oldproductOutname" id="oldproductOutname" value="{$productionOutData->productName}"/>
                                </div>
                            </div>

                            <div class="col-lg-2">
                                <div class="form-group">
                                    <label>الكمية</label>
                                    <input type="text" name="outQuantity" class="form-control positivefloat outCalc" id="outQuantity" value="{$productionOutData->outQuantity}">
                                </div>
                            </div>
                            <div class="col-lg-2">
                                <div class="form-group">
                                    <label>تكلفة تصنيع الوحدة</label>
                                    <input type="text" name="outUnitCost" class="form-control positivefloat outCalc" id="outUnitCost" value="{$productionOutData->outUnitCost}">
                                </div>
                            </div>
                            <div class="col-lg-2">
                                <div class="form-group">
                                    <label>التكلفة الاجمالية للوحدة </label>
                                    <input type="text" name="outAllCostTot" class="form-control" id="outAllCostTot" value="{$productionOutData->outAllCostTot}" disabled>
                                    <input type="hidden" name="outAllCostTot_h" class="form-control" id="outAllCostTot_h" value="{$productionOutData->outAllCostTot}">
                                </div>
                            </div>
                            <div class="col-lg-2">
                                <div class="form-group">
                                    <label>تكلفة التصنيع </label>
                                    <input type="text" name="outAllCost" class="form-control" id="outAllCost" disabled  value="{$productionOutData->outAllCost}">
                                </div>
                            </div>
                            <br/>
                            <div class="col-lg-4">
                                <div class="form-group">
                                    <label>التعليق</label>
                                    <textarea name="comment" class="form-control" rows="2">{$productionOutData->comment}</textarea>
                                </div>
                            </div>

                        </div>
                    </div>


                    <!-- المكونات -->
                    <div class="card">
                        <div class="col-lg-6">
                            <h4>المخرجات</h4>
                        </div>
                        <a class="btn add pull-left addInPro" id="addInPro"><i class="glyphicon glyphicon-plus-sign"></i></a>
                        <div class="table-responsive">
                            <table class="table billtable table-bordered table-black ">
                                <thead>
                                    <tr>
                                        <th class="wdt400">المنتج </th>
                                        <th style="width:20%">وحدة القياس</th>
                                        <th style="width:10%">السعر</th>
                                        <th style="width:10%">الكمية</th>
                                        <th style="width:10%">الاجمالى</th>
                                        <th class="hidden-print" style="width:5%"></th>
                                    </tr>
                                </thead>
                                <tbody id="inTabletb">
                                    {assign var=i value=1}
                                    {assign var=allCost value=0}
                                    {foreach $allProductionOutDetail as $data}
                                    <tr>
                                        <td>
                                            <input type="hidden" name="detailid{$i}" id="detailid{$i}" value="{$data->id}"/>

                                            <input type="hidden" id="product{$i}" name="product{$i}" data-itr="{$i}" class="select2productin wdt100" tabindex="7" />
                                            <input type="hidden" name="oldproductid{$i}" id="oldproductid{$i}" value="{$data->productid}"/>
                                            <input type="hidden" name="oldproductname{$i}" id="oldproductname{$i}" value="{$data->productName}"/>
                                        </td>
                                        <td><input type="hidden" name="unitId{$i}"  id="unitId{$i}" class="select2_unit" data-itr="{$i}">
                                            <input type="hidden" name="oldunitid{$i}" id="oldunitid{$i}" value="{$data->unitid}"/>
                                            <input type="hidden" name="oldunitname{$i}" id="oldunitname{$i}" value="{$data->unitName}"/>
                                        </td>
                                        <td><input type="text" name="price{$i}" id="price{$i}" min="0" class="form-control inPrice inCalc positivefloat" data-itr="{$i}" value="{$data->price}"/></td>
                                        <td><input type="text" name="quantity{$i}" id="quantity{$i}" min="0" class="form-control inQuantity inCalc positivefloat" data-itr="{$i}" value="{$data->quantity}" /></td>
                                        <td><span class="inTotalCost" id="inTotalCost{$i}">{$data->inTotalCost}</span></td>
                                        <td class="noprint"><button id="remove{$i}" type="button" class="close flt-none removeicon removeproduct" aria-hidden="true">&times;</button></td>
                                    </tr>
                                    {assign var=allCost value=$allCost+$data->inTotalCost}
                                    {assign var=i value=$i+1}
                                    {/foreach}
                                </tbody>
                            </table>
                            <input type="hidden" name="inProItr" id="inProItr" value="{$i}">
                        </div>
                        <button type="button" class="btn btn-dark pull-left ft-nor">
                            الاجمالى <span class="badge wht-clo">
                                <div id='allCost'>{$allCost}</div>
                            </span>
                        </button>
                        <div class="clearfix"></div>
                    </div>
                    <div class="clearfix"></div>
                    <input type="hidden" name="id" id="id" value="{$productionOutData->id}"/>
                    <div class="row  hidden-print m10" >
                        <div class="col-lg-12">
                            <button type="button"  id="saveBtn" class="btn btn-primary">
                                <i class="glyphicon glyphicon-ok "></i>  حفظ</button>
                        </div>

                    </div>
                    <!-- end of fifth row-->

                </form>

            </div> <!-- end of panel-body-->

        </div>  <!-- end of panel panel-default-->

    </div> <!-- end of container-->

</div>  <!-- end of row-->

