mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
Fix : Receipt & Invoices
This commit is contained in:
@@ -67,8 +67,8 @@ export const fetchInvoicesTable = ({ query } = {}) => {
|
||||
dispatch({
|
||||
type: t.INVOICES_PAGE_SET,
|
||||
payload: {
|
||||
sales_invoices: response.data.sales_invoices.results,
|
||||
pagination: response.data.sales_invoices.pagination,
|
||||
sales_invoices: response.data.sales_invoices,
|
||||
pagination: response.data.pagination,
|
||||
customViewId: response.data.customViewId || -1,
|
||||
},
|
||||
});
|
||||
@@ -76,13 +76,13 @@ export const fetchInvoicesTable = ({ query } = {}) => {
|
||||
dispatch({
|
||||
type: t.INVOICES_ITEMS_SET,
|
||||
payload: {
|
||||
sales_invoices: response.data.sales_invoices.results,
|
||||
sales_invoices: response.data.sales_invoices,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.INVOICES_PAGINATION_SET,
|
||||
payload: {
|
||||
pagination: response.data.sales_invoices.pagination,
|
||||
pagination: response.data.pagination,
|
||||
customViewId: response.data.customViewId || -1,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -80,7 +80,7 @@ const reducer = createReducer(initialState, {
|
||||
const { pagination, customViewId } = action.payload;
|
||||
|
||||
const mapped = {
|
||||
pageSize: parseInt(pagination.pageSize, 10),
|
||||
pageSize: parseInt(pagination.page_size, 10),
|
||||
page: parseInt(pagination.page, 10),
|
||||
total: parseInt(pagination.total, 10),
|
||||
};
|
||||
|
||||
@@ -6,17 +6,11 @@ export const submitReceipt = ({ form }) => {
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.post('sales/receipts', form)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||
});
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
@@ -60,12 +54,10 @@ export const fetchReceipt = ({ id }) => {
|
||||
new Promise((resovle, reject) => {
|
||||
ApiService.get(`sales/receipts/${id}`)
|
||||
.then((response) => {
|
||||
const { receipt } = response.data;
|
||||
dispatch({
|
||||
type: t.RECEIPT_SET,
|
||||
payload: {
|
||||
id,
|
||||
receipt: response.data.receipt,
|
||||
},
|
||||
payload: { id, receipt },
|
||||
});
|
||||
resovle(response);
|
||||
})
|
||||
@@ -94,21 +86,21 @@ export const fetchReceiptsTable = ({ query = {} }) => {
|
||||
dispatch({
|
||||
type: t.RECEIPTS_PAGE_SET,
|
||||
payload: {
|
||||
sales_receipts: response.data.sales_receipts.results,
|
||||
pagination: response.data.sales_receipts.pagination,
|
||||
sales_receipts: response.data.sale_receipts,
|
||||
pagination: response.data.pagination,
|
||||
customViewId: response.data.customViewId || -1,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.RECEIPTS_ITEMS_SET,
|
||||
payload: {
|
||||
sales_receipts: response.data.sales_receipts.results,
|
||||
sales_receipts: response.data.sale_receipts,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: t.RECEIPTS_PAGINATION_SET,
|
||||
payload: {
|
||||
pagination: response.data.sales_receipts.pagination,
|
||||
pagination: response.data.pagination,
|
||||
customViewId: response.data.customViewId || -1,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -60,7 +60,6 @@ const reducer = createReducer(initialState, {
|
||||
|
||||
const viewId = customViewId || -1;
|
||||
const view = state.views[viewId] || {};
|
||||
|
||||
state.views[viewId] = {
|
||||
...view,
|
||||
pages: {
|
||||
@@ -76,7 +75,7 @@ const reducer = createReducer(initialState, {
|
||||
const { pagination, customViewId } = action.payload;
|
||||
|
||||
const mapped = {
|
||||
pageSize: parseInt(pagination.pageSize, 10),
|
||||
pageSize: parseInt(pagination.page_size, 10),
|
||||
page: parseInt(pagination.page, 10),
|
||||
total: parseInt(pagination.total, 10),
|
||||
};
|
||||
@@ -85,7 +84,6 @@ const reducer = createReducer(initialState, {
|
||||
pagesCount: Math.ceil(mapped.total / mapped.pageSize),
|
||||
pageIndex: Math.max(mapped.page - 1, 0),
|
||||
};
|
||||
|
||||
state.views = {
|
||||
...state.views,
|
||||
[customViewId]: {
|
||||
|
||||
Reference in New Issue
Block a user