<?php $__env->startSection('panel'); ?>
    <div class="row">
        <div class="col-lg-12">
            <div class="card b-radius--10 ">
                <div class="card-body p-0">
                    <div class="table-responsive--md  table-responsive">
                        <table class="table table--light style--two sortable-table">
                            <thead>
                                <tr>
                                    <th><?php echo app('translator')->get('Name'); ?></th>
                                    <th><?php echo app('translator')->get('Price'); ?></th>
                                    <th><?php echo app('translator')->get('Time'); ?></th>
                                    <th><?php echo app('translator')->get('Status'); ?></th>
                                    <th><?php echo app('translator')->get('Action'); ?></th>
                                </tr>
                            </thead>
                            <tbody class="sort">
                                <?php $__empty_1 = true; $__currentLoopData = $plans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $plan): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr class="sortable-table-row" data-id="<?php echo e($plan->id); ?>">
                                        <td><?php echo e(__($plan->name)); ?></td>
                                        <td><?php echo e(showAmount($plan->price)); ?></td>
                                        <td><?php echo e(__($plan->time)); ?> <?php echo app('translator')->get('Days'); ?></td>
                                        <td> <?php echo $plan->statusBadge; ?> </td>
                                        <td>
                                            <div class="button--group">
                                                <button type="button" data-id="<?php echo e($plan->id); ?>"
                                                    data-name      = "<?php echo e($plan->name); ?>"
                                                    data-time      = "<?php echo e($plan->time); ?>"
                                                    data-price     = "<?php echo e($plan->price); ?>"
                                                    data-route     = "<?php echo e(route('admin.plan.store', $plan->id)); ?>"
                                                    data-bs-toggle = "modal" data-bs-target = "#planModal"
                                                    class="btn btn-outline--primary editBtn btn-sm"><i
                                                        class="las la-pen"></i><?php echo app('translator')->get('Edit'); ?></button>

                                                <?php if($plan->status == Status::DISABLE): ?>
                                                    <button class="btn btn-sm btn-outline--success confirmationBtn"
                                                        data-question = "<?php echo app('translator')->get('Are you sure to enable this plan?'); ?>"
                                                        data-action   = "<?php echo e(route('admin.plan.status', $plan->id)); ?>"><i
                                                            class="la la-eye"></i><?php echo app('translator')->get('Enable'); ?>
                                                    </button>
                                                <?php else: ?>
                                                    <button class="btn btn-sm btn-outline--danger confirmationBtn"
                                                        data-question="<?php echo app('translator')->get('Are you sure to disable this plan?'); ?>"
                                                        data-action="<?php echo e(route('admin.plan.status', $plan->id)); ?>"><i
                                                            class="la la-eye-slash"></i><?php echo app('translator')->get('Disable'); ?>
                                                    </button>
                                                <?php endif; ?>

                                            </div>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td class="text-muted text-center" colspan="100%"><?php echo e(__($emptyMessage)); ?></td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table><!-- table end -->
                    </div>
                </div>
                <?php if($plans->hasPages()): ?>
                    <div class="card-footer py-4">
                        <?php echo e(paginateLinks($plans)); ?>

                    </div>
                <?php endif; ?>
            </div><!-- card end -->
        </div>
    </div>

    <div class="modal fade" id="planModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title"><?php echo app('translator')->get('Add New plan'); ?></h4>
                    <button type="button" class="close" data-bs-dismiss="modal"><span><i
                                class="las la-times"></i></span></button>
                </div>
                <form method="post" action="<?php echo e(route('admin.plan.store')); ?>" enctype="multipart/form-data">
                    <?php echo csrf_field(); ?>
                    <div class="modal-body">
                        <div class="form-group">
                            <label><?php echo app('translator')->get('Name'); ?> </label>
                            <input type="text" class="form-control" name="name" required>
                        </div>
                        <div class="form-group">
                            <label><?php echo app('translator')->get('Time'); ?></label>
                            <div class="input-group">
                                <input type="text" class="form-control" name="time" value="">
                                <span class="input-group-text"><?php echo app('translator')->get('Days'); ?></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label><?php echo app('translator')->get('Price'); ?></label>
                            <div class="input-group">
                                <input type="text" class="form-control" name="price" value="">
                                <span class="input-group-text"><?php echo e(gs('cur_sym')); ?></span>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn--primary w-100 h-45"><i class="fa fa-send"></i>
                            <?php echo app('translator')->get('Submit'); ?></button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <?php if (isset($component)) { $__componentOriginalbd5922df145d522b37bf664b524be380 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalbd5922df145d522b37bf664b524be380 = $attributes; } ?>
<?php $component = App\View\Components\ConfirmationModal::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('confirmation-modal'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\ConfirmationModal::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalbd5922df145d522b37bf664b524be380)): ?>
<?php $attributes = $__attributesOriginalbd5922df145d522b37bf664b524be380; ?>
<?php unset($__attributesOriginalbd5922df145d522b37bf664b524be380); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalbd5922df145d522b37bf664b524be380)): ?>
<?php $component = $__componentOriginalbd5922df145d522b37bf664b524be380; ?>
<?php unset($__componentOriginalbd5922df145d522b37bf664b524be380); ?>
<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('breadcrumb-plugins'); ?>
    <button type="button" data-route="<?php echo e(route('admin.plan.store')); ?>" data-bs-target="#planModal" data-bs-toggle="modal"
        class="btn btn-sm btn-outline--primary addBtn"><i class="las la-plus"></i><?php echo app('translator')->get('Add New'); ?></button>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('style-lib'); ?>
    <link rel="stylesheet" href="<?php echo e(asset('assets/admin/css/table-sortable.css')); ?>">
<?php $__env->stopPush(); ?>

<?php $__env->startPush('script-lib'); ?>
    <script src="<?php echo e(asset('assets/admin/js/jquery-ui.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/admin/js/table-sortable.js')); ?>"></script>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('script'); ?>
    <script>
        $(function($) {
            "use strict";
            var modal = $('#planModal');

            $('.editBtn').on('click', function() {
                modal.find('form')[0].reset();
                modal.find('form').attr('action', $(this).data('route'));
                modal.find('input[name=name]').val($(this).data('name'));
                modal.find('input[name=time]').val($(this).data('time'));
                modal.find('input[name=price]').val($(this).data('price'));
            });

            $('.addBtn').on('click', function() {
                modal.find('form')[0].reset();
                modal.find('form').attr('action', $(this).data('route'));
            });

        });
    </script>
<?php $__env->stopPush(); ?>


<?php $__env->startPush('script'); ?>
    <script>
        function updateSortOrder(sorting) {
            var action = "<?php echo e(route('admin.plan.sort')); ?>";
            var csrf = "<?php echo e(csrf_token()); ?>";
            sortOrderAction(sorting, action, csrf);
        }
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('admin.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/braixses/aklooo.com/core/resources/views/admin/plan/index.blade.php ENDPATH**/ ?>