<?php $__env->startSection('panel'); ?>
    <div class="row">

        <div class="col-lg-12">
            <div class="card">
                <div class="card-body p-0">
                    <div class="table-responsive--sm table-responsive">
                        <table class="table table--light style--two">
                            <thead>
                                <tr>
                                    <th><?php echo app('translator')->get('Plan'); ?></th>
                                    <th><?php echo app('translator')->get('Limit'); ?></th>
                                    <th><?php echo app('translator')->get('Installment'); ?></th>
                                    <th><?php echo app('translator')->get('Status'); ?></th>
                                    <th><?php echo app('translator')->get('Action'); ?></th>
                                </tr>
                            </thead>
                            <tbody>
                           <?php $__empty_1 = true; $__currentLoopData = $plans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                               <tr>
                                    <td data-label="<?php echo app('translator')->get('Plan'); ?>">
                                        <div class="font-weight-bold"><?php echo e(__($data->name)); ?></div>
                                        <?php
                                            $profit = ($data->total_installment*$data->per_installment) -100;
                                        ?>

                                    <span class="font-weight-bold <?php if($profit > 0): ?>text--success <?php else: ?> text--danger <?php endif; ?>">
                                    <?php echo e(getAmount($profit)); ?>% </span>
                                    <?php echo app('translator')->get('in'); ?> <span class="text--primary"><?php echo e($data->total_installment*$data->installment_interval); ?></span> <?php echo app('translator')->get('days'); ?>
                                    </td>

                                    <td data-label="<?php echo app('translator')->get('Limit'); ?>">

                                            <?php echo app('translator')->get('Min'); ?>: <?php echo e($general->cur_sym.showAmount($data->minimum_amount)); ?>

                                            <div>
                                                <?php echo app('translator')->get('Max'); ?>: <?php echo e($general->cur_sym.showAmount($data->maximum_amount)); ?>

                                            </div>
                                    </td>

                                   <td data-label="<?php echo app('translator')->get('Installment'); ?>">
                                        <span class="text--primary">
                                            <?php echo e($data->per_installment+0); ?>%
                                        </span>
                                        <?php echo app('translator')->get('every'); ?>
                                        <span class="text--primary">
                                            <?php echo e($data->installment_interval); ?>

                                        </span> <?php echo app('translator')->get('Days'); ?>
                                    <br><?php echo app('translator')->get('for'); ?> <span class="text--primary"><?php echo e($data->total_installment); ?></span> <?php echo app('translator')->get('Times'); ?>
                                    </td>


                                   <td data-label="<?php echo app('translator')->get('Status'); ?>">
                                       <?php if($data->status == 1): ?>
                                           <span class="text--small badge font-weight-normal badge--success"><?php echo app('translator')->get('Enabled'); ?></span>
                                       <?php else: ?>
                                           <span class="text--small badge font-weight-normal badge--danger"><?php echo app('translator')->get('Disabled'); ?></span>
                                       <?php endif; ?>
                                   </td>

                                   <td data-label="<?php echo app('translator')->get('Action'); ?>">

                                       <a href="<?php echo e(route('admin.loan.plan.edit', $data->id)); ?>"
                                          class="icon-btn ml-1 editBtn" data-toggle="tooltip" title=""
                                          data-original-title="<?php echo app('translator')->get('Edit'); ?>">
                                           <i class="la la-pencil"></i>
                                       </a>

                                       <a href="javascript:void(0)"
                                          data-id="<?php echo e($data->id); ?>"
                                          data-status="<?php echo e($data->status); ?>"
                                          class="icon-btn statusBtn <?php echo e($data->status == 1 ? 'bg--danger' : 'bg--success'); ?> ml-1" data-toggle="tooltip" title=""
                                          data-original-title="<?php if($data->status == 1): ?> <?php echo app('translator')->get('Disable'); ?> <?php else: ?> <?php echo app('translator')->get('Active'); ?> <?php endif; ?>">
                                           <i class="la la-<?php echo e($data->status == 1 ? 'la la-eye-slash' : 'la la-eye'); ?>"></i>
                                       </a>

                                   </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 id="statusModal" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title"><?php echo app('translator')->get('Confirmation'); ?>!</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form action="<?php echo e(route('admin.loan.plan.status')); ?>" method="POST">
                <?php echo csrf_field(); ?>
                <input type="hidden" name="id">
                <div class="modal-body">

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn--dark" data-dismiss="modal"><?php echo app('translator')->get('No'); ?></button>
                    <button type="submit" class="btn btn--primary"><?php echo app('translator')->get('Yes'); ?></button>
                </div>
            </form>
        </div>
    </div>
</div>

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

<?php $__env->startPush('breadcrumb-plugins'); ?>
    <a href="<?php echo e(route('admin.loan.plan.create')); ?>" class="btn btn-sm btn--primary box--shadow1 text-white text--small addBtn"><i class="la la-plus"></i><?php echo app('translator')->get('Add New'); ?></a>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('script'); ?>
<script>
    (function ($) {

        "use strict";

        $('.statusBtn').on('click', (e)=> {
            var btn     = $(e.currentTarget);
            var modal   = $('#statusModal');
            var status  = btn.data('status');
            var message = status == 1 ? '<?php echo app('translator')->get("Are you sure to disable this plan?"); ?>':'<?php echo app('translator')->get("Are you sure to enable this plan?"); ?>';
            modal.find('.modal-body').text(message);
            modal.find('input[name=id]').val(btn.data('id'));
            modal.modal('show');
        });

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

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