

<?php $__env->startSection('title'); ?>
    تعديل القراءت
<?php $__env->stopSection(); ?>

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

<?php $__env->stopSection(); ?>

<?php $__env->startSection('header-content'); ?>
تعديل القراءت

<?php $__env->stopSection(); ?>

<?php $__env->startSection('content-body'); ?>
			
<div>
    <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('updateReadiing',$reading->id)); ?>" class="row g-3 fv-plugins-bootstrap5 fv-plugins-framework needs-validation" novalidate>
                <?php echo csrf_field(); ?>
                <div class="col-12 col-md-6 fv-plugins-icon-container">
                    <label class="form-label" for="employ_names">اسم العامل</label>
                    <select id="employ_name" name="employeeId" class="form-control" required="">
                        <option value="<?php echo e($reading->employee->id); ?>" selected id="myId"> <?php echo e($reading->employee->name); ?></option>
                        <?php if(isset($emploies)): ?>
                            <?php $__currentLoopData = $emploies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $employ): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($employ->id); ?>">
                                   <?php if(isset($employ->id)): ?> 
                                    <?php echo e($employ->id); ?>

                                   <?php endif; ?>
                                </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php endif; ?>
                    </select> 
                    <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="pumpId">رقم الطرمبة</label>
                    <select id="pumpNumber" name="pumpId" class="form-control" required="">
                        <option value="<?php echo e($reading->pump->id); ?>" selected id="pumpNumber">                                   الطرمبة رقم 
                            <?php echo e($reading->pump->id); ?></option>
                        <?php if(isset($pumps)): ?>
                            <?php $__currentLoopData = $pumps; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pump): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($pump->id); ?>">
                                   <?php if(isset($pump->id)): ?> 
                                   الطرمبة رقم 
                                   <?php echo e($pump->id); ?>

                                   <?php endif; ?> 
                                    النوع 
                                    <?php if(isset($pump->tank->type)): ?> 
                                    <?php if($pump->tank->type ==0): ?>
                                        بترول
                                    <?php else: ?>
                                        ديزل
                                    <?php endif; ?>
                                    <?php endif; ?>
                                </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php endif; ?>
                    </select> 
                    <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="start_of_day_read">قراءة الصباح</label>
                    <input type="number" required="" id="start_of_day_read" name="startOfDayRead" class="form-control" placeholder="الرجاء ادخال قراءة الصباح" value="<?php echo e($reading->start_of_day_read); ?>">
                    <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="end_of_day_read">قراءة المساء</label>
                    <input type="number" required="" id="end_of_day_read" name="endOfDayRead" class="form-control" placeholder="الرجاء ادخال قراءة المساء">
                    <div class="fv-plugins-message-container invalid-feedback ">
                        الرجاء قراءة المساء
                    </div>
                </div>
               
                </div>
              <div class="col-12 text-center mb-5">
                <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 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('toggleReading')); ?>" class="row g-3 fv-plugins-bootstrap5 fv-plugins-framework"  novalidate="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>
            <input type="hidden">
            </form>
        </div>
    </div>
    </div>
   </div>
<?php $__env->stopSection(); ?>

<?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('#employ_name');
            const $option = $select.querySelector('#myId');
            const employId = item.dataset.employ_name;
            console.log(employId);
            $select.value =employId;
            document.getElementById("id").value =item.dataset.id;
            // document.getElementById("employ_name").value =item.dataset.employ_name;
            document.getElementById("start_of_day_read").value =item.dataset.start_of_day_read;
            document.getElementById("end_of_day_read").value =item.dataset.end_of_day_read;
           
            $('#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>  
<script src="<?php echo e(asset('/vendor/datatables/js/jquery.dataTables.min.js')); ?>"></script>
<script src="<?php echo e(asset('/js/plugins-init/datatables.init.js')); ?>"></script>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\Nasser\Desktop\petrol_store\resources\views/readings/edite.blade.php ENDPATH**/ ?>