diff --git a/src/components/Panels/OrderMessagePanel.vue b/src/components/Panels/OrderMessagePanel.vue index cc6240d..44e8c4d 100644 --- a/src/components/Panels/OrderMessagePanel.vue +++ b/src/components/Panels/OrderMessagePanel.vue @@ -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; diff --git a/src/locales/en.json b/src/locales/en.json index 66270c4..9f147ba 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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 order's message!", "success-save-html": "Saved order's message in the browser memory!", diff --git a/src/locales/pl.json b/src/locales/pl.json index 578f736..faf6838 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -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ść rozkazu!", "success-save-html": "Zapisano treść rozkazu w pamięci przeglądarki!",