<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">تصنيع</a></li>
            <li><a href="branchRequestController.php?do=show">طلبات الفرع</a></li>
            <li class="active">تعديل</li>
        </ol>
        <div class="panel panel-default panel-m">
            <div class="panel-heading">
                <h3 class="panel-title">تعديل</h3>
            </div>
            <div class="panel-body"> {literal}
                <form class="nameToBeChecked form-horizontal" role="form" action="branchRequestController.php?do=update"
                      method="post" enctype="multipart/form-data" id="spform">
                    {/literal}
                    <!-- =================================================   -->

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

                    <!-- =================================================   -->
                    <div class="form-group">
                        <label class="col-lg-2 control-label">الفرع </label>
                        <div class="col-lg-4">
                            <span>
                                {if $allBranch}
                                <select name="branchid" id="branchid" data-placeholder="اختر " class="select2 wdt100">
                                    <option value="-1">اختر</option>
                                    {foreach $allBranch as $branch}
                                    <option value="{$branch.branchId}" {if $branch.branchId eq $showData->branchid} selected {/if}>{$branch.branchName}</option>
                                    {/foreach}
                                </select>
                                {else}
                                {$branchData.branchName}
                                <input type="hidden" name="branchid" value="{$branchData.branchId}" />
                                {/if}
                            </span>
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label class="col-lg-2 control-label">المخزن </label>
                        <div class="col-lg-4">
                            {if $searchinonestore neq 0}
                            <input type="hidden" name="storeId" id="storeId" value="{$storeid}">
                            {$storedef->storeName}
                            {else}
                            <select class="select2 wdt100" name="storeId" id="storeId">
                                <option value="-1">اختر مخزن</option>
                                {foreach $storeData as $store}
                                <option value="{$store->storeId}" {if $store->storeId eq $showData->storeid} selected {/if}>{$store->storeName}</option>
                                {/foreach}
                            </select>
                            {/if}
                        </div>
                    </div>
                    <!--==============================-->
                    <button type="button" name="addpro" id="addpro" class="btn btn-primary pull-left ft-nor"> اضافة
                        جديد</button>
                    <div class="table-responsive">
                        <table class="table billtable table-black table-bordered" id="productTable">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>المنتج</th>
                                    <th>الكمية الحالية</th>
                                    <th>العدد المطلوب</th>
                                    <th>تعليق</th>
                                    <th class="hidden-print">حذف</th>
                                </tr>
                            </thead>
                            <tbody>
                                {assign var=i value=1}
                                {foreach $allPro as $pro}
                                <tr>
                                    <td>{$pro@iteration}</td>
                                    <td>
                                        <div id="myproductselect">
                                        <input type="hidden" class="select2product wdt400 myproduct" data-itr="{$i}"
                                            name="product{$i}" id="product{$i}" data-placeholder="اختر منتج" />
                                        <input type="hidden" name="oldproductname{$i}" id="oldproductname{$i}"
                                            value="{$pro.productName} / {$pro.productCatName}" />
                                        <input type="hidden" name="oldproductid{$i}" id="oldproductid{$i}"
                                            value="{$pro.productid}" />
                                    </div>
                                    </td>
                                    <td>
                                        <input type="text" readonly name="quantity{$i}" id="quantity{$i}" value="{$pro.productquantity}" class="form-control" />
                                    </td>
                                    <td>
                                        <input type="number" name="number{$i}" id="number{$i}" value="{$pro.quantity}" class="form-control" />
                                    </td>
                                    <td>
                                        <textarea name="comment{$i}" id="comment{$i}" class="form-control">{$pro.comment}</textarea>
                                    </td>
                                    <td id="{$i}" class="hidden-print">
                                        <button id="remove{$i}" type="button"
                                            class="close flt-none removeicon removeproduct"
                                            aria-hidden="true">&times;</button>
                                    </td>
                                </tr>
                                {assign var=i value=$i+1}
                                {/foreach}
                            </tbody>
                        </table>
                    </div>

                    <input type="hidden" name="productItr" id="productItr" value="{count($allPro)}" />
                    <!-- =================================================   -->

                    <input name="id" id="id" type="hidden" value="{$showData->id}" />

                    <!-- =================================================   -->
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="submit" class="btn btn-primary pull-left" id="spbutton">حفظ</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>