<?php $__env->startSection('title'); ?>
    <?php echo e(__('subscription')); ?>

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

<?php $__env->startSection('content'); ?>
    <div class="content-wrapper">
        <div class="page-header">
            <h3 class="page-title">
                <?php echo e(__('subscription')); ?>

            </h3>
        </div>
        <div class="row">
            
            <div class="col-md-9 col-sm-12 col-tb-6 grid-margin stretch-card">
                <div class="card">
                    <div class="card-body">
                        <h4 class="card-title float-left">
                            <?php echo e(__('active') . ' ' . __('plan')); ?>

                        </h4>
                        <div class="row">
                            <div class="col-sm-12 col-md-12 text-right">
                                <?php if(!empty($features)): ?>
                                    <a href="<?php echo e(route('subscriptions.index')); ?>" class="btn btn-theme btn-sm"><?php echo e(__('update_current_plan')); ?></a>
                                <?php else: ?>
                                    &nbsp;
                                <?php endif; ?>
                            </div>    
                            
                        </div>
                        <hr>
                        <div class="row">
                            <div class="form-group col-sm-12 col-md-4">
                                <label for=""><?php echo e(__('name')); ?></label>
                                <?php echo Form::text('name', $active_package ? $active_package->name : null, [
                                    'class' => 'form-control form-control-sm',
                                    'readonly',
                                ]); ?>

                            </div>
                            <div class="form-group col-sm-12 col-md-4">
                                <label for=""><?php echo e(__('start_date')); ?></label>
                                <?php echo Form::text('start_date', $active_package ? $active_package->start_date : null, [
                                    'class' => 'form-control form-control-sm',
                                    'readonly',
                                ]); ?>

                            </div>
                            <div class="form-group col-sm-12 col-md-4">
                                <label for=""><?php echo e(__('end_date')); ?></label>
                                <?php echo Form::text('end_date', $active_package ? $active_package->end_date : null, [
                                    'class' => 'form-control form-control-sm',
                                    'readonly',
                                ]); ?>

                            </div>
                            <div class="form-group col-sm-12 col-md-3">
                                <label for=""><?php echo e(__('per_active_student_charges')); ?>

                                    (<?php echo e($system_settings['currency_symbol']); ?>)</label>
                                <?php echo Form::text('student_charge', $active_package ? $active_package->student_charge : null, [
                                    'class' => 'form-control form-control-sm',
                                    'readonly',
                                ]); ?>

                            </div>
                            <div class="form-group col-sm-12 col-md-3">
                                <label for=""><?php echo e(__('per_active_staff_charges')); ?>

                                    (<?php echo e($system_settings['currency_symbol']); ?>)</label>
                                <?php echo Form::text('staff_charge', $active_package ? $active_package->staff_charge : null, [
                                    'class' => 'form-control form-control-sm',
                                    'readonly',
                                ]); ?>

                            </div>
                        </div>
                        <div class="row">
                            <?php if($active_package): ?>
                                <div class="form-group col-sm-12 col-md-12">
                                    <h2 class="card-title"><?php echo e(__('features')); ?></h2>
                                </div>
                                <?php $__currentLoopData = $active_package->subscription_feature; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $feature): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <div class="form-group col-sm-12 col-md-4">
                                        <input checked class="feature-checkbox" type="checkbox" name="feature_id"/>
                                        <label class="feature-list text-center"><?php echo e($feature->feature->name); ?></label>
                                    </div>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php endif; ?>
                        </div>
                        <hr>
                        <div class="row">
                            <div class="form-group col-sm-12 col-md-12">
                                <h2 class="card-title"><?php echo e(__('addons')); ?></h2>
                            </div>
                            <?php $__currentLoopData = $addons; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $addon): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="form-group col-sm-12 col-md-4">
                                    <input checked class="feature-checkbox" type="checkbox" name="feature_id"/>
                                    <label class="feature-list text-center">
                                        <?php echo e(__($addon->feature->name)); ?>

                                        <?php if($addon->status): ?>
                                            <i class="fa fa-times text-danger discontinue_addon"
                                               data-id="<?php echo e($addon->id); ?>"
                                               title="<?php echo e(__('discontinue_upcoming_plan')); ?>"></i>
                                        <?php endif; ?>

                                    </label>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    </div>
                </div>
            </div>

            
            <div class="col-md-3 col-sm-12 col-tb-6 grid-margin stretch-card">
                <div class="card">
                    <?php if($upcoming_package && $school_settings['auto_renewal_plan']): ?>
                        <div class="card-body">
                            <h4 class="card-title float-left"><?php echo e(__('upcoming_plan')); ?></h4>
                            <div class="row text-right">
                                <div class="col-sm-12 col-md-12">
                                    <a href="<?php echo e(route('subscriptions.index')); ?>" class="btn btn-sm btn-theme"><?php echo e(__('update_plan')); ?></a>
                                </div>
                            </div>
                            
                            <hr>
                            <div class="upcoming-feature-list">
                                <div class="row">
                                    <div class="form-group col-sm-12 col-md-12">
                                        <label for=""><?php echo e(__('name')); ?></label>
                                        <input type="text" name="name" class="form-control form-control-sm"
                                               value="<?php echo e($upcoming_package->name); ?>" readonly>
                                    </div>
                                </div>
                                <h4 class="card-title"><?php echo e(__('features')); ?></h4>

                                <ul class="list-unstyled">
                                    <?php $__currentLoopData = $upcoming_package->package->package_feature; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $feature): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <li><i class="fa fa-check check mr-2"></i><?php echo e($feature->feature->name); ?></li>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </ul>
                            </div>

                            <div class="addon">
                                <h4 class="card-title"><?php echo e(__('addons')); ?></h4>
                                <ul class="list-unstyled">
                                    <?php $__currentLoopData = $addons; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $addon): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <li>
                                            <?php if($addon->status): ?>
                                                <i class="fa fa-check check mr-2"></i><?php echo e($addon->feature->name); ?>

                                            <?php else: ?>
                                                <i class="fa fa-times no-feature mr-2"></i><?php echo e($addon->feature->name); ?>

                                            <?php endif; ?>
                                        </li>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </ul>
                            </div>
                        </div>
                        <div class="mx-4 text-justify text-uppercase">
                            <small
                                    class="text-danger"><?php echo e(__('Note : Certain additional features will not be part of the next billing period as they have already been integrated into your upcoming subscription package')); ?></small>
                        </div>
                        <div class="d-flex justify-content-between m-3">
                            
                            
                            
                            
                            <div class="ml-auto">
                                <button class="btn btn-danger btn-sm text-wrap cancel-upcoming-plan"
                                        <?php if($active_package->id == $upcoming_package->id): ?> data-id="" <?php else: ?> data-id="<?php echo e($upcoming_package->id); ?>" <?php endif; ?>
                                ><?php echo e(__('Cancel This Plan')); ?></button>
                            </div>
                        </div>

                    <?php else: ?>
                        <div class="card-body">
                            <h4 class="card-title"><?php echo e(__('upcoming_plan')); ?></h4>
                            <hr>
                        </div>
                    <?php endif; ?>
                </div>
            </div>

            <div class="col-sm-12 col-md-12 grid-margin stretch-card">
                <div class="card">
                    <div class="card-body">
                        <div class="row">
                            <div class="form-group col-sm-12 col-md-12">
                                <h3 class="card-title"><?php echo e(__('Active Subscription Billing Details')); ?></h3>
                                <hr>
                            </div>
                            <?php if($active_package): ?>
                                <div class="form-group col-sm-12 col-md-12 table-responsive">
                                    <table class="table table-bordered" data-mobile-responsive="true">
                                        <tr>
                                            <th class="text-center"><?php echo e(__('plan')); ?></th>
                                            <th class="text-center"><?php echo e(__('user')); ?></th>
                                            <th class="text-center"><?php echo e(__('charges')); ?> (<?php echo e($system_settings['currency_symbol']); ?>)</th>
                                            <th class="text-center"><?php echo e(__('total_user')); ?></th>
                                            <th class="text-center"><?php echo e(__('total_amount')); ?> (<?php echo e($system_settings['currency_symbol']); ?>)</th>
                                        </tr>
                                        <tr>
                                            <td class="text-center" rowspan="2"><?php echo e($active_package->name); ?></td>
                                            <td><?php echo e(__('students')); ?></td>
                                            <td class="text-right"><?php echo e($active_package->student_charge); ?></td>
                                            <td class="text-right"><?php echo e($data['students']); ?></td>
                                            <td class="text-right">
                                                <?php echo e(number_format($data['students'] * $active_package->student_charge, 2)); ?>

                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <?php echo e(__('staffs')); ?>

                                                <div class="text-small text-muted mt-2">
                                                    <?php echo e(__('including_teachers_and_other_staffs')); ?>

                                                </div>
                                            </td>
                                            <td class="text-right"><?php echo e($active_package->staff_charge); ?></td>
                                            <td class="text-right"><?php echo e($data['staffs']); ?></td>
                                            <td class="text-right">
                                                <?php echo e(number_format($data['staffs'] * $active_package->staff_charge, 2)); ?>

                                            </td>
                                        </tr>
                                        <tr>
                                            <th colspan="4"><?php echo e(__('Total User Charges')); ?> :</th>
                                            <th class="text-right">
                                                <?php echo e($system_settings['currency_symbol']); ?>

                                                <?php echo e(number_format($data['students'] * $active_package->student_charge + $data['staffs'] * $active_package->staff_charge, 2)); ?>

                                                <?php
                                                    $total_user_charges = number_format($data['students'] * $active_package->student_charge + $data['staffs'] * $active_package->staff_charge, 2);
                                                ?>
                                            </th>
                                        </tr>
                                        <tr>
                                            <th colspan="5" class="text-center"><?php echo e(__('addon_charges')); ?></th>
                                        </tr>
                                        <tr>
                                            <th colspan="4"><?php echo e(__('addon')); ?></th>
                                            <th class="text-center"><?php echo e(__('total_amount')); ?> (<?php echo e($system_settings['currency_symbol']); ?>)</th>
                                        </tr>
                                        <?php
                                            $total_addon_charges = 0;
                                        ?>
                                        <?php $__currentLoopData = $addons; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $addon): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <tr>
                                                <td colspan="4"><?php echo e($addon->feature->name); ?></td>
                                                <td class="text-right"><?php echo e(number_format($addon->price, 2)); ?> </td>
                                                <?php
                                                    $total_addon_charges += $addon->price;
                                                ?>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <th colspan="4"><?php echo e(__('total_addon_charges')); ?> :</th>
                                            <th class="text-right">
                                                <?php echo e($system_settings['currency_symbol']); ?><?php echo e(number_format($total_addon_charges, 2)); ?>

                                            </th>
                                        </tr>
                                        <tr>
                                            <th colspan="4"><?php echo e(__('total_bill_amount')); ?> :</th>
                                            <th class="text-right">
                                                <?php echo e($system_settings['currency_symbol']); ?><?php echo e(number_format($total_addon_charges + $total_user_charges, 2)); ?>

                                            </th>
                                        </tr>
                                    </table>
                                </div>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>


            <div class="col-md-12 grid-margin stretch-card">
                <div class="card">
                    <div class="card-body">
                        <h4 class="card-title"><?php echo e(__('history')); ?></h4>
                        <table aria-describedby="mydesc" class='table' id='table_list' data-toggle="table"
                               data-url="<?php echo e(route('subscriptions.show', 1)); ?>" data-click-to-select="true"
                               data-side-pagination="server" data-pagination="true"
                               data-page-list="[5, 10, 20, 50, 100, 200]" data-search="true" data-show-columns="true"
                               data-show-refresh="true" data-fixed-columns="true" data-fixed-number="2"
                               data-fixed-right-number="1" data-trim-on-search="false" data-mobile-responsive="true"
                               data-sort-name="id" data-sort-order="desc" data-maintain-selected="true"
                               data-export-data-type='all' data-query-params="subscriptionQueryParams"
                               data-toolbar="#toolbar"
                               data-export-options='{ "fileName": "subscription-list-<?= date('d-m-y') ?>"
                            ,"ignoreColumn":["operate"]}' data-show-export="true" data-escape="true">
                            <thead>
                            <tr>
                                <th scope="col" data-field="id" data-sortable="true" data-visible="false"><?php echo e(__('id')); ?></th>
                                <th scope="col" data-field="no"><?php echo e(__('no.')); ?></th>
                                <th scope="col" data-field="date" data-sortable="false"><?php echo e(__('bill_generate_date')); ?></th>
                                <th scope="col" data-field="due_date" data-sortable="false"><?php echo e(__('due_date')); ?></th>
                                <th scope="col" data-field="name" data-sortable="false"><?php echo e(__('name')); ?></th>
                                <th scope="col" data-width="500" data-field="description" data-sortable="false"><?php echo e(__('description')); ?></th>
                                <th scope="col" data-field="transaction_id"><?php echo e(__('transaction_id')); ?></th>
                                <th scope="col" data-field="total_student" data-sortable="false"><?php echo e(__('total_students')); ?></th>
                                <th scope="col" data-field="total_staff"> <?php echo e(__('total_staffs')); ?></th>
                                <th scope="col" data-field="amount"><?php echo e(__('Amount')); ?></th>
                                <th scope="col" data-field="payment_status" data-formatter="transactionPaymentStatus"><?php echo e(__('status')); ?></th>
                                <th scope="col" data-field="operate" data-events="subscriptionEvents" data-escape="false"><?php echo e(__('action')); ?></th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>

            
            <div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
                 aria-hidden="true">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content">
                        <div class="modal-header">

                            <h5 class="modal-title" id="exampleModalLabel"><span class="billing_cycle btn-gradient-dark p-2 text-small"></span></h5>

                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <form class="" action="<?php echo e(route('subscriptions.store')); ?>" novalidate="novalidate" data-stripe-publishable-key="<?php echo e($settings['stripe_publishable_key'] ?? null); ?>"
                              data-success-function="formSuccessFunction" method="post">
                            <?php echo csrf_field(); ?>
                            <input type="hidden" name="id" id="edit_id">
                            <div class="modal-body">
                                <div class="card">
                                    <div class="card-body">
                                        <div class="row">
                                            <div class="col-sm-12 col-md-12 table-responsive">
                                                <table class="table table-bordered">
                                                    <tr>
                                                        <th class="text-center"><?php echo e(__('plan')); ?></th>
                                                        <th class="text-center"><?php echo e(__('user')); ?></th>
                                                        <th class="text-center"><?php echo e(__('charges')); ?> (<?php echo e($system_settings['currency_symbol']); ?>)</th>
                                                        <th class="text-center"><?php echo e(__('total_user')); ?></th>
                                                        <th class="text-center"><?php echo e(__('total_amount')); ?> (<?php echo e($system_settings['currency_symbol']); ?>)</th>
                                                    </tr>
                                                    <tr>
                                                        <td class="text-center plan-name" rowspan="2"></td>
                                                        <td><?php echo e(__('students')); ?></td>
                                                        <td class="text-right student-charge"></td>
                                                        <td class="text-right total-student"></td>
                                                        <td class="text-right total-student-charge"></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <?php echo e(__('staffs')); ?>

                                                            <div class="text-small text-muted mt-2">
                                                                <?php echo e(__('including_teachers_and_other_staffs')); ?>

                                                            </div>
                                                        </td>
                                                        <td class="text-right staff-charge"></td>
                                                        <td class="text-right total-staff"></td>
                                                        <td class="text-right total-staff-charge"></td>
                                                    </tr>
                                                    <tr>
                                                        <th colspan="4" class="text-left">
                                                            <?php echo e(__('Total User Charges')); ?> :
                                                        </th>
                                                        <th class="text-right">
                                                            <span><?php echo e($system_settings['currency_symbol']); ?></span>
                                                            <span class="total-user-charges"></span>
                                                        </th>
                                                    </tr>
                                                    <tr>
                                                        <th colspan="5" class="text-center"><?php echo e(__('addon_charges')); ?>

                                                        </th>
                                                    </tr>
                                                    <tr>
                                                        <th colspan="4"><?php echo e(__('addon')); ?></th>
                                                        <th class="text-center"><?php echo e(__('total_amount')); ?> (<?php echo e($system_settings['currency_symbol']); ?>)</th>
                                                    </tr>
                                                    <tbody class="addon-charges">

                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-secondary"
                                                data-dismiss="modal"><?php echo e(__('close')); ?></button>
                                        <input class="btn btn-theme btn-pay" type="submit" value=<?php echo e(__('pay')); ?> />
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>

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

<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/mimeld/mxul.mimeld.com/resources/views/subscription/subscription.blade.php ENDPATH**/ ?>