

<?php $__env->startSection('title'); ?>
   <?php echo app('translator')->get('Manage Addon'); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('breadcrumb'); ?>
 <section class="section">
    <div class="section-header">
        <h1><?php echo app('translator')->get('Manage Addon'); ?></h1>
    </div>
</section>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <div class="row justify-content-center">
        
        <div class="col-md-8">
            <div class="card border-left border-primary">
                <div class="card-body">
                    <span class="font-weight-bold"><?php echo app('translator')->get('Warning'); ?> :  </span> <code class="text-warning"><?php echo app('translator')->get('We strongly recommend that, please backup your whole system and database before you install the addon.'); ?></code>
                </div>
            </div>
            <div class="card">
                <div class="card-header d-flex justify-content-between">
                    <h5><?php echo app('translator')->get('Install Addon'); ?></h5>
                    <h6 class="text-primary"><?php echo app('translator')->get('System version : '.sysVersion()); ?></h6>
                </div>
                <div class="card-body">
                    <form class="form-horizontal" action="<?php echo e(route('admin.addon.install')); ?>" method="POST"   enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>   
                        <div class="form-group">
                            <label><?php echo app('translator')->get('Addon Purchase Key'); ?></label>
                            <div class="custom-file">
                                <input type="text" name="purchase_key" class="form-control" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="addon_zip"><?php echo app('translator')->get('Zip File'); ?></label>
                            <div class="custom-file">
                                <input type="file" name="addon" class="form-control" required>
                            </div>
                        </div>
                        <div class="form-group mb-0 text-right">
                            <button type="submit" class="btn btn-primary"><?php echo app('translator')->get('Install / Addon'); ?></button>
                        </div>
                    </form>

                    <hr>

                    <h5 class="my-4"><?php echo app('translator')->get('Installed Addon'); ?></h5>
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th><?php echo app('translator')->get('Name'); ?></th>
                                    <th><?php echo app('translator')->get('Version'); ?></th>
                                    <th><?php echo app('translator')->get('Status'); ?></th>
                                    <th class="text-right"><?php echo app('translator')->get('Action'); ?></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__empty_1 = true; $__currentLoopData = $addons; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $addon): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td><?php echo e(ucwords($addon->name)); ?></td>
                                    <td><?php echo e($addon->version); ?></td>
                                    <td>
                                        <?php if($addon->status == 1): ?>
                                            <span class="badge badge-success"><?php echo app('translator')->get('Active'); ?></span>
                                        <?php else: ?>
                                            <span class="badge badge-danger"><?php echo app('translator')->get('Inactive'); ?></span>
                                        <?php endif; ?>
                                    </td>
                                    <td class="text-right">
                                        <?php if($addon->status == 1): ?>
                                            <a href="javascript:;" data-route="<?php echo e(route('admin.addon.status', $addon->id)); ?>" data-status="<?php echo e($addon->status); ?>" class="action btn btn-sm btn-danger"><?php echo app('translator')->get('Deactivate'); ?></a>
                                        <?php else: ?>
                                            <a href="javascript:;" data-route="<?php echo e(route('admin.addon.status', $addon->id)); ?>" data-status="<?php echo e($addon->status); ?>" class="btn btn-primary btn-sm action"><?php echo app('translator')->get('Activate'); ?></a>
                                        <?php endif; ?>
                                    </td>
                                </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    
                                <tr><td colspan="12" class="text-center"><?php echo app('translator')->get('No installed addon found'); ?></td></tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                </div>
            </div>

            
        </div>
        
    </div>


    <div class="modal fade" id="statusModal" tabindex="-1" role="dialog" aria-labelledby="modelTitleId" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <form action="" method="POST">
                <?php echo csrf_field(); ?>
                <div class="modal-content">
                    <div class="modal-body text-center mt-4">
                        <h6 class="status-text"></h6>
                    </div>
                    <div class="modal-footer justify-content-center">
                        <button type="button" class="btn btn-dark" data-dismiss="modal"><?php echo app('translator')->get('Close'); ?></button>
                        <button type="submit" class="btn btn-primary"><?php echo app('translator')->get('Yes I\'m sure'); ?></button>
                    </div>
                </div>
            </form>
        </div>
    </div>


<?php $__env->stopSection(); ?>
<?php $__env->startPush('style'); ?>
   <style>
       .form-control {
         line-height: 1.2 !important
       }
   </style>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('script'); ?>
    <script>
        'use strict';
        $('.action').on('click',function(){
            var route = $(this).data('route')
            var status = $(this).data('status')
            var text = ''
            if(status == 1){
                text = "<?php echo app('translator')->get('You are about to deactivate this addon. Please note that once you deactive the whole addon will no longer be workable in the system. So are you sure about this action?'); ?>"
            }else{
                text = "<?php echo app('translator')->get('Are you sure about this action?'); ?>"
            }

            $('#statusModal').find('.status-text').text(text)
            $('#statusModal').find('form').attr('action', route)
            $('#statusModal').modal('show')

        })
    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\update\wallet_main\project\resources\views/admin/addon/index.blade.php ENDPATH**/ ?>