


<?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'); ?>
    <!--**********************************
                Content body start
            ***********************************-->
    <?php echo $__env->make('massages', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

    <!-- row -->
    <div class="row" style="width: 95%; margin:auto;">
        <div class="col-xl-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">عملية بدل جديدة</h4>
                </div>
                <div class="card-body pb-3 tran">
                    <div class="form-validation">
                        <form class="validation need-validation" novalidate method="POST" action="<?php echo e(route('storeMultiExchange')); ?>">
                            <?php echo csrf_field(); ?>
                            <table class="tableSpicial">
                                <thead>
                                    <th>النوع</th>
                                    <th>العميل</th>
                                    <th>كمية البترول</th>
                                    <th>كمية الديزل</th>
                                </thead>
                                <tbody id="inputs">
                                    <tr class="tr_data inputs-border-radius-0">
                                        <td>
                                            <select class="form-control form-white inputRead type" onchange="getIndexType(0)"
                                                data-placeholder="Choose a color..." name="type[]" required>
                                                <option disabled selected value="">الرجاء اختيار نوع البدل</option>
                                                <option value='0' rel="petrolselect">بترول &#11013; ديزل</option>
                                                <option value='1' rel="desilselect">ديزل &#11013; بترول</option>
                                            </select>
                                        </td>
                                        <td>
                                            <select class="form-control form-white  inputRead senderName" onchange="changeQuantityClint(0)" onclick="changeOtherClint(0)"
                                                data-placeholder="Choose a color..." name="name[]" required>
                                                <option disabled selected value="">الرجاء اختيار احد العملاء</option>
                                                <?php if(isset($senders)): ?>
                                                    <?php $__currentLoopData = $senders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sender): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option class="accounts-senders" value="<?php echo e($sender->name); ?>"><?php echo e($sender->name); ?> الرصيد المتبقي <?php echo e($sender->balance); ?></option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                <?php endif; ?>
                                            </select>
                                        </td>
                                        <td>
                                            <input name="petrolQuantity[]" type="number" class="form-control inputRead quantity"  onblur="getquantity(0)"
                                                id="validationCustom06" placeholder="ادخل كمية البترول.." required="">
                                        </td>
                                        <td>
                                            <input name="dieselQuantity[]"  type="number" class="form-control inputRead dieselQuantity" onblur="getquantityDisal(0)"
                                                id="validationCustom06" placeholder="ادخل كمية الديزل.." required="">
                                        </td>
                                        <td style="cursor: pointer; padding: 5px; text-align: center" class="delete" onclick="deleteTage(0)">
                                            <span class="text-danger fs-4 fw-bold form-control">X</span>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

                            
                            <div class="col-xl-12" style="direction: rtl;">
                                <span id="add" onclick="addNewRow()" class="btn btn-success">+</span>
                                
                            </div>

                            <div class="col-xl-12" style="direction: ltr;">
                                <button type="button" class="btn btn-primary me-sm-3 me-1 showModal"
                                    data-title="هل انت متأكد من تقييد البدل ؟">تقييد </button>
                            </div>

                    </div>
                    <?php echo $__env->make('print_confirmation.print_confirmation', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

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

        </div>
    </div>



    <!--**********************************
                Content body end
            ***********************************-->
    <script src="<?php echo e('/js/add-input/exchange.js'); ?>"></script>
    <script src="<?php echo e(asset('/js/quickly/print_confirmation_exchange.js')); ?>"></script>
    <?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
    <script>
        // this show modal if is return validation from backend
        $(window).on('load', function() {
            showModalAdd = document.querySelectorAll(".showModalAdd");
            if (showModalAdd.length > 0)
                $('#addTank').modal('show');

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

        //edit modal
        const edit = document.querySelectorAll('.edit');
        console.log(edit);
        document.querySelectorAll('.edit').forEach(item => {
            item.addEventListener('click', e => {
                // alert(item.dataset.id)
                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;
                const selectType = document.querySelector("#type");

                for (var i = 0; i < selectType.options.length; i++) {
                    console.log(selectType.options[i].value);
                    if (selectType.options[i].value === type) {
                        selectType.selectedIndex = i;
                        break;
                    }
                }
                $('#editModal').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>
    <script src="<?php echo e(asset('/js/validation.js')); ?>"></script>

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

<?php echo $__env->make('coupons.inputs', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?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/quickly/exchanges.blade.php ENDPATH**/ ?>