chore: added instruction conflicts checking

This commit is contained in:
2025-10-11 00:26:53 +02:00
parent a1d0c47910
commit 201c49845f
3 changed files with 25 additions and 3 deletions
+23 -3
View File
@@ -168,7 +168,23 @@ function showActionMonit(content: string, type: TActionMonitType) {
}, 5000); }, 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[] = []; const fieldsToCorrect: string[] = [];
for (let headerKey in store.orderData.header) { 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) { if (fieldsToCorrect.length > 0) {
showActionMonit(t('order-message.warning-fill-missing'), 'warning'); showActionMonit(t('order-message.warning-fill-missing'), 'warning');
return false; return false;
@@ -271,7 +291,7 @@ function copyMessage() {
if (!navigator.clipboard) if (!navigator.clipboard)
return showActionMonit(t('order-message.warning-outdated-clipboard'), 'warning'); return showActionMonit(t('order-message.warning-outdated-clipboard'), 'warning');
const areFieldsCorrect = verifyOrderFields(); const areFieldsCorrect = areOrderFieldsCorrect();
if (!areFieldsCorrect) return; if (!areFieldsCorrect) return;
+1
View File
@@ -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-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-order-identical": "Last saved order is identical as the current one!",
"warning-no-order-selected": "Choose the already saved order first!", "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! :/", "error-update": "An error occurred while saving this order! :/",
"success-update-html": "Updated this <b class=\"text--accent\">order's</b> message!", "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!", "success-save-html": "Saved <b class=\"text--accent\">order's</b> message in the browser memory!",
+1
View File
@@ -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-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-order-identical": "Ostatni zapisany rozkaz jest identyczny z obecnym!",
"warning-no-order-selected": "Wybierz rozkaz, który chcesz zaktualizować!", "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! :/", "error-update": "Wystąpił błąd podczas aktualizowania tego rozkazu! :/",
"success-update-html": "Zaktualizowano treść <b class=\"text--accent\">rozkazu</b>!", "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!", "success-save-html": "Zapisano treść <b class=\"text--accent\">rozkazu</b> w pamięci przeglądarki!",