<?php $__env->startSection('title', __('locale.buttons.new_subscription')); ?> <?php $__env->startSection('vendor-style'); ?> <!-- vendor css files --> <link rel="stylesheet" href="<?php echo e(asset(mix('vendors/css/forms/select/select2.min.css'))); ?>"> <?php $__env->stopSection(); ?> <?php $__env->startSection('content'); ?> <!-- Basic Vertical form layout section start --> <section id="basic-vertical-layouts"> <div class="row match-height"> <div class="col-md-6 col-12"> <div class="card"> <div class="card-header"> <h4 class="card-title"><?php echo e(__('locale.buttons.new_subscription')); ?> </h4> </div> <div class="card-content"> <div class="card-body"> <form class="form form-vertical" action="<?php echo e(route('admin.subscriptions.store')); ?>" method="post"> <?php echo csrf_field(); ?> <div class="form-body"> <div class="row"> <div class="col-12"> <div class="mb-1"> <label for="user_id" class="form-label required"><?php echo e(__('locale.labels.select_customer')); ?></label> <select class="form-select customer" name="user_id"> <?php $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $customer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($customer->id); ?>" <?php echo e(Request::get('customer_id') == $customer->id ? 'selected': null); ?>> <?php echo e($customer->displayName()); ?> </option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> <?php $__errorArgs = ['user_id']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p><small class="text-danger"><?php echo e($message); ?></small></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> <div class="col-12"> <div class="mb-1"> <label for="plan_id" class="form-label required"><?php echo e(__('locale.labels.select_plan')); ?></label> <select class="form-select plan" name="plan_id"> <?php $__currentLoopData = $plans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $plan): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($plan->id); ?>"><?php echo e(htmlspecialchars($plan->name)."|".htmlspecialchars(\App\Library\Tool::format_price($plan->price, $plan->currency->format))); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> <?php $__errorArgs = ['plan_id']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p><small class="text-danger"><?php echo e($message); ?></small></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> <div class="col-12"> <div class="mb-1"> <label for="end_period_last_days" class="form-label required"><?php echo e(__('locale.subscription.subscription_period_end')); ?></label> <input type="number" id="end_period_last_days" class="form-control text-right <?php $__errorArgs = ['end_period_last_days']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?>" value="10" name="end_period_last_days" required placeholder="<?php echo e(__('locale.labels.required')); ?>"> <?php $__errorArgs = ['end_period_last_days']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p><small class="text-danger"><?php echo e($message); ?></small></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> </div> <div class="col-12"> <button type="submit" class="btn btn-primary mb-1"><i data-feather="save"></i> <?php echo e(__('locale.buttons.create')); ?></button> </div> </div> </div> </form> </div> </div> </div> </div> </div> </section> <!-- // Basic Vertical form layout section end --> <?php $__env->stopSection(); ?> <?php $__env->startSection('vendor-script'); ?> <!-- vendor files --> <script src="<?php echo e(asset(mix('vendors/js/forms/select/select2.full.min.js'))); ?>"></script> <?php $__env->stopSection(); ?> <?php $__env->startSection('page-script'); ?> <script> $(document).ready(function () { function formatSearch(item) { let selectionText = item.text.split("|"); return $('<span>' + selectionText[0] + '</br><b>' + selectionText[1] + '</b>' + '</span>'); } function formatSelected(item) { let selectionText = item.text.split("|"); return $('<span>' + selectionText[0].substring(0, 100) + '</span>'); } $(".customer").each(function () { let $this = $(this); $this.wrap('<div class="position-relative"></div>'); $this.select2({ // the following code is used to disable x-scrollbar when click in select input and // take 100% width in responsive also dropdownAutoWidth: true, width: '100%', dropdownParent: $this.parent() }); }); $(".plan").each(function () { let $this = $(this); $this.wrap('<div class="position-relative"></div>'); $this.select2({ // the following code is used to disable x-scrollbar when click in select input and // take 100% width in responsive also dropdownAutoWidth: true, width: '100%', templateResult: formatSearch, templateSelection: formatSelected, dropdownParent: $this.parent() }); }); let firstInvalid = $('form').find('.is-invalid').eq(0); if (firstInvalid.length) { $('body, html').stop(true, true).animate({ 'scrollTop': firstInvalid.offset().top - 200 + 'px' }, 200); } }); </script> <?php $__env->stopSection(); ?> <?php echo $__env->make('layouts/contentLayoutMaster', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/bouloter/sms/resources/views/admin/subscriptions/create.blade.php ENDPATH**/ ?>