Skip to content

Commit

Permalink
refs #1480 Invoice/Bill payment show error issue solved
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Jun 10, 2020
1 parent 57cc191 commit b79d9e4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
9 changes: 8 additions & 1 deletion resources/assets/js/views/purchases/bills.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ const app = new Vue({

this.component = Vue.component('add-new-component', (resolve, reject) => {
resolve({
template: '<div id="dynamic-component"><akaunting-modal-add-new :show="payment.modal" @submit="onSubmit" @cancel="onCancel" :buttons="payment.buttons" :title="payment.title" :is_component=true :message="payment.html"></akaunting-modal-add-new></div>',
template: '<div id="dynamic-component"><akaunting-modal-add-new modal-dialog-class="modal-md" :show="payment.modal" @submit="onSubmit" @cancel="onCancel" :buttons="payment.buttons" :title="payment.title" :is_component=true :message="payment.html"></akaunting-modal-add-new></div>',

mixins: [
Global
Expand All @@ -352,6 +352,7 @@ const app = new Vue({
methods: {
onSubmit(event) {
this.form = event;
this.form.response = {};

this.loading = true;

Expand Down Expand Up @@ -396,6 +397,12 @@ const app = new Vue({
window.location.href = response.data.redirect;
}
}

if (response.data.error) {
this.form.loading = false;

this.form.response = response.data;
}
})
.catch(error => {
this.form.loading = false;
Expand Down
9 changes: 8 additions & 1 deletion resources/assets/js/views/sales/invoices.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ const app = new Vue({

this.component = Vue.component('add-new-component', (resolve, reject) => {
resolve({
template: '<div id="dynamic-component"><akaunting-modal-add-new :show="payment.modal" @submit="onSubmit" @cancel="onCancel" :buttons="payment.buttons" :title="payment.title" :is_component=true :message="payment.html"></akaunting-modal-add-new></div>',
template: '<div id="dynamic-component"><akaunting-modal-add-new modal-dialog-class="modal-md" :show="payment.modal" @submit="onSubmit" @cancel="onCancel" :buttons="payment.buttons" :title="payment.title" :is_component=true :message="payment.html"></akaunting-modal-add-new></div>',

mixins: [
Global
Expand All @@ -353,6 +353,7 @@ const app = new Vue({
methods: {
onSubmit(event) {
this.form = event;
this.form.response = {};

this.loading = true;

Expand Down Expand Up @@ -397,6 +398,12 @@ const app = new Vue({
window.location.href = response.data.redirect;
}
}

if (response.data.error) {
this.form.loading = false;

this.form.response = response.data;
}
})
.catch(error => {
this.form.loading = false;
Expand Down
4 changes: 2 additions & 2 deletions resources/views/modals/bills/payment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
'route' => ['modals.bills.bill.transactions.store', $bill->id],
'novalidate' => true
]) !!}
<div class="row">
<base-alert type="warning" v-if="typeof form.response !== 'undefined' && form.response.error" v-html="form.response.message"></base-alert>
<base-alert type="warning" v-if="typeof form.response !== 'undefined' && form.response.error" v-html="form.response.message"></base-alert>

<div class="row">
{{ Form::dateGroup('paid_at', trans('general.date'), 'calendar', ['id' => 'paid_at', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], Date::now()->toDateString()) }}

{{ Form::moneyGroup('amount', trans('general.amount'), 'money-bill-alt', ['required' => 'required', 'autofocus' => 'autofocus', 'currency' => $currency, 'dynamic-currency' => 'currency'], $bill->grand_total) }}
Expand Down
4 changes: 2 additions & 2 deletions resources/views/modals/invoices/payment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
'route' => ['modals.invoices.invoice.transactions.store', $invoice->id],
'novalidate' => true
]) !!}
<div class="row">
<base-alert type="warning" v-if="typeof form.response !== 'undefined' && form.response.error" v-html="form.response.message"></base-alert>
<base-alert type="warning" v-if="typeof form.response !== 'undefined' && form.response.error" v-html="form.response.message"></base-alert>

<div class="row">
{{ Form::dateGroup('paid_at', trans('general.date'), 'calendar', ['id' => 'paid_at', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], Date::now()->toDateString()) }}

{{ Form::moneyGroup('amount', trans('general.amount'), 'money-bill-alt', ['required' => 'required', 'autofocus' => 'autofocus', 'currency' => $currency, 'dynamic-currency' => 'currency'], $invoice->grand_total) }}
Expand Down

0 comments on commit b79d9e4

Please sign in to comment.