This commit is contained in:
a.bouhuolia
2021-09-15 11:32:04 +02:00
12 changed files with 21 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
export const ERROR = { export const ERROR = {
// Sales Estimates // Sales Estimates
ESTIMATE_NUMBER_IS_NOT_UNQIUE: 'ESTIMATE.NUMBER.IS.NOT.UNQIUE', ESTIMATE_NUMBER_IS_NOT_UNQIUE: 'ESTIMATE.NUMBER.IS.NOT.UNQIUE',
SALE_ESTIMATE_NO_IS_REQUIRED: 'SALE_ESTIMATE_NO_IS_REQUIRED',
// Sales Invoices // Sales Invoices
SALE_INVOICE_NUMBER_IS_EXISTS: 'SALE.INVOICE.NUMBER.IS.EXISTS', SALE_INVOICE_NUMBER_IS_EXISTS: 'SALE.INVOICE.NUMBER.IS.EXISTS',
@@ -13,5 +14,5 @@ export const ERROR = {
// Bills // Bills
BILL_NUMBER_EXISTS: 'BILL.NUMBER.EXISTS', BILL_NUMBER_EXISTS: 'BILL.NUMBER.EXISTS',
SALE_INVOICE_NO_IS_REQUIRED: 'SALE_INVOICE_NO_IS_REQUIRED' SALE_INVOICE_NO_IS_REQUIRED: 'SALE_INVOICE_NO_IS_REQUIRED',
}; };

View File

@@ -33,7 +33,7 @@ export const useManualJournalsColumns = () => {
{ {
id: 'journal_number', id: 'journal_number',
Header: intl.get('journal_no'), Header: intl.get('journal_no'),
accessor: (row) => `#${row.journal_number}`, accessor: (row) => `${row.journal_number}`,
className: 'journal_number', className: 'journal_number',
width: 100, width: 100,
clickable: true, clickable: true,

View File

@@ -165,7 +165,7 @@ export function useBillsTableColumns() {
{ {
id: 'bill_number', id: 'bill_number',
Header: intl.get('bill_number'), Header: intl.get('bill_number'),
accessor: (row) => (row.bill_number ? `#${row.bill_number}` : null), accessor: (row) => (row.bill_number ? `${row.bill_number}` : null),
width: 100, width: 100,
className: 'bill_number', className: 'bill_number',
clickable: true, clickable: true,

View File

@@ -84,7 +84,7 @@ function PaymentMadeForm({
if (totalPaymentAmount <= 0) { if (totalPaymentAmount <= 0) {
AppToaster.show({ AppToaster.show({
message: intl.get('you_cannot_make_payment_with_zero_total_amount'), message: intl.get('you_cannot_make_payment_with_zero_total_amount'),
intent: Intent.WARNING, intent: Intent.DANGER,
}); });
return; return;
} }

View File

@@ -88,7 +88,7 @@ export function usePaymentMadesTableColumns() {
id: 'payment_number', id: 'payment_number',
Header: intl.get('payment_number'), Header: intl.get('payment_number'),
accessor: (row) => accessor: (row) =>
row.payment_number ? `#${row.payment_number}` : null, row.payment_number ? `${row.payment_number}` : null,
width: 140, width: 140,
className: 'payment_number', className: 'payment_number',
clickable: true, clickable: true,

View File

@@ -78,6 +78,13 @@ function EstimateForm({
estimate_number: intl.get('estimate_number_is_not_unqiue'), estimate_number: intl.get('estimate_number_is_not_unqiue'),
}); });
} }
if (
errors.some((error) => error.type === ERROR.SALE_ESTIMATE_NO_IS_REQUIRED)
) {
setErrors({
estimate_number: intl.get('estimate.field.error.estimate_number_required'),
});
}
}; };
// Handles form submit. // Handles form submit.

View File

@@ -169,7 +169,7 @@ export function useEstiamtesTableColumns() {
id: 'estimate_number', id: 'estimate_number',
Header: intl.get('estimate_number'), Header: intl.get('estimate_number'),
accessor: (row) => accessor: (row) =>
row.estimate_number ? `#${row.estimate_number}` : null, row.estimate_number ? `${row.estimate_number}` : null,
width: 140, width: 140,
className: 'estimate_number', className: 'estimate_number',
clickable: true, clickable: true,

View File

@@ -153,6 +153,7 @@ function InvoiceFormHeaderFields({
{({ form, field, meta: { error, touched } }) => ( {({ form, field, meta: { error, touched } }) => (
<FormGroup <FormGroup
label={<T id={'invoice_no'} />} label={<T id={'invoice_no'} />}
labelInfo={<FieldRequiredHint />}
inline={true} inline={true}
className={classNames('form-group--invoice-no', CLASSES.FILL)} className={classNames('form-group--invoice-no', CLASSES.FILL)}
intent={inputIntent({ error, touched })} intent={inputIntent({ error, touched })}

View File

@@ -93,8 +93,7 @@ export const transformErrors = (errors, { setErrors }) => {
errors.some((error) => error.type === ERROR.SALE_INVOICE_NO_IS_REQUIRED) errors.some((error) => error.type === ERROR.SALE_INVOICE_NO_IS_REQUIRED)
) { ) {
setErrors({ setErrors({
invoice_no: invoice_no: intl.get('invoice.field.error.invoice_no_required'),
'Invoice number is required, use auto-increment mode or enter manually.',
}); });
} }
}; };

View File

@@ -106,7 +106,6 @@ function PaymentReceiveForm({
message: intl.get('you_cannot_make_payment_with_zero_total_amount'), message: intl.get('you_cannot_make_payment_with_zero_total_amount'),
intent: Intent.DANGER, intent: Intent.DANGER,
}); });
setSubmitting(false);
return; return;
} }
const form = { const form = {

View File

@@ -110,7 +110,7 @@ export function usePaymentReceivesColumns() {
id: 'payment_receive_no', id: 'payment_receive_no',
Header: intl.get('payment_receive_no'), Header: intl.get('payment_receive_no'),
accessor: (row) => accessor: (row) =>
row.payment_receive_no ? `#${row.payment_receive_no}` : null, row.payment_receive_no ? `${row.payment_receive_no}` : null,
width: 140, width: 140,
className: 'payment_receive_no', className: 'payment_receive_no',
clickable: true, clickable: true,

View File

@@ -1324,7 +1324,9 @@
"auto_increment.field.manually": "I will enter them manually each time", "auto_increment.field.manually": "I will enter them manually each time",
"auto_increment.field.manual_this_transaction": "Manual entering for this transaction.", "auto_increment.field.manual_this_transaction": "Manual entering for this transaction.",
"auto_increment.field.auto": "Auto-incrementing number.", "auto_increment.field.auto": "Auto-incrementing number.",
"date_format": { "date_formats": {
"YYYY MMM DD": "YYYY MMM DD" "YYYY MMM DD": "YYYY MMM DD"
} },
"estimate.field.error.estimate_number_required": "Estimate number is required, use auto-increment mode or enter manually.",
"invoice.field.error.invoice_no_required": "Invoice number is required, use auto-increment mode or enter manually"
} }