feat: add quick payment receive & made in action Bar detail.

This commit is contained in:
elforjani13
2021-09-26 22:08:13 +02:00
parent 71f9fa47d4
commit 288225a0c1
7 changed files with 35 additions and 9 deletions

View File

@@ -21,7 +21,7 @@ export const transformErrors = (errors, { setFieldError }) => {
intl.get('payment_number_is_not_unique'),
);
}
if (getError('INVALID_PAYMENT_AMOUNT')) {
if (getError('INVALID_BILL_PAYMENT_AMOUNT')) {
setFieldError(
'payment_amount',
intl.get('the_payment_amount_bigger_than_invoice_due_amount'),

View File

@@ -16,7 +16,7 @@ import withDialogActions from 'containers/Dialog/withDialogActions';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { Icon, FormattedMessage as T } from 'components';
import { If, Icon, FormattedMessage as T } from 'components';
import { safeCallback, compose } from 'utils';
@@ -32,7 +32,7 @@ function BillDetailActionsBar({
}) {
const history = useHistory();
const { billId } = useBillDrawerContext();
const { billId, bill } = useBillDrawerContext();
// Handle edit bill.
const onEditBill = () => {
@@ -45,6 +45,11 @@ function BillDetailActionsBar({
openAlert('bill-delete', { billId });
};
// Handle quick bill payment .
const handleQuickBillPayment = () => {
openDialog('quick-payment-made', { billId });
};
return (
<DashboardActionsBar>
<NavbarGroup>
@@ -54,6 +59,14 @@ function BillDetailActionsBar({
text={<T id={'edit_bill'} />}
onClick={safeCallback(onEditBill)}
/>
<If condition={bill.is_open && !bill.is_fully_paid}>
<Button
className={Classes.MINIMAL}
icon={<Icon icon="quick-payment-16" iconSize={16} />}
text={<T id={'payment_divider'} />}
onClick={handleQuickBillPayment}
/>
</If>
<NavbarDivider />
<Button
className={Classes.MINIMAL}

View File

@@ -16,7 +16,7 @@ import withDialogActions from 'containers/Dialog/withDialogActions';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { Icon, FormattedMessage as T } from 'components';
import { If, Icon, FormattedMessage as T } from 'components';
import { compose } from 'utils';
@@ -36,7 +36,7 @@ function InvoiceDetailActionsBar({
const history = useHistory();
// Invoice detail drawer context.
const { invoiceId } = useInvoiceDetailDrawerContext();
const { invoiceId, invoice } = useInvoiceDetailDrawerContext();
// Handle edit sale invoice.
const handleEditInvoice = () => {
@@ -54,6 +54,11 @@ function InvoiceDetailActionsBar({
openDialog('invoice-pdf-preview', { invoiceId });
};
// Handle quick payment invoice.
const handleQuickPaymentInvoice = () => {
openDialog('quick-payment-receive', { invoiceId });
};
return (
<DashboardActionsBar>
<NavbarGroup>
@@ -63,6 +68,14 @@ function InvoiceDetailActionsBar({
text={<T id={'edit_invoice'} />}
onClick={handleEditInvoice}
/>
<If condition={invoice.is_delivered && !invoice.is_fully_paid}>
<Button
className={Classes.MINIMAL}
icon={<Icon icon="quick-payment-16" iconSize={16} />}
text={<T id={'payment_divider'} />}
onClick={handleQuickPaymentInvoice}
/>
</If>
<NavbarDivider />
<Button
className={Classes.MINIMAL}

View File

@@ -57,7 +57,7 @@ export function ActionsMenu({
<If condition={original.is_open && !original.is_fully_paid}>
<MenuItem
icon={<Icon icon="quick-payment-16" iconSize={16} />}
text={intl.get('add_payment')}
text={intl.get('payment_divider')}
onClick={safeCallback(onQuick, original)}
/>
</If>

View File

@@ -131,7 +131,7 @@ export function ActionsMenu({
<If condition={original.is_delivered && !original.is_fully_paid}>
<MenuItem
icon={<Icon icon="quick-payment-16" iconSize={16} />}
text={intl.get('add_payment')}
text={intl.get('payment_divider')}
onClick={safeCallback(onQuick, original)}
/>
</If>

View File

@@ -833,7 +833,7 @@
"the_payment_amount_that_received": "مبلغ الدفع الذي تم استلامه من الزبون أكبر من المبلغ المستحق لهذه الفاتورة.",
"invoice_number": "رقم الفاتورة",
"make_payment": "قم بالدفع",
"add_payment": "إضافة الدفع",
"payment_divider": "إضافة الدفع",
"quick_receive_payment": "سند قبض سريع",
"amount_received": "تم استلام المبلغ",
"payment_receive_number_required": "مطلوب رقم استلام الدفعة",

View File

@@ -820,7 +820,7 @@
"invoice_date": "Invoice date",
"invoice_amount": "Invoice amount",
"make_payment": "Make Payment",
"add_payment": "Add Payment",
"payment_divider": "Payment divider",
"quick_receive_payment": "Quick Receive Payment",
"amount_received": "Amount Received",
"payment_no": "Payment No.",