fix status action in view invoice

This commit is contained in:
satyaprakash10
2019-11-14 19:54:23 +05:30
parent 5aeac185ea
commit 090c33f63c
5 changed files with 51 additions and 8 deletions

View File

@ -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)

View File

@ -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'

View File

@ -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