merge: estimate work branch to master

This commit is contained in:
Ahmed Bouhuolia
2020-10-26 14:34:54 +02:00
parent 4ed96e5143
commit 40fa6aa71f
25 changed files with 419 additions and 96 deletions

View File

@@ -80,9 +80,8 @@ const reducer = createReducer(initialState, {
[t.BILLS_PAGINATION_SET]: (state, action) => {
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),
};
@@ -99,7 +98,7 @@ const reducer = createReducer(initialState, {
},
};
},
[t.BILL_NUMBER_CHANGED]: (state, action) => {
const { isChanged } = action.payload;
state.nextBillNumberChanged = isChanged;

View File

@@ -6,17 +6,12 @@ export const submitEstimate = ({ form }) => {
new Promise((resolve, reject) => {
ApiService.post('sales/estimates', 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);
});
});
@@ -95,21 +90,21 @@ export const fetchEstimatesTable = ({ query = {} }) => {
dispatch({
type: t.ESTIMATES_PAGE_SET,
payload: {
sales_estimates: response.data.sales_estimates.results,
pagination: response.data.sales_estimates.pagination,
sales_estimates: response.data.sales_estimates,
pagination: response.data.pagination,
customViewId: response.data.customViewId || -1,
},
});
dispatch({
type: t.ESTIMATES_ITEMS_SET,
payload: {
sales_estimates: response.data.sales_estimates.results,
sales_estimates: response.data.sales_estimates,
},
});
dispatch({
type: t.ESTIMATES_PAGINATION_SET,
payload: {
pagination: response.data.sales_estimates.pagination,
pagination: response.data.pagination,
customViewId: response.data.customViewId || -1,
},
});

View File

@@ -65,21 +65,21 @@ export const fetchPaymentMadesTable = ({ query = {} }) => {
dispatch({
type: t.PAYMENT_MADES_PAGE_SET,
payload: {
bill_payments: response.data.bill_payments.results,
pagination: response.data.bill_payments.pagination,
bill_payments: response.data.bill_payments,
pagination: response.data.pagination,
customViewId: response.data.customViewId || -1,
},
});
dispatch({
type: t.PAYMENT_MADES_ITEMS_SET,
payload: {
bill_payments: response.data.bill_payments.results,
bill_payments: response.data.bill_payments,
},
});
dispatch({
type: t.PAYMENT_MADES_PAGINATION_SET,
payload: {
pagination: response.data.bill_payments.pagination,
pagination: response.data.pagination,
customViewId: response.data.customViewId || -1,
},
});
@@ -102,14 +102,6 @@ export const fetchPaymentMade = ({ id }) => {
new Promise((resovle, reject) => {
ApiService.get(`purchases/bill_payments/${id}`, {})
.then((response) => {
// dispatch({
// type: t.RELOAD_INVOICES,
// payload: {
// sales_invoices: response.data.paymentReceive.entries.map(
// (e) => e.invoice,
// ),
// },
// });
dispatch({
type: t.PAYMENT_MADE_SET,
payload: {

View File

@@ -12,6 +12,7 @@ const initialState = {
page_size: 5,
page: 1,
},
nextPaymentNumberChanged: false,
};
const defaultPaymentMade = {
@@ -84,5 +85,11 @@ const reducer = createReducer(initialState, {
},
};
},
[t.PAYMENT_MADES_NUMBER_CHANGED]:(state,action)=>{
const { isChanged } = action.payload;
state.nextPaymentNumberChanged = isChanged
}
});
export default createTableQueryReducers('bill_payments', reducer);

View File

@@ -8,4 +8,5 @@ export default {
PAYMENT_MADES_PAGE_SET: 'PAYMENT_MADES_PAGE_SET',
PAYMENT_MADES_ITEMS_SET: 'PAYMENT_MADES_ITEMS_SET',
PAYMENT_MADES_PAGINATION_SET: 'PAYMENT_MADES_PAGINATION_SET',
PAYMENT_MADES_NUMBER_CHANGED:'PAYMENT_MADES_NUMBER_CHANGED'
};