<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">شئون قانونية</a></li>
              <li><a href="Contracts.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="Contracts.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">
                            <span>
                        <select name="member" class="form-control select2 wdt100" required  >
                             <option value="-1">اختر المقاول</option>
                            {foreach $members as $member}
                                <option value="{$member.member_name}" {if $showData->member == $member.member_name}selected{/if}>{$member.member_name}</option>
                            {/foreach}
                        </select>
                        </span>
                        </div>
                    </div>
                      <!--==============================-->
                     <div class="form-group">
                        <label for="announcementName" class="col-lg-2 control-label">عنوان العقد</label>
                        <div class="col-lg-4"> <span id="sprytextfield1">
                                <input type="text" name="name" id="name" class="form-control" value="{$showData->name}" />
                                <span class="textfieldRequiredMsg">*</span></span>
                        </div>
                    </div>

                      <!--==============================-->
                      <div class="form-group">
                        <label for="announcementSubDate" class="col-lg-2 control-label"> تاريخ العقد</label>
                        <div class="col-lg-4"> <span id="sprytextfield2">
                                <input type="date" name="date" id="date" value="{$showData->date}">
                                <span class="textfieldRequiredMsg">*</span></span>
                        </div>
                    </div>
                     <!--==============================-->
                     <div class="form-group">
                        <label for="announcementInsurance" class="col-lg-2 control-label"> قيمة العقد</label>
                        <div class="col-lg-4"> <span id="sprytextfield2">
                                <input type="number" name="value" id="value" class="form-control" value="{$showData->value}">
                                <span class="textfieldRequiredMsg">*</span></span>
                        </div>
                    </div>
                    <!--==============================-->
                    <div class="form-group">
                        <label for="court_decision" class="col-lg-2 control-label">نعليق</label>
                        <div class="col-lg-4">
                            <textarea name="comment" id="comment" class="form-control" rows="4" >{$showData->comment}</textarea>
                        </div>
                    </div>
                    
                      <div class="form-group">
                        <label class="col-lg-2 control-label">مرفق</label>
                        <div class="col-lg-2">
                              {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/contracts/{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>
                    <!--==============================-->
                    <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}