mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-30 21:21:09 -04:00 
			
		
		
		
	fix status action in view estimate
This commit is contained in:
		| @ -56,6 +56,7 @@ export const fetchViewEstimate = ({ commit, dispatch, state }, id) => { | ||||
| export const sendEmail = ({ commit, dispatch, state }, data) => { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     window.axios.post(`/api/estimates/send`, data).then((response) => { | ||||
|       commit(types.UPDATE_ESTIMATE_STATUS, {id: data.id, status: 'SENT'}) | ||||
|       resolve(response) | ||||
|     }).catch((err) => { | ||||
|       reject(err) | ||||
| @ -100,7 +101,7 @@ export const deleteMultipleEstimates = ({ commit, dispatch, state }, id) => { | ||||
| export const updateEstimate = ({ commit, dispatch, state }, data) => { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     window.axios.put(`/api/estimates/${data.id}`, data).then((response) => { | ||||
|       commit(types.UPDATE_ESTIMATE, response.data) | ||||
|       commit(types.UPDATE_ESTIMATE_STATUS, response.data) | ||||
|       resolve(response) | ||||
|     }).catch((err) => { | ||||
|       reject(err) | ||||
|  | ||||
| @ -4,3 +4,7 @@ export const getTemplateId = (state) => state.estimateTemplateId | ||||
| export const selectedEstimates = (state) => state.selectedEstimates | ||||
| export const totalEstimates = (state) => state.totalEstimates | ||||
| export const selectedCustomer = (state) => state.selectedCustomer | ||||
| export const getEstimate = (state) => (id) => { | ||||
|   let invId = parseInt(id) | ||||
|   return state.estimates.find(estimate => estimate.id === invId) | ||||
| } | ||||
|  | ||||
| @ -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_ESTIMATES = 'RESET_SELECTED_ESTIMATES' | ||||
| export const UPDATE_ESTIMATE_STATUS = 'UPDATE_ESTIMATE_STATUS' | ||||
|  | ||||
| @ -37,6 +37,12 @@ export default { | ||||
|     state.estimates[pos] = data.estimate | ||||
|   }, | ||||
|  | ||||
|   [types.UPDATE_ESTIMATE_STATUS] (state, data) { | ||||
|     let pos = state.estimates.findIndex(estimate => estimate.id === data.id) | ||||
|  | ||||
|     state.estimates[pos].status = data.status | ||||
|   }, | ||||
|  | ||||
|   [types.RESET_SELECTED_ESTIMATES] (state, data) { | ||||
|     state.selectedEstimates = [] | ||||
|     state.selectAllField = false | ||||
|  | ||||
		Reference in New Issue
	
	Block a user