<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">المناقصات</a></li>
            <li><a href="extracts.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="extracts.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-9">
                            <select name="request" id="request" class="select2 " required>
                                <option value="-1">--- اختر (العضو - العملية - الجهة ) ---</option>
                                {foreach $requests as $req}
                                    <option value="{$req.site_id}">
                                       العضو: {$req.member_name} |
                                       العملية: {$req.tender_name} |
                                     
                                      الجهة: {$req.the_issuing_entity}
                                      
                                    </option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                   
                    
                    <!--==============================-->
                      <div class="form-group">
                        <label for="people" class="col-lg-2 control-label">قوي عاملة</label>
                        <div class="col-lg-4">
                           <input type="number" step="any" name="people"  class="form-control">
                        </div>
                    </div>
                    <!--==============================-->
                      <div class="form-group">
                        <label for="insurance" class="col-lg-2 control-label">تأمينات</label>
                        <div class="col-lg-4">
                           <input type="number" step="0.01" name="insurance"  class="form-control">
                        </div>
                    </div>
                    <!--==============================-->
                      <div class="form-group">
                        <label for="value" class="col-lg-2 control-label">قيمة المستخلص</label>
                        <div class="col-lg-4">
                           <input type="number" step="0.01" name="value"  class="form-control">
                        </div>
                    </div>
                    <!--==============================-->
                      <div class="form-group">
                        <label for="value" class="col-lg-2 control-label">تاريخ المستخلص</label>
                        <div class="col-lg-2">
                           <input type="date" step="0.01" name="date"  class="form-control">
                        </div>
                    </div>
                    <!--==============================-->
                      <div class="form-group">
                        <label for="notes" class="col-lg-2 control-label">تعليق</label>
                        <div class="col-lg-4">
                            <textarea name="comment" id="comment" class="form-control" rows="3" ></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 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");
            var myForm = document.getElementById("spform");
            var SS = Spry.Widget.Form.validate(myForm);
            if (SS == true) {
                myForm.submit();
            } else {
                $('#spbutton').removeClass("processing");
            }
        }
    });
$(document).ready(function() {
    $('#nature').on('change', function() {
        if ($(this).val() === 'other') {
            $('#other_input_container').show();
        } else {
            $('#other_input_container').hide(); 
            $('#other_nature').val(''); 
        }
    });
});
$(document).ready(function(){
    $('#name').on('change', function() {
        let sideValue = $(this).find(':selected').data('side');
        if (sideValue) {
                $('#side').val(sideValue);
            } else {
                $('#side').val(''); 
            }
        });
})
</script>
{/literal}