

<?php $__env->startSection('content'); ?>
  <div class="page-header">
    <h4 class="page-title">
      <?php if(request()->path()=='admin/pending/orders'): ?>
        Pending
      <?php elseif(request()->path()=='admin/all/orders'): ?>
        All
      <?php elseif(request()->path()=='admin/processing/orders'): ?>
        Processing
      <?php elseif(request()->path()=='admin/completed/orders'): ?>
        Completed
      <?php elseif(request()->path()=='admin/rejected/orders'): ?>
        Rejcted
      <?php endif; ?>
      Subscriptions
    </h4>
    <ul class="breadcrumbs">
      <li class="nav-home">
        <a href="<?php echo e(route('admin.dashboard')); ?>">
          <i class="flaticon-home"></i>
        </a>
      </li>
      <li class="separator">
        <i class="flaticon-right-arrow"></i>
      </li>
      <li class="nav-item">
        <a href="#">Package Management</a>
      </li>
      <li class="separator">
        <i class="flaticon-right-arrow"></i>
      </li>
      <li class="nav-item">
        <a href="#">Subscriptions</a>
      </li>
      <li class="separator">
        <i class="flaticon-right-arrow"></i>
      </li>
      <li class="nav-item">
        <a href="#">
            <?php if(request()->input('type')=='all'): ?>
                All
            <?php elseif(request()->input('type')=='active'): ?>
                Active
            <?php elseif(request()->input('type')=='expired'): ?>
                Expired
            <?php endif; ?>
            Subscriptions
        </a>
      </li>
    </ul>
  </div>
  <div class="row">
    <div class="col-md-12">

      <div class="card">
        <div class="card-header">
            <div class="row">
                <div class="col-lg-4">
                    <div class="card-title">
                        <?php if(request()->input('type')=='all'): ?>
                            All
                        <?php elseif(request()->input('type')=='active'): ?>
                            Active
                        <?php elseif(request()->input('type')=='expired'): ?>
                            Expired
                        <?php endif; ?>
                        Subscriptions
                    </div>
                </div>
                <div class="col-lg-7 offset-lg-1">
                    <button class="btn btn-danger float-right btn-md mr-2 d-none bulk-delete ml-2" data-href="<?php echo e(route('admin.sub.bulk.delete')); ?>"><i class="flaticon-interface-5"></i> Delete</button>
                    <form class="float-right" action="<?php echo e(route('admin.subscriptions')); ?>" id="searchForm">
                        <input type="hidden" name="type" value="<?php echo e(request()->input('type')); ?>">
                        <div class="row no-gutters">
                            <div class="col-lg-6">
                                <input name="term" type="text" class="form-control" placeholder="Customer Name / Email" value="<?php echo e(request()->input('term')); ?>">
                            </div>
                            <div class="col-lg-6">
                                <select name="package" class="form-control" onchange="document.getElementById('searchForm').submit()">
                                    <option value="">All Packages</option>
                                    <?php $__currentLoopData = $packages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $package): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($package->id); ?>" <?php echo e(request()->input('package') == $package->id ? 'selected' : ''); ?>><?php echo e($package->title); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="card-body">
          <div class="row">
            <div class="col-lg-12">
              <?php if(count($subscriptions) == 0): ?>
                <h3 class="text-center">NO SUBSCRIPTION <?php echo e(request()->input('type') == 'request' ? 'REQUEST' : ''); ?> FOUND</h3>
              <?php else: ?>
                <div class="table-responsive">
                  <table class="table table-striped mt-3">
                    <thead>
                      <tr>
                        <th scope="col">
                            <input type="checkbox" class="bulk-check" data-val="all">
                        </th>
                        <th scope="col">Name</th>
                        <th scope="col">Package</th>
                        <?php if(request()->input('type') == 'request'): ?>
                        <th scope="col">Decision</th>
                        <?php else: ?>
                        <th scope="col">Status</th>
                        <?php endif; ?>
                        <th scope="col">Details</th>
                        <?php if(request()->input('type') == 'request'): ?>
                        <th scope="col">Gateway</th>
                        <th scope="col">Receipt</th>
                        <?php endif; ?>
                        <th scope="col">Mail</th>
                        <th scope="col">Actions</th>
                      </tr>
                    </thead>
                    <tbody>
                      <?php $__currentLoopData = $subscriptions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $sub): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                          <td>
                            <input type="checkbox" class="bulk-check" data-val="<?php echo e($sub->id); ?>">
                          </td>
                          <td>
                              <?php echo e($sub->name); ?>

                          </td>
                          <td>
                              <?php if(request()->input('type') == 'request'): ?>
                              <?php echo e($sub->pending_package ? $sub->pending_package->title : '-'); ?>

                              <?php else: ?>
                              <?php echo e($sub->current_package ? $sub->current_package->title : '-'); ?>

                              <?php endif; ?>
                          </td>
                          <td>
                              
                              <?php if(request()->input('type') == 'request'): ?>
                                <form action="<?php echo e(route('admin.subscription.status')); ?>" class="inline-block" id="statusForm" method="POST">
                                    <?php echo csrf_field(); ?>
                                    <input type="hidden" name="subscription_id" value="<?php echo e($sub->id); ?>">
                                    <select class="form-control form-control-sm" name="status" onchange="document.getElementById('statusForm').submit()">
                                        <option value="">Pending</option>
                                        <option value="accept">Accept</option>
                                        <option value="reject">Reject</option>
                                    </select>
                                </form>
                              <?php else: ?>
                                <?php if($sub->status == 0): ?>
                                    <span class="badge badge-danger"><i class="far fa-times-circle"></i> Expired</span>
                                <?php elseif($sub->status == 1): ?>
                                    <span class="badge badge-success"><i class="far fa-check-circle"></i> Active</span>
                                <?php endif; ?>
                              <?php endif; ?>
                          </td>
                          <td>
                              <button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#detailsModal<?php echo e($sub->id); ?>">
                                  Details
                              </button>
                          </td>
                          <?php if(request()->input('type') == 'request'): ?>
                          <td>
                              <?php echo e($sub->pending_payment_method); ?>

                          </td>
                          <td>
                              <?php if(!empty($sub->receipt)): ?>
                                <a href="#" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#receiptModal<?php echo e($sub->id); ?>">Receipt</a>
                              <?php else: ?>
                                -
                              <?php endif; ?>
                          </td>
                          <?php endif; ?>
                          <td>
                              <button class="btn btn-secondary btn-sm editbtn" data-toggle="modal" data-target="#mailModal" data-email="<?php echo e($sub->email); ?>">Mail</button>
                          </td>
                          <td>
                            <form class="deleteform d-block" action="<?php echo e(route('admin.package.subDelete')); ?>" method="post">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="subscription_id" value="<?php echo e($sub->id); ?>">
                                <button type="submit" class="btn btn-danger btn-sm deletebtn">
                                  Delete
                                </button>
                            </form>
                          </td>
                        </tr>


                        <?php if(request()->input('type') == 'request'): ?>
                        
                        <div class="modal fade" id="receiptModal<?php echo e($sub->id); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                            <div class="modal-dialog" role="document">
                              <div class="modal-content">
                                <div class="modal-header">
                                  <h5 class="modal-title" id="exampleModalLabel">Receipt Image</h5>
                                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span>
                                  </button>
                                </div>
                                <div class="modal-body">
                                    <img src="<?php echo e(asset('assets/front/receipt/' . $sub->receipt)); ?>" alt="Receipt" width="100%">
                                </div>
                                <div class="modal-footer">
                                  <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                </div>
                              </div>
                            </div>
                        </div>
                        <?php endif; ?>

                        <?php if ($__env->exists('admin.package.subscription-details')) echo $__env->make('admin.package.subscription-details', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                      <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                  </table>
                </div>

                <!-- Send Mail Modal -->
                <div class="modal fade" id="mailModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
                  <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
                    <div class="modal-content">
                      <div class="modal-header">
                        <h5 class="modal-title" id="exampleModalLongTitle">Send Mail</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                          <span aria-hidden="true">&times;</span>
                        </button>
                      </div>
                      <div class="modal-body">
                        <form id="ajaxEditForm" class="" action="<?php echo e(route('admin.subscription.mail')); ?>" method="POST">
                          <?php echo csrf_field(); ?>
                          <div class="form-group">
                            <label for="">Client Mail **</label>
                            <input id="inemail" type="text" class="form-control" name="email" value="" placeholder="Enter email">
                            <p id="eerremail" class="mb-0 text-danger em"></p>
                          </div>
                          <div class="form-group">
                            <label for="">Subject **</label>
                            <input id="insubject" type="text" class="form-control" name="subject" value="" placeholder="Enter subject">
                            <p id="eerrsubject" class="mb-0 text-danger em"></p>
                          </div>
                          <div class="form-group">
                            <label for="">Message **</label>
                            <textarea id="inmessage" class="form-control summernote" name="message" placeholder="Enter message" data-height="150"></textarea>
                            <p id="eerrmessage" class="mb-0 text-danger em"></p>
                          </div>
                        </form>
                      </div>
                      <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                        <button id="updateBtn" type="button" class="btn btn-primary">Send Mail</button>
                      </div>
                    </div>
                  </div>
                </div>
              <?php endif; ?>
            </div>
          </div>
        </div>
        <div class="card-footer">
          <div class="row">
            <div class="d-inline-block mx-auto">
                <?php echo e($subscriptions->links()); ?>

            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

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

<?php echo $__env->make('admin.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\xampp\htdocs\plusagency\without-license\plusagency-3.2\core\resources\views/admin/package/subscriptions.blade.php ENDPATH**/ ?>