diff --git a/app/Http/Controllers/Wizard/Taxes.php b/app/Http/Controllers/Wizard/Taxes.php
index 8d0ff82ab..e81525862 100644
--- a/app/Http/Controllers/Wizard/Taxes.php
+++ b/app/Http/Controllers/Wizard/Taxes.php
@@ -81,7 +81,14 @@ class Taxes extends Controller
$item = $tax;
- return view('wizard.taxes.edit', compact('item'));
+ $html = view('wizard.TAXES.edit', compact('item'))->render();
+
+ return response()->json([
+ 'success' => true,
+ 'error' => false,
+ 'message' => 'null',
+ 'html' => $html,
+ ]);
}
/**
diff --git a/resources/views/wizard/currencies/edit.blade.php b/resources/views/wizard/currencies/edit.blade.php
index ad169fa8f..43cbdc70a 100644
--- a/resources/views/wizard/currencies/edit.blade.php
+++ b/resources/views/wizard/currencies/edit.blade.php
@@ -12,7 +12,7 @@
{{ Form::radioGroup('enabled', trans('general.enabled'), trans('general.yes'), trans('general.no'), [], 'col-md-12') }}
- {!! Form::button('', ['type' => 'button', 'class' => 'btn btn-success currency-updated', 'data-loading-text' => trans('general.loading'), 'data-href' => url('wizard/currencies/' . $item->id), 'style' => 'padding: 9px 14px; margin-top: 10px;']) !!}
+ {!! Form::button('', ['type' => 'button', 'class' => 'btn btn-success currency-updated', 'data-loading-text' => trans('general.loading'), 'data-href' => url('wizard/currencies/' . $item->id), 'data-id' => $item->id, 'style' => 'padding: 9px 14px; margin-top: 10px;']) !!}
|
{{ Form::numberGroup('precision', trans('currencies.precision'), 'bullseye', [], $item->precision) }}
diff --git a/resources/views/wizard/currencies/index.blade.php b/resources/views/wizard/currencies/index.blade.php
index 6e2b754d1..2b1c21353 100644
--- a/resources/views/wizard/currencies/index.blade.php
+++ b/resources/views/wizard/currencies/index.blade.php
@@ -224,6 +224,8 @@
success: function(json) {
if (json['success']) {
$('#currency-' + data_id).after(json['html']);
+ $('#enabled_1').trigger('click');
+ $('#name').focus();
$("#code").select2({
placeholder: "{{ trans('general.form.select.field', ['field' => trans('currencies.code')]) }}"
@@ -239,18 +241,30 @@
$(this).html('');
$('.help-block').remove();
+ data = $('#tbl-currencies input[type=\'number\'], #tbl-currencies input[type=\'text\'], #tbl-currencies input[type=\'radio\'], #tbl-currencies input[type=\'hidden\'], #tbl-currencies textarea, #tbl-currencies select').serialize();
data_href = $(this).data('href');
+ data_id = $(this).data('id');
$.ajax({
url: data_href,
type: 'PATCH',
dataType: 'JSON',
- data: $('#tbl-currencies input[type=\'number\'], #tbl-currencies input[type=\'text\'], #tbl-currencies input[type=\'radio\'], #tbl-currencies input[type=\'hidden\'], #tbl-currencies textarea, #tbl-currencies select').serialize(),
+ data: data,
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
success: function(json) {
$('.currency-updated').html('');
if (json['success']) {
+ $('#currency-' + data_id + ' .currency-name a').text($('#currency-edit #name').val());
+ $('#currency-' + data_id + ' .currency-code').text($('#currency-edit #code').val());
+ $('#currency-' + data_id + ' .currency-rate').text($('#currency-edit #rate').val());
+
+ if ($('#currency-edit #enabled').val()) {
+ $('#currency-' + data_id + ' .currency-status').html('{{ trans('general.enabled') }}');
+ } else {
+ $('#currency-' + data_id + ' .currency-status').html('{{ trans('general.disabled') }}');
+ }
+
$('#currency-create').remove();
$('#currency-edit').remove();
}
diff --git a/resources/views/wizard/taxes/edit.blade.php b/resources/views/wizard/taxes/edit.blade.php
index dda141058..21a5981c7 100644
--- a/resources/views/wizard/taxes/edit.blade.php
+++ b/resources/views/wizard/taxes/edit.blade.php
@@ -9,6 +9,6 @@
{{ Form::radioGroup('enabled', trans('general.enabled'), trans('general.yes'), trans('general.no'), [], 'col-md-12') }}
|
- {!! Form::button('', ['type' => 'button', 'class' => 'btn btn-success tax-updated', 'data-loading-text' => trans('general.loading'), 'data-href' => url('wizard/taxes/' . $item->id), 'style' => 'padding: 9px 14px; margin-top: 10px;']) !!}
+ {!! Form::button('', ['type' => 'button', 'class' => 'btn btn-success tax-updated', 'data-loading-text' => trans('general.loading'), 'data-href' => url('wizard/taxes/' . $item->id), 'data-id' => $item->id, 'style' => 'padding: 9px 14px; margin-top: 10px;']) !!}
|
\ No newline at end of file
diff --git a/resources/views/wizard/taxes/index.blade.php b/resources/views/wizard/taxes/index.blade.php
index 064e1fbbd..13d5b59cc 100644
--- a/resources/views/wizard/taxes/index.blade.php
+++ b/resources/views/wizard/taxes/index.blade.php
@@ -222,6 +222,8 @@
success: function(json) {
if (json['success']) {
$('#tax-' + data_id).after(json['html']);
+ $('#enabled_1').trigger('click');
+ $('#name').focus();
$("#code").select2({
placeholder: "{{ trans('general.form.select.field', ['field' => trans('taxes.code')]) }}"
@@ -249,6 +251,15 @@
$('.tax-updated').html('');
if (json['success']) {
+ $('#tax-' + data_id + ' .tax-name a').text($('#tax-edit #name').val());
+ $('#tax-' + data_id + ' .tax-rate').text($('#tax-edit #rate').val());
+
+ if ($('#tax-edit #enabled').val()) {
+ $('#tax-' + data_id + ' .tax-status').html('{{ trans('general.enabled') }}');
+ } else {
+ $('#tax-' + data_id + ' .tax-status').html('{{ trans('general.disabled') }}');
+ }
+
$('#tax-create').remove();
$('#tax-edit').remove();
}