diff --git a/src/containers/Sales/Invoices/InvoiceForm/InvoiceForm.schema.js b/src/containers/Sales/Invoices/InvoiceForm/InvoiceForm.schema.js index eaedac85f..9d68c079a 100644 --- a/src/containers/Sales/Invoices/InvoiceForm/InvoiceForm.schema.js +++ b/src/containers/Sales/Invoices/InvoiceForm/InvoiceForm.schema.js @@ -1,4 +1,5 @@ import * as Yup from 'yup'; +import moment from 'moment'; import intl from 'react-intl-universal'; import { DATATYPES_LENGTH } from 'common/dataTypes'; import { isBlank } from 'utils'; @@ -7,7 +8,15 @@ const getSchema = () => Yup.object().shape({ customer_id: Yup.string().label(intl.get('customer_name_')).required(), invoice_date: Yup.date().required().label(intl.get('invoice_date_')), - due_date: Yup.date().required().label(intl.get('due_date_')), + due_date: Yup.date() + .min(Yup.ref('invoice_date'), ({ path, min }) => + intl.get('invoice.validation.due_date', { + path, + min: moment(min).format('YYYY/MM/DD'), + }), + ) + .required() + .label(intl.get('due_date_')), invoice_no: Yup.string() .max(DATATYPES_LENGTH.STRING) .label(intl.get('invoice_no_')), diff --git a/src/lang/ar/index.json b/src/lang/ar/index.json index cf6eb0632..b732b125b 100644 --- a/src/lang/ar/index.json +++ b/src/lang/ar/index.json @@ -1361,6 +1361,7 @@ "item.field.sell_account.hint": "أدخل السعر الذي ستبيعه لهذا العنصر.", "item_entries.products_services.hint": "أدخل المنتجات أو الخدمات التي تبيعها أو تشتريها لتتبع ما قمت ببيعه أو شرائه.", "item_entries.landed.hint": "يتيح لك هذه الخيار إمكانية إضافة تكلفة اضافية علي فاتورة الشراء متال علي ذلك تكاليف الشحن ، ثم تحديد هذه التكلفة لتحميلها علي فاتورة الشراء.", + "item_entries.remove_row": "حذف الصف", "invoice.auto_increment.auto": "يتم تعيين أرقام الفواتير على وضع الزيادة التلقائي. هل أنت متأكد من تغيير هذا الإعداد؟", "invoice.auto_increment.manually": "يتم تعيين أرقام فواتيرك يدوياً. هل أنت متأكد من تغيير هذه الإعدادات؟", "manual_journals.auto_increment.auto": "يتم تعيين أرقام القيود على وضع الزيادة التلقائي. هل أنت متأكد من تغيير هذا الإعداد؟", @@ -1847,6 +1848,7 @@ "warehouse_transfer.column.transfer_quantity": "الكمية ", "warehouse_transfer.column.source_warehouse": "المصدر", "warehouse_transfer.column.destination_warehouse": "الوجهة", + "warehouse_transfer.column.cost_price": "سعر التكلفة", "warehouse_transfer.auto_increment.auto": "يتم تعيين أرقام النقل على وضع الزيادة التلقائي. هل أنت متأكد من تغيير هذا الإعداد؟", "warehouse_transfer.auto_increment.manually": "يتم تعيين أرقام النقل يدوياً. هل أنت متأكد من تغيير هذه الإعدادات؟", "warehouse_transfer.setting_your_auto_generated_transfer_no": "تعيين رقم النقل الذي تم إنشاؤه تلقائيًا", @@ -2006,6 +2008,6 @@ "warehouse_transfer.empty_status.title": "إدارة عمليات النقل بين المستودعات", "warehouse_transfer.empty_status.description": "غالبًا ماتحتاج الاعمال ذات مستودعات متعددة لطلبات نقل البضائع من مستودع إلى آخر عندما تكون في حاجة ماسة إلى البائعين.", "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}" } \ No newline at end of file diff --git a/src/lang/en/index.json b/src/lang/en/index.json index 5911e4753..9d46f4090 100644 --- a/src/lang/en/index.json +++ b/src/lang/en/index.json @@ -1338,6 +1338,7 @@ "item.field.sell_account.hint": "Enter price which you goint to sell this item.", "item_entries.products_services.hint": "Enter products or services you sell or buy to keep tracking what your sold or purchased.", "item_entries.landed.hint": "This options allows you to be able to add additional cost eg. freight then allocate cost to the items in your bills.", + "item_entries.remove_row": "Remove line", "invoice.auto_increment.auto": "Your invoice numbers are set on auto-increment mode. Are you sure changing this setting?", "invoice.auto_increment.manually": "Your invoice numbers are set on manual mode. Are you sure chaning this settings?", "manual_journals.auto_increment.auto": "Your Jouranl numbers are set on auto-increment mode. Are you sure changing this setting?", @@ -2007,5 +2008,6 @@ "warehouse_transfer.empty_status.description": "Business with multiply warehouses often transfers items from on warehouse to another when they are in immediate need of vendors.", "warehouse_transfer.form.reason.label": "Reason", "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}" } \ No newline at end of file