<?php $__env->startSection('panel'); ?>
<div class="row">
    <div class="col-lg-12">
        <div class="card bl--5-primary mb-3">
            <div class="card-body">
                <p><?php echo app('translator')->get('This module could be enabled or disabled from the'); ?> <a href="<?php echo e(route('admin.setting.system.configuration')); ?>"><?php echo app('translator')->get('System Setting'); ?></a>. <?php echo app('translator')->get('If you enable the module you users will be able to use some HTML code to generate the referral users.'); ?></p>
            </div>
        </div>
        <div class="card">
            <div class="card-body p-0">
                <div class="table-responsive--md  table-responsive">
                    <table class="table table--light style--two">
                        <thead>
                            <tr>
                                <th><?php echo app('translator')->get('S.N.'); ?></th>
                                <th><?php echo app('translator')->get('Banner'); ?></th>
                                <th><?php echo app('translator')->get('Name'); ?></th>
                                <th><?php echo app('translator')->get('Action'); ?></th>
                            </tr>
                        </thead>
                        <tbody class="list">
                            <?php $__empty_1 = true; $__currentLoopData = $tools; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tool): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td> <?php echo e(($tool->currentPage-1) * $tool->perPage + $loop->iteration); ?></td>

                                    <td>
                                        <div class="user d-flex justify-content-center">
                                            <div class="thumb">
                                                <img src="<?php echo e(getImage(getFilePath('promotions').  '/'. @$tool->banner)); ?>" alt="<?php echo app('translator')->get('image'); ?>">
                                            </div>
                                        </div>
                                    </td>
                                    <td> <?php echo e(__($tool->name)); ?> </td>

                                    <td>
                                        <button type="button"
                                            data-id="<?php echo e($tool->id); ?>"
                                            data-name="<?php echo e($tool->name); ?>"
                                            data-image="<?php echo e(getImage(getFilePath('promotions').  '/'. @$tool->banner)); ?>"
                                            data-action="<?php echo e(route('admin.promotional.tool.update',$tool->id)); ?>" class="btn btn-sm btn-outline--primary editBtn"> <i class="las la-pen"></i> <?php echo app('translator')->get('Edit'); ?> </button>
                                        <button type="button" data-action="<?php echo e(route('admin.promotional.tool.remove', $tool->id)); ?>" class="btn btn-sm btn-outline--danger deleteBtn"> <i class="las la-trash"></i> <?php echo app('translator')->get('Delete'); ?></button>
                                    </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>
                </div>
            </div>
            <?php if($tools->hasPages()): ?>
            <div class="card-footer py-4">
                <?php echo e(paginateLinks($tools)); ?>

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

<div id="addModal" class="modal fade">
    <div class="modal-dialog" role="document">
        <div class="modal-content ">
            <div class="modal-header">
                <h5 class="modal-title"><?php echo app('translator')->get('Add New Banner'); ?></h5>
                <button type="button" class="close" data-bs-dismiss="modal" aria-label="<?php echo app('translator')->get('Close'); ?>">
                    <span aria-hidden="true"><i class="las la-times"></i></span>
                </button>
            </div>
            <form action="<?php echo e(route('admin.promotional.tool.store')); ?>" method="POST" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>
                <div class="modal-body">
                    <div class="image-upload">
                        <div class="thumb">
                            <div class="avatar-preview">
                                <div class="profilePicPreview" style="background-image: url(<?php echo e(getImage(getFilePath('default'))); ?>)">
                                    <button type="button" class="remove-image"><i class="fa fa-times"></i></button>
                                </div>
                            </div>
                            <div class="avatar-edit">
                                <input type="file" class="profilePicUpload p-0" id="profilePicUpload2" accept="jpeg, jpg, png, gif" name="image_input" >
                                <label for="profilePicUpload2" class="bg--primary"><?php echo app('translator')->get('Select Banner Image'); ?></label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group mt-3">
                      <label for="name"><?php echo app('translator')->get('Name'); ?></label>
                      <input type="text" class="form-control" name="name" id="name">
                    </div>

                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn w-100 btn--primary h-45"><?php echo app('translator')->get('Submit'); ?></button>
                </div>
            </form>
        </div>
    </div>
</div>


<div id="editModal" class="modal fade">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title"><?php echo app('translator')->get('Edit Banner'); ?></h5>
                <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true"><i class="las la-times"></i></span>
                </button>
            </div>
            <form action="" method="POST" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>
                <div class="modal-body">
                    <div class="image-upload">
                        <div class="thumb">
                            <div class="avatar-preview">
                                <div class="profilePicPreview" style="background-image: url(<?php echo e(getImage(getFilePath('default'))); ?>)">
                                    <button type="button" class="remove-image"><i class="fa fa-times"></i></button>
                                </div>
                            </div>
                            <div class="avatar-edit">
                                <input type="file" class="profilePicUpload p-0" id="profilePicUpload-1" accept="jpeg, jpg, png, gif" name="image_input" >
                                <label for="profilePicUpload-1" class="bg--primary"><?php echo app('translator')->get('Select Banner Image'); ?></label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group mt-3">
                        <label for="name1"><?php echo app('translator')->get('Name'); ?></label>
                        <input type="text" class="form-control" name="name" id="name1">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn w-100 btn--primary h-45"><?php echo app('translator')->get('Submit'); ?></button>
                </div>
            </form>
        </div>
    </div>
</div>

<div class="modal fade" id="deleteModal">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <form action="" method="POST">
                <?php echo csrf_field(); ?>
                <div class="modal-header">
                    <h5 class="modal-title text-capitalize"><?php echo app('translator')->get('Removal Confirmation'); ?></h5>
                    <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true"><i class="las la-times"></i></span>
                    </button>
                </div>
                <div class="modal-body">
                    <?php echo app('translator')->get('Are you sure to delete this banner?'); ?>
                </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'); ?>
    <button data-bs-toggle="modal" data-bs-target="#addModal" class="btn btn-sm btn-outline--primary"> <i class="las la-plus"></i> <?php echo app('translator')->get('Add New'); ?></button>
<?php $__env->stopPush(); ?>


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

            $('.editBtn').on('click', function () {
                var modal = $('#editModal');
                var form = modal.find('form');

                modal.find('input[name=name]').val($(this).data('name'));
                modal.find('.profilePicPreview').css('background-image', `url(${$(this).data('image')})`);
                form.attr('action',$(this).data('action'));
                modal.modal('show');
            });

            $('.deleteBtn').on('click', function ()
            {
                var modal   = $('#deleteModal');
                var form    = modal.find('form');
                form.attr('action',$(this).data('action'));
                modal.modal('show');
            });

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

<?php $__env->startPush('style'); ?>
    <style>
        .image-upload .thumb .profilePicUpload {
            display: none
        }
        .avatar-edit {
            padding: 15px 2px 0 ;
        }

        .image-upload .thumb .profilePicPreview {
            background-size: contain !important;
            background-position: center !important;
        }
    </style>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('admin.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/xam/phemex.xa-m.pro/core/resources/views/admin/promotion/tools.blade.php ENDPATH**/ ?>