<?php $__env->startSection('styles'); ?>
    <link href="<?php echo e(asset('assets/plugins/custom/datatables/datatables.bundle.rtl.css')); ?>?version=<?php echo e(config('app.version')); ?>" rel="stylesheet" type="text/css"/>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <div class="card">
        <div class="card-header border-0 pt-6">
            <?php if($options['search'] === true): ?>
                <div class="card-title">
                    <div class="d-flex align-items-center position-relative my-1">
                        <i class="ki-outline ki-magnifier fs-3 position-absolute ms-5"></i>
                        <input type="text" name="search" data-table-filter="search" class="form-control form-control-solid w-250px ps-12" placeholder="البحث" />
                    </div>
                </div>
            <?php endif; ?>
            <div class="card-toolbar">
                <div class="d-flex justify-content-end" data-table-toolbar="base">
                    <?php if(!empty($options['filters']) && count($options['filters']) > 0): ?>
                        <div>
                            <button type="button" class="btn btn-light-primary me-3" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end">
                                <i class="ki-outline ki-filter fs-2"></i> التصفية
                            </button>
                            <div class="menu menu-sub menu-sub-dropdown w-300px w-md-325px" data-kt-menu="true" data-table-filter="form">
                                <div class="px-7 py-5">
                                    <div class="fs-4 text-dark fw-bold">خيارات التصفية</div>
                                </div>
                                <div class="separator border-gray-200"></div>
                                <div class="px-7 py-5">
                                    <?php $__currentLoopData = $options['filters']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $filter): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php
                                            $addClass = '';
                                            $addData = '';
                                            if(!empty($filter['get']) && is_array($filter['get'])){
                                                $addClass .= " getData";
                                                $addData .= " data-ajax-get-data='".$filter['get']['ajax']."'";
                                                $addData .= " data-empty-get-data='".json_encode($filter['get']['empty'])."'";
                                                $addData .= " data-select-get-data='".json_encode($filter['get']['select'])."'";
                                            }
                                        ?>
                                        <div class="mb-10" data-table-filter="filter" data-table-filter-type="<?php echo e($filter['type']); ?>" data-table-filter-column="<?php echo e($filter['column']); ?>">
                                            <label for="filter_<?php echo e($filter['name']); ?>" class="form-label fs-5 fw-semibold mb-3"><?php echo e($filter['title']); ?>:</label>
                                            <?php if($filter['type'] == 'select'): ?>
                                                <select class="form-select form-select-solid fw-bold <?php echo $addClass ?? ''; ?>" <?php echo $addData ?? ''; ?> id="filter_<?php echo e($filter['name']); ?>" name="<?php echo e($filter['name']); ?>" data-kt-select2="true" data-allow-clear="true" data-placeholder="<?php echo e($filter['all']); ?>">
                                                    <option></option>
                                                    <?php $__currentLoopData = $filter['data']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option class="rmv" value="<?php echo e($key); ?>"><?php echo e($value); ?></option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                            <?php elseif($filter['type'] == 'radio'): ?>
                                                <div class="d-flex flex-column flex-wrap fw-semibold">
                                                    <label class="form-check form-check-sm form-check-custom form-check-solid mb-3 me-5">
                                                        <input class="form-check-input" type="radio" name="<?php echo e($filter['name']); ?>" value="all" checked="checked" />
                                                        <span class="form-check-label text-gray-600">
                                                            <?php echo e($filter['all']); ?>

                                                        </span>
                                                    </label>
                                                    <?php $__currentLoopData = $filter['data']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <label class="form-check form-check-sm form-check-custom form-check-solid mb-3 me-5">
                                                            <input class="form-check-input" type="radio" name="<?php echo e($filter['name']); ?>" value="<?php echo e($data); ?>" />
                                                            <span class="form-check-label text-gray-600">
                                                                <?php echo e($data); ?>

                                                            </span>
                                                        </label>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </div>
                                            <?php endif; ?>
                                        </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <div class="d-flex justify-content-end">
                                        <button type="button" class="btn btn-light btn-active-light-primary me-2" data-kt-menu-dismiss="true" data-table-filter="reset">إلغاء التصفية</button>
                                        <button type="button" class="btn btn-primary" data-kt-menu-dismiss="true" data-table-filter="submit">تطبيق التصفية</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>

                    <?php if($options['export'] == true): ?>
                        <div>
                            <button type="button" class="btn btn-light-primary me-3" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end">
                                <i class="ki-outline ki-exit-up fs-2"></i> تصدير البيانات
                            </button>
                            <div id="export_menu" class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-600 menu-state-bg-light-primary fw-semibold fs-7 w-200px py-4" data-kt-menu="true">
                                <div class="menu-item px-3 ">
                                    <a href="#" class="menu-link px-3" data-kt-export="excel">
                                        تصدير البيانات إلى EXCEL
                                    </a>
                                </div>
                                <div class="menu-item px-3">
                                    <a href="#" class="menu-link px-3" data-kt-export="csv">
                                        تصدير البيانات إلى CSV
                                    </a>
                                </div>
                                <div class="menu-item px-3">
                                    <a href="#" class="menu-link px-3" data-kt-export="pdf">
                                        تصدير البيانات إلى PDF
                                    </a>
                                </div>
                            </div>
                            <div id="export_buttons" class="d-none"></div>
                        </div>
                    <?php endif; ?>

                    <?php if(!empty($options['create']) && search_route_to_permissions($options['create']['route'], $myPermissions) == true && $options['trashed'] != 'trashed'): ?>
                        <?php if(!empty($options['create']['href'])): ?>
                            <a type="button" class="btn btn-primary" href="<?php echo e(route($options['create']['route'])); ?>">
                                <?php echo e($options['create']['title']); ?>

                            </a>
                        <?php else: ?>
                        <button type="button" class="btn btn-primary openModalAddEdit" data-ajax="<?php echo e(route($options['create']['route'])); ?>">
                            <?php echo e($options['create']['title']); ?>

                        </button>
                        <?php endif; ?>

                    <?php endif; ?>
                    <?php if(!empty($options['create']) && !empty($options['create']['permission']) && search_route_to_permissions($options['create']['permission'], $myPermissions) == true && $options['trashed'] != 'trashed'): ?>
                        <button type="button" class="btn btn-primary openModalAddEdit" data-ajax="<?php echo e($options['create']['route']); ?>">
                            <?php echo e($options['create']['title']); ?>

                        </button>
                    <?php endif; ?>
                    <?php if(!empty($options['custom_btn']) && !empty($options['custom_btn']['permission']) && search_route_to_permissions($options['custom_btn']['permission'], $myPermissions) == true && $options['trashed'] != 'trashed'): ?>
                        <button type="button" class="btn btn-primary openModalAddEdit mx-2" data-ajax="<?php echo e($options['custom_btn']['route']); ?>">
                            <?php echo e($options['custom_btn']['title']); ?>

                        </button>
                    <?php endif; ?>
                    <?php if(!empty($options['custom_btn_2']) && !empty($options['custom_btn_2']['permission']) && search_route_to_permissions($options['custom_btn_2']['permission'], $myPermissions) == true && $options['trashed'] != 'trashed'): ?>
                        <button type="button" class="btn btn-primary openModalAddEdit mx-2" data-ajax="<?php echo e($options['custom_btn_2']['route']); ?>">
                            <?php echo e($options['custom_btn_2']['title']); ?>

                        </button>
                    <?php endif; ?>
                    <?php if(!empty($options['custom_btn_3']) && !empty($options['custom_btn_3']['permission']) && search_route_to_permissions($options['custom_btn_3']['permission'], $myPermissions) == true && $options['trashed'] != 'trashed'): ?>
                        <button type="button" class="btn btn-primary openModalAddEdit mx-2" data-ajax="<?php echo e($options['custom_btn_3']['route']); ?>">
                            <i class="fa fa-<?php echo e($options['custom_btn_3']['title']); ?>"></i>
                        </button>
                    <?php endif; ?>
                    
                    <?php if(!empty($options['trashed_link']) && !empty($options['trashed_link']['permission']) && search_route_to_permissions($options['trashed_link']['permission'], $myPermissions) == true && $options['trashed'] != 'trashed'): ?>
                        <a class="btn btn-success me-2 ms-2" href="<?php echo e($options['trashed_link']['route']); ?>">
                            <?php echo e($options['trashed_link']['title']); ?>

                        </a>
                    <?php endif; ?>
                    <?php if(!empty($options['list_link']) && !empty($options['list_link']['permission']) && search_route_to_permissions($options['list_link']['permission'], $myPermissions) == true && $options['trashed'] == 'trashed'): ?>
                        <a class="btn btn-primary me-2 ms-2" href="<?php echo e($options['list_link']['route']); ?>">
                            <?php echo e($options['list_link']['title']); ?>

                        </a>
                    <?php endif; ?>
                </div>

                <?php if(!empty($options['buttons']) && is_array($options['buttons']) && count($options['buttons']) > 0): ?>
                    <?php if(search_route_to_permissions($options['buttons']['delete'], $myPermissions) == true or search_route_to_permissions($options['buttons']['restore'], $myPermissions) == true or search_route_to_permissions($options['buttons']['forceDelete'], $myPermissions) == true): ?>
                        <div class="d-flex justify-content-end align-items-center d-none" data-table-toolbar="selected">
                            <div data-table-select="selected">
                                <?php if($options['trashed'] == 'trashed'): ?>
                                    <?php if(search_route_to_permissions($options['buttons']['restore'], $myPermissions) == true): ?>
                                        <button type="button" class="btn btn-warning" data-text="هل أنت متأكد من إستعادة العناصر المحددة؟" data-ajax="<?php echo e(route($options['buttons']['restore'])); ?>">
                                            إستعادة العناصر المحددة (<span data-table-select="selected_count"></span>)
                                        </button>
                                    <?php endif; ?>
                                    <?php if(search_route_to_permissions($options['buttons']['forceDelete'], $myPermissions) == true): ?>
                                        <button type="button" class="btn btn-danger" data-text="هل أنت متأكد من الحذف النهائي للعناصر المحددة؟" data-ajax="<?php echo e(route($options['buttons']['forceDelete'])); ?>">
                                            حذف نهائي للعناصر المحددة (<span data-table-select="selected_count"></span>)
                                        </button>
                                    <?php endif; ?>
                                <?php else: ?>
                                    <?php if(search_route_to_permissions($options['buttons']['delete'], $myPermissions) == true): ?>
                                        <button type="button" class="btn btn-danger" data-text="هل أنت متأكد من حذف العناصر المحددة؟" data-ajax="<?php echo e(route($options['buttons']['delete'])); ?>">
                                            حذف العناصر المحددة (<span data-table-select="selected_count"></span>)
                                        </button>

                                        <?php if(!empty($options['custom_btn']) && !empty($options['custom_btn']['permission']) && search_route_to_permissions($options['custom_btn']['permission'], $myPermissions) == true && $options['trashed'] != 'trashed'): ?>
                                            <button type="button" class="btn btn-primary mx-2" data-ajax="<?php echo e($options['custom_btn']['route']); ?>">
                                                <?php echo e($options['custom_btn']['title']); ?>

                                            </button>
                                        <?php endif; ?>

                                    <?php endif; ?>
                                <?php endif; ?>
                            </div>
                        </div>
                    <?php endif; ?>
                <?php endif; ?>
            </div>
        </div>
        <div class="card-body pt-0">
            <table class="table align-middle table-row-dashed fs-6 gy-5" id="data-table">
                <thead>
                    <tr class="text-start text-gray-400 fw-bold fs-7 text-uppercase gs-0">
                        <?php $__currentLoopData = $options['columns']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $column): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <th class="text-right <?php echo e($column['exportable'] == false ? 'no-export' : ''); ?>" style="width: <?php echo e($column['width']); ?>%">
                                <?php if($column['id'] == 'checkbox'): ?>
                                    <div class="form-check form-check-sm form-check-custom form-check-solid me-3">
                                        <input class="form-check-input checkbox-table" name="checkAll_rows" type="checkbox" data-kt-check="true" data-kt-check-target="#data-table .checkbox-table" />
                                    </div>
                                <?php else: ?>
                                    <?php echo e($column['title']); ?>

                                <?php endif; ?>
                            </th>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tr>
                </thead>
                <tbody class="fw-semibold text-gray-600">
                </tbody>
            </table>
        </div>
    </div>
    <div class="modal fade" id="modalAddEdit" tabindex-1 aria-hidden="true">
        <div class="modal-dialog modal-fullscreen p-9">
            <div class="modal-content modal-rounded">
                <div class="modal-header">
                    <h5 class="modal-title"></h5>
                    <div class="btn btn-icon btn-sm btn-active-light-primary ms-2" data-bs-dismiss="modal" aria-label="Close">
                        <i class="ki-duotone ki-cross fs-2x"><span class="path1"></span><span class="path2"></span></i>
                    </div>
                </div>
                <div class="modal-body scroll-y m-5"></div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    <script src="<?php echo e(asset('assets/plugins/custom/datatables/datatables.bundle.js')); ?>?version=<?php echo e(config('app.version')); ?>"></script>
    <script>
        var urlParams = new URLSearchParams(window.location.search);
        var id = urlParams.get('id');

        var AjaxUrl = "<?php echo e($options['route'].'?ajax=true'); ?>";
        console.log(AjaxUrl);
        var Columns = [
            <?php $__currentLoopData = $options['columns']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $column): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                {
                    data: "<?php echo e($column['id']); ?>",
                    orderable: <?php echo ($column['orderable'] == true) ? 'true' : 'false'; ?>,
                    exportable: <?php echo ($column['exportable'] == true) ? 'true' : 'false'; ?>,
                },
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        ];
        var defaultOrder = <?php echo json_encode($options['defaultOrder']); ?>;
        var exportFileName = "<?php echo e(last($options['breadcrumb'])); ?>";
        var Cairo_Regular = "<?php echo e(asset('assets/fonts/Cairo-Regular.ttf')); ?>";
        var Cairo_Bold = "<?php echo e(asset('assets/fonts/Cairo-Bold.ttf')); ?>";
    </script>
    <script src="<?php echo e(asset('assets/js/datatable.js')); ?>?version=<?php echo e(config('app.version')); ?>"></script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/haladigitally/Desktop/TR/operations_manager/resources/views/data.blade.php ENDPATH**/ ?>