<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">الشئون القانونية</a></li>
            <li><a href="Cases.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="Cases.php?do=update"
                      method="post" enctype="multipart/form-data" id="spform">
                    {/literal}
                    <!-- =================================================   -->
                  <div class="form-group">
                        <label class="col-lg-2 control-label">
                            {if $showData->status == 1}رقم القضية{else}رقم الدعوى{/if}
                        </label>
                        <div class="col-lg-4">
                            <span id="sprytextfield1">
                                <input type="text" name="num" id="num" class="form-control" value="{$showData->case_num}">
                                <span class="textfieldRequiredMsg">*</span>
                            </span>
                        </div>
                    </div>
                        <!--==============================-->
                 <div class="form-group">
                        <label class="col-lg-2 control-label">المحامي المختص</label>
                        <div class="col-lg-4">
                            
                            <select name="lawyer_id" id="lawyer_id" class="select2 wdt100">
                                <option value="">اختر المحامي</option>
                                {foreach $lawyers as $lawyer}
                                    <option value="{$lawyer->id}" {if $showData->lawyer_id == $lawyer->id}selected{/if}>
                                        {$lawyer->name}
                                    </option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                        <!--==============================-->
                 <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 == $member->id}selected{/if}>
                                        {$member->member_name}
                                    </option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                        <!--==============================-->
                     <div class="form-group">
                        <label for="announcementEvaluation" class="col-lg-2 control-label">حالة القضية</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" name="status" id="status2" class="radioR" value="0" {if $showData->status == 0}checked{/if}>
                                    جارية </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" name="status" id="status1" class="radioR" value="1" {if $showData->status == 1}checked{/if}>
                                    تم الحكم فيها </label>
                            </div>
                        </div>
                    </div>


                   <div class="form-group">
                        <label class="col-lg-2 control-label">الخصوم</label>
                        <div class="col-lg-4">
                            <input type="text" name="opponents" class="form-control" value="{$showData->opponents}">
                        </div>
                    </div>
                      <!--==============================-->
                    <div class="form-group">
                        <label class="col-lg-2 control-label">الموضوع</label>
                        <div class="col-lg-8">
                            <textarea name="subject" class="form-control" rows="4">{$showData->subject}</textarea>
                        </div>
                    </div>
                     <!--==============================-->
                    <div class="form-group">
                        <label class="col-lg-2 control-label">قرار المحكمة</label>
                        <div class="col-lg-8">
                            <textarea name="court_decision" class="form-control" rows="3">{$showData->decision}</textarea>
                        </div>
                    </div>
                     <!--==============================-->
                        <div class="form-group">
                        <label for="announcementEvaluation" class="col-lg-2 control-label">مكان حفظ الملف</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" name="place" id="place" class="radioR" value="in" {if $showData->place == in}checked{/if}>
                                    داخل الجمعية </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" name="place" id="place" class="radioR" value="out" {if $showData->place== out}checked{/if}>
                                    خارج الجمعية </label>
                            </div>
                        </div>
                    </div>
                    <!--==============================-->
                     <div class="form-group">
                        <label class="col-lg-2 control-label">ملاحظات</label>
                        <div class="col-lg-8">
                            <textarea name="notes" class="form-control" rows="2">{$showData->notes}</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/Cases/{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}