Fixed Button text

This commit is contained in:
2024-09-05 15:32:09 +02:00
parent 5de004d657
commit 821b22c168
3 changed files with 40 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "WorkTime",
"version": "0.1.1",
"version": "0.1.2",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {

View File

@@ -36,7 +36,7 @@
</section>
<div class="button-container" *ngIf="isToday()">
<ion-button (click)="addEntry()">{{currentAction === 'login' ? "Einstempeln" : "Ausstempeln"}}</ion-button>
<ion-button (click)="addEntry()">{{translateCurrentAction()}}</ion-button>
<ion-button shape="round" class="icon-button" (click)="openModal()">
<ion-icon slot="icon-only" name="add"></ion-icon>
</ion-button>

View File

@@ -75,7 +75,7 @@ export class TimePage {
public generateSeparatorText(entry1: TimeEntry, entry2: TimeEntry): string {
let text = entry1.type === 'login' ? "Arbeit " : "Pause ";
if (entry1.type === 'start-drive' && entry2.type === 'end-drive') {
text = "Dienstreise";
text = "Dienstreise ";
}
return text + `(${this.calculateTimespan(entry1.registeredAt, entry2.registeredAt)})`;
@@ -123,7 +123,43 @@ export class TimePage {
if (today.length == 0) {
this.currentAction = 'login';
}else {
this.currentAction = today[today.length - 1].type === 'login' ? 'logout' : 'login';
const lastAction = today[today.length - 1].type;
switch (lastAction) {
case "start-drive":
this.currentAction = 'end-drive';
break;
case "end-drive":
this.currentAction = 'login';
break;
case "login":
this.currentAction = 'logout';
break;
case "logout":
default:
this.currentAction = 'login';
break;
}
}
}
public translateCurrentAction(): string {
switch (this.currentAction) {
case "start-drive":
return "Dienstreise starten";
case "end-drive":
return "Dienstreise beenden";
case "login":
return "Einstempeln";
case "logout":
default:
return "Ausstempeln";
}
}