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

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

    <div class="card shadow mb-4">
        <div class="card-header py-3 d-flex">
            <h6 class="m-0 font-weight-bold">
                <?php echo e($title); ?>

            </h6>
        </div>
        <div class="card-body">
            <div class="col-lg-12">
                <div class="table-responsives mt-10"  x-data="displayable_orders()">
                    <?php echo e($dataTable->table()); ?>

                </div>

                <?php if (isset($component)) { $__componentOriginal47cbb53c90e5d97428e9c4bd5c6f751e01de00d5 = $component; } ?>
<?php $component = App\View\Components\Offcanvas::resolve(['closable' => true] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('offcanvas'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Offcanvas::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'offcanvas-displayed-invoice','data-bs-scroll' => 'true','data-bs-backdrop' => 'true','class' => 'offcanvas-end offcanvas-size-xl']); ?>
                     <?php $__env->slot('title', null, []); ?> <?php echo e(__("Invoice")); ?> <?php $__env->endSlot(); ?>

                    <div x-data="{
                        get order(){
                         return this.$store.invoice.order
                         }
                        }">
                        <div class="row">
                            <div class="col-lg-12" id="invoice-block">
                                <?php if (isset($component)) { $__componentOriginal4245d621aa7df090449f0966544febd37a6b7b1d = $component; } ?>
<?php $component = App\View\Components\Invoice::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('invoice'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Invoice::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal4245d621aa7df090449f0966544febd37a6b7b1d)): ?>
<?php $component = $__componentOriginal4245d621aa7df090449f0966544febd37a6b7b1d; ?>
<?php unset($__componentOriginal4245d621aa7df090449f0966544febd37a6b7b1d); ?>
<?php endif; ?>
                            </div>
                            <template x-if="order">
                                <div class="col-lg-12">
                                    <button class="btn btn-warning rounded-sm btn-block text-uppercase btn-action-action-order"
                                            @click="printHtmlBlock('invoice-block','INVOICE-'+order.reference)">
                                        <span x-text="'Print invoice ('+order.reference+')'"></span>
                                        <i class="m-l-2 fa fa-print"></i>
                                    </button>
                                </div>
                            </template>
                        </div>
                    </div>
                 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal47cbb53c90e5d97428e9c4bd5c6f751e01de00d5)): ?>
<?php $component = $__componentOriginal47cbb53c90e5d97428e9c4bd5c6f751e01de00d5; ?>
<?php unset($__componentOriginal47cbb53c90e5d97428e9c4bd5c6f751e01de00d5); ?>
<?php endif; ?>

                <div class="cards shadows mb-4s" x-data="{
                                                    refreshOrdersList () {
                                                        return  refresh_datatable(tableId,getUrl())
                                                    },
                                                    }">
                    <?php if (isset($component)) { $__componentOriginal47cbb53c90e5d97428e9c4bd5c6f751e01de00d5 = $component; } ?>
<?php $component = App\View\Components\Offcanvas::resolve(['closable' => true] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('offcanvas'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Offcanvas::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'offcanvas-modal-filters','data-bs-scroll' => 'true','data-bs-backdrop' => 'true','class' => 'offcanvas-end offcanvas-size-sms']); ?>
                         <?php $__env->slot('title', null, []); ?> <?php echo e(__("Sales filters")); ?> <?php $__env->endSlot(); ?>

                        <div >
                            <div class="row">
                                <div class="col-lg-12">
                                    <?php echo BootForm::select('status-filter',__("Statuses"),
                                        $statuses->pluck("code"),$statuses->pluck('name',"code"), ['data-plugin-multiselect',"multiple"]); ?>

                                </div>
                                
                                
                                
                                
                                

                                <div class="col-lg-12 form-group">
                                    <div class="pull-rights" id="order-bloc-dates">
                                        <label class="mb-1"><?php echo e(__("Period")); ?></label>
                                        <div class="input-daterange datepicker input-group"
                                             data-plugin-datepicker
                                             data-plugin-options="{format:'dd-mm-yyyy'}">
                                            <span class="input-group-addon"><strong><?php echo e(__("From")); ?></strong></span>
                                            <input type="text" class="form-control form-control-sm order-input-date"
                                                   name="order-start-date"
                                                   readonly
                                                   id="order-start-date"
                                                   value="<?php echo e(date("d-m-Y",strtotime(first_date_of_period()))); ?>">
                                            <span class="input-group-addon"><strong><?php echo e(__("To")); ?></strong></span>
                                            <input type="text" class="form-control form-control-sm order-input-date"
                                                   name="order-end-date"
                                                   readonly
                                                   id="order-end-date"
                                                   value="<?php echo e(date('d-m-Y')); ?>">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-12">
                                    <?php echo BootForm::select('billing-desks-filter',__("Billing Desks"),
                                        $billing_desks->pluck("id"),$billing_desks->pluck('name',"id"), ['data-plugin-multiselect',"multiple"]); ?>

                                </div>
                                <div class="col-lg-12">
                                    <?php echo BootForm::select('created-by-filter',__("Created By"),
                                        $users->pluck("id"),$users->pluck('full_name',"id"), ['data-plugin-multiselect',"multiple"]); ?>

                                </div>

                                <div class="col-lg-12">
                                    <button class="btn btn-app btn-block text-white"
                                            @click="refreshOrdersList()">
                                        <?php echo e(__("Apply Filter")); ?>

                                        <span class="fa fa-check"></span>
                                    </button>
                                </div>
                            </div>
                        </div>

                     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal47cbb53c90e5d97428e9c4bd5c6f751e01de00d5)): ?>
<?php $component = $__componentOriginal47cbb53c90e5d97428e9c4bd5c6f751e01de00d5; ?>
<?php unset($__componentOriginal47cbb53c90e5d97428e9c4bd5c6f751e01de00d5); ?>
<?php endif; ?>

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


<?php $__env->startPush("js"); ?>

    <?php echo e($dataTable->scripts()); ?>


    <script>

        const $selectStatuses = $("select#status-filter");
        const $selectPOS = $("select#billing-desks-filter");
        const $selectCreatedBy = $("select#created-by-filter");
        const $startDate = $("#order-start-date");
        const $endDate = $("#order-end-date");

        // const checkHomme = (name) => (name === "Joel") ? "HOMME" : "DIABLO"

        const getUrl = function(url = '<?php echo e(route("admin.sales.index")); ?>'){
            let statuses = $selectStatuses.val();
            let startDate = $startDate.val();
            let endDate = $endDate.val();
            const billing_desks = $selectPOS.val();
            const created_by = $selectCreatedBy.val();
            return  url+"?statuses="+statuses
                +"&start_date="+startDate
                +"&end_date="+endDate
                +"&billing_desks="+billing_desks
                +"&users="+created_by
                ;
            
        };

        var tableId = '<?php echo e($table_sale_id); ?>';

        $(function () {

        })
        document.addEventListener('alpine:init', () => {


        })
    </script>

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

<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/lekruu/public_html/resources/views/backend/sales/index.blade.php ENDPATH**/ ?>