mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
BIG-238: Validate bill due date.
This commit is contained in:
@@ -1,16 +1,19 @@
|
|||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
|
import moment from 'moment';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import { DATATYPES_LENGTH } from 'common/dataTypes';
|
import { DATATYPES_LENGTH } from 'common/dataTypes';
|
||||||
import { isBlank } from 'utils';
|
import { isBlank } from 'utils';
|
||||||
|
|
||||||
const BillFormSchema = Yup.object().shape({
|
const BillFormSchema = Yup.object().shape({
|
||||||
vendor_id: Yup.number()
|
vendor_id: Yup.number().required().label(intl.get('vendor_name_')),
|
||||||
.required()
|
bill_date: Yup.date().required().label(intl.get('bill_date_')),
|
||||||
.label(intl.get('vendor_name_')),
|
|
||||||
bill_date: Yup.date()
|
|
||||||
.required()
|
|
||||||
.label(intl.get('bill_date_')),
|
|
||||||
due_date: Yup.date()
|
due_date: Yup.date()
|
||||||
|
.min(Yup.ref('bill_date'), ({ path, min }) =>
|
||||||
|
intl.get('bill.validation.due_date', {
|
||||||
|
path,
|
||||||
|
min: moment(min).format('YYYY/MM/DD'),
|
||||||
|
}),
|
||||||
|
)
|
||||||
.required()
|
.required()
|
||||||
.label(intl.get('due_date_')),
|
.label(intl.get('due_date_')),
|
||||||
bill_number: Yup.string()
|
bill_number: Yup.string()
|
||||||
@@ -25,7 +28,7 @@ const BillFormSchema = Yup.object().shape({
|
|||||||
open: Yup.boolean(),
|
open: Yup.boolean(),
|
||||||
branch_id: Yup.string(),
|
branch_id: Yup.string(),
|
||||||
warehouse_id: Yup.string(),
|
warehouse_id: Yup.string(),
|
||||||
exchange_rate:Yup.number(),
|
exchange_rate: Yup.number(),
|
||||||
entries: Yup.array().of(
|
entries: Yup.array().of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
quantity: Yup.number()
|
quantity: Yup.number()
|
||||||
|
|||||||
@@ -2010,5 +2010,6 @@
|
|||||||
"item.error.you_could_not_delete_item_has_associated": "لا يمكنك حذف العنصر لديه معاملات مرتبطة به ",
|
"item.error.you_could_not_delete_item_has_associated": "لا يمكنك حذف العنصر لديه معاملات مرتبطة به ",
|
||||||
"warehouse_transfer.quantity_cannot_be_zero_or_empty": "لا يمكن أن تكون الكمية صفراً أو فارغة.",
|
"warehouse_transfer.quantity_cannot_be_zero_or_empty": "لا يمكن أن تكون الكمية صفراً أو فارغة.",
|
||||||
"invoice.validation.due_date": "يجب أن يكون حقل {path} في وقت لاحق من {min}",
|
"invoice.validation.due_date": "يجب أن يكون حقل {path} في وقت لاحق من {min}",
|
||||||
"estimate.validation.expiration_date": "يجب أن يكون حقل {path} في وقت لاحق من {min}"
|
"estimate.validation.expiration_date": "يجب أن يكون حقل {path} في وقت لاحق من {min}",
|
||||||
|
"bill.validation.due_date": "يجب أن يكون حقل {path} في وقت لاحق من {min}"
|
||||||
}
|
}
|
||||||
@@ -2010,5 +2010,6 @@
|
|||||||
"warehouse_transfer.form.reason.placeholder": "Enter the reason behind the transfer order.",
|
"warehouse_transfer.form.reason.placeholder": "Enter the reason behind the transfer order.",
|
||||||
"warehouse_transfer.quantity_cannot_be_zero_or_empty": "Quantity cannot be zero or empty.",
|
"warehouse_transfer.quantity_cannot_be_zero_or_empty": "Quantity cannot be zero or empty.",
|
||||||
"invoice.validation.due_date": "{path} field must be later than {min}",
|
"invoice.validation.due_date": "{path} field must be later than {min}",
|
||||||
"estimate.validation.expiration_date": "{path} field must be later than {min}"
|
"estimate.validation.expiration_date": "{path} field must be later than {min}",
|
||||||
|
"bill.validation.due_date": "{path} field must be later than {min}"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user