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

<!-- Content wrapper scroll start -->
<div class="content-wrapper-scroll">

<!-- Content wrapper start -->
<div class="content-wrapper">

<!-- Row start -->
<div class="row gutters">
        <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">

            <!-- Task section start -->
            <div class="tasks-section">

                <!-- Labels container start -->
                <div class="labels-container">
                    <div class="lablesContainerScroll">
                        <div class="filters-block">
                            <h5>Filters</h5>
                            <div class="filters">
                                <a href="#" class="active">
                                    <i class="icon-receipt"></i> unsettled
                                </a>
                                <a href="<?php echo e(route('settledTable')); ?>">
                                    <i class="icon-error"></i> Paid
                                </a>
                                <a href="<?php echo e(route('tableLinks')); ?>">
                                    <i class="icon-error"></i> Generate Links
                                </a>
                            </div>
                        </div>											
                    </div>
                </div>
                <!-- Labels container end -->

                <!-- Tasks container start -->
                <div class="tasks-container">
                    <div class="tasks-header">
                        <h3>Tables Management <span><?php echo e($getDayClose->day_close); ?></span></h3>
                        <?php if(auth()->user()->role == "Sales Person"): ?>
                        <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#DeliveryModalGeneral"> <i class="icon-shopping-cart1"></i> New Sale</button>
                        <?php endif; ?>
                    </div>
                    <div class="tasksContainerScroll">
                         <!-- Card start -->
                                <div class="table-responsive">
                                    <table id="scrollVertical" class="table custom-table">
                                        <thead>
                                            <tr>
                                                <th>
                                                <div class="form-check form-check-inline">
                                                    <input class="form-check-input" type="checkbox" id="select-all">
                                                </div>
                                                </th>
                                            <th>Trans. No.</th>
                                            <?php if(auth()->user()->role == "Administrator"): ?>
                                            <th>Outlet</th>
                                            <?php endif; ?>
                                            <th>Table Name</th>
                                            <th>Served by</th>
                                            <th>Added At</th>
                                            <?php if(auth()->user()->role !== "Administrator"): ?>
                                            <th>Action</th>
                                            <?php endif; ?>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        <?php $__currentLoopData = $tables_transactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <tr>
                                            <td>
                                            <div class="form-check form-check-inline">
                                                <input type="checkbox" class="form-check-input" name="tables[]" value="<?php echo e($transaction->id); ?>">
                                            </div>
                                            </td>
                                            <td><a href="<?php echo e(route('orderTransaction',$transaction->invoice_number)); ?>"><strong><?php echo e($transaction->invoice_number); ?></strong></a></td>
                                            <?php if(auth()->user()->role == "Administrator"): ?>
                                            <td><?php echo e($transaction->branch); ?></td>
                                            <?php endif; ?>
                                            <td><?php echo e($transaction->table_name); ?></td>
                                            <td><?php echo e($transaction -> table_served_by); ?></td>
                                            <td><?php echo e($transaction -> created_at); ?></td>
                                            <?php if(auth()->user()->role !== "Administrator"): ?>
                                            <td>
                                                <a href="#" id="<?php echo e($transaction -> id); ?>" onclick="confirmPayment(this.id)" class="btn btn-outline-primary btn-sm m-1">Confirm Payment</a>
                                                <a href="#" id="<?php echo e($transaction -> id); ?>" onclick="AddItemInvoice(this.id)" class="btn btn-outline-info btn-sm m-1"> <i class="icon-shopping-cart1"></i> Add to Invoice</a>   
                                            </td>
                                            <?php endif; ?>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </tbody>
                                    </table>
                                </div>
                        </div>
                        <!-- Card end -->

                    </div>
                </div>
                <!-- Tasks container end -->

            </div>
            <!-- Task section end -->

        </div>
    </div>
    <!-- Row end -->

</div>
<!-- Content wrapper end -->

<script>
    function confirmPayment(id) {
            Swal.fire({
                title: 'Confirm Payment, Are you sure?',
                text: "You won't be able to revert this!",
                icon: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Yes, Confirm!'
                }).then((result) => {
                if (result.isConfirmed) {
                    window.location.href = "/ceqa-dashboard/confirm-payment/"+id;
                }
                })
        }

        
        function AddItemInvoice(id) {
            Swal.fire({
                title: 'Add to Exiting Reciept, Are you sure?',
                text: "You won't be able to revert this!",
                icon: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Yes, Confirm!'
                }).then((result) => {
                if (result.isConfirmed) {
                    window.location.href = "/ceqa-dashboard/add-to-invoice/"+id;
                }
                })
        }
</script>


<script type="text/javascript">  
    document.getElementById('select-all').onclick = function(){
        var ele=document.getElementsByName('tables[]');  
        for (var checkbox of ele) {
                checkbox.checked = this.checked;
            }
    
    }              
</script> 


<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/morttsons/public_html/morttsonsposfiles/resources/views/tables/table-mgt.blade.php ENDPATH**/ ?>