first commit
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
@extends('theme::layouts.app')
|
||||
|
||||
@section('style')
|
||||
<style>
|
||||
.form-tabs {
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.list-buttons-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-width: 95px;
|
||||
}
|
||||
.list-buttons-wrapper .list-buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 41px;
|
||||
height: 41px;
|
||||
background-color: #009B9A;
|
||||
color: #000000;
|
||||
border-radius: 50px;
|
||||
font-size: 24px;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.basic-services-item-list-wrapper .basic-services-item-list-item .list-title {
|
||||
opacity: 0;
|
||||
}
|
||||
.basic-services-item-list-wrapper .basic-services-item-list-item:first-of-type .list-title {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.basic-services-wrapper .basic-services-item:first-of-type .basic-services-buttons {
|
||||
display: none;
|
||||
}
|
||||
.optional-services-wrapper .optional-services-item:first-of-type .optional-services-buttons {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<h2 class="dashboard-title">{{ __("Subscription Details") }}</h2>
|
||||
<div class="tabs-content">
|
||||
<div class="tabs-content-item">
|
||||
<form action="{{ route('cms.subscriptions.management.store') }}" class="form-tabs white-input" id="addFrm">
|
||||
<input type="hidden" name="service_type" value="{{ isset($subscription) && $subscription ? $subscription->service_type : $service_type }}">
|
||||
|
||||
@include('theme::cms.subscriptions.management.form')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<script>
|
||||
$(document).ready( function () {
|
||||
$('#addFrm').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var action = $(this).attr('action');
|
||||
var button = $(this).find('button[type="submit"]');
|
||||
var buttonHtml = button.html();
|
||||
|
||||
if (!button.is(':disabled') && action) {
|
||||
button.attr('disabled', 'disabled');
|
||||
button.html('<i class="fa fa-spinner fa-spin" style="font-size:24px"></i>');
|
||||
|
||||
$.ajax({
|
||||
url: action,
|
||||
type: "post",
|
||||
data: $(this).serialize(),
|
||||
dataType: 'json',
|
||||
success:function(data) {
|
||||
button.removeAttr('disabled');
|
||||
button.html(buttonHtml);
|
||||
|
||||
if (data.success) {
|
||||
popToast('success', data.message);
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.href = '{{ route("cms.subscriptions.management") }}';
|
||||
}, 2000);
|
||||
}
|
||||
else {
|
||||
popToast('danger', data.message);
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
var errors = data.responseJSON.errors;
|
||||
$.each(errors, function(index, error) {
|
||||
popToast('danger', errors[0]);
|
||||
return false;
|
||||
});
|
||||
|
||||
button.removeAttr('disabled');
|
||||
button.html(buttonHtml);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,103 @@
|
||||
@extends('theme::layouts.app')
|
||||
|
||||
@section('style')
|
||||
<style>
|
||||
.form-tabs {
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.list-buttons-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-width: 95px;
|
||||
}
|
||||
.list-buttons-wrapper .list-buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 41px;
|
||||
height: 41px;
|
||||
background-color: #009B9A;
|
||||
color: #000000;
|
||||
border-radius: 50px;
|
||||
font-size: 24px;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.basic-services-item-list-wrapper .basic-services-item-list-item .list-title {
|
||||
opacity: 0;
|
||||
}
|
||||
.basic-services-item-list-wrapper .basic-services-item-list-item:first-of-type .list-title {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.basic-services-wrapper .basic-services-item:first-of-type .basic-services-buttons {
|
||||
display: none;
|
||||
}
|
||||
.optional-services-wrapper .optional-services-item:first-of-type .optional-services-buttons {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<h2 class="dashboard-title">{{ __("Subscription Details") }}</h2>
|
||||
<div class="tabs-content">
|
||||
<div class="tabs-content-item">
|
||||
<form action="{{ route('cms.subscriptions.management.update', ['subscription' => $subscription->id]) }}" class="form-tabs white-input" id="editFrm">
|
||||
@include('theme::cms.subscriptions.management.form')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<script>
|
||||
$(document).ready( function () {
|
||||
$('#editFrm').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var action = $(this).attr('action');
|
||||
var button = $(this).find('button[type="submit"]');
|
||||
var buttonHtml = button.html();
|
||||
|
||||
if (!button.is(':disabled') && action) {
|
||||
button.attr('disabled', 'disabled');
|
||||
button.html('<i class="fa fa-spinner fa-spin" style="font-size:24px"></i>');
|
||||
|
||||
$.ajax({
|
||||
url: action,
|
||||
type: "post",
|
||||
data: $(this).serialize(),
|
||||
dataType: 'json',
|
||||
success:function(data) {
|
||||
button.removeAttr('disabled');
|
||||
button.html(buttonHtml);
|
||||
|
||||
if (data.success) {
|
||||
popToast('success', data.message);
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.href = '{{ route("cms.subscriptions.management") }}';
|
||||
}, 2000);
|
||||
}
|
||||
else {
|
||||
popToast('danger', data.message);
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
var errors = data.responseJSON.errors;
|
||||
$.each(errors, function(index, error) {
|
||||
popToast('danger', errors[0]);
|
||||
return false;
|
||||
});
|
||||
|
||||
button.removeAttr('disabled');
|
||||
button.html(buttonHtml);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,270 @@
|
||||
|
||||
@csrf
|
||||
<div class="flex">
|
||||
<div class="label-field"><label>
|
||||
<span>{{ __("Status") }}</span>
|
||||
<select name="status" required>
|
||||
<option value="active" {{ isset($subscription) && $subscription && $subscription->status == 'active' ? 'selected' : '' }}>{{ __("Active") }}</option>
|
||||
<option value="inactive" {{ isset($subscription) && $subscription && $subscription->status == 'inactive' ? 'selected' : '' }}>{{ __("Inactive") }}</option>
|
||||
</select>
|
||||
</label></div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="label-field"><label>
|
||||
<span>{{ __("Name(English)") }}</span>
|
||||
<input type="text" placeholder="" value="{{ isset($subscription) && $subscription ? $subscription->name_english : '' }}" name="name_english" required>
|
||||
</label></div>
|
||||
<div class="label-field"><label>
|
||||
<span>{{ __("Name(Chinese)") }}</span>
|
||||
<input type="text" placeholder="" value="{{ isset($subscription) && $subscription ? $subscription->name_chinese : '' }}" name="name_chinese" required>
|
||||
</label></div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="label-field"><label>
|
||||
<span>{{ __("Period(English)") }}</span>
|
||||
<select name="period_english" required>
|
||||
<option value="annually" {{ isset($subscription) && $subscription && $subscription->period_english == 'annually' ? 'selected' : '' }}>Annually</option>
|
||||
<option value="monthly" {{ isset($subscription) && $subscription && $subscription->period_english == 'monthly' ? 'selected' : '' }}>Monthly</option>
|
||||
<option value="daily" {{ isset($subscription) && $subscription && $subscription->period_english == 'daily' ? 'selected' : '' }}>Daily</option>
|
||||
</select>
|
||||
</label></div>
|
||||
<div class="label-field"><label>
|
||||
<span>{{ __("Period(Chinese)") }}</span>
|
||||
<select name="period_chinese" required>
|
||||
<option value="每年" {{ isset($subscription) && $subscription && $subscription->period_chinese == '每年' ? 'selected' : '' }}>每年</option>
|
||||
<option value="每月" {{ isset($subscription) && $subscription && $subscription->period_chinese == '每月' ? 'selected' : '' }}>每月</option>
|
||||
<option value="每日" {{ isset($subscription) && $subscription && $subscription->period_chinese == '每日' ? 'selected' : '' }}>每日</option>
|
||||
</select>
|
||||
</label></div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="label-field"><label>
|
||||
<span>{{ __("Name description(English)") }}</span>
|
||||
<input type="text" placeholder="" name="description_english" value="{{ isset($subscription) && $subscription ? $subscription->description_english : '' }}" required>
|
||||
</label></div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="label-field"><label>
|
||||
<span>{{ __("Name description(Chinese)") }}</span>
|
||||
<input type="text" placeholder="" name="description_chinese" value="{{ isset($subscription) && $subscription ? $subscription->description_chinese : '' }}" required>
|
||||
</label></div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="label-field"><label>
|
||||
<span>{{ __("Price") }}($)</span>
|
||||
<input type="text" class="number-only" placeholder="" name="price" value="{{ isset($subscription) && $subscription ? $subscription->price : '' }}" required>
|
||||
</label></div>
|
||||
</div>
|
||||
|
||||
<div class="legend-form form-tabs basic-services-wrapper">
|
||||
<h3 class="nomarg">Basic services</h3>
|
||||
@php
|
||||
$basicServices = isset($subscription) && $subscription ? $subscription->basicServices : [[]];
|
||||
@endphp
|
||||
@foreach ($basicServices as $basicService)
|
||||
<div class="form-tabs basic-services-item">
|
||||
<div class="flex align-center">
|
||||
<div class="fit-content">
|
||||
Service <span class="basic-services-count">{{ $loop->iteration }}</span> title
|
||||
</div>
|
||||
<div class="label-field"><label>
|
||||
<span>(English)</span>
|
||||
<input type="text" placeholder="" value="{{ isset($basicService->title_english) ? $basicService->title_english : '' }}" name="basic_service_title_english[{{ $loop->index }}]" required>
|
||||
</label></div>
|
||||
<div class="label-field"><label>
|
||||
<span>(Chinese)</span>
|
||||
<input type="text" placeholder="" value="{{ isset($basicService->title_chinese) ? $basicService->title_chinese : '' }}" name="basic_service_title_chinese[{{ $loop->index }}]" required>
|
||||
</label></div>
|
||||
</div>
|
||||
<div class="form-tabs basic-services-item-list-wrapper">
|
||||
@php
|
||||
$lists = isset($basicService->lists) ? $basicService->lists : [[]];
|
||||
@endphp
|
||||
@foreach ($lists as $list)
|
||||
<div class="flex align-center basic-services-item-list-item">
|
||||
<div class="fit-content list-title">
|
||||
{{ __("Service") }} <span class="basic-services-count">{{ $loop->iteration }}</span> {{ __("list") }}
|
||||
</div>
|
||||
<div class="label-field">
|
||||
<label>
|
||||
<span>({{ __("English") }})</span>
|
||||
<input type="text" placeholder="" value="{{ isset($list->title_english) ? $list->title_english : '' }}" class="basic_service_list_title_english" name="basic_service_list_title_english[{{ $loop->parent->index }}][{{ $loop->index }}]" required>
|
||||
</label>
|
||||
</div>
|
||||
<div class="label-field">
|
||||
<label>
|
||||
<span>({{ __("Chinese") }})</span>
|
||||
<input type="text" placeholder="" value="{{ isset($list->title_chinese) ? $list->title_chinese : '' }}" class="basic_service_list_title_chinese" name="basic_service_list_title_chinese[{{ $loop->parent->index }}][{{ $loop->index }}]" required>
|
||||
</label>
|
||||
</div>
|
||||
<div class="list-buttons-wrapper">
|
||||
<button type="button" class="list-buttons" data-action="remove">-</button>
|
||||
<button type="button" class="list-buttons" data-action="add">+</button>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="flex">
|
||||
<button type="button" class="btn btn-error basic-services-buttons btn-normal" data-action="remove">{{ __("Remove service") }}</button>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
<div class="flex">
|
||||
<button type="button" class="btn primary-button btn-normal basic-services-buttons" data-action="add">{{ __("Add new service") }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="legend-form form-tabs optional-services-wrapper">
|
||||
<h3 class="nomarg">Optional services</h3>
|
||||
@php
|
||||
$optionalServices = isset($subscription) && $subscription ? $subscription->optionalServices : [[]];
|
||||
@endphp
|
||||
@foreach ($optionalServices as $optionalService)
|
||||
<div class="form-tabs optional-services-item">
|
||||
<div class="flex align-center optional-services-item-list-item">
|
||||
<div class="fit-content list-title">
|
||||
{{ __("Service") }} <span class="optional-services-count">{{ $loop->iteration }}</span> {{ __("list") }}
|
||||
</div>
|
||||
<div class="label-field">
|
||||
<label>
|
||||
<span>({{ __("English") }})</span>
|
||||
<input type="text" placeholder="" value="{{ isset($optionalService->title_english) ? $optionalService->title_english : '' }}" name="optional_service_title_english[{{ $loop->index }}]" required>
|
||||
</label>
|
||||
</div>
|
||||
<div class="label-field">
|
||||
<label>
|
||||
<span>({{ __("Chinese") }})</span>
|
||||
<input type="text" placeholder="" value="{{ isset($optionalService->title_chinese) ? $optionalService->title_chinese : '' }}" name="optional_service_title_chinese[{{ $loop->index }}]" required>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex align-center price-fields">
|
||||
<div class="fit-content">
|
||||
{{ __("Service") }} <span class="optional-services-count">{{ $loop->iteration }}</span> {{ strtolower(__("Price")) }}
|
||||
</div>
|
||||
<div class="label-field">
|
||||
<label>
|
||||
<input type="radio" class="optional_service_is_custom" name="optional_service_is_custom[{{ $loop->index }}]" value="no" {{ isset($optionalService->is_custom) && !$optionalService->is_custom ? 'checked' : '' }} required>
|
||||
<span>$</span>
|
||||
<input type="text" class="number-only" name="optional_service_price[{{ $loop->index }}]" value="{{ isset($optionalService->is_custom) && !$optionalService->is_custom && isset($optionalService->price) ? $optionalService->price : '' }}">
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ __("Period") }}</span>
|
||||
<select name="optional_service_period[{{ $loop->index }}]">
|
||||
<option value="year" {{ isset($optionalService->is_custom) && !$optionalService->is_custom && isset($optionalService->period) && $optionalService->period == 'year' ? 'selected' : '' }}>{{ __("Year") }}</option>
|
||||
<option value="month" {{ isset($optionalService->is_custom) && !$optionalService->is_custom && isset($optionalService->period) && $optionalService->period == 'month' ? 'selected' : '' }}>{{ __("Month") }}</option>
|
||||
<option value="day" {{ isset($optionalService->is_custom) && !$optionalService->is_custom && isset($optionalService->period) && $optionalService->period == 'day' ? 'selected' : '' }}>{{ __("Day") }}</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="label-field">
|
||||
<label>
|
||||
<input type="radio" class="optional_service_is_custom" name="optional_service_is_custom[{{ $loop->index }}]" value="yes" {{ isset($optionalService->is_custom) && $optionalService->is_custom ? 'checked' : '' }} required>
|
||||
<span>{{ __("Custom") }}:</span>
|
||||
<input type="text" name="optional_service_custom_description[]" value="{{ isset($optionalService->is_custom) && $optionalService->is_custom && isset($optionalService->custom_description) ? $optionalService->custom_description : '' }}">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex">
|
||||
<button type="button" class="btn btn-error optional-services-buttons btn-normal" data-action="remove">{{ __("Remove service") }}</button>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<div class="flex">
|
||||
<button type="button" class="btn primary-button btn-normal optional-services-buttons" data-action="add">{{ __("Add new service") }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center justify-content-center">
|
||||
<button type="submit" class="btn green-btn mx-3">{{ __("Save") }}</button>
|
||||
<a href="{{ route('cms.subscriptions.management') }}" class="btn red-btn mx-3">{{ __("Back") }}</a>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready( function () {
|
||||
$(document).on('click', '.basic-services-item-list-wrapper .basic-services-item-list-item .list-buttons', function(e) {
|
||||
var action = $(this).attr('data-action');
|
||||
var parentWrapper = $(this).parents('.basic-services-item-list-wrapper').first();
|
||||
|
||||
if (action == 'add') {
|
||||
var cloneWrapper = parentWrapper.find('.basic-services-item-list-item').first().clone();
|
||||
|
||||
cloneWrapper.find('input[type="text"]').val('');
|
||||
|
||||
parentWrapper.append(cloneWrapper);
|
||||
}
|
||||
else if (action == 'remove') {
|
||||
if (parentWrapper.find('.basic-services-item-list-item').length > 1) {
|
||||
$(this).parents('.basic-services-item-list-item').first().remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
$(document).on('click', '.basic-services-wrapper .basic-services-buttons', function(e) {
|
||||
var action = $(this).attr('data-action');
|
||||
var parentWrapper = $(this).parents('.basic-services-wrapper').first();
|
||||
|
||||
if (action == 'add') {
|
||||
var cloneWrapper = parentWrapper.find('.basic-services-item').first().clone();
|
||||
|
||||
cloneWrapper.find('.basic-services-count').text(parentWrapper.find('.basic-services-item').length + 1);
|
||||
cloneWrapper.find('input[type="text"]').val('');
|
||||
cloneWrapper.find('.basic-services-item-list-wrapper .basic-services-item-list-item:not(:first-child)').remove();
|
||||
cloneWrapper.find('.basic-services-item-list-wrapper .basic-services-item-list-item .basic_service_list_title_english').attr('name', 'basic_service_list_title_english[' + parentWrapper.find('.basic-services-item').length + '][]');
|
||||
cloneWrapper.find('.basic-services-item-list-wrapper .basic-services-item-list-item .basic_service_list_title_chinese').attr('name', 'basic_service_list_title_chinese[' + parentWrapper.find('.basic-services-item').length + '][]');
|
||||
|
||||
parentWrapper.find('.basic-services-item:last').after(cloneWrapper);
|
||||
}
|
||||
else if (action == 'remove') {
|
||||
if (parentWrapper.find('.basic-services-item').length > 1) {
|
||||
$(this).parents('.basic-services-item').first().remove();
|
||||
|
||||
var count = 1;
|
||||
parentWrapper.find('.basic-services-item').each(function( index ) {
|
||||
$(this).find('.basic-services-count').text(count);
|
||||
$(this).find('.basic-services-item-list-wrapper .basic-services-item-list-item .basic_service_list_title_english').attr('name', 'basic_service_list_title_english[' + (count - 1) + '][]');
|
||||
$(this).find('.basic-services-item-list-wrapper .basic-services-item-list-item .basic_service_list_title_chinese').attr('name', 'basic_service_list_title_chinese[' + (count - 1) + '][]');
|
||||
count++;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
$(document).on('click', '.optional-services-wrapper .optional-services-buttons', function(e) {
|
||||
var action = $(this).attr('data-action');
|
||||
var parentWrapper = $(this).parents('.optional-services-wrapper').first();
|
||||
|
||||
if (action == 'add') {
|
||||
var cloneWrapper = parentWrapper.find('.optional-services-item').first().clone();
|
||||
|
||||
cloneWrapper.find('.optional-services-count').text(parentWrapper.find('.optional-services-item').length + 1);
|
||||
cloneWrapper.find('input[type="radio"]').prop('checked', false);
|
||||
cloneWrapper.find('.optional_service_is_custom').attr('name', 'optional_service_is_custom[' + parentWrapper.find('.optional-services-item').length + ']');
|
||||
cloneWrapper.find('.price-fields').find('select').removeAttr('required');
|
||||
cloneWrapper.find('.price-fields').first().find('input[type="text"]').removeAttr('required');
|
||||
|
||||
parentWrapper.find('.optional-services-item:last').after(cloneWrapper);
|
||||
}
|
||||
else if (action == 'remove') {
|
||||
if (parentWrapper.find('.optional-services-item').length > 1) {
|
||||
$(this).parents('.optional-services-item').first().remove();
|
||||
|
||||
var count = 1;
|
||||
parentWrapper.find('.optional-services-item').each(function( index ) {
|
||||
$(this).find('.optional-services-count').text(count);
|
||||
$(this).find('.optional_service_is_custom').attr('name', 'optional_service_is_custom[' + (count - 1) + ']');
|
||||
count++;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
$(document).on('change', '.optional_service_is_custom', function(e) {
|
||||
$(this).parents('.price-fields').first().find('select').removeAttr('required');
|
||||
$(this).parents('.price-fields').first().find('input[type="text"]').removeAttr('required');
|
||||
|
||||
$(this).parents('.label-field').first().find('select').attr('required', 'required');
|
||||
$(this).parents('.label-field').first().find('input[type="text"]').attr('required', 'required');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,323 @@
|
||||
@extends('theme::layouts.app')
|
||||
|
||||
|
||||
@section('content')
|
||||
<div class="dashboard-title-flex space-between">
|
||||
<h2 class="dashboard-title">{{ __("Subscription Management") }}</h2>
|
||||
<div class="dashboard-button-title">
|
||||
@if (auth()->user()->userRole->hasAccess('manage-subscription-packages'))
|
||||
<a href="{{ route('cms.subscriptions.management.create', ['service_type' => 'bookkeeping']) }}" class="btn primary-button add-new-btn">{{ __("Add New") }}</a>
|
||||
@endif
|
||||
<a href="{{ route('cms.subscriptions') }}" class="btn btn-error">{{ __("Back") }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tabs-navigation blue-tabs">
|
||||
<ul>
|
||||
<li class="active"><a href="#" class="js-tab-navigate" data-id="#in-queue" data-add-url="{{ route('cms.subscriptions.management.create', ['service_type' => 'bookkeeping']) }}"><img class="dashboard-detail-image max-25" src="{{ asset('themes/tailwind/images/business-black.svg') }}"> {{ __("Bookkeeping") }}</a></li>
|
||||
<li><a href="#" class="js-tab-navigate" data-id="#completed" data-add-url="{{ route('cms.subscriptions.management.create', ['service_type' => 'company_secretary']) }}"><img class="dashboard-detail-image max-25" src="{{ asset('themes/tailwind/images/secretary-black.svg') }}"> {{ __("Company Secretary") }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="tabs-content">
|
||||
<div class="tabs-content-item white-bg no-padd no-box-shadow" id="in-queue">
|
||||
<table id="bookkeppingSubscriptionListTable" class="">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{{ __("Name") }}</td>
|
||||
<td>{{ __("Price") }}</td>
|
||||
<td>{{ __("Period") }}</td>
|
||||
<td>{{ __("Status") }}</td>
|
||||
<td>{{ __("Action") }}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{-- <tr>
|
||||
<td>Demi</td>
|
||||
<td>$14,000</td>
|
||||
<td>Anually</td>
|
||||
<td><span class="success item-list-note">Active</span></td>
|
||||
<td><a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">View</a> <span class="long-pipe">|</span> <a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">Edit</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Demi</td>
|
||||
<td>$14,000</td>
|
||||
<td>Anually</td>
|
||||
<td><span class="success item-list-note">Active</span></td>
|
||||
<td><a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">View</a> <span class="long-pipe">|</span> <a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">Edit</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Demi</td>
|
||||
<td>$14,000</td>
|
||||
<td>Anually</td>
|
||||
<td><span class="success item-list-note">Active</span></td>
|
||||
<td><a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">View</a> <span class="long-pipe">|</span> <a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">Edit</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Demi</td>
|
||||
<td>$14,000</td>
|
||||
<td>Anually</td>
|
||||
<td><span class="success item-list-note">Active</span></td>
|
||||
<td><a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">View</a> <span class="long-pipe">|</span> <a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">Edit</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Demi</td>
|
||||
<td>$14,000</td>
|
||||
<td>Anually</td>
|
||||
<td><span class="success item-list-note">Active</span></td>
|
||||
<td><a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">View</a> <span class="long-pipe">|</span> <a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">Edit</a></td>
|
||||
</tr> --}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tabs-content-item white-bg no-padd no-box-shadow" id="completed" style="display: none;">
|
||||
<table id="comSecSubscriptionListTable" class="">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{{ __("Name") }}</td>
|
||||
<td>{{ __("Price") }}</td>
|
||||
<td>{{ __("Period") }}</td>
|
||||
<td>{{ __("Status") }}</td>
|
||||
<td>{{ __("Action") }}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{-- <tr>
|
||||
<td>Demi</td>
|
||||
<td>$14,000</td>
|
||||
<td>Anually</td>
|
||||
<td><span class="success item-list-note">Active</span></td>
|
||||
<td><a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">View</a> <span class="long-pipe">|</span> <a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">Edit</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Demi</td>
|
||||
<td>$14,000</td>
|
||||
<td>Anually</td>
|
||||
<td><span class="success item-list-note">Active</span></td>
|
||||
<td><a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">View</a> <span class="long-pipe">|</span> <a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">Edit</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Demi</td>
|
||||
<td>$14,000</td>
|
||||
<td>Anually</td>
|
||||
<td><span class="success item-list-note">Active</span></td>
|
||||
<td><a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">View</a> <span class="long-pipe">|</span> <a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">Edit</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Demi</td>
|
||||
<td>$14,000</td>
|
||||
<td>Anually</td>
|
||||
<td><span class="success item-list-note">Active</span></td>
|
||||
<td><a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">View</a> <span class="long-pipe">|</span> <a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">Edit</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Demi</td>
|
||||
<td>$14,000</td>
|
||||
<td>Anually</td>
|
||||
<td><span class="success item-list-note">Active</span></td>
|
||||
<td><a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">View</a> <span class="long-pipe">|</span> <a href="{{ route('cms.subscriptions.management') }}?u=1" class="primary-text">Edit</a></td>
|
||||
</tr> --}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<script>
|
||||
$(document).ready( function () {
|
||||
var currentLanguage = $('#currentLanguage').val();
|
||||
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
var bookkeppingSubscriptionListTable = $("#bookkeppingSubscriptionListTable").DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
url: '{{ route("cms.subscriptions.management.table", ["service_type" => "bookkeeping"]) }}',
|
||||
type: 'post',
|
||||
"dataSrc": function ( json ) {
|
||||
for (var i = 0; i < json.data.length; i++) {
|
||||
$.each( json.data[i], function( key, value ) {
|
||||
json.data[i][key] = value ? value : '-';
|
||||
});
|
||||
}
|
||||
|
||||
return json.data;
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
(currentLanguage == 'zh_hk' ? {data: 'name_chinese', name: 'name_chinese'} : {data: 'name_english', name: 'name_english'}),
|
||||
{data: 'price', name: 'price'},
|
||||
(currentLanguage == 'zh_hk' ? {data: 'period_chinese', name: 'period_chinese'} : {data: 'period_english', name: 'period_english'}),
|
||||
{data: 'status', name: 'status'},
|
||||
{data: 'actions', name: 'actions', searchable: false, sortable: false}
|
||||
],
|
||||
order: [[0, "asc"]],
|
||||
searchDelay: 500,
|
||||
"language": {
|
||||
"paginate": {
|
||||
"next": ">", // Text for the "Next" page button
|
||||
"previous": "<" // Text for the "Previous" page button
|
||||
},
|
||||
"emptyTable": '{{ __("No data available in table") }}'
|
||||
// Add more text customizations if needed
|
||||
}
|
||||
});
|
||||
|
||||
var comSecSubscriptionListTable = $("#comSecSubscriptionListTable").DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
url: '{{ route("cms.subscriptions.management.table", ["service_type" => "company_secretary"]) }}',
|
||||
type: 'post',
|
||||
"dataSrc": function ( json ) {
|
||||
for (var i = 0; i < json.data.length; i++) {
|
||||
$.each( json.data[i], function( key, value ) {
|
||||
json.data[i][key] = value ? value : '-';
|
||||
});
|
||||
}
|
||||
|
||||
return json.data;
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
(currentLanguage == 'zh_hk' ? {data: 'name_chinese', name: 'name_chinese'} : {data: 'name_english', name: 'name_english'}),
|
||||
{data: 'price', name: 'price'},
|
||||
(currentLanguage == 'zh_hk' ? {data: 'period_chinese', name: 'period_chinese'} : {data: 'period_english', name: 'period_english'}),
|
||||
{data: 'status', name: 'status'},
|
||||
{data: 'actions', name: 'actions', searchable: false, sortable: false}
|
||||
],
|
||||
order: [[0, "asc"]],
|
||||
searchDelay: 500,
|
||||
"language": {
|
||||
"paginate": {
|
||||
"next": ">", // Text for the "Next" page button
|
||||
"previous": "<" // Text for the "Previous" page button
|
||||
},
|
||||
"emptyTable": '{{ __("No data available in table") }}'
|
||||
// Add more text customizations if needed
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.suspend-subscription', function(e) {
|
||||
var action = $(this).attr('data-action');
|
||||
|
||||
if (action) {
|
||||
Swal.fire({
|
||||
title: '{{ __("Are you sure?") }}',
|
||||
text: `{{ __("You would not be able to revert this!") }}`,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: '{{ __("Yes") }}',
|
||||
cancelButtonText: '{{ __("Cancel") }}'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: action,
|
||||
type: "post",
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success:function(data) {
|
||||
if (data.success) {
|
||||
$('#validationModal').modal('show');
|
||||
$('#validationModal .error-message').html(data.message);
|
||||
|
||||
bookkeppingSubscriptionListTable.ajax.reload();
|
||||
comSecSubscriptionListTable.ajax.reload();
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
var errors = data.responseJSON.errors;
|
||||
var errorMessage = '<ul>';
|
||||
$.each(errors, function(index, error) {
|
||||
console.log(error);
|
||||
errorMessage += '<li>' + error[0] + '</li>';
|
||||
});
|
||||
errorMessage += '</ul>';
|
||||
|
||||
$('#validationModal .error-message').html(errorMessage);
|
||||
$('#validationModal').modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.activate-subscription', function(e) {
|
||||
var action = $(this).attr('data-action');
|
||||
|
||||
if (action) {
|
||||
Swal.fire({
|
||||
title: '{{ __("Are you sure?") }}',
|
||||
text: `{{ __("You would not be able to revert this!") }}`,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: '{{ __("Yes") }}',
|
||||
cancelButtonText: '{{ __("Cancel") }}'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: action,
|
||||
type: "post",
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success:function(data) {
|
||||
if (data.success) {
|
||||
$('#validationModal').modal('show');
|
||||
$('#validationModal .error-message').html(data.message);
|
||||
|
||||
bookkeppingSubscriptionListTable.ajax.reload();
|
||||
comSecSubscriptionListTable.ajax.reload();
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
var errors = data.responseJSON.errors;
|
||||
var errorMessage = '<ul>';
|
||||
$.each(errors, function(index, error) {
|
||||
console.log(error);
|
||||
errorMessage += '<li>' + error[0] + '</li>';
|
||||
});
|
||||
errorMessage += '</ul>';
|
||||
|
||||
$('#validationModal .error-message').html(errorMessage);
|
||||
$('#validationModal').modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".js-side-nav").click(function(e){
|
||||
e.preventDefault();
|
||||
var id = jQuery(this).data('id');
|
||||
jQuery(this).closest('.side-nav-tabs').next().find('.js-content-tab').hide();
|
||||
jQuery(id).show();
|
||||
jQuery(this).closest('.side-nav-tabs').find('li').removeClass('active');
|
||||
jQuery(this).parent().addClass('active');
|
||||
});
|
||||
|
||||
$(".js-tab-navigate").click(function(e){
|
||||
e.preventDefault();
|
||||
var id = jQuery(this).data('id');
|
||||
jQuery(this).closest('.tabs-navigation').next().find('.tabs-content-item').hide();
|
||||
jQuery(id).show();
|
||||
jQuery(this).closest('.tabs-navigation').find('li').removeClass('active');
|
||||
jQuery(this).parent().addClass('active');
|
||||
|
||||
var addUrl = jQuery(this).data('add-url');
|
||||
$('.add-new-btn').attr('href', addUrl)
|
||||
});
|
||||
} );
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user