mirror of
https://github.com/crater-invoice/crater.git
synced 2026-02-09 20:32:40 -05:00
Fix Invoice/Estimate template issues and Add Payment Receipt, Custom Payment Modes and Item units
This commit is contained in:
committed by
Mohit Panjwani
parent
56a955befd
commit
4c33a5d88c
@@ -12,9 +12,9 @@ export const fetchPayments = ({ commit, dispatch, state }, params) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const fetchCreatePayment = ({ commit, dispatch }, page) => {
|
||||
export const fetchPayment = ({ commit, dispatch }, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.get(`/api/payments/create`).then((response) => {
|
||||
window.axios.get(`/api/payments/${id}`).then((response) => {
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
@@ -22,7 +22,7 @@ export const fetchCreatePayment = ({ commit, dispatch }, page) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const fetchPayment = ({ commit, dispatch }, id) => {
|
||||
export const fetchEditPaymentData = ({ commit, dispatch }, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.get(`/api/payments/${id}/edit`).then((response) => {
|
||||
resolve(response)
|
||||
@@ -32,6 +32,16 @@ export const fetchPayment = ({ commit, dispatch }, id) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const fetchCreatePayment = ({ commit, dispatch }, page) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.get(`/api/payments/create`).then((response) => {
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const addPayment = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post('/api/payments', data).then((response) => {
|
||||
@@ -97,3 +107,78 @@ export const selectAllPayments = ({ commit, dispatch, state }) => {
|
||||
commit(types.SET_SELECT_ALL_STATE, true)
|
||||
}
|
||||
}
|
||||
|
||||
export const addPaymentMode = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/payment-methods`, data).then((response) => {
|
||||
commit(types.ADD_PAYMENT_MODE, response.data)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const updatePaymentMode = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.put(`/api/payment-methods/${data.id}`, data).then((response) => {
|
||||
commit(types.UPDATE_PAYMENT_MODE, response.data)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const fetchPaymentModes = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.get(`/api/payment-methods`, data).then((response) => {
|
||||
commit(types.SET_PAYMENT_MODES, response.data.paymentMethods)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const fetchPaymentMode = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.get(`/api/payment-methods/${data.id}`, data).then((response) => {
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const deletePaymentMode = ({ commit, dispatch, state }, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.delete(`/api/payment-methods/${id}`).then((response) => {
|
||||
commit(types.DELETE_PAYMENT_MODE, id)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const sendEmail = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post(`/api/payments/send`, data).then((response) => {
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const searchPayment = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.get(`/api/payments?${data}`).then((response) => {
|
||||
// commit(types.UPDATE_INVOICE, response.data)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user