diff --git a/resources/assets/js/plugins/en.js b/resources/assets/js/plugins/en.js index 76e4f6eb..ea2900d4 100644 --- a/resources/assets/js/plugins/en.js +++ b/resources/assets/js/plugins/en.js @@ -308,6 +308,7 @@ export default { invoice_template: 'Invoice Template', template: 'Template', mark_as_sent: 'Mark as sent', + confirm_send_invoice: 'This invoice will be sent via email to the customer', invoice_mark_as_sent: 'This invoice will be marked as sent', confirm_send: 'This invoice will be sent via email to the customer', invoice_date: 'Invoice Date', diff --git a/resources/assets/js/store/modules/invoice/actions.js b/resources/assets/js/store/modules/invoice/actions.js index 64d167a0..4910fe63 100644 --- a/resources/assets/js/store/modules/invoice/actions.js +++ b/resources/assets/js/store/modules/invoice/actions.js @@ -47,6 +47,7 @@ export const fetchViewInvoice = ({ commit, dispatch, state }, id) => { export const sendEmail = ({ commit, dispatch, state }, data) => { return new Promise((resolve, reject) => { window.axios.post(`/api/invoices/send`, data).then((response) => { + commit(types.UPDATE_INVOICE_STATUS, {id: data.id, status: 'SENT'}) resolve(response) }).catch((err) => { reject(err) diff --git a/resources/assets/js/store/modules/invoice/mutation-types.js b/resources/assets/js/store/modules/invoice/mutation-types.js index 9c7553dd..c92a4755 100644 --- a/resources/assets/js/store/modules/invoice/mutation-types.js +++ b/resources/assets/js/store/modules/invoice/mutation-types.js @@ -14,3 +14,4 @@ export const SELECT_CUSTOMER = 'SELECT_CUSTOMER' export const RESET_SELECTED_CUSTOMER = 'RESET_SELECTED_CUSTOMER' export const SET_SELECT_ALL_STATE = 'SET_SELECT_ALL_STATE' export const RESET_SELECTED_INVOICES = 'RESET_SELECTED_INVOICES' +export const UPDATE_INVOICE_STATUS = 'UPDATE_INVOICE_STATUS' diff --git a/resources/assets/js/store/modules/invoice/mutations.js b/resources/assets/js/store/modules/invoice/mutations.js index b765f045..f8a5cad2 100644 --- a/resources/assets/js/store/modules/invoice/mutations.js +++ b/resources/assets/js/store/modules/invoice/mutations.js @@ -28,6 +28,12 @@ export default { state.invoices[pos] = data.invoice }, + [types.UPDATE_INVOICE_STATUS] (state, data) { + let pos = state.invoices.findIndex(invoice => invoice.id === data.id) + + state.invoices[pos].status = data.status + }, + [types.RESET_SELECTED_INVOICES] (state, data) { state.selectedInvoices = [] state.selectAllField = false diff --git a/resources/assets/js/views/invoices/View.vue b/resources/assets/js/views/invoices/View.vue index fd1ce809..4a7359fd 100644 --- a/resources/assets/js/views/invoices/View.vue +++ b/resources/assets/js/views/invoices/View.vue @@ -5,16 +5,28 @@