mirror of
https://github.com/Spythere/genera-tor.git
synced 2026-05-03 05:28:13 +00:00
chore: added optional fields support in messages
This commit is contained in:
@@ -71,7 +71,10 @@ function generateMessage() {
|
|||||||
|
|
||||||
messageHtml += `<b>[${value.name}]</b> ${t(
|
messageHtml += `<b>[${value.name}]</b> ${t(
|
||||||
localeKey + '.message-html',
|
localeKey + '.message-html',
|
||||||
messageValues
|
messageValues,
|
||||||
|
Object.keys(value.inputFields).filter(
|
||||||
|
(k) => value.optionalFieldNames.includes(k) && value.inputFields[k].trim() != ''
|
||||||
|
).length
|
||||||
)}<br />`;
|
)}<br />`;
|
||||||
|
|
||||||
if (value.key == '2310' && value.listFields) {
|
if (value.key == '2310' && value.listFields) {
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ function verifyOrderFields() {
|
|||||||
for (const fieldKey in instruction.inputFields) {
|
for (const fieldKey in instruction.inputFields) {
|
||||||
const fieldValue = instruction.inputFields[fieldKey];
|
const fieldValue = instruction.inputFields[fieldKey];
|
||||||
|
|
||||||
if (fieldValue.trim() == '') {
|
if (fieldValue.trim() == '' && !instruction.optionalFieldNames.includes(fieldKey)) {
|
||||||
hasAllInputsFilled = false;
|
hasAllInputsFilled = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -150,7 +150,7 @@
|
|||||||
"signalbox2": "x.2 posterunek",
|
"signalbox2": "x.2 posterunek",
|
||||||
"km1": "x.3 km",
|
"km1": "x.3 km",
|
||||||
"other1": "x.96 inne",
|
"other1": "x.96 inne",
|
||||||
"message-html": "<b>Zatrzymanie pociągu</b> na posterunku/szlaku {0} {'|'} {1} w km {2} celem {3}"
|
"message-html": "<b>Zatrzymanie pociągu</b> na posterunku {0} w km {2} celem {3} | <b>Zatrzymanie pociągu</b> na szlaku {0} {'|'} {1} w km {2} celem {3} | <b>Zatrzymanie pociągu</b> na szlaku {0} {'|'} {1} w km {2} celem {3}"
|
||||||
},
|
},
|
||||||
"2145": {
|
"2145": {
|
||||||
"text": "Na {signalbox1} na sygnalizatorze {signal1} {bold1}",
|
"text": "Na {signalbox1} na sygnalizatorze {signal1} {bold1}",
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
"signalbox1": "x.1 posterunek",
|
"signalbox1": "x.1 posterunek",
|
||||||
"signalbox2": "x.2 posterunek",
|
"signalbox2": "x.2 posterunek",
|
||||||
"km1": "x.3 km",
|
"km1": "x.3 km",
|
||||||
"message-html": "<b>Wskazania tarcz ostrzegawczych</b> przejazdowych na posterunku/szlaku {1} / {2} odnoszących się do przejazdu w km {3}, <b>są nieważne. Jazda z prędkością rozkładową.</b>"
|
"message-html": "<b>Wskazania tarcz ostrzegawczych</b> przejazdowych na posterunku/szlaku {1} / {2} odnoszących się do przejazdu w km {3} <b>są nieważne. Jazda z prędkością rozkładową.</b>"
|
||||||
},
|
},
|
||||||
"2155": {
|
"2155": {
|
||||||
"text": "{bold1} na posterunku/szlaku {signalbox1}{'|'}{signalbox2} odnoszące się do sygnalizatora {signal1}.",
|
"text": "{bold1} na posterunku/szlaku {signalbox1}{'|'}{signalbox2} odnoszące się do sygnalizatora {signal1}.",
|
||||||
|
|||||||
+1
-1
@@ -156,7 +156,7 @@ export const useStore = defineStore('store', {
|
|||||||
km1: ''
|
km1: ''
|
||||||
},
|
},
|
||||||
optionalFieldNames: ['signalbox2'],
|
optionalFieldNames: ['signalbox2'],
|
||||||
textDirectives: ['bold1', 'br']
|
textDirectives: ['bold1', 'br', 'bold2']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '2155',
|
key: '2155',
|
||||||
|
|||||||
Reference in New Issue
Block a user