feat : header api.

This commit is contained in:
elforjani3
2021-05-08 03:17:46 +02:00
parent 9a1a90250a
commit 790cc51bcc
7 changed files with 78 additions and 35 deletions

View File

@@ -30,14 +30,14 @@ function CustomersBalanceSummary({
}) { }) {
const [filter, setFilter] = useState({ const [filter, setFilter] = useState({
asDate: moment().endOf('day').format('YYYY-MM-DD'), as_date: moment().endOf('day').format('YYYY-MM-DD'),
}); });
// Handle re-fetch customers balance summary after filter change. // Handle re-fetch customers balance summary after filter change.
const handleFilterSubmit = (filter) => { const handleFilterSubmit = (filter) => {
const _filter = { const _filter = {
...filter, ...filter,
asDate: moment(filter.asDate).format('YYYY-MM-DD'), as_date: moment(filter.as_date).format('YYYY-MM-DD'),
}; };
setFilter({ ..._filter }); setFilter({ ..._filter });
}; };

View File

@@ -29,13 +29,13 @@ function CustomersBalanceSummaryHeader({
// validation schema. // validation schema.
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
asDate: Yup.date().required().label('asDate'), as_date: Yup.date().required().label('asDate'),
}); });
// filter form initial values. // filter form initial values.
const initialValues = { const initialValues = {
...pageFilter, ...pageFilter,
asDate: moment(pageFilter.asDate).toDate(), as_date: moment(pageFilter.as_date).toDate(),
}; };
// handle form submit. // handle form submit.

View File

