  <!--**********************************
           strat modals
        ***********************************-->


        <!-- Modal Add Supplier -->
    <div class="modal fade " id="addTank" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="addTank" aria-hidden="true">
        <div class="modal-dialog modal-lg modal-simple modal-add-new-address form-validation">
          <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title"><strong>إضافة مورد جديد </strong></h4>
            </div>
            <div class="modal-body">
                     <form id="addSupplirs" method="POST" action="<?php echo e(route('storeClint')); ?>" class="row g-3 fv-plugins-bootstrap5 fv-plugins-framework needs-validation" novalidate>
                      <?php echo csrf_field(); ?>
                      <div class="row">
                      <div class="col-12 col-md-6 fv-plugins-icon-container">
                          <label class="form-label" for="name">الاسم</label>
                          <input type="text" id="validationCustom01" value="<?php echo e(old('name')); ?>" name="name" class="form-control text" placeholder="الرجاء ادخال الاسم" required="">
                          <p id="alert" class="massege"></p>
                          <div class="fv-plugins-message-container invalid-feedback ">
                         يرجاء ادخال الاسم
                          </div>
                          <?php $__errorArgs = ['name'];
$__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 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" required="">
                            <option value="" selected disabled>اختار نوع الحساب</option>
                              <option value="0">بترول</option>
                              <option value="1">ديزل</option>
                          </select>
                          <div class="fv-plugins-message-container invalid-feedback ">
                           يرجاء ادخال نوع الحساب
                          </div>
                          <?php $__errorArgs = ['accountType'];
$__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>
                      <input type="hidden" value="6" name="role" required="">

                      <div class="col-12 col-md-6 fv-plugins-icon-container">
                          <label class="form-label" for="phone">رقم الهاتف او الجوال</label>
                          <input type="tel" id="phone" value="<?php echo e(old('phone')); ?>" name="phone" class="form-control" placeholder="الرجاء ادخال رقم الهاتف او  الجوال" required="">
                          <p id="alertPhone" class="massege"></p>
                          <div class="fv-plugins-message-container invalid-feedback ">
                          يرجاء ادخال رقم الموبايل او الهاتف
                          </div>
                          <?php $__errorArgs = ['phone'];
$__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 class="col-12 col-md-6 fv-plugins-icon-container">
                          <label class="form-label" for="address">العنوان</label>
                          <input type="text" id="address" value="<?php echo e(old('address')); ?>" name="address" class="form-control text" placeholder="الرجاء ادخال اللعنوان" required="">
                          <p id="alertAddress" class="massege"></p>
                          <div class="fv-plugins-message-container invalid-feedback ">
                           يرجاء ادخال العنوان
                          </div>
                          <?php $__errorArgs = ['address'];
$__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="modal-footer">
                        <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>
        <!-- End Modal Add Supplier -->

      
      <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="addSupplirs" method="POST" action="<?php echo e(route('updateClint')); ?>" class="row g-3 fv-plugins-bootstrap5 fv-plugins-framework needs-validation" novalidate>
                            <?php echo csrf_field(); ?>
                            <input type="hidden" name="id" id="id">
                            <div class="col-12 col-md-6 fv-plugins-icon-container">
                                <label class="form-label" for="name">الاسم</label>
                                <input type="text" value="<?php echo e(old('name')); ?>" id="nameSuppliers" name="name" class="form-control text" placeholder="الرجاء ادخال الاسم" required="">
                                <p id="alert" class="massege"></p>
                                <div class="fv-plugins-message-container invalid-feedback ">
                            يرجاء ادخال الاسم
                                </div>
                                <?php $__errorArgs = ['name'];
$__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 class="col-12 col-md-6 fv-plugins-icon-container">
                                <label class="form-label" for="accountType">نوع الحساب</label>
                                <select id="type" name="accountType" class="form-control" required="">
                                <option value="" selected disabled>اختار نوع الحساب</option>
                                    <option value="0">بترول</option>
                                    <option value="1">ديزل</option>
                                </select>
                                <div class="fv-plugins-message-container invalid-feedback ">
                                يرجاء ادخال نوع الحساب
                                </div>
                                <?php $__errorArgs = ['accountType'];
$__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>

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

                            <div class="col-12 col-md-6 fv-plugins-icon-container">
                                <label class="form-label" for="phone">رقم الهاتف او الجوال</label>
                                <input type="tel" value="<?php echo e(old('phone')); ?>" id="phoneSuppliers" name="phone" class="form-control" placeholder="الرجاء ادخال رقم الهاتف او  الجوال" required="">
                                <p id="alertPhone" class="massege"></p>
                                <div class="fv-plugins-message-container invalid-feedback ">
                                يرجاء ادخال رقم الموبايل او الهاتف
                                </div>
                                <?php $__errorArgs = ['phone'];
$__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 class="col-12 col-md-6 fv-plugins-icon-container">
                                <label class="form-label" for="address">العنوان</label>
                                <input type="text" id="addressSuppliers" value="<?php echo e(old('address')); ?>" name="address" class="form-control text" placeholder="الرجاء ادخال اللعنوان" required="">
                                <p id="alertAddress" class="massege"></p>
                                <div class="fv-plugins-message-container invalid-feedback ">
                                يرجاء ادخال العنوان
                                </div>
                                <?php $__errorArgs = ['address'];
$__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 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>


       
       <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"> ايقاف مورد</h3>
                <p class="address-subtitle text-danger">هل انت متأكد من ايقاف هذا المورد</p>
                </div>
                <form id="addNewAddressForm" method="GET" action="<?php echo e(route('toggleClint')); ?>" 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 btn-danger 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>


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

    const edit =document.querySelectorAll('.edit');
    document.querySelectorAll('.edit').forEach(item => {
            item.addEventListener('click', e => {
            document.getElementById("id").value =item.dataset.id;
            document.getElementById("nameSuppliers").value =item.dataset.name;
            document.getElementById("addressSuppliers").value =item.dataset.address;
            document.getElementById("phoneSuppliers").value =item.dataset.phone;
            let type = item.dataset.type.split("-");
            const selectType = document.querySelector("#type");

            for(var i=0; i < selectType.options.length; i++)
            {
                    console.log(selectType.options[i].text);
                    if(selectType.options[i].text === type[1])
                    {
                        selectType.selectedIndex = i;
                        break;
                    }
            }
            $('#editModal').modal('show');
        })
    })

    //toggle modal
    const toggle =document.querySelectorAll('.toggle');
    document.querySelectorAll('.toggle').forEach(item => {
            item.addEventListener('click', e => {
            console.log(item.dataset.id);
            const id = item.dataset.id;
            document.getElementById("id_toggle").value =item.dataset.id;
            $('#toggleModal').modal('show');
        })
    })
  </script>
<?php /**PATH C:\Users\Nasser\Desktop\petrol_store\resources\views/supplier/modals.blade.php ENDPATH**/ ?>