
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">المناقصات</a></li>
            <li><a href="technicalOpenion.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="technicalOpenion.php?do=add"
                      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-6"><span id="spryselect1">
                            <span>
                                <select name="num" id="num" data-placeholder="اختر الطلب" class="select2 wdt100">
                                    <option value="-1">اختر العملية للمعاينة الفنية</option>
                                    {foreach $requests as $request}
                                        <option value="{$request.bo_id}">
                                            {$request.tender_name} —  {$request.member_name}
                                        </option>
                                    {/foreach}
                                </select>
                            </span><span class="selectRequiredMsg">*</span></span>
                        </div>
                    </div>
                    <!--==============================-->
                    <div class="form-group">
                        <label for="announcmentTerms"
                               class="col-lg-2 control-label"> الرأي الفني</label>
                        <div class="col-lg-10">
                            <textarea class="form-control " rows="3" name="openion"></textarea>
                        </div>
                    </div>
                     <!--==============================-->
                       <div class="form-group">
                        <label class="col-lg-2 control-label"> مرفقات</label>
                        <div class="col-lg-4">
                            <input type="file" name="image[]" id="image" multiple accept=".jpg, .jpeg, .png, .pdf" />
                        </div>
                    </div>
                    <!--==============================-->
                    <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 spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", { 
        invalidValue: "-1", 
        validateOn: ["blur", "change"] 
    });

    $(document).ready(function() {
        $('#num').on('change', function() {
            spryselect1.validate(); 
        });
    });
    $(document).on('click', '#spbutton', function (e) {
        var myForm = document.getElementById("spform");
        
        var isFormValid = Spry.Widget.Form.validate(myForm);

        if (isFormValid) {
           
            if (!$('#spbutton').hasClass("processing")) {
                $('#spbutton').addClass("processing");
                myForm.submit();
            }
        } else {
           
            $('#spbutton').removeClass("processing");
            alert("برجاء اختيار العملية");
        }
    });
</script>
{/literal}
