mirror of
https://github.com/Spythere/genera-tor.git
synced 2026-05-03 13:38:12 +00:00
chore: added instruction conflicts checking
This commit is contained in:
@@ -168,7 +168,23 @@ function showActionMonit(content: string, type: TActionMonitType) {
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
function verifyOrderFields() {
|
||||
function checkConflicts() {
|
||||
if (
|
||||
store.orderData.instructions
|
||||
.filter((i) => i.key == '2110' || i.key == '2115')
|
||||
.every((i) => i.active)
|
||||
) {
|
||||
showActionMonit(
|
||||
t('order-message.warning-conflicting-instructions', ['21.10', '21.15']),
|
||||
'warning'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function areOrderFieldsCorrect() {
|
||||
const fieldsToCorrect: string[] = [];
|
||||
|
||||
for (let headerKey in store.orderData.header) {
|
||||
@@ -183,7 +199,11 @@ function verifyOrderFields() {
|
||||
}
|
||||
}
|
||||
|
||||
// Are header & footer fields check
|
||||
const areConflicting = checkConflicts();
|
||||
|
||||
if (areConflicting) return false;
|
||||
|
||||
// Header & footer fields check
|
||||
if (fieldsToCorrect.length > 0) {
|
||||
showActionMonit(t('order-message.warning-fill-missing'), 'warning');
|
||||
return false;
|
||||
@@ -271,7 +291,7 @@ function copyMessage() {
|
||||
if (!navigator.clipboard)
|
||||
return showActionMonit(t('order-message.warning-outdated-clipboard'), 'warning');
|
||||
|
||||
const areFieldsCorrect = verifyOrderFields();
|
||||
const areFieldsCorrect = areOrderFieldsCorrect();
|
||||
|
||||
if (!areFieldsCorrect) return;
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
"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!",
|
||||
"warning-conflicting-instructions": "Instruction {0} and {1} can't be on the same order!",
|
||||
"error-update": "An error occurred while saving this order! :/",
|
||||
"success-update-html": "Updated this <b class=\"text--accent\">order's</b> message!",
|
||||
"success-save-html": "Saved <b class=\"text--accent\">order's</b> message in the browser memory!",
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
"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ć!",
|
||||
"warning-conflicting-instructions": "Instrukcje {0} i {1} nie mogą znajdować się na tym samym rozkazie jednocześnie!",
|
||||
"error-update": "Wystąpił błąd podczas aktualizowania tego rozkazu! :/",
|
||||
"success-update-html": "Zaktualizowano treść <b class=\"text--accent\">rozkazu</b>!",
|
||||
"success-save-html": "Zapisano treść <b class=\"text--accent\">rozkazu</b> w pamięci przeglądarki!",
|
||||
|
||||
Reference in New Issue
Block a user