@@ -298,6 +298,9 @@ export function useCustomerBalanceSummaryReport(query, props) {
method: 'get', method: 'get',
url: '/financial_statements/customer-balance-summary', url: '/financial_statements/customer-balance-summary',
params: query, params: query,
headers: {
Accept: 'application/json+table',
},
}, },
{ {
select: (res) => ({ select: (res) => ({
@@ -324,12 +327,16 @@ export function useVendorsBalanceSummaryReport(query, props) {
method: 'get', method: 'get',
url: '/financial_statements/vendor-balance-summary', url: '/financial_statements/vendor-balance-summary',
params: query, params: query,
headers: {
Accept: 'application/json+table',
},
}, },
{ {
select: (res) => ({ select: (res) => ({
columns: res.data.columns, columns: res.data.columns,
query: res.data.query, query: res.data.query,
tableRows: res.data.table.rows, tableRows: res.data.table.data,
}), }),
defaultData: { defaultData: {
tableRows: [], tableRows: [],
@@ -350,6 +357,9 @@ export function useCustomersTranscationsReport(query, props) {
method: 'get', method: 'get',
url: '/financial_statements/transactions-by-customers', url: '/financial_statements/transactions-by-customers',
params: query, params: query,
headers: {
Accept: 'application/json+table',
},
}, },
{ {
select: (res) => ({ select: (res) => ({
@@ -364,3 +374,31 @@ export function useCustomersTranscationsReport(query, props) {
}, },
); );
} }
/**
* Retrieve vendors transcations report.
*/
export function useVendorsTranscationsReport(query, props) {
return useRequestQuery(
[t.FINANCIAL_REPORT, t.VENDORS_TRANSACTIONS, query],
{
method: 'get',
url: '/financial_statements/transactions-by-vendors',
params: query,
headers: {
Accept: 'application/json+table',
},
},
{
select: (res) => ({
data: res.data.table,
tableRows: res.data.table.data,
}),
defaultData: {
tableRows: [],
data: [],
},
...props,
},
);
}

View File

@@ -1055,6 +1055,12 @@ export default {
transaction_date: 'Transaction date', transaction_date: 'Transaction date',
transaction_type: 'Transaction type', transaction_type: 'Transaction type',
running_balance: 'Running Balance', running_balance: 'Running Balance',
account_normal:'Account normal', account_normal: 'Account normal',
published_at:'Published at', published_at: 'Published at',
customers_balance_summary: 'Customers Balance Summary',
vendors_balance_summary: 'Vendors Balance Summary',
percentage_of_column: 'Percentage',
customers_transactions: 'Customers Transcations',
vendors_transactions: 'Vendors Transcations',
reference_type: 'Reference type',
}; };

View File

@@ -264,11 +264,11 @@ export default [
}, },
{ {
path: `/financial-reports/transactions-by-customers`, path: `/financial-reports/transactions-by-customers`,
// component: lazy(() => component: lazy(() =>
// import( import(
// 'containers/FinancialStatements/CustomersTransactions/CustomersTransactions' 'containers/FinancialStatements/CustomersTransactions/CustomersTransactions'
// ), ),
// ), ),
breadcrumb: 'Customers Transactions ', breadcrumb: 'Customers Transactions ',
hint: '..', hint: '..',
pageTitle: formatMessage({ id: 'customers_transactions' }), pageTitle: formatMessage({ id: 'customers_transactions' }),
@@ -276,12 +276,12 @@ export default [
sidebarExpand: false, sidebarExpand: false,
}, },
{ {
path: `/financial-reports/vendors-transactions`, path: `/financial-reports/transactions-by-vendors`,
// component: lazy(() => component: lazy(() =>
// import( import(
// 'containers/FinancialStatements/' 'containers/FinancialStatements/VendorsTransactions/VendorsTransactions'
// ), ),
// ), ),
breadcrumb: 'Vendors Transactions ', breadcrumb: 'Vendors Transactions ',
hint: '..', hint: '..',
pageTitle: formatMessage({ id: 'vendors_transactions' }), pageTitle: formatMessage({ id: 'vendors_transactions' }),

View File

@@ -129,12 +129,11 @@ export function toggleInventoryValuationFilterDrawer(toggle) {
}; };
} }
/** /**
* Toggles display of the customers balance summary filter drawer. * Toggles display of the customers balance summary filter drawer.
* @param {boolean} toggle * @param {boolean} toggle
*/ */
export function toggleCustomersBalanceSummaryFilterDrawer(toggle) { export function toggleCustomersBalanceSummaryFilterDrawer(toggle) {
return { return {
type: `${t.CUSTOMERS_BALANCE_SUMMARY}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`, type: `${t.CUSTOMERS_BALANCE_SUMMARY}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
payload: { payload: {
@@ -146,7 +145,7 @@ export function toggleInventoryValuationFilterDrawer(toggle) {
* Toggles display of the vendors balance summary filter drawer. * Toggles display of the vendors balance summary filter drawer.
* @param {boolean} toggle * @param {boolean} toggle
*/ */
export function toggleVendorsBalanceSummaryFilterDrawer(toggle) { export function toggleVendorsBalanceSummaryFilterDrawer(toggle) {
return { return {
type: `${t.VENDORS_BALANCE_SUMMARY}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`, type: `${t.VENDORS_BALANCE_SUMMARY}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
payload: { payload: {
@@ -158,7 +157,7 @@ export function toggleInventoryValuationFilterDrawer(toggle) {
* Toggles display of the customers transactions filter drawer. * Toggles display of the customers transactions filter drawer.
* @param {boolean} toggle * @param {boolean} toggle
*/ */
export function toggleCustomersTransactionsFilterDrawer(toggle) { export function toggleCustomersTransactionsFilterDrawer(toggle) {
return { return {
type: `${t.CUSTOMERS_TRANSACTIONS}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`, type: `${t.CUSTOMERS_TRANSACTIONS}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
payload: { payload: {
@@ -167,15 +166,15 @@ export function toggleInventoryValuationFilterDrawer(toggle) {
}; };
} }
// /** /**
// * Toggles display of the vendors transactions filter drawer. * Toggles display of the vendors transactions filter drawer.
// * @param {boolean} toggle * @param {boolean} toggle
// */ */
// export function toggleVendorsTransactionsFilterDrawer(toggle) { export function toggleVendorsTransactionsFilterDrawer(toggle) {
// return { return {
// type: `${t.VENDORS_TRANSACTIONS}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`, type: `${t.VENDORS_TRANSACTIONS}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
// payload: { payload: {
// toggle, toggle,
// }, },
// }; };
// } }

View File

@@ -13,5 +13,5 @@ export default {
CUSTOMERS_BALANCE_SUMMARY: 'CUSTOMERS BALANCE SUMMARY', CUSTOMERS_BALANCE_SUMMARY: 'CUSTOMERS BALANCE SUMMARY',
VENDORS_BALANCE_SUMMARY: 'VENDORS BALANCE SUMMARY', VENDORS_BALANCE_SUMMARY: 'VENDORS BALANCE SUMMARY',
CUSTOMERS_TRANSACTIONS: 'CUSTOMERS TRANSACTIONS', CUSTOMERS_TRANSACTIONS: 'CUSTOMERS TRANSACTIONS',
// VENDORS_TRANSACTIONS: 'CUSTOMERS TRANSACTIONS', VENDORS_TRANSACTIONS: 'VENDORS TRANSACTIONS',
}; };