mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-31 05:31:10 -04:00 
			
		
		
		
	Add File based templates
This commit is contained in:
		
				
					committed by
					
						 Mohit Panjwani
						Mohit Panjwani
					
				
			
			
				
	
			
			
			
						parent
						
							00961bcae1
						
					
				
				
					commit
					d1dd704cdf
				
			| @ -60,10 +60,7 @@ export const fetchEstimate = ({ commit, dispatch, state }, id) => { | ||||
|     window.axios | ||||
|       .get(`/api/v1/estimates/${id}`) | ||||
|       .then((response) => { | ||||
|         commit( | ||||
|           types.SET_TEMPLATE_ID, | ||||
|           response.data.estimate.estimate_template_id | ||||
|         ) | ||||
|         commit(types.SET_TEMPLATE_NAME, response.data.estimate.template_name) | ||||
|         resolve(response) | ||||
|       }) | ||||
|       .catch((err) => { | ||||
| @ -297,7 +294,7 @@ export const resetItem = ({ commit, dispatch, state }) => { | ||||
|  | ||||
| export const setTemplate = ({ commit, dispatch, state }, data) => { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     commit(types.SET_TEMPLATE_ID, data) | ||||
|     commit(types.SET_TEMPLATE_NAME, data) | ||||
|     resolve({}) | ||||
|   }) | ||||
| } | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| export const estimates = (state) => state.estimates | ||||
| export const selectAllField = (state) => state.selectAllField | ||||
| export const getTemplateId = (state) => state.estimateTemplateId | ||||
| export const getTemplateName = (state) => state.estimateTemplateName | ||||
| export const selectedEstimates = (state) => state.selectedEstimates | ||||
| export const totalEstimates = (state) => state.totalEstimates | ||||
| export const selectedCustomer = (state) => state.selectedCustomer | ||||
|  | ||||
| @ -4,7 +4,7 @@ import * as getters from './getters' | ||||
|  | ||||
| const initialState = { | ||||
|   estimates: [], | ||||
|   estimateTemplateId: 1, | ||||
|   estimateTemplateName: null, | ||||
|   selectAllField: false, | ||||
|   selectedEstimates: [], | ||||
|   totalEstimates: 0, | ||||
|  | ||||
| @ -9,7 +9,7 @@ export const RESET_CUSTOMER = 'RESET_CUSTOMER' | ||||
| export const RESET_ITEM = 'RESET_ITEM' | ||||
| export const SET_CUSTOMER = 'SET_CUSTOMER' | ||||
| export const SET_ITEM = 'SET_ITEM' | ||||
| export const SET_TEMPLATE_ID = 'SET_TEMPLATE_ID' | ||||
| export const SET_TEMPLATE_NAME = 'SET_TEMPLATE_NAME' | ||||
| export const SELECT_CUSTOMER = 'SELECT_CUSTOMER' | ||||
| export const RESET_SELECTED_CUSTOMER = 'RESET_SELECTED_CUSTOMER' | ||||
| export const SET_SELECT_ALL_STATE = 'SET_SELECT_ALL_STATE' | ||||
|  | ||||
| @ -52,8 +52,8 @@ export default { | ||||
|     state.selectAllField = false | ||||
|   }, | ||||
|  | ||||
|   [types.SET_TEMPLATE_ID](state, templateId) { | ||||
|     state.estimateTemplateId = templateId | ||||
|   [types.SET_TEMPLATE_NAME](state, templateName) { | ||||
|     state.estimateTemplateName = templateName | ||||
|   }, | ||||
|  | ||||
|   [types.SELECT_CUSTOMER](state, data) { | ||||
|  | ||||
| @ -21,7 +21,7 @@ export const fetchInvoice = ({ commit, dispatch, state }, id) => { | ||||
|     window.axios | ||||
|       .get(`/api/v1/invoices/${id}`) | ||||
|       .then((response) => { | ||||
|         commit(types.SET_TEMPLATE_ID, response.data.invoice.invoice_template_id) | ||||
|         commit(types.SET_TEMPLATE_NAME, response.data.invoice.template_name) | ||||
|         resolve(response) | ||||
|       }) | ||||
|       .catch((err) => { | ||||
| @ -219,7 +219,7 @@ export const resetCustomer = ({ commit, dispatch, state }) => { | ||||
|  | ||||
| export const setTemplate = ({ commit, dispatch, state }, data) => { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     commit(types.SET_TEMPLATE_ID, data) | ||||
|     commit(types.SET_TEMPLATE_NAME, data) | ||||
|     resolve({}) | ||||
|   }) | ||||
| } | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| export const invoices = (state) => state.invoices | ||||
| export const selectAllField = (state) => state.selectAllField | ||||
| export const getTemplateId = (state) => state.invoiceTemplateId | ||||
| export const getTemplateName = (state) => state.invoiceTemplateName | ||||
| export const selectedInvoices = (state) => state.selectedInvoices | ||||
| export const totalInvoices = (state) => state.totalInvoices | ||||
| export const selectedCustomer = (state) => state.selectedCustomer | ||||
|  | ||||
| @ -4,7 +4,7 @@ import * as getters from './getters' | ||||
|  | ||||
| const initialState = { | ||||
|   invoices: [], | ||||
|   invoiceTemplateId: 1, | ||||
|   invoiceTemplateName: null, | ||||
|   selectedInvoices: [], | ||||
|   selectAllField: false, | ||||
|   totalInvoices: 0, | ||||
|  | ||||
| @ -12,7 +12,7 @@ export const SET_CUSTOMER = 'SET_CUSTOMER' | ||||
| export const RESET_ITEM = 'RESET_ITEM' | ||||
| export const SET_ITEM = 'SET_ITEM' | ||||
|  | ||||
| export const SET_TEMPLATE_ID = 'SET_TEMPLATE_ID' | ||||
| export const SET_TEMPLATE_NAME = 'SET_TEMPLATE_NAME' | ||||
|  | ||||
| export const SELECT_CUSTOMER = 'SELECT_CUSTOMER' | ||||
| export const RESET_SELECTED_CUSTOMER = 'RESET_SELECTED_CUSTOMER' | ||||
|  | ||||
| @ -51,8 +51,8 @@ export default { | ||||
|     state.selectedInvoices = [] | ||||
|   }, | ||||
|  | ||||
|   [types.SET_TEMPLATE_ID](state, templateId) { | ||||
|     state.invoiceTemplateId = templateId | ||||
|   [types.SET_TEMPLATE_NAME](state, templateName) { | ||||
|     state.invoiceTemplateName = templateName | ||||
|   }, | ||||
|  | ||||
|   [types.SELECT_CUSTOMER](state, data) { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user