diff --git a/src/modules/extendedCallWindow/assets/missionKeywords.ts b/src/modules/extendedCallWindow/assets/missionKeywords.ts index 240ebdd090..8447835529 100644 --- a/src/modules/extendedCallWindow/assets/missionKeywords.ts +++ b/src/modules/extendedCallWindow/assets/missionKeywords.ts @@ -1,6 +1,11 @@ export default ( LSSM: Vue, - settings: { keyword: string; color: string; missions: number[] }[] + settings: { + keyword: string; + color: string; + prefix: boolean; + missions: number[]; + }[] ): void => { const missionHelpBtn = document.getElementById('mission_help'); const missionTitle = document.getElementById('missionH1'); @@ -12,7 +17,7 @@ export default ( ); if (missionType < 0) return; - const addLabel = (text: string, color: string) => { + const addLabel = (text: string, color: string, prefix: boolean) => { const label = document.createElement('span'); label.classList.add('label'); label.style.backgroundColor = color; @@ -23,11 +28,12 @@ export default ( textNode.style.color = 'transparent'; textNode.style.filter = 'invert(1) grayscale(1) contrast(9)'; label.appendChild(textNode); - missionTitle.appendChild(label); + if (!prefix) missionTitle.appendChild(label); + else missionTitle.insertBefore(label, missionTitle.firstChild); }; settings.forEach(s => { if (!s.missions.includes(missionType)) return; - addLabel(s.keyword, s.color); + addLabel(s.keyword, s.color, s.prefix); }); }; diff --git a/src/modules/extendedCallWindow/components/missionKeywords/settings-item.vue b/src/modules/extendedCallWindow/components/missionKeywords/settings-item.vue index 83e739231f..7f7a277ef7 100644 --- a/src/modules/extendedCallWindow/components/missionKeywords/settings-item.vue +++ b/src/modules/extendedCallWindow/components/missionKeywords/settings-item.vue @@ -19,6 +19,13 @@ {{ updateName }} +
+ +
- (this.missions = missions.map(({ id, name }) => ({ - value: id, - label: `${name} (ID: ${id})`, - }))) - ); + async beforeMount() { + this.missions = ((await this.$store.dispatch( + 'api/getMissions', + false + )) as Mission[]).map(({ id, name }) => ({ + value: id, + label: `${name} (ID: ${id})`, + })); }, }); diff --git a/src/modules/extendedCallWindow/components/missionKeywords/settings-titles.vue b/src/modules/extendedCallWindow/components/missionKeywords/settings-titles.vue index 9b506cd3a9..37d88fe261 100644 --- a/src/modules/extendedCallWindow/components/missionKeywords/settings-titles.vue +++ b/src/modules/extendedCallWindow/components/missionKeywords/settings-titles.vue @@ -9,6 +9,9 @@ {{ $t('modules.extendedCallWindow.settings.missionKeywords.preview') }} + {{ + $t('modules.extendedCallWindow.settings.missionKeywords.prepend') + }} {{ $t('modules.extendedCallWindow.settings.missionKeywords.missions') }} diff --git a/src/modules/extendedCallWindow/i18n/de_DE.root.json b/src/modules/extendedCallWindow/i18n/de_DE.root.json index 29168a8a33..c617ba49f3 100644 --- a/src/modules/extendedCallWindow/i18n/de_DE.root.json +++ b/src/modules/extendedCallWindow/i18n/de_DE.root.json @@ -77,6 +77,7 @@ "description": "Lasse dir ein eigenes Stichwort neben dem Einsatznamen anzeigen", "keyword": "Stichwort", "color": "Hintergrundfarbe", + "prepend": "Vor dem Einsatznamen anzeigen", "missions": "Einsätze", "preview": "Vorschau" }, diff --git a/src/modules/extendedCallWindow/main.ts b/src/modules/extendedCallWindow/main.ts index 8ce86132a8..a13de9d38c 100644 --- a/src/modules/extendedCallWindow/main.ts +++ b/src/modules/extendedCallWindow/main.ts @@ -106,6 +106,7 @@ export default (async (LSSM, MODULE_ID, $m) => { defaultItem: { keyword: '', color: '#777777', + prefix: false, missions: [], }, }, @@ -193,7 +194,12 @@ export default (async (LSSM, MODULE_ID, $m) => { ).default(LSSM, getSetting, $m); const missionKeywordsSettings = await getSetting< - { keyword: string; color: string; missions: number[] }[] + { + keyword: string; + color: string; + prefix: boolean; + missions: number[]; + }[] >('missionKeywords'); if (missionKeywordsSettings.length) diff --git a/typings/modules/ExtendedCallWindow/missionKeywords/SettingsItem.d.ts b/typings/modules/ExtendedCallWindow/missionKeywords/SettingsItem.d.ts index 4eb68030ca..45f9a071e2 100644 --- a/typings/modules/ExtendedCallWindow/missionKeywords/SettingsItem.d.ts +++ b/typings/modules/ExtendedCallWindow/missionKeywords/SettingsItem.d.ts @@ -1,6 +1,7 @@ interface item { keyword: string; color: string; + prefix: boolean; missions: number[]; } @@ -20,6 +21,7 @@ export interface SettingsItemProps { export interface SettingsItemComputed { updateName: item['keyword']; updateColor: item['color']; + updatePrefix: item['prefix']; updateMissions: Option[]; selectableMissions: Option[]; }