mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
WIP/ Feature : Estimate & Receipt & Bill & Invoice
This commit is contained in:
@@ -29,9 +29,12 @@ export const submitInvoice = ({ form }) => {
|
||||
export const deleteInvoice = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resovle, reject) => {
|
||||
ApiService.delete(`invoice/${id}`)
|
||||
ApiService.delete(`sales/invoices/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({ type: t.INVOICE_DELETE });
|
||||
dispatch({
|
||||
type: t.INVOICE_DELETE,
|
||||
payload: { id },
|
||||
});
|
||||
resovle(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -46,7 +49,7 @@ export const editInvoice = (id, form) => {
|
||||
dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_LOADING,
|
||||
});
|
||||
ApiService.post(`invoice/${id}`, form)
|
||||
ApiService.post(`sales/invoices/${id}`, form)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||
@@ -64,39 +67,39 @@ export const editInvoice = (id, form) => {
|
||||
});
|
||||
});
|
||||
};
|
||||
export const fetchInvoicesTable = ({ query = {} }) => {
|
||||
return (dispatch, getState) =>
|
||||
new Promise((resolve, rejcet) => {
|
||||
const pageQuery = getState().invoices.tableQuery;
|
||||
|
||||
export const fetchInvoicesTable = ({ query } = {}) => {
|
||||
return (dispatch, getState) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const pageQuery = getState().sales_invoices.tableQuery;
|
||||
dispatch({
|
||||
type: t.INVOICES_TABLE_LOADING,
|
||||
payload: {
|
||||
loading: true,
|
||||
},
|
||||
});
|
||||
ApiService.get('invoices', {
|
||||
ApiService.get('sales/invoices', {
|
||||
params: { ...pageQuery, ...query },
|
||||
})
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.INVOICES_PAGE_SET,
|
||||
payload: {
|
||||
invoices: response.data.invoices.results,
|
||||
pagination: response.data.invoices.pagination,
|
||||
sales_invoices: response.data.sales_invoices.results,
|
||||
pagination: response.data.sales_invoices.pagination,
|
||||
customViewId: response.data.customViewId || -1,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.INVOICES_ITEMS_SET,
|
||||
payload: {
|
||||
invoices: response.data.invoices.results,
|
||||
sales_invoices: response.data.sales_invoices.results,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.INVOICES_PAGINATION_SET,
|
||||
payload: {
|
||||
pagination: response.data.invoices.pagination,
|
||||
pagination: response.data.sales_invoices.pagination,
|
||||
customViewId: response.data.customViewId || -1,
|
||||
},
|
||||
});
|
||||
@@ -109,7 +112,7 @@ export const fetchInvoicesTable = ({ query = {} }) => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
rejcet(error);
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -117,13 +120,13 @@ export const fetchInvoicesTable = ({ query = {} }) => {
|
||||
export const fetchInvoice = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resovle, reject) => {
|
||||
ApiService.get(`invoices/${id}`)
|
||||
ApiService.get(`sales/invoices/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.INVOICE_SET,
|
||||
payload: {
|
||||
id,
|
||||
invoice: response.data.invoice,
|
||||
sale_invoice: response.data.sale_invoice,
|
||||
},
|
||||
});
|
||||
resovle(response);
|
||||
|
||||
Reference in New Issue
Block a user