

<div class="row">
    <div class="container">

        <ol class="breadcrumb">
            <li><a href="#">خصائص عامة</a></li>
            <li><a href="policyController.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" action="policyController.php?do=update" method="post" onsubmit="if (Spry.Widget.Form.validate(this)) {
                            checkNameWithId(event, 'policy', 'policyName', 'policyId');
                            return true;
                        } else {
                            return false;
                        }">
                    <!--validate the form before checking name-->
                    {/literal}
                    <div class="form-group">
                        <label for="invoicenumber" class="col-lg-2 control-label"> رقم الفاتوره </label>
                        <div class="col-lg-4">
                            <input type="text" name="invoicenumber" id="invoicenumber" class="form-control" placeholder="رقم الفاتوره " required=""  value="{$loadData->invoicenumber}" />
                        </div>
                    </div>



                    <div class="form-group">
                        <label for="policyName" class="col-lg-2 control-label"> عدد الطرود</label>
                        <div class="col-lg-4"><span id="sprytextfield1">
                                <input type="text" name="policyName" id="policyName" class="form-control" placeholder="عدد الطرود" value="{$loadData->policyName}" />
                                <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg"> ادخل رقم مناسب.</span></span>

                            <div id="nameError" class="alert alert-block alert-danger fade in" style="display:none">
                                <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">&times;</button>
                                <h4>رسالة خطأ</h4>
                                <p>هذا الإسم مستخدم من قبل</p>
                                <div class="clearfix"></div>
                            </div>


                        </div>
                    </div>

                    <!-- =================================================   -->


                    <div class="form-group">
                        <label for="policyNum" class="col-lg-2 control-label">رقم البوليصة</label>
                        <div class="col-lg-4">
                            <span id="sprytextfield2">
                                <input type="text" name="policyNum" id="policyNum"  class="form-control numberinput" placeholder="رقم البوليصة" value="{$loadData->policyNum}" />
                                <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل الرقم صحيح</span></span>
                        </div>
                    </div>

                    <!-- =================================================   -->



                    <div class="form-group">
                        <label for="policyDate" class="col-lg-2 control-label">التاريخ</label>
                        <div class="col-lg-4">
                            <span id="sprytextfield3">
                                <input type="text" name="policyDate" id="policyDate"  class="form-control awdatepicker" autocomplete="off"  data-date-format="yyyy-mm-dd"  placeholder="التاريخ" value="{$loadData->policyDate}" />
                                <span class="textfieldRequiredMsg">*</span></span>
                        </div>
                    </div>

                    <!-- =================================================   -->


                    <div class="form-group">
                        <label for="policyCost" class="col-lg-2 control-label">سعر البوليصة</label>
                        <div class="col-lg-4">


                            <div class="input-group">
                                <span id="sprytextfield4">
                                    <input type="text" name="policyCost" id="policyCost"  class="form-control numberinput" placeholder="سعر البوليصة" value="{$loadData->policyCost}" readonly/>
                                    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل السعر صحيح</span></span>

                                <span class="input-group-addon">{$currency}</span>
                            </div>


                        </div>
                    </div>


                    <!-- =================================================   -->




                    <div class="form-group">
                        <label for="companyId" class="col-lg-2 control-label">شركة الشحن</label>
                        <div class="col-lg-4">


                            <select class="select2 wdt100" name="companyId" id="companyId">

                                {foreach $shippercompaniesData as $shippercompanies}

                                <option  {if {$loadData->companyId} eq {$shippercompanies->companyId}} selected {/if} value="{$shippercompanies->companyId}">{$shippercompanies->companyName}</option>
                                {/foreach}

                            </select>


                        </div>
                    </div>

                    <!-- =================================================   -->


                    <div class="form-group">
                        <label for="policyType" class="col-lg-2 control-label">نوع البوليصة</label>
                        <div class="col-lg-4">

                            <select name="policyType" id="policyType"  class="select2 wdt100">

                                <option {if {$loadData->policyType} eq 1} selected {/if}  value="1">ذهاب</option>
                                <option {if {$loadData->policyType} eq 2} selected {/if}  value="2">عودة</option>
                            </select>
                        </div>
                    </div>



                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="type" class="col-lg-2 control-label">النوع</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" id="cusType" name="type" value="1" {if $loadData->senderType eq 1}checked{/if}>
                                    عملاء
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" id="supType" name="type" value="2" {if $loadData->senderType eq 2}checked{/if}>
                                    موردين
                                </label>
                            </div>
                        </div>
                    </div>

                    <!-- ================================================= -->
                    <div class="form-group">
                        <label for="SenderName" class="col-lg-2 control-label">الاسم</label>
                        <div class="col-lg-4"><span id="spryselect3">
                                <select id="SenderName" name="SenderName" data-placeholder="اختر اسم" class="select2 wdt100"  tabindex="3">
                                    <option value="-1">اختر اسم</option>
                                    {if $customerData}

                                    {foreach $customerData as $data}
                                    <option value="{$data->clientname}" {if $data->clientname eq $loadData->senderName}selected{/if}>{$data->clientname}</option>
                                    {/foreach}

                                    {else}

                                    {foreach $suppliersData as $data}
                                    <option value="{$data->suppliername}" {if $data->suppliername eq $loadData->senderName}selected{/if}>{$data->suppliername}</option>
                                    {/foreach}

                                    {/if}
                                </select>
                                <span class="selectInvalidMsg">*</span><span class="selectRequiredMsg">*</span></span>
                            <!--<span id="sprytextfield5">
                            <input type="text" name="SenderName" id="SenderName" class="form-control" placeholder="اسم الراسل" />
                          <span class="textfieldRequiredMsg">*</span></span>-->
                            <input type="hidden" name="SenderId" id="SenderId" value="{$loadData->senderId}">
                        </div>
                    </div>





                    <!-- =================================================   -->

                    <input type="hidden" name="policyId" id="policyId" value="{$loadData->policyId}"/>
                    <input type="hidden" name="tempdele" id="tempdele" value="{$loadData->tempdele}"/>
                    <input type="hidden" name="saveId" id="saveId" value="{$loadData->saveId}"/>

                    <!-- =================================================   -->

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="submit"  class="btn btn-primary pull-left">حفظ الامر</button>
                        </div>
                    </div>




                </form>
            </div>
        </div>




    </div>
</div>



{literal}

<script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "real");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "integer");
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "real");
    var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");

</script>

{/literal}

