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

     




        <!-- Modal Add Pump -->
     <div class="modal fade none-border" id="addPump">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title"><strong>إضافة طرمبة جديدة</strong></h4>
                </div>
            <div class="modal-body">
                <form id="addNewAddressForm" method="POST" action="<?php echo e(route('storePump')); ?>" class="row g-3 fv-plugins-bootstrap5 fv-plugins-framework needs-validation" novalidate>
                    <?php echo csrf_field(); ?>
                    <div class="row">
                    <div class="col-md-12">
                        <label class="form-label" for="tankId">حدد رقم الخزان المرتبط بطرمبة</label>
                        <select id="tankId" name="tankId" class="form-control" required>
                    <option selected id="myId" disabled="disabled" value="">اختار الخزان المرتبط بطرمبة</option>
                            <?php if(isset($tanks)): ?>
                                <?php $__currentLoopData = $tanks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tank): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($tank->id); ?>">
                                        <?php if(isset($tank->type)): ?>
                                        <?php if($tank->type == 0): ?>
                                        الخزان رقم <?php echo e($tank->id); ?> النوع
                                        بترول
                                        <?php else: ?>
                                        الخزان رقم <?php echo e($tank->id); ?> النوع
                                       ديزل
                                        <?php endif; ?>
                                       <?php endif; ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php endif; ?>
                        </select>
                        <div class="fv-plugins-message-container invalid-feedback ">
                            الرجاء اختيار احدى الخزانات
                        </div>
                        <?php $__errorArgs = ['tankId'];
$__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="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>
                  <input type="hidden">
                 </form>
              </div>
          </div>
        </div>

          <!--End Model add Pump-->



<!-- Modal Edit Pump -->
   <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">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title"><strong>تعديل الطرمبة </strong></h4>
            </div>

        <div class="modal-body">
            <form id="addNewAddressForm" method="post" action="<?php echo e(route('updatePump')); ?>" class="row g-3 fv-plugins-bootstrap5 fv-plugins-framework  needs-validation" novalidate>
                <?php echo csrf_field(); ?>
            <div class="row">
                <div class="col-md-12">
                <label class="form-label" for="tankId">حدد رقم الخزان المرتبط بطرمبة</label>
                <select id="tank" name="idTank" class="form-control" required="">
                    <option selected id="myId" disabled="disabled" value="">اختار الخزان المرتبط بطرمبة</option>
                    <?php if(isset($tanks)): ?>
                        <?php $__currentLoopData = $tanks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tank): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($tank->id); ?>">
                                <?php if(isset($tank->type)): ?>
                                <?php if($tank->type == 0): ?>
                                الخزان رقم <?php echo e($tank->id); ?> النوع
                                بترول
                                <?php else: ?>
                                الخزان رقم <?php echo e($tank->id); ?> النوع
                                ديزل
                                <?php endif; ?>
                                <?php endif; ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php endif; ?>
                </select>
                <div class="fv-plugins-message-container invalid-feedback">
                     الرجاء اختيار احدى الخزانات
                </div>
                <?php $__errorArgs = ['tankId'];
$__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); ?>
                <input type="hidden" id="id" name="id" value="">
            </div>
            </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>
    <!--End Model Edit Pump-->

    <!-- Model Stop Pump-->
    <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">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title"><strong>ايقاف طرمبة</strong></h4>
            </div>
            <div class="modal-body">

                <div class="text-center mb-4">

                <p class="address-subtitle text-danger">هل انت متأكد من ايقاف هذه الطرمبة</p>
                </div>
                <form id="addNewAddressForm" method="GET" action="<?php echo e(route('togglePump')); ?>" class="row g-3 fv-plugins-bootstrap5 fv-plugins-framework"  novalidate="novalidate">
                    <?php echo csrf_field(); ?>
                <input class="form-control form-white" 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>
                <input type="hidden">
                </form>
            </div>
        </div>
        </div>
       </div>

    <!-- End Model Stop Pump-->






   <?php $__env->startSection('script'); ?>
<script>
    //edit modal
    const edit =document.querySelectorAll('.edit');
    document.querySelectorAll('.edit').forEach(item => {
            item.addEventListener('click', e => {
            const $select = document.querySelector('#tank');
            const $option = $select.querySelector('#myId');
            const id = item.dataset.tank;
            document.getElementById("id").value =item.dataset.id;
            $select.value =id;
            $('#editModal').modal('show');
        })
    })

    //toggle modal
    const toggle =document.querySelectorAll('.toggle');
    document.querySelectorAll('.toggle').forEach(item => {
            item.addEventListener('click', e => {
            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/pump/modals.blade.php ENDPATH**/ ?>