mirror of
https://github.com/Spythere/genera-tor.git
synced 2026-05-03 05:28:13 +00:00
chore: order fields verification on update
This commit is contained in:
@@ -249,6 +249,12 @@ function verifyOrderFields() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function hasHeaderFieldsComplete() {
|
||||
return Object.values(store.orderData.header).every((v) => {
|
||||
return v.trim().length != 0;
|
||||
});
|
||||
}
|
||||
|
||||
// TODO
|
||||
function incrementOrderNo() {
|
||||
// store.orderData. = (Number(order.header.orderNo) + 1).toString();
|
||||
@@ -270,12 +276,8 @@ function copyMessage() {
|
||||
}
|
||||
|
||||
function saveOrder() {
|
||||
const noHeaderInfo = Object.values(store.orderData.header).some((v) => {
|
||||
return v.trim().length == 0;
|
||||
});
|
||||
|
||||
if (noHeaderInfo) {
|
||||
showActionMonit(`${t('order-message.warning-fill-top')}`, 'warning');
|
||||
if (!hasHeaderFieldsComplete()) {
|
||||
showActionMonit(`${t('order-message.warning-fill-top-save')}`, 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -322,15 +324,19 @@ function saveOrder() {
|
||||
|
||||
function updateOrder() {
|
||||
if (!store.chosenLocalOrderId) {
|
||||
showActionMonit(`${t('order-message.warning-no-order-selected')}`, 'warning');
|
||||
showActionMonit(t('order-message.warning-no-order-selected'), 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasHeaderFieldsComplete()) {
|
||||
showActionMonit(t('order-message.warning-fill-top-update'), 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
const localOrder = window.localStorage.getItem(store.chosenLocalOrderId);
|
||||
|
||||
if (!localOrder) {
|
||||
showActionMonit(`${t('order-message.error-update')}`, 'warning');
|
||||
showActionMonit(t('order-message.error-update'), 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -28,7 +28,8 @@
|
||||
"warning-fill-inputs": "Fill all the empty fields before copying the order!",
|
||||
"warning-add-instruction": "Add at least one order instruction before copying the order!",
|
||||
"warning-fill-missing": "Fill rows in the order's header and footer before copying it!",
|
||||
"warning-fill-top": "Fill at least fields A, B, C and D in the order's header before saving it!",
|
||||
"warning-fill-top-save": "Fill at least fields A, B, C and D in the order's header before saving it!",
|
||||
"warning-fill-top-update": "Fill at least fields A, B, C and D in the order's header before updating it!",
|
||||
"warning-order-identical": "Last saved order is identical as the current one!",
|
||||
"warning-no-order-selected": "Choose the already saved order first!",
|
||||
"error-update": "An error occurred while saving this order! :/",
|
||||
|
||||
+2
-1
@@ -28,7 +28,8 @@
|
||||
"warning-fill-inputs": "Wypełnij puste rubryki rozkazu przed jego skopiowaniem!",
|
||||
"warning-add-instruction": "Dodaj co najmniej jedną instrukcję rozkazu przed jego skopiowaniem!",
|
||||
"warning-fill-missing": "Uzupełnij rubryki w nagłówku i stopce rozkazu przed jego skopiowaniem!",
|
||||
"warning-fill-top": "Wypełnij co najmniej rubryki A, B, C i D w nagłówku rozkazu przed jego zapisaniem!",
|
||||
"warning-fill-top-save": "Wypełnij co najmniej rubryki A, B, C i D w nagłówku rozkazu przed jego zapisaniem!",
|
||||
"warning-fill-top-update": "Wypełnij co najmniej rubryki A, B, C i D w nagłówku rozkazu przed jego zaktualizowaniem!",
|
||||
"warning-order-identical": "Ostatni zapisany rozkaz jest identyczny z obecnym!",
|
||||
"warning-no-order-selected": "Wybierz rozkaz, który chcesz zaktualizować!",
|
||||
"error-update": "Wystąpił błąd podczas aktualizowania tego rozkazu! :/",
|
||||
|
||||
Reference in New Issue
Block a user