
<div class="modal fade" id="addTank" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" style="z-index: 11;">
    <div class="modal-dialog modal-lg modal-simple modal-add-new-address">
        <div class="modal-content">
        <div class="modal-body">
            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            <div class="text-center mb-4">
                <h3 class="address-title">اضافة توريد جديد</h3>
                <p class="address-subtitle">الرجاء تعبيئة جميع البيانات</p>
            </div>
            <form id="addNewAddressForm"  class="row g-3 fv-plugins-bootstrap5 fv-plugins-framework needs-validation"  novalidate="" method="POST" action="<?php echo e(route('storeSupply')); ?>">
                <?php echo csrf_field(); ?>
                <div class="row">
                    <div class="col-xl-6">
                        <div class="mb-3 row">
                            <label class="col-lg-12 col-form-label" for="validationCustom01">اسم المورد<span class="text-danger">*</span>
                            </label>
                            <div class="col-lg-12">
                                <select class="form-control form-white" data-placeholder="Choose a color..." name="supplierName" required>
                                    <option disabled="disabled" selected value="">الرجاء اختيار احد الموردين</option>
                                    <?php $__currentLoopData = $niceNames; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $niceName): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($niceName); ?>"><?php echo e($niceName); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                                <div class="invalid-feedback">
                                    يرجاء ادخال اسم المورد
                                </div>
                                <?php $__errorArgs = ['supplierName'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-danger px-2 showModalAdd ">
                                  <?php echo e($message); ?>

                                </div>
                              <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                            
                        </div>
                        <div class="mb-3 row">
                            <label class="col-lg-12 col-form-label" for="validationCustom02">ملاحظة لعملية التوريد<span class="text-danger">*</span>
                            </label>
                            <div class="col-lg-12">
                                <input name="notice" value="<?php echo e(old('notice')); ?>" type="text" class="form-control form-control-sm" id="validationCustom02" placeholder="ادخل  ملاحظة " required="">
                                <div class="invalid-feedback">
                                    الرجاء ادخال  ملاحظة لعملية التوريد
                                </div>
                                <?php $__errorArgs = ['notice'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-danger px-2 showModalAdd ">
                                  <?php echo e($message); ?>

                                </div>
                              <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>
                    </div>
                    
                    <div class="col-xl-6">
                        <div class="mb-3 row">
                            <label class="col-lg-12 col-form-label" for="validationCustom05">النوع
                                <span class="text-danger">*</span>
                            </label>
                            <div class="col-lg-12">
                            <select class="form-control form-white" data-placeholder="Choose a color..." name="type" required>
                            <option disabled="disabled" selected value="">الرجاء اختيار  نوع الكمية</option>
                            <option value="0">بترول</option>
                            <option value="1">ديزل</option> 
                        </select>
                        <div class="invalid-feedback">
                            يرجاء تحديد نوع المشتقات
                        </div>
                        <?php $__errorArgs = ['type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <div class="text-danger px-2 showModalAdd ">
                          <?php echo e($message); ?>

                        </div>
                      <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                        </div>
                        <div class="mb-3 row">
                            <label class="col-lg-12 col-form-label" for="validationCustom06">الكمية
                                <span class="text-danger">*</span>
                            </label>
                            <div class="col-lg-12">
                                <input name="quantity" type="number" class="form-control" id="validationCustom06" placeholder="ادخل الكمية.." required="">
                                <div class="invalid-feedback">
                                    يرجاء ادخل الكمية بشكل صحيح
                                </div>
                                <?php $__errorArgs = ['quantity'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger px-2 showModalAdd ">
                                    <?php echo e($message); ?>

                                    </div>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>
                        </div>
                    </div>
                <div class="col-12 text-center"> 
                <button type="button" class="btn  btn-outline-primary  me-1" data-bs-toggle="modal" data-bs-target="#addSuplier">
                    <i class="mdi mdi-plus-circle ms-2"></i>اضافة مورد جديد 
                </button>	
                <button type="submit" class="btn btn-primary me-sm-3 me-1">حفظ</button>
                <button type="reset" class="btn btn-label-secondary" data-bs-dismiss="modal" aria-label="Close">الغاء</button>
                </div>
                <input type="hidden">
            </form>
            </div>
        </div>
    </div>
    </div>

<div class="modal fade " id="addSuplier" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="addSuplier" aria-hidden="true">
    <div class="modal-dialog modal-lg modal-simple modal-add-new-address">
    <div class="modal-content">
        <div class="modal-body">
            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            <div class="text-center mb-4">
                <h3 class="address-title">اضافة مورد جديد</h3>
                <p class="address-subtitle">يرجى تعبيئة جميع البيانات</p>
            </div>
            <form id="addNewAddressForm" method="POST" action="<?php echo e(route('storeClint')); ?>" class="row g-3 fv-plugins-bootstrap5 fv-plugins-framework"  novalidate="novalidate">
                <?php echo csrf_field(); ?>
                <div class="col-12 col-md-6 fv-plugins-icon-container">
                    <label class="form-label" for="name">الاسم</label>
                    <input type="text" id="name" name="name" class="form-control" placeholder="يرجى ادخال الاسم">
                    <div class="fv-plugins-message-container invalid-feedback">
                    
                    </div>
                </div>
                <div class="col-12 col-md-6 fv-plugins-icon-container">
                    <label class="form-label" for="accountType">نوع الحساب</label>
                    <select id="accountType" name="accountType" class="form-control">
                        <option value="0">بترول</option>
                        <option value="1">ديزل</option>
                    </select>
                    <div class="fv-plugins-message-container invalid-feedback">
                        
                    </div>
                </div>

                <input type="hidden" value="6" name="role">

                <div class="col-12 col-md-6 fv-plugins-icon-container">
                    <label class="form-label" for="phone">رقم الهاتف او الجوال</label>
                    <input type="tel" id="phone" name="phone" class="form-control" placeholder="يرجى ادخال رقم الهاتف او  الجوال">
                    <div class="fv-plugins-message-container invalid-feedback">
                    
                    </div>
                </div>
                <div class="col-12 col-md-6 fv-plugins-icon-container">
                    <label class="form-label" for="address">العنوان</label>
                    <input type="text" id="address" name="address" class="form-control" placeholder="يرجى ادخال اللعنوان">
                    <div class="fv-plugins-message-container invalid-feedback">
                    
                    </div>
                </div>
                <div class="col-12 text-center">
                <button type="submit" class="btn btn-primary me-sm-3 me-1">اضافة</button>
                <button type="reset" class="btn btn-label-secondary" data-bs-dismiss="modal" aria-label="Close">الغاء</button>
                </div>

            </form>



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

 
 <div class="modal fade" id="editModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="modalEdit" aria-hidden="true">
    <div class="modal-dialog modal-lg modal-simple modal-add-new-address">
        <div class="modal-content">
            <div class="modal-body">
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                <div class="text-center mb-4">
                <h3 class="address-title">التعديل على التوريدة</h3>
                <p class="address-subtitle">الرجاء التحقق من جميع الحقول</p>
            </div>
            <form id="addNewAddressForm"  class="row g-3 fv-plugins-bootstrap5 fv-plugins-framework needs-validation"  novalidate="" method="POST" action="<?php echo e(route('update_supply')); ?>">
                <?php echo csrf_field(); ?>
                <div class="row">
                    <div class="col-xl-6">
                        <div class="mb-3 row">
                            <label class="col-lg-12 col-form-label" for="validationCustom01">اسم المورد<span class="text-danger">*</span>
                            </label>
                            <div class="col-lg-12">
                                <select id="suplierId" class="form-control form-white" data-placeholder="Choose a color..." name="supplierName" required>
                                    <option disabled="disabled" selected value="">الرجاء اختيار احد الموردين</option>
                                    <?php $__currentLoopData = $niceNames; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $niceName): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($niceName); ?>"><?php echo e($niceName); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                                <div class="invalid-feedback">
                                    يرجاء ادخال اسم المورد
                                </div>
                                <?php $__errorArgs = ['supplierName'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-danger px-2 showModalEdit ">
                                  <?php echo e($message); ?>

                                </div>
                              <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                            
                        </div>
                        <div class="mb-3 row">
                            <label class="col-lg-12 col-form-label" for="validationCustom02">ملاحظة لعملية التوريد<span class="text-danger">*</span>
                            </label>
                            <div class="col-lg-12">
                                <input name="notice" value="<?php echo e(old('notice')); ?>" type="text" class="form-control form-control-sm" id="notice" placeholder="ادخل عدد ملاحظة " required="">
                                <div class="invalid-feedback">
                                    الرجاء ادخال  ملاحظة لعملية التوريد
                                </div>
                                <?php $__errorArgs = ['notice'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-danger px-2 showModalEdit ">
                                  <?php echo e($message); ?>

                                </div>
                              <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>
                    </div>
                    
                    <div class="col-xl-6">
                        <div class="mb-3 row">
                            <label class="col-lg-12 col-form-label" for="validationCustom05">النوع
                                <span class="text-danger">*</span>
                            </label>
                            <div class="col-lg-12">
                            <select id="type" class="form-control form-white" data-placeholder="Choose a color..." name="type" required>
                            <option disabled="disabled" selected value="">الرجاء اختيار  نوع الكمية</option>
                            <option value="0">بترول</option>
                            <option value="1">ديزل</option> 
                        </select>
                        <div class="invalid-feedback">
                           يرجاء تحديد نوع المشتقات
                        </div>
                        <?php $__errorArgs = ['type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <div class="text-danger px-2 showModalEdit ">
                          <?php echo e($message); ?>

                        </div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                        </div>
                        <div class="mb-3 row">
                            <label class="col-lg-12 col-form-label" for="validationCustom06">الكمية
                                <span class="text-danger">*</span>
                            </label>
                            <div class="col-lg-12">
                                <input name="quantity" type="number" value="<?php echo e(old('quantity')); ?>" class="form-control" id="quantity" placeholder="ادخل الكمية.." required="">
                                <div class="invalid-feedback">
                                    يرجاء ادخل الكمية بشكل صحيح
                                </div>
                                <?php $__errorArgs = ['quantity'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger px-2 showModalEdit ">
                                    <?php echo e($message); ?>

                                    </div>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>
                        </div>
                    </div>
              <div class="col-12 text-center"> 
                <button type="submit" class="btn btn-primary me-sm-3 me-1">تعديل</button>
                <button type="reset" class="btn btn-label-secondary" data-bs-dismiss="modal" aria-label="Close">الغاء</button>
              </div>
              <input type="hidden" id="id" name="id">
            </form>
            </div>
            </div>
        </div>
    </div>
</div>



<div class="modal fade" id="toggleModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="modalEdit" aria-hidden="true">
    <div class="modal-dialog modal-lg modal-simple modal-add-new-address">
    <div class="modal-content">
        <div class="modal-body">
            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            <div class="text-center mb-4">
                <h3 class="address-title" id="header">تعليق هذه التوريدة</h3>
                <p class="address-subtitle text-danger" id="content">هل انت متأكد من تعليق هذه التوريدة</p>
            </div>
            <form id="addNewAddressForm" method="GET" action="<?php echo e(route('toggle_supply')); ?>" class="row g-3 fv-plugins-bootstrap5 fv-plugins-framework needs-validation" novalidate="">
                <?php echo csrf_field(); ?>
            <input type="hidden" name="id" id="id_toggle">
            <div class="col-12 text-center">
                <button type="submit" class="btn  me-sm-3 me-1 " id="btncomfirm">نعم</button>
                <button type="reset" class="btn btn-label-secondary" data-bs-dismiss="modal" aria-label="Close">الغاء</button>
            </div>
            </form>
        </div>
    </div>
    </div>
</div>


<?php $__env->startSection('script'); ?>

<script>

// this show modal if is return validation from backend
$(window).on('load', function() {
            showModalAdd = document.querySelectorAll(".showModalAdd");
            console.log(showModalAdd.length);
                    if(showModalAdd.length > 0)
                    $('#addTank').modal('show');

            showModalEdit = document.querySelectorAll(".showModalEdit");
            console.log(showModalEdit.length)
            if(showModalEdit.length > 0)
              $('#editModal').modal('show');
              
            // showModalAddEnd = document.querySelectorAll(".showModalAddEnd");
            // console.log(showModalAddEnd.length)
            // if(showModalAddEnd.length > 0)
            //   $('#addendReading').modal('show');
        });



    //edit modal
    const edit =document.querySelectorAll('.edit');
    document.querySelectorAll('.edit').forEach(item => {
            item.addEventListener('click', e => {
            document.getElementById("id").value =item.dataset.id;
            document.getElementById("notice").value =item.dataset.notice;
            document.getElementById("quantity").value =item.dataset.quantity;
            console.log(item.dataset.type);
            const selectSuplierId = document.querySelector("#suplierId");
            const selectType = document.querySelector("#type");

            for(var i=0; i < selectSuplierId.options.length; i++)
            {
                    if(selectSuplierId.options[i].text === item.dataset.suplier_name)
                    {
                        selectSuplierId.selectedIndex = i;
                        break;
                    }
            }
            
            for(var i=0; i < selectType.options.length; i++)
            {
                    if(selectType.options[i].value === item.dataset.type)
                    {
                        selectType.selectedIndex = i;
                        break;
                    }
            }
                    $('#editModal').modal('show');
                })
            })
      
    </script>

    <script>
        $(document).ready(function () {
        $('table.display').DataTable();
    });
    </script><?php /**PATH C:\Users\Nasser\Desktop\petrol_store\resources\views/supply/modalsSupply.blade.php ENDPATH**/ ?>