<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">مراسلات بين الادارات</a></li>
            <li><a href="messages.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="messages.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="employee[]" id="employee" multiple data-placeholder="اختر الموظف" class="select2 wdt100">
                                    <option value="-1">اختر الموظف</option>
                                    {foreach $employees as $employee}
                                        <option value="{$employee.employeename}" {if $showData.employee|strpos:$employee.employeename !== false }selected{/if}  >{$employee.employeename}</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="subject" id="subject" class="form-control" value="{$showData->subject}" />
                                <span class="textfieldRequiredMsg">*</span></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="details" id="details" class="form-control" value="{$showData->details}" />
                                <span class="textfieldRequiredMsg">*</span></span>
                        </div>
                    </div>
                    <!--==============================-->
                     
                    <!--==============================-->
                      <div class="form-group">
                        <label class="col-lg-2 control-label">ارفاق 1</label>
                        <div class="col-lg-4">
                            {if $showData->first_image != "" && $showData->first_image !="." &&
                            $showData->first_image !="no image"}
                            <div style="margin-bottom: 10px;">
                            {assign var="imgs" value=","|explode:trim($showData->first_image)}
                            {foreach $imgs as $img}
                                <img src="../upload/messages/{trim($img)}" width="80" height="60" style="border:1px solid #ccc; margin-left:5px;" />
                                
                            {/foreach}
                            </div>
                            {/if}
                            <input type="file" name="image[]" id="image" multiple  accept=".jpg, .jpeg, .png, .pdf"/>
                            <input type="hidden" name="imageurl" id="imageurl" value="{$showData->first_image}" />
                        </div>
                    </div>
                <!--==============================-->
                 <div class="form-group">
                    <label class="col-lg-2 control-label">ارفاق 2</label>
                    <div class="col-lg-4">
                        {if $showData->sec_image != "" && $showData->sec_image != "no image"}
                            <div style="margin-bottom: 10px;">
                                {assign var="etihads" value=","|explode:$showData->sec_image}
                                {foreach $etihads as $e}
                                    {if $e|trim != ""}
                                        <img src="../upload/messages/{$e|trim}" width="80" height="60" style="border:1px solid #ccc; margin-left:5px;" />
                                    {/if}
                                {/foreach}
                            </div>
                        {/if}
                        <input type="file" name="etihadimg[]" id="etihadimg" multiple  accept=".jpg, .jpeg, .png, .pdf" />
                        <input type="hidden" name="oldetihadimg" value="{$showData->sec_image}" />
                    </div>
                    </div>
                    <!--==============================-->
                   <div class="form-group">
                    <label class="col-lg-2 control-label">ارفاق 3</label>
                    <div class="col-lg-4">
                        {if $showData->therd_image != "" && $showData->therd_image != "no image"}
                            <div style="margin-bottom: 10px;">
                                {assign var="ids" value=","|explode:$showData->therd_image}
                                {foreach $ids as $id_file}
                                    {if $id_file|trim != ""}
                                        <img src="../upload/messages/{$id_file|trim}" width="80" height="60" style="border:1px solid #ccc; margin-left:5px;" />
                                    {/if}
                                {/foreach}
                            </div>
                        {/if}
                        <input type="file" name="idimg[]" id="idimg" multiple  accept=".jpg, .jpeg, .png, .pdf" />
                        <input type="hidden" name="oldidimg" value="{$showData->therd_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}