diff --git a/public/js/components/DashboardWidget/Ampel.js b/public/js/components/DashboardWidget/Ampel.js index 7aaf152ec..fdf7752c7 100755 --- a/public/js/components/DashboardWidget/Ampel.js +++ b/public/js/components/DashboardWidget/Ampel.js @@ -1,24 +1,24 @@ import AbstractWidget from './Abstract'; import BaseOffcanvas from '../Base/Offcanvas'; -const widgetAmpelMAX = 4; - export default { name: 'WidgetsAmpel', components: { BaseOffcanvas }, data: () => ({ + WIDGET_AMPEL_MAX: 4, filter: '', source: '', - ampeln: null, allAmpeln:null, activeAmpeln:null, + phrasen: {ampeln:false, ui:false}, }), mixins: [ AbstractWidget ], computed: { - widgetAmpelMAX(){ - return widgetAmpelMAX; + arePhrasenLoaded(){ + // checks if both the phrasen categories 'ampeln' and 'ui' are loaded + return this.phrasen.ampeln && this.phrasen.ui; }, ampelnComputed(){ @@ -31,7 +31,7 @@ export default { }, ampelnOverview () { - return this.activeAmpeln?.slice(0, widgetAmpelMAX); // show only newest 4 active ampeln + return this.activeAmpeln?.slice(0, this.WIDGET_AMPEL_MAX); // show only newest 4 active ampeln }, count () { let datasource = this.activeAmpeln; @@ -111,15 +111,20 @@ export default { }, validateBtnTxt(buttontext){ - if(buttontext instanceof Array && !buttontext.length) return 'Bestätigen'; + if(buttontext instanceof Array && !buttontext.length) return this.$p.t('ui','bestaetigen'); - if(!buttontext) return 'Bestätigen'; + if(!buttontext) return this.$p.t('ui','bestaetigen'); return buttontext; } }, created() { - + this.$p.loadCategory('ampel').then(() => { + this.isPhrasenLoaded = true; + }); + this.$p.loadCategory('ui').then(() => { + this.isPhrasenLoaded = true; + }); this.$emit('setConfig', false); }, async mounted() { @@ -131,18 +136,18 @@ export default {
-
Neueste Ampeln
- +
{{$p.t('ampeln','newestAmpeln')}}
+
-
Deadline: {{ getDate(ampel.deadline) }}
+
{{$p.t('ampeln','deadline')}}: {{ getDate(ampel.deadline) }}
@@ -156,12 +161,12 @@ export default {
Super!
- Keine offenen Ampeln. + {{$p.t('ampeln','noOpenAmpeln')}}
-
Neueste Ampeln
-