<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">

                <form class="form-horizontal" action="policyController.php?do=add" method="post">
                    <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="" />
                        </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="عدد الطرود" />
                                <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">ادخل
                                    رقم مناسب.</span></span>


                        </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="رقم البوليصة" />
                                <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" value="{$today}"
                                    placeholder="التاريخ" />
                                <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="سعر البوليصة" />
                                    <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="type" class="col-lg-2 control-label">التاثير فى الخزنة الان</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" id="affectSave" name="affectSave" value="0" checked>
                                    نعم
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" id="affectSave" name="affectSave" value="1">
                                    لا
                                </label>
                            </div>
                        </div>
                    </div>


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




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

                            <span id="spryselect1">
                                <select class="select2 wdt100" name="companyId" id="companyId">
                                    <option value="-1">اختر شركة</option>

                                    {foreach $shippercompaniesData as $shippercompanies}

                                    <option value="{$shippercompanies->companyId}">{$shippercompanies->companyName}
                                    </option>
                                    {/foreach}

                                </select>
                                <span class="selectInvalidMsg"> *</span></span>

                        </div>
                    </div>

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


                    <div class="form-group">
                        <label for="policyType" class="col-lg-2 control-label">نوع البوليصة</label>
                        <div class="col-lg-4">
                            <span id="spryselect2">
                                <select name="policyType" id="policyType" class="select2 wdt100">
                                    <option value="-1">اختر النوع</option>
                                    <option value="1">ذهاب</option>
                                    <option value="2">عودة</option>
                                </select>
                                <span class="selectInvalidMsg">*</span></span>
                        </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" class="senderType" id="cusType" name="type" value="1">
                                    عملاء
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" class="senderType" id="supType" name="type" value="2">
                                    موردين
                                </label>
                            </div>
                        </div>
                    </div>

                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="SenderName" class="col-lg-2 control-label">الاسم</label>
                        <div id="SenderNameDiv">
                            <div class="col-lg-4"><span id="spryselect3">
                                    <select id="" name="" data-placeholder="اختر اسم" class="select2 wdt100"
                                        tabindex="3">
                                        <option value="-1">اختر اسم</option>
                                    </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>-->
                            </div>
                        </div>
                        <input type="hidden" name="SenderId" id="SenderId" value="">
                        <input type="hidden" name="SenderName" id="SenderName" value="">
                        <div id="cDiv" class="hidden">
                            <input type="hidden" id="clientsearchvalue"
                                value="{$Programsettingdata->clientsearchvalue}" />
                            <div class="col-lg-4"><span id="sprytextfield6">
                                    <div id="clientDiv">
                                        <input type="hidden" name="clientid" id="clientid"
                                            class="select2Client wdt100 sender" />
                                    </div>
                                    <span class="textfieldRequiredMsg">*</span>
                                </span>
                                <input type="hidden" id="oldclientid" />
                                <input type="hidden" id="oldclientname" />
                            </div>
                        </div>
                        <div id="sDiv" class="hidden">
                            <input type="hidden" id="clientsearchvalue"
                                value="{$Programsettingdata->clientsearchvalue}" />
                            <div class="col-lg-4"><span id="sprytextfield7">
                                    <div id="suppDiv">
                                        <input type="hidden" name="suppid" id="suppid"
                                            class="select2Supp wdt100 sender" />
                                    </div>
                                    <span class="textfieldRequiredMsg">*</span>
                                </span>
                            </div>
                            <input type="hidden" id="oldsuppid" />
                            <input type="hidden" id="oldsuppname" />
                        </div>
                    </div>





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

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="submit" class="btn btn-primary pull-left" id="submtBtn">حفظ الامر</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 spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", { isRequired: false, invalidValue: "-1" });
    var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");

    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", { isRequired: false, invalidValue: "-1" });

    var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", { invalidValue: "-1" });

    $(".senderType").on('change', function () {
        var val = $('input[name="type"]:checked').val();
        if (val == 1 || val == 2) {
            spryselect3.destroy();
        }
        $('#SenderName').val();
        $('#SenderId').val();
    });
</script>

{/literal}