<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">نظام المحاسبة</a></li>
            <li><a href="checks.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="checks.php?do=update"
                      method="post" enctype="multipart/form-data" id="spform">
                    {/literal}
                    <!-- =================================================   -->
                 <div class="form-group">
                        <label class="col-lg-2 control-label">المقاول</label>
                        <div class="col-lg-4">
                            
                            <select name="member_id" id="member_id" class="select2 wdt100">
                                <option value="">اختر المقاول</option>
                                {foreach $members as $member}
                                    <option value="{$member->id}" {if $showData->member_id == $member->id}selected{/if}>
                                        {$member->member_name}
                                    </option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                        <!--==============================-->
                     <div class="form-group">
                        <label for="notes" class="col-lg-2 control-label">دفعة رقم</label>
                        <div class="col-lg-4">
                            <input type="number" name="batch_num" id="batch_num" class="form-control" value="{$showData->batch_num}">
                        </div>
                        <span class="textfieldRequiredMsg">*</span>
                    </div>
                     <!--==============================-->
                     <div class="form-group">
                        <label for="notes" class="col-lg-2 control-label">قيمة الدفعة</label>
                        <div class="col-lg-4">
                            <input type="number" name="batch_value" id="batch_value" class="form-control" value="{$showData->batch_value}">
                        </div>
                        <span class="textfieldRequiredMsg">*</span>
                    </div>
                     <!--==============================-->
                    <div class="form-group">
                        <label for="notes" class="col-lg-2 control-label">رقم الشيك</label>
                        <div class="col-lg-4">
                            <input type="number" name="check_num" id="check_num" class="form-control" value="{$showData->check_num}">
                        </div>
                        <span class="textfieldRequiredMsg">*</span>
                    </div>
                     <!--==============================-->
                    <div class="form-group">
                        <label for="notes" class="col-lg-2 control-label"> البنك</label>
                        <div class="col-lg-4">
                            <input type="text" name="bank" id="bank" class="form-control" value="{$showData->bank}">
                        </div>
                        <span class="textfieldRequiredMsg">*</span>
                    </div>
                     <!--==============================-->
                       <div class="form-group">
                        <label for="court_decision" class="col-lg-2 control-label">تفاصيل</label>
                        <div class="col-lg-4">
                            <textarea name="details" id="details" class="form-control" rows="4" >{$showData->details}</textarea>
                        </div>
                    </div>
                    <!--==============================-->
                     
                    <div class="form-group">
                        <label for="notes" class="col-lg-2 control-label">تعليق</label>
                        <div class="col-lg-4">
                            <textarea name="comment" id="comment" class="form-control" rows="3" >{$showData->comment}</textarea>
                        </div>
                    </div>
                    <!--==============================-->
                  
                      <div class="form-group">
                        <label class="col-lg-2 control-label">ارفاق استمارة</label>
                        <div class="col-lg-8">
                              {if $showData->images != "" && $showData->images !="." &&
                            $showData->images !="no image"}
                            <div style="margin-bottom: 10px;">
                            {assign var="imgs" value=","|explode:trim($showData->images)}
                            {foreach $imgs as $img}
                                <img src="../upload/checks/{trim($img)}" width="80" height="60" style="border:1px solid #ccc; margin-left:5px;" />
                                
                            {/foreach}
                            </div>
                            {/if}
                            <input type="file" name="image[]" multiple class="form-control"  accept=".jpg, .jpeg, .png, .pdf">
                            <input type="hidden" name="imageurl" value="{$showData->images}" />
                        </div>
                    </div>
                    <!--==============================-->
                      <div class="form-group">
                        <label class="col-lg-2 control-label">ارفاق صورة الشيك</label>
                        <div class="col-lg-8">
                              {if $showData->check_image != "" && $showData->check_image !="." &&
                            $showData->check_image !="no image"}
                            <div style="margin-bottom: 10px;">
                            {assign var="imgs" value=","|explode:trim($showData->check_image)}
                            {foreach $imgs as $img}
                                <img src="../upload/checks/{trim($img)}" width="80" height="60" style="border:1px solid #ccc; margin-left:5px;" />
                                
                            {/foreach}
                            </div>
                            {/if}
                            <input type="file" name="check_image[]" multiple class="form-control"  accept=".jpg, .jpeg, .png, .pdf">
                            <input type="hidden" name="check_imageurl" value="{$showData->check_image}" />
                        </div>
                    </div>
                    <!--==============================-->
                    <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="button" class="btn btn-primary pull-left" id="spbutton">حفظ</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{literal}
<script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    $('#spbutton').live('click', function (e) {
        if (!$('#spbutton').hasClass("processing")) {
            $('#spbutton').addClass("processing");
            $('#productCatName').trigger('blur');
            setTimeout(function () {
                var myForm = document.getElementById("spform");
                var SS = Spry.Widget.Form.validate(myForm);
                if (SS == true) {
                    myForm.submit();
                } else {
                    $('#spbutton').removeClass("processing");
                }
            }, 500);
        }
    });
   
</script>
{/literal}