mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-31 05:31:10 -04:00 
			
		
		
		
	Merge branch 'fix-view-status' into 'master'
Fix view status See merge request mohit.panjvani/crater-web!37
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) | ||||
| @ -131,7 +132,7 @@ export const markAsRejected = ({ commit, dispatch, state }, data) => { | ||||
| export const markAsSent = ({ commit, dispatch, state }, data) => { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     window.axios.post(`/api/estimates/mark-as-sent`, data).then((response) => { | ||||
|       // commit(types.UPDATE_INVOICE, response.data) | ||||
|       commit(types.UPDATE_ESTIMATE_STATUS, {id: data.id, status: 'SENT'}) | ||||
|       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