Fixed Button text
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "WorkTime",
|
"name": "WorkTime",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"author": "Ionic Framework",
|
"author": "Ionic Framework",
|
||||||
"homepage": "https://ionicframework.com/",
|
"homepage": "https://ionicframework.com/",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div class="button-container" *ngIf="isToday()">
|
<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-button shape="round" class="icon-button" (click)="openModal()">
|
||||||
<ion-icon slot="icon-only" name="add"></ion-icon>
|
<ion-icon slot="icon-only" name="add"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
|
|||||||
@@ -123,7 +123,43 @@ export class TimePage {
|
|||||||
if (today.length == 0) {
|
if (today.length == 0) {
|
||||||
this.currentAction = 'login';
|
this.currentAction = 'login';
|
||||||
}else {
|
}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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user