bugfix
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
Header
|
||||
====================================================== -->
|
||||
<ion-header>
|
||||
|
||||
</ion-header>
|
||||
|
||||
<!-- ======================================================
|
||||
@@ -35,11 +34,15 @@
|
||||
<ion-card *ngFor="let aviso of pages[currentPageIndex]; let i = index"
|
||||
class="arrival-card"
|
||||
[ngClass]="getStatusClass(aviso.status, aviso.lkW_fertig, aviso.avisoTVHinweis)">
|
||||
|
||||
<!-- Nummer links oben (Kachel-Index in der aktuellen Seite) -->
|
||||
<div class="card-number">{{ getOverallIndex(i) }}</div>
|
||||
|
||||
<!-- Wenn kein Hinweis oder 'shouldShowNormalContent' == true -> normaler Inhalt -->
|
||||
<ng-container *ngIf="shouldShowNormalContent(aviso); else showAvisoHinweis">
|
||||
<div class="flex-container">
|
||||
|
||||
<!-- LKW-Nummer -->
|
||||
<div class="lkwnr"
|
||||
appAutoFontSize
|
||||
[maxFontSizePercentage]="34"
|
||||
@@ -47,55 +50,80 @@
|
||||
{{ aviso.lkW_Nr }}
|
||||
</div>
|
||||
|
||||
<!-- Datum / Zeit / Dauer -->
|
||||
<div class="ion-text-center"
|
||||
appAutoFontSize
|
||||
[maxFontSizePercentage]="33"
|
||||
[maxFontSize]="avisoTvSettings[0].kachelFontSizeDateTime">
|
||||
<ion-icon [name]="getStatusIcon(aviso.status)"
|
||||
[color]="getStatusColor(aviso.status)"
|
||||
class="inline-icon"></ion-icon>
|
||||
class="inline-icon">
|
||||
</ion-icon>
|
||||
{{ aviso.ankunft }}
|
||||
<ion-icon name="hourglass-outline"
|
||||
[color]="getStatusColor(aviso.status)"
|
||||
class="inline-icon"></ion-icon>
|
||||
class="inline-icon">
|
||||
</ion-icon>
|
||||
{{ aviso.dauer }}
|
||||
</div>
|
||||
|
||||
<!-- Mitarbeiter / Wechseltext (nur bei fertigem LKW ohne Hinweis) -->
|
||||
<div class="ion-text-center"
|
||||
appAutoFontSize
|
||||
[maxFontSizePercentage]="33"
|
||||
[maxFontSize]="avisoTvSettings[0].kachelFontSizeDateTime"
|
||||
[ngClass]="{'wechseltextdiv': displayMitarbeiterTexts[aviso.lkW_Nr] === 'BITTE KOMMEN / LÜTFEN GELIN'}">
|
||||
|
||||
|
||||
[ngClass]="{'wechseltextdiv': toggleWechselText && aviso.lkW_fertig && !aviso.avisoTVHinweis}">
|
||||
|
||||
<!-- Icon -->
|
||||
<ion-icon name="person-outline"
|
||||
[ngClass]="{'wechseltext': displayMitarbeiterTexts[aviso.lkW_Nr] === 'BITTE KOMMEN / LÜTFEN GELIN'}">
|
||||
|
||||
[ngClass]="{'wechseltext': toggleWechselText && aviso.lkW_fertig && !aviso.avisoTVHinweis}">
|
||||
</ion-icon>
|
||||
{{ displayMitarbeiterTexts[aviso.lkW_Nr] || aviso.letzterMitarbeiter }}
|
||||
|
||||
<!-- Wenn LKW fertig und KEIN Hinweis => Text wechseln -->
|
||||
<ng-container *ngIf="aviso.lkW_fertig && !aviso.avisoTVHinweis; else noToggleText">
|
||||
{{
|
||||
toggleWechselText
|
||||
? 'BITTE KOMMEN / LÜTFEN GELIN'
|
||||
: (aviso.letzterMitarbeiter || 'Mitarbeiter nicht verfügbar')
|
||||
}}
|
||||
</ng-container>
|
||||
|
||||
<!-- Fallback: normaler Mitarbeiter-Text -->
|
||||
<ng-template #noToggleText>
|
||||
{{ aviso.letzterMitarbeiter }}
|
||||
</ng-template>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Hinweis-Bildchen (Passport, Problem etc.) -->
|
||||
<div *ngIf="aviso.avisoTVHinweis"
|
||||
[ngClass]="getImageClassButtomLeft(aviso.avisoTVHinweis)"
|
||||
class="blinking-image bottom-left-image-problem">
|
||||
<img [src]="getTvHinweisImgSrc(aviso.avisoTVHinweis)" alt="Aviso Hinweis" />
|
||||
</div>
|
||||
|
||||
<!-- LKW fertig + kein Hinweis => OK-Badge -->
|
||||
<div *ngIf="aviso.lkW_fertig && aviso.avisoTVHinweis == '' " class="bottom-left-image-round">
|
||||
<img [src]="'assets/warnings/okRound.png'" alt="Aviso Hinweis" />
|
||||
<img src="assets/warnings/okRound.png" alt="Fertig / OK" />
|
||||
</div>
|
||||
|
||||
<!-- Zusätzliche IM/EX-Icons (Standort 'WAI') -->
|
||||
<div *ngIf="standort === 'WAI'">
|
||||
<div class="bottom-right-icon-im" *ngIf="aviso.imEx === 'IMPORT'">
|
||||
<img src="assets/icon/import_icon.png" style="width: 0.7em; aspect-ratio: 10 / 12" /> </div>
|
||||
<img src="assets/icon/import_icon.png"
|
||||
style="width: 0.7em; aspect-ratio: 10 / 12" />
|
||||
</div>
|
||||
<div class="bottom-right-icon-ex" *ngIf="aviso.imEx === 'EXPORT'">
|
||||
<img src="assets/icon/import_icon.png" style="width: 0.7em; aspect-ratio: 10 / 12" /> </div>
|
||||
<img src="assets/icon/import_icon.png"
|
||||
style="width: 0.7em; aspect-ratio: 10 / 12" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
|
||||
<!-- ======================================================
|
||||
ELSE: Hinweis-Anzeige
|
||||
====================================================== -->
|
||||
<ng-template #showAvisoHinweis>
|
||||
<div class="flex-container-hinweis">
|
||||
<div class="lkwnr" style="margin-top: 1%; margin-bottom: 1%"
|
||||
@@ -110,6 +138,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- IM/EX-Icons bei Hinweisen (nur Standort 'WAI') -->
|
||||
<div *ngIf="standort === 'WAI'">
|
||||
<div class="bottom-right-icon" *ngIf="aviso.imEx === 'IMPORT'">
|
||||
<ion-icon name="download-outline"></ion-icon>
|
||||
@@ -120,12 +149,10 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
</ion-card>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================================================
|
||||
Nachricht bei fehlenden Arrivals
|
||||
Keine Ankünfte
|
||||
====================================================== -->
|
||||
<ion-grid>
|
||||
<ion-row *ngIf="!loadingArrivals && arrivals.length === 0 && !errorMessage">
|
||||
@@ -136,18 +163,15 @@
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
<!-- Bedingtes Textfeld für TV-Einstellungen -->
|
||||
|
||||
</ion-content>
|
||||
|
||||
<!-- ======================================================
|
||||
Logobar mit Progress Bar
|
||||
====================================================== -->
|
||||
|
||||
<ion-progress-bar [value]="progressBarValue"
|
||||
class="custom-progress-bar"
|
||||
buffer="1"></ion-progress-bar>
|
||||
buffer="1">
|
||||
</ion-progress-bar>
|
||||
<ion-toolbar class="logobar">
|
||||
|
||||
<!-- Start Slot -->
|
||||
@@ -160,25 +184,26 @@
|
||||
<div class="logo-and-icons">
|
||||
<img [src]="'assets/Logos/' + avisoTvSettings[0].logo" class="logo" />
|
||||
|
||||
<!-- Bedingtes Div für WAI Standort -->
|
||||
<!-- Legende für WAI (Import / Export) -->
|
||||
<div *ngIf="standort === 'WAI'" class="title legendecontainer">
|
||||
<div class="div-import">
|
||||
<img src="assets/icon/import_icon.png" style="width: 0.8em; aspect-ratio: 10 / 12" /> = IMPORT
|
||||
</div>
|
||||
<div class="div-export">
|
||||
<img src="assets/icon/export_icon_1.png" style="width: 0.8em; aspect-ratio: 10 / 12" /> = EXPORT
|
||||
</div>
|
||||
<img src="assets/icon/import_icon.png"
|
||||
style="width: 0.8em; aspect-ratio: 10 / 12" /> = IMPORT
|
||||
</div>
|
||||
<div class="div-export">
|
||||
<img src="assets/icon/export_icon_1.png"
|
||||
style="width: 0.8em; aspect-ratio: 10 / 12" /> = EXPORT
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- End Slot -->
|
||||
<span slot="end" class="title" style="margin-right:0.3%">
|
||||
({{ totalArrivals }}) <br /> {{ currentPageIndex + 1 }} / {{ pages.length }}
|
||||
({{ totalArrivals }}) <br />
|
||||
{{ currentPageIndex + 1 }} / {{ pages.length }}
|
||||
</span>
|
||||
|
||||
</ion-toolbar>
|
||||
|
||||
|
||||
<!-- ======================================================
|
||||
Footer mit Tabs
|
||||
====================================================== -->
|
||||
|
||||
@@ -40,7 +40,8 @@ const TVTEXTSETTINGS_INTERVAL_MS = 60000;
|
||||
const TVSETTINGS_INTERVAL_MS = 10000;
|
||||
const TOGGLE_DIV_INTERVAL_MS = 5000;
|
||||
|
||||
const WECHSELTEXT = "BITTE KOMMEN / LÜTFEN GELIN"
|
||||
//Wechseltext
|
||||
const WECHSELTEXT = "BITTE KOMMEN / LÜTFEN GELIN";
|
||||
|
||||
interface StatusInfo {
|
||||
class: string;
|
||||
@@ -87,6 +88,8 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
currentDate: Date = new Date();
|
||||
private dateSubscription: Subscription = new Subscription();
|
||||
|
||||
private durationSubscription: Subscription = new Subscription();
|
||||
|
||||
standort = '';
|
||||
standortID = 0;
|
||||
seiten = true;
|
||||
@@ -114,20 +117,23 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
private toggleDivInterval: any;
|
||||
private currentCssVariables: CssVariables | null = null;
|
||||
|
||||
settingDisplayData: SettingDisplayData[] = [];
|
||||
|
||||
avisoTimeouts: { [key: string]: any } = {};
|
||||
avisoStates: { [key: string]: boolean } = {};
|
||||
|
||||
displayMitarbeiterTexts: { [key: string]: string } = {};
|
||||
avisoOriginalLetzterMitarbeiter: { [key: string]: string } = {};
|
||||
avisoMitarbeiterIntervals: { [key: string]: any } = {};
|
||||
private MITARBEITER_INTERVAL_MS = 3000;
|
||||
// NEU: Für den globalen Wechseltext
|
||||
public toggleWechselText: boolean = false;
|
||||
private GLOBAL_WECHSELTEXT_INTERVAL: any;
|
||||
|
||||
// Zeiten für Hint-/Normal-Anzeige
|
||||
contentDuration = 3000;
|
||||
avisoHinweisDuration = 1500;
|
||||
|
||||
pendingArrivals: AvisoDto[] | null = null;
|
||||
// Anzeigedaten für die Fixe-Zeilen im oberen Bereich
|
||||
settingDisplayData: SettingDisplayData[] = [];
|
||||
|
||||
// Zustände für AVISOs (z.B. ob normaler Inhalt vs. Warnhinweis gezeigt wird)
|
||||
avisoTimeouts: { [key: string]: any } = {};
|
||||
avisoStates: { [key: string]: boolean } = {};
|
||||
|
||||
// Falls neue Arrivals schon geladen, aber noch nicht aktiv
|
||||
pendingArrivals: AvisoDto[] | null = null;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
@@ -148,11 +154,6 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.currentDate = new Date();
|
||||
this.dateSubscription = interval(1000).subscribe(() => {
|
||||
this.currentDate = new Date();
|
||||
});
|
||||
|
||||
this.route.paramMap.subscribe(params => {
|
||||
this.standort = params.get('standort') || '';
|
||||
});
|
||||
@@ -163,42 +164,28 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
this.onlyOK = queryParams.get('onlyOK') === 'true';
|
||||
});
|
||||
|
||||
this.route.data.pipe(takeUntil(this.destroy$)).subscribe((resolvedData) => {
|
||||
const data = (resolvedData as any)['avisoData'] as AvisoResolvedData;
|
||||
this.route.data
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.subscribe((resolvedData) => {
|
||||
const data = (resolvedData as any)['avisoData'] as AvisoResolvedData;
|
||||
this.avisoTvTextSettings = data.avisoTvTextSettings;
|
||||
this.avisoTvSettings = data.avisoTvSettings;
|
||||
this.arrivals = data.arrivals.avisos;
|
||||
this.totalArrivals = data.arrivals.totalCount;
|
||||
this.standortID = data.standortID;
|
||||
|
||||
this.avisoTvTextSettings = data.avisoTvTextSettings;
|
||||
this.avisoTvSettings = data.avisoTvSettings;
|
||||
this.arrivals = data.arrivals.avisos;
|
||||
console.log(this.arrivals);
|
||||
this.totalArrivals = data.arrivals.totalCount;
|
||||
this.standortID = data.standortID;
|
||||
|
||||
this.arrivals.forEach(aviso => {
|
||||
if (aviso.lkW_fertig && aviso.avisoTVHinweis === "") {
|
||||
this.displayMitarbeiterTexts[aviso.lkW_Nr] = WECHSELTEXT;
|
||||
}
|
||||
this.paginateArrivals();
|
||||
this.cdr.detectChanges();
|
||||
this.preprocessHtmlSettings();
|
||||
this.setCSSVariables();
|
||||
this.startDivToggle();
|
||||
this.paginateArrivals();
|
||||
this.startPageRotation();
|
||||
this.updateAvisoStatesAndCycles();
|
||||
});
|
||||
|
||||
|
||||
/* this.arrivals.forEach(aviso => {
|
||||
if (aviso.lkW_Nr === '81ACY359') {
|
||||
aviso.avisoTVHinweis = 'URGENT';
|
||||
}
|
||||
});
|
||||
*/
|
||||
this.paginateArrivals();
|
||||
this.cdr.detectChanges();
|
||||
|
||||
this.preprocessHtmlSettings();
|
||||
this.setCSSVariables();
|
||||
this.startDivToggle();
|
||||
this.paginateArrivals();
|
||||
this.startPageRotation();
|
||||
this.updateAvisoStatesAndCycles();
|
||||
});
|
||||
|
||||
const ARRIVALS_INTERVAL_MS = (this.avisoTvSettings[0].seitenwechselInSek * 1000 / 2);
|
||||
|
||||
// Arrivals zyklisch neu laden
|
||||
const ARRIVALS_INTERVAL_MS = (this.avisoTvSettings[0]?.seitenwechselInSek * 1000 / 2) || 5000;
|
||||
interval(ARRIVALS_INTERVAL_MS)
|
||||
.pipe(
|
||||
switchMap(() => {
|
||||
@@ -217,35 +204,21 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
)
|
||||
.subscribe((data: AvisoArrivalsResponse) => {
|
||||
this.loadingArrivals = false;
|
||||
/* this.arrivals.forEach(aviso => {
|
||||
if (aviso.lkW_Nr === '81ACY359') {
|
||||
aviso.avisoTVHinweis = 'URGENT';
|
||||
}
|
||||
});*/
|
||||
|
||||
if (this.pages.length > 1) {
|
||||
// Bei mehreren Seiten erst mit dem nächsten Seitenwechsel übernehmen
|
||||
this.pendingArrivals = data.avisos;
|
||||
this.totalArrivals = data.totalCount;
|
||||
} else {
|
||||
// Bei nur einer Seite direkt übernehmen
|
||||
this.arrivals = data.avisos;
|
||||
this.totalArrivals = data.totalCount;
|
||||
this.paginateArrivals();
|
||||
this.cdr.detectChanges();
|
||||
|
||||
this.arrivals.forEach(aviso => {
|
||||
if (aviso.lkW_fertig && aviso.avisoTVHinweis === "") {
|
||||
if (!this.displayMitarbeiterTexts[aviso.lkW_Nr]) {
|
||||
this.displayMitarbeiterTexts[aviso.lkW_Nr] = WECHSELTEXT;
|
||||
}
|
||||
} else {
|
||||
if (this.displayMitarbeiterTexts[aviso.lkW_Nr]) {
|
||||
delete this.displayMitarbeiterTexts[aviso.lkW_Nr];
|
||||
}
|
||||
}
|
||||
});
|
||||
this.updateAvisoStatesAndCycles();
|
||||
}
|
||||
});
|
||||
|
||||
// TV Settings laden
|
||||
interval(TVSETTINGS_INTERVAL_MS)
|
||||
.pipe(
|
||||
switchMap(() => this.loadAvisoTvSettings()),
|
||||
@@ -253,12 +226,31 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
// TV Text Settings laden
|
||||
interval(TVTEXTSETTINGS_INTERVAL_MS)
|
||||
.pipe(
|
||||
switchMap(() => this.loadAvisoTvTextSettings()),
|
||||
takeUntil(this.destroy$)
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
// Sekündliche Uhrzeit
|
||||
this.currentDate = new Date();
|
||||
this.dateSubscription = interval(1000).subscribe(() => {
|
||||
this.currentDate = new Date();
|
||||
});
|
||||
|
||||
// Dauerberechnung aller Arrivals
|
||||
this.updateDurations();
|
||||
this.durationSubscription = interval(60000).subscribe(() => {
|
||||
this.updateDurations();
|
||||
});
|
||||
|
||||
// Globaler Wechseltext für alle fertigen LKWs ohne Hinweis
|
||||
this.GLOBAL_WECHSELTEXT_INTERVAL = setInterval(() => {
|
||||
this.toggleWechselText = !this.toggleWechselText;
|
||||
this.cdr.detectChanges();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
@@ -268,30 +260,61 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
|
||||
Object.values(this.avisoMitarbeiterIntervals).forEach(intervalId => clearInterval(intervalId));
|
||||
this.avisoMitarbeiterIntervals = {};
|
||||
|
||||
// Zeitgeber aufräumen
|
||||
Object.values(this.avisoTimeouts).forEach(timeoutId => clearTimeout(timeoutId));
|
||||
this.avisoTimeouts = {};
|
||||
|
||||
if (this.toggleDivInterval) {
|
||||
clearInterval(this.toggleDivInterval);
|
||||
}
|
||||
|
||||
if (this.progressBarSubscription) {
|
||||
this.progressBarSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
if (this.dateSubscription) {
|
||||
this.dateSubscription.unsubscribe();
|
||||
}
|
||||
if (this.durationSubscription) {
|
||||
this.durationSubscription.unsubscribe();
|
||||
}
|
||||
if (this.GLOBAL_WECHSELTEXT_INTERVAL) {
|
||||
clearInterval(this.GLOBAL_WECHSELTEXT_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
// Dauer (h/m) berechnen
|
||||
private updateDurations(): void {
|
||||
const currentYear = new Date().getFullYear();
|
||||
const currentDate = new Date();
|
||||
this.arrivals.forEach(aviso => {
|
||||
if (aviso.ankunft) {
|
||||
const [tagMonat, uhrzeit] = aviso.ankunft.split(' ');
|
||||
const [tag, monat] = tagMonat.split('.');
|
||||
const [stunden, minuten] = uhrzeit.split(':');
|
||||
const arrivalDate = new Date(
|
||||
currentYear,
|
||||
parseInt(monat) - 1,
|
||||
parseInt(tag),
|
||||
parseInt(stunden),
|
||||
parseInt(minuten)
|
||||
);
|
||||
const diffMs = currentDate.getTime() - arrivalDate.getTime();
|
||||
if (diffMs >= 0) {
|
||||
const diffMinutes = Math.floor(diffMs / 60000);
|
||||
const hours = Math.floor(diffMinutes / 60);
|
||||
const mins = diffMinutes % 60;
|
||||
aviso.dauer = `${hours}h ${mins}m`;
|
||||
} else {
|
||||
aviso.dauer = '0h 0m';
|
||||
}
|
||||
}
|
||||
});
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
|
||||
private startProgressBar(seitenwechselInSek: number): void {
|
||||
if (this.progressBarSubscription) {
|
||||
this.progressBarSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
this.progressBarValue = 0;
|
||||
const progressBarIntervalMs = 100;
|
||||
const totalSteps = Math.floor((seitenwechselInSek * 1000) / progressBarIntervalMs);
|
||||
@@ -356,7 +379,6 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
if (fontSize) {
|
||||
const fontSizePx = this.convertToPx(fontSize);
|
||||
textAlign = div.style.textAlign || 'left';
|
||||
|
||||
div.dataset['originalFontSizePx'] = fontSizePx.toString();
|
||||
div.dataset['originalTextAlign'] = textAlign;
|
||||
}
|
||||
@@ -389,7 +411,6 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
this.reloadPageOnce();
|
||||
return;
|
||||
}
|
||||
|
||||
Object.assign(this, newCssVariables);
|
||||
this.currentCssVariables = newCssVariables;
|
||||
} else {
|
||||
@@ -404,7 +425,7 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
private async loadAvisoTvSettings(): Promise<void> {
|
||||
this.loadingTvSettings = true;
|
||||
try {
|
||||
const data: TvSettings[] = await lastValueFrom(
|
||||
await lastValueFrom(
|
||||
this.avisoService.getAvisoTvSettings(this.standortID).pipe(
|
||||
tap((data: TvSettings[]) => {
|
||||
this.avisoTvSettings = data;
|
||||
@@ -422,7 +443,7 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
private async loadAvisoTvTextSettings(): Promise<void> {
|
||||
this.loadingTextSettings = true;
|
||||
try {
|
||||
const data: AvisoTvTextSettingsDto[] = await lastValueFrom(
|
||||
await lastValueFrom(
|
||||
this.avisoService.getAvisoTvTextSettings(this.standort).pipe(
|
||||
tap((data: AvisoTvTextSettingsDto[]) => {
|
||||
this.avisoTvTextSettings = data;
|
||||
@@ -448,7 +469,6 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
|
||||
private startDivToggle(): void {
|
||||
const shouldToggle = this.settingDisplayData.some(data => data.nonEmptyFixeZeilen.length > 1);
|
||||
|
||||
if (shouldToggle) {
|
||||
this.toggleDivInterval = setInterval(() => {
|
||||
this.settingDisplayData.forEach((data, index) => {
|
||||
@@ -468,7 +488,7 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
}
|
||||
|
||||
getStatusClass(status: number, lkwFertig: boolean, avisoTvhinweis: string): string {
|
||||
if (lkwFertig && avisoTvhinweis == "") {
|
||||
if (lkwFertig && avisoTvhinweis === "") {
|
||||
return STATUS_MAP['lkwfertig'].class;
|
||||
} else if (avisoTvhinweis != "") {
|
||||
return STATUS_MAP['fehlt'].class;
|
||||
@@ -487,9 +507,11 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
return "assets/warnings/passport.png";
|
||||
}
|
||||
else if (avisotvhinweis.toLowerCase() == "problem") {
|
||||
return "assets/warnings/urgent.png"
|
||||
return "assets/warnings/urgent.png";
|
||||
}
|
||||
else {
|
||||
return "assets/warnings/urgent.png";
|
||||
}
|
||||
else { return "assets/warnings/urgent.png" }
|
||||
}
|
||||
|
||||
getStatusColor(status: number): string {
|
||||
@@ -513,7 +535,6 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
if (!this.avisoTvSettings || this.avisoTvSettings.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const settings = this.avisoTvSettings[0];
|
||||
const windowWidth = window.innerWidth;
|
||||
const windowHeight = window.innerHeight;
|
||||
@@ -524,6 +545,7 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
};
|
||||
|
||||
if (isMobileDevice()) {
|
||||
// Keine Mehrseiten-Darstellung bei kleinen Geräten
|
||||
this.pages = [this.arrivals];
|
||||
this.tilesPerPage = this.arrivals.length;
|
||||
this.currentPageIndex = 0;
|
||||
@@ -548,10 +570,12 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
const containerPadding = (0 / 100) * windowHeight;
|
||||
const containerPaddingTotal = containerPadding * 2;
|
||||
|
||||
// Anzahl Spalten
|
||||
const columns = Math.floor(
|
||||
(windowWidth - containerPaddingTotal + gutterHorizontal) / (tileWidth + gutterHorizontal)
|
||||
) || 1;
|
||||
|
||||
// Platz für Zeilen berechnen
|
||||
const availableHeightForTiles =
|
||||
windowHeight -
|
||||
logo -
|
||||
@@ -574,20 +598,18 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
if (this.currentPageIndex >= this.pages.length) {
|
||||
this.currentPageIndex = 0;
|
||||
}
|
||||
this.updateAvisoStatesAndCycles();
|
||||
}
|
||||
|
||||
// *** NEU *** Anpassung im startPageRotation(), um pendingArrivals einzuspielen
|
||||
private startPageRotation(): void {
|
||||
if (!this.avisoTvSettings || this.avisoTvSettings.length === 0) {
|
||||
console.warn('avisoTvSettings ist nicht verfügbar oder leer');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.pages.length <= 1) {
|
||||
console.info('Nur eine Seite vorhanden. Automatischer Seitenwechsel wird nicht gestartet.');
|
||||
// Nur eine Seite
|
||||
return;
|
||||
}
|
||||
|
||||
const seitenwechselInSek = this.avisoTvSettings[0].seitenwechselInSek;
|
||||
if (typeof seitenwechselInSek === 'number' && seitenwechselInSek > 0) {
|
||||
const intervalMs = seitenwechselInSek * 1000;
|
||||
@@ -596,25 +618,11 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
interval(intervalMs)
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.subscribe(() => {
|
||||
// *** NEU *** Hier prüfen wir, ob pendingArrivals vorliegen
|
||||
// Neue Arrivals erst beim Seitenwechsel übernehmen
|
||||
if (this.pendingArrivals) {
|
||||
this.arrivals = this.pendingArrivals;
|
||||
this.pendingArrivals = null;
|
||||
this.paginateArrivals();
|
||||
|
||||
// Aktualisierung der Mitarbeitertexte
|
||||
this.arrivals.forEach(aviso => {
|
||||
if (aviso.lkW_fertig && aviso.avisoTVHinweis === "") {
|
||||
if (!this.displayMitarbeiterTexts[aviso.lkW_Nr]) {
|
||||
this.displayMitarbeiterTexts[aviso.lkW_Nr] = WECHSELTEXT;
|
||||
}
|
||||
} else {
|
||||
if (this.displayMitarbeiterTexts[aviso.lkW_Nr]) {
|
||||
delete this.displayMitarbeiterTexts[aviso.lkW_Nr];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
|
||||
@@ -638,165 +646,53 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
|
||||
private arrivalsAreEqual(a: AvisoDto[], b: AvisoDto[]): boolean {
|
||||
if (a.length !== b.length) {
|
||||
console.log(`Array-Längen sind unterschiedlich: a.length = ${a.length}, b.length = ${b.length}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < a.length; i++) {
|
||||
const aItem = a[i];
|
||||
const bItem = b[i];
|
||||
|
||||
if (aItem.avisoID !== bItem.avisoID) {
|
||||
console.log(`Unterschied bei avisoID an Index ${i}: a.avisoID = ${aItem.avisoID}, b.avisoID = ${bItem.avisoID}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aItem.status !== bItem.status) {
|
||||
console.log(`Unterschied bei status an Index ${i}: a.status = ${aItem.status}, b.status = ${bItem.status}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aItem.lkW_Nr !== bItem.lkW_Nr) {
|
||||
console.log(`Unterschied bei lkW_Nr an Index ${i}: a.lkW_Nr = ${aItem.lkW_Nr}, b.lkW_Nr = ${bItem.lkW_Nr}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aItem.ankunft !== bItem.ankunft) {
|
||||
console.log(`Unterschied bei ankunft an Index ${i}: a.ankunft = ${aItem.ankunft}, b.ankunft = ${bItem.ankunft}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aItem.dauer !== bItem.dauer) {
|
||||
console.log(`Unterschied bei dauer an Index ${i}: a.dauer = ${aItem.dauer}, b.dauer = ${bItem.dauer}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aItem.letzterMitarbeiter !== bItem.letzterMitarbeiter) {
|
||||
console.log(`Unterschied bei letzterMitarbeiter an Index ${i}: a.letzterMitarbeiter = ${aItem.letzterMitarbeiter}, b.letzterMitarbeiter = ${bItem.letzterMitarbeiter}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aItem.weiterleitungTextTV !== bItem.weiterleitungTextTV) {
|
||||
console.log(`Unterschied bei weiterleitungTextTV an Index ${i}: a.weiterleitungTextTV = ${aItem.weiterleitungTextTV}, b.weiterleitungTextTV = ${bItem.weiterleitungTextTV}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aItem.imEx !== bItem.imEx) {
|
||||
console.log(`Unterschied bei imEx an Index ${i}: a.imEx = ${aItem.imEx}, b.imEx = ${bItem.imEx}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aItem.zollDigitalEingereicht !== bItem.zollDigitalEingereicht) {
|
||||
console.log(`Unterschied bei zollDigitalEingereicht an Index ${i}: a.zollDigitalEingereicht = ${aItem.zollDigitalEingereicht}, b.zollDigitalEingereicht = ${bItem.zollDigitalEingereicht}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aItem.buero !== bItem.buero) {
|
||||
console.log(`Unterschied bei buero an Index ${i}: a.buero = ${aItem.buero}, b.buero = ${bItem.buero}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aItem.avisoTVHinweis !== bItem.avisoTVHinweis) {
|
||||
console.log(`Unterschied bei avisoTVHinweis an Index ${i}: a.avisoTVHinweis = ${aItem.avisoTVHinweis}, b.avisoTVHinweis = ${bItem.avisoTVHinweis}`);
|
||||
if (
|
||||
aItem.avisoID !== bItem.avisoID ||
|
||||
aItem.status !== bItem.status ||
|
||||
aItem.lkW_Nr !== bItem.lkW_Nr ||
|
||||
aItem.ankunft !== bItem.ankunft ||
|
||||
aItem.letzterMitarbeiter !== bItem.letzterMitarbeiter ||
|
||||
aItem.imEx !== bItem.imEx ||
|
||||
aItem.buero !== bItem.buero ||
|
||||
aItem.avisoTVHinweis !== bItem.avisoTVHinweis
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Die beiden Arrays sind gleich.');
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private updateAvisoStatesAndCycles(): void {
|
||||
const currentKeys = new Set<string>();
|
||||
|
||||
this.arrivals.forEach(aviso => {
|
||||
const key = aviso.lkW_Nr;
|
||||
currentKeys.add(key);
|
||||
|
||||
this.handleAvisoTVHinweis(aviso, key);
|
||||
this.handleLkwFertigAndTextToggle(aviso, key);
|
||||
if (aviso.avisoTVHinweis) {
|
||||
// Hat das Aviso einen Hinweis, dann abwechseln
|
||||
if (!(key in this.avisoStates)) {
|
||||
this.avisoStates[key] = true;
|
||||
this.startAvisoCycle(key);
|
||||
}
|
||||
} else {
|
||||
// Kein Hinweis => immer normal
|
||||
this.avisoStates[key] = true;
|
||||
}
|
||||
});
|
||||
|
||||
this.cleanupObsoleteEntries(currentKeys);
|
||||
}
|
||||
|
||||
private handleAvisoTVHinweis(aviso: AvisoDto, key: string): void {
|
||||
if (aviso.avisoTVHinweis) {
|
||||
if (!(key in this.avisoStates)) {
|
||||
this.avisoStates[key] = true;
|
||||
this.startAvisoCycle(key);
|
||||
console.log(`Started aviso cycle for key: ${key}`);
|
||||
}
|
||||
} else {
|
||||
this.avisoStates[key] = true;
|
||||
}
|
||||
}
|
||||
|
||||
private handleLkwFertigAndTextToggle(aviso: AvisoDto, key: string): void {
|
||||
if (aviso.lkW_fertig && aviso.avisoTVHinweis === "") {
|
||||
if (!this.displayMitarbeiterTexts[key]) {
|
||||
this.displayMitarbeiterTexts[key] = WECHSELTEXT;
|
||||
console.log(`Initialized displayMitarbeiterTexts for key: ${key}`);
|
||||
}
|
||||
|
||||
if (!this.avisoMitarbeiterIntervals[key]) {
|
||||
this.avisoMitarbeiterIntervals[key] = setInterval(() => {
|
||||
this.toggleMitarbeiterText(aviso, key);
|
||||
}, this.MITARBEITER_INTERVAL_MS);
|
||||
console.log(`Started text toggle interval for key: ${key}`);
|
||||
}
|
||||
} else {
|
||||
this.clearMitarbeiterTextToggle(key);
|
||||
}
|
||||
}
|
||||
|
||||
private toggleMitarbeiterText(aviso: AvisoDto, key: string): void {
|
||||
if (this.displayMitarbeiterTexts[key] === WECHSELTEXT) {
|
||||
this.displayMitarbeiterTexts[key] = aviso.letzterMitarbeiter || 'Mitarbeiter nicht verfügbar';
|
||||
} else {
|
||||
this.displayMitarbeiterTexts[key] = WECHSELTEXT;
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
|
||||
private cleanupObsoleteEntries(currentKeys: Set<string>): void {
|
||||
// Alte Keys entfernen
|
||||
Object.keys(this.avisoStates).forEach(key => {
|
||||
if (!currentKeys.has(key)) {
|
||||
clearTimeout(this.avisoTimeouts[key]);
|
||||
delete this.avisoStates[key];
|
||||
delete this.avisoTimeouts[key];
|
||||
console.log(`Cleaned up avisoStates and timeouts for key: ${key}`);
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(this.avisoMitarbeiterIntervals).forEach(key => {
|
||||
if (!currentKeys.has(key)) {
|
||||
clearInterval(this.avisoMitarbeiterIntervals[key]);
|
||||
delete this.avisoMitarbeiterIntervals[key];
|
||||
console.log(`Cleaned up Mitarbeiter-Interval for key: ${key}`);
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(this.displayMitarbeiterTexts).forEach(key => {
|
||||
if (!currentKeys.has(key)) {
|
||||
delete this.displayMitarbeiterTexts[key];
|
||||
console.log(`Cleaned up displayMitarbeiterTexts for key: ${key}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private clearMitarbeiterTextToggle(key: string): void {
|
||||
if (this.avisoMitarbeiterIntervals[key]) {
|
||||
clearInterval(this.avisoMitarbeiterIntervals[key]);
|
||||
delete this.avisoMitarbeiterIntervals[key];
|
||||
console.log(`Cleared text toggle interval for key: ${key}`);
|
||||
}
|
||||
|
||||
if (this.displayMitarbeiterTexts[key]) {
|
||||
delete this.displayMitarbeiterTexts[key];
|
||||
console.log(`Cleared displayMitarbeiterTexts for key: ${key}`);
|
||||
}
|
||||
}
|
||||
|
||||
private startAvisoCycle(key: string): void {
|
||||
@@ -804,7 +700,7 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
if (!aviso || !aviso.avisoTVHinweis) {
|
||||
return;
|
||||
}
|
||||
|
||||
// "true" => normaler Inhalt, "false" => Hinweis
|
||||
if (this.avisoStates[key]) {
|
||||
this.avisoTimeouts[key] = setTimeout(() => {
|
||||
this.avisoStates[key] = false;
|
||||
@@ -831,6 +727,8 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Falls kein Hinweis: immer "normalen" Content,
|
||||
// sonst Umschalten zwischen normal und Hinweis
|
||||
shouldShowNormalContent(aviso: AvisoDto): boolean {
|
||||
if (!aviso.avisoTVHinweis) {
|
||||
return true;
|
||||
|
||||
@@ -100,4 +100,5 @@ export class AvisoService {
|
||||
catchError(this.handleError)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user