mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
refactoring(payment receive): payment receive.
This commit is contained in:
@@ -6,7 +6,7 @@ import { Drawer, DrawerSuspense } from 'components';
|
|||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
const PaymentReceiveDrawerContent = lazy(() =>
|
const PaymentReceiveDrawerContent = lazy(() =>
|
||||||
import('containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplate'),
|
import('./PaymentReceiveDrawerContent'),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,7 +16,7 @@ function PaymentReceiveDrawer({
|
|||||||
name,
|
name,
|
||||||
//#withDrawer
|
//#withDrawer
|
||||||
isOpen,
|
isOpen,
|
||||||
payload,
|
payload: { paymentReceiveId },
|
||||||
|
|
||||||
closeDrawer,
|
closeDrawer,
|
||||||
}) {
|
}) {
|
||||||
@@ -28,7 +28,7 @@ function PaymentReceiveDrawer({
|
|||||||
return (
|
return (
|
||||||
<Drawer isOpen={isOpen} isClose={handleDrawerClose}>
|
<Drawer isOpen={isOpen} isClose={handleDrawerClose}>
|
||||||
<DrawerSuspense>
|
<DrawerSuspense>
|
||||||
<PaymentReceiveDrawerContent />
|
<PaymentReceiveDrawerContent paymentReceiveId={paymentReceiveId} />
|
||||||
</DrawerSuspense>
|
</DrawerSuspense>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { PaymentReceiveDrawerProvider } from './PaymentReceiveDrawerProvider';
|
||||||
|
import PaymentReceivePaper from './PaymentReceivePaper';
|
||||||
|
/**
|
||||||
|
* payment receive drawer content.
|
||||||
|
*/
|
||||||
|
export default function PaymentReceiveDrawerContent({
|
||||||
|
// #ownProp
|
||||||
|
paymentReceiveId,
|
||||||
|
}) {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PaymentReceiveDrawerProvider paymentReceiveId={paymentReceiveId}>
|
||||||
|
<PaymentReceivePaper />
|
||||||
|
</PaymentReceiveDrawerProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import React, { createContext, useContext } from 'react';
|
||||||
|
import { usePaymentReceive } from 'hooks/query';
|
||||||
|
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
||||||
|
|
||||||
|
const PaymentReceiveDrawerContext = createContext();
|
||||||
|
|
||||||
|
function PaymentReceiveDrawerProvider({ paymentReceiveId, ...props }) {
|
||||||
|
const {
|
||||||
|
data: paymentReceive,
|
||||||
|
isFetching: isPaymentReceiveLoading,
|
||||||
|
} = usePaymentReceive(paymentReceiveId, {
|
||||||
|
enabled: !!paymentReceiveId,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Provider payload.
|
||||||
|
const provider = {
|
||||||
|
paymentReceiveId,
|
||||||
|
paymentReceive,
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DashboardInsider loading={isPaymentReceiveLoading}>
|
||||||
|
<PaymentReceiveDrawerContext.Provider value={provider} {...props} />
|
||||||
|
</DashboardInsider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const usePaymentReceiveDrawerContext = () =>
|
||||||
|
useContext(PaymentReceiveDrawerContext);
|
||||||
|
|
||||||
|
export { PaymentReceiveDrawerProvider, usePaymentReceiveDrawerContext };
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PaymentPaperTemplate from 'containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplate';
|
||||||
|
import { usePaymentReceiveDrawerContext } from './PaymentReceiveDrawerProvider';
|
||||||
|
|
||||||
|
export default function PaymentReceivePaper() {
|
||||||
|
const { paymentReceive } = usePaymentReceiveDrawerContext();
|
||||||
|
|
||||||
|
return <PaymentPaperTemplate paperData={paymentReceive.paymentReceive} />;
|
||||||
|
}
|
||||||
@@ -58,8 +58,8 @@ function PaymentReceivesDataTable({
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Handle drawer payment receive.
|
// Handle drawer payment receive.
|
||||||
const handleDrawerPaymentReceive = () => {
|
const handleDrawerPaymentReceive = ({ id }) => {
|
||||||
openDrawer('payment-receive-drawer', {});
|
openDrawer('payment-receive-drawer', { paymentReceiveId: id });
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle datatable fetch once the table's state changing.
|
// Handle datatable fetch once the table's state changing.
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export function ActionsMenu({
|
|||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon={'receipt-24'} iconSize={16} />}
|
icon={<Icon icon={'receipt-24'} iconSize={16} />}
|
||||||
text={formatMessage({ id: 'payment_receive_paper' })}
|
text={formatMessage({ id: 'payment_receive_paper' })}
|
||||||
onClick={() => onDrawer()}
|
onClick={safeCallback(onDrawer, paymentReceive)}
|
||||||
/>
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={formatMessage({ id: 'delete_payment_receive' })}
|
text={formatMessage({ id: 'delete_payment_receive' })}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export function usePaymentReceives(query, props) {
|
|||||||
},
|
},
|
||||||
filterMeta: {},
|
filterMeta: {},
|
||||||
}),
|
}),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,20 +118,15 @@ export function usePaymentReceive(id, props) {
|
|||||||
{
|
{
|
||||||
select: (res) => ({
|
select: (res) => ({
|
||||||
paymentReceive: res.data.payment_receive,
|
paymentReceive: res.data.payment_receive,
|
||||||
receivableEntries: res.data.receivable_entries,
|
|
||||||
}),
|
}),
|
||||||
...props
|
...props,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...states,
|
...states,
|
||||||
data: defaultTo(states.data, {
|
data: defaultTo(states.data, {}),
|
||||||
paymentReceive: {},
|
};
|
||||||
receivableInvoices: {},
|
|
||||||
paymentInvoices: {}
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,6 +153,6 @@ export function usePaymentReceiveEditPage(id, props) {
|
|||||||
data: defaultTo(states.data, {
|
data: defaultTo(states.data, {
|
||||||
paymentReceive: {},
|
paymentReceive: {},
|
||||||
entries: [],
|
entries: [],
|
||||||
})
|
}),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -996,4 +996,9 @@ export default {
|
|||||||
contact_type: 'Contact Type',
|
contact_type: 'Contact Type',
|
||||||
duplicate_contact: 'Duplicate Contact',
|
duplicate_contact: 'Duplicate Contact',
|
||||||
contact_type_: 'Contact type',
|
contact_type_: 'Contact type',
|
||||||
|
the_payment_amount_that_received:
|
||||||
|
'The payment amount that received from the customer is more than the due amount for this invoice.',
|
||||||
|
invoice_number: 'Invoice number',
|
||||||
|
invoice_date: 'Invoice date',
|
||||||
|
invoice_amount: 'Invoice amount',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
#page-size {
|
#page-size {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
// background-color: #ffffff;
|
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
width: 21cm;
|
width: 21cm;
|
||||||
height: 29.7cm;
|
// height: 29.7cm;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.template {
|
.template {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
// margin: 30px;
|
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
|
|
||||||
&__header {
|
&__header {
|
||||||
@@ -31,7 +29,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
border-bottom: 2px solid #1155cc;
|
border-bottom: 2px solid #1155cc;
|
||||||
// padding-bottom: 40px;
|
|
||||||
padding-bottom: 35px;
|
padding-bottom: 35px;
|
||||||
|
|
||||||
&__info {
|
&__info {
|
||||||
@@ -62,30 +59,28 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 0px 5px;
|
padding: 0px 5px;
|
||||||
margin: 5px 0px 20px 0px;
|
margin: 5px 0px 20px 0px;
|
||||||
font-size: 16px;
|
|
||||||
|
|
||||||
&__rows {
|
.bigcapital-datatable {
|
||||||
display: flex;
|
.table {
|
||||||
margin-bottom: 15px;
|
.thead .tr .th .resizer {
|
||||||
color: #1155cc;
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
&--cell {
|
.thead .th {
|
||||||
flex: 0 20%;
|
font-size: 16px;
|
||||||
|
font-weight: 400;
|
||||||
|
border-bottom: none;
|
||||||
|
background-color: transparent;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
color: #1155cc;
|
||||||
|
}
|
||||||
|
.tbody .tr .td {
|
||||||
|
font-size: 15px;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
border-bottom: 1px solid #cecbcb;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&--cell-payment-receive {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--cell:first-child {
|
|
||||||
flex: 1 0 20%;
|
|
||||||
padding-left: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__rows:not(:first-child) {
|
|
||||||
color: #000;
|
|
||||||
border-bottom: 1px solid #cecbcb;
|
|
||||||
padding-bottom: 15px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,9 +91,6 @@
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
|
|
||||||
// font-size: 18px;
|
|
||||||
// font-weight: 500;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
|
|||||||
Reference in New Issue
Block a user