Made TimeType selector in modal respond to last entry

This commit is contained in:
2024-09-03 18:14:21 +02:00
parent f712291bdd
commit 0e98d1e711
3 changed files with 6 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "WorkTime",
"version": "0.0.1",
"version": "1.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
@@ -62,4 +62,4 @@
"typescript": "~5.4.0"
},
"description": "An Ionic project"
}
}

View File

@@ -67,7 +67,7 @@
</ion-modal>
</ion-item>
<ion-item>
<ion-select label="Stempeltyp" value="login" cancel-text="Abbrechen" [(ngModel)]="modalMode">
<ion-select label="Stempeltyp" value="login" cancel-text="Abbrechen" [(ngModel)]="currentAction">
<ion-select-option value="login">Einstempeln</ion-select-option>
<ion-select-option value="logout">Ausstempeln</ion-select-option>
<ion-select-option value="start-drive">Dienstreise starten</ion-select-option>

View File

@@ -30,7 +30,6 @@ export class TimePage {
@ViewChild('createModal') modal: IonModal | undefined;
public modalDate: any;
public modalMode: TimeType = 'login';
public currentDate: any;
constructor() {
@@ -127,7 +126,7 @@ export class TimePage {
this.data.push({
registeredAt: date,
type: this.modalMode
type: this.currentAction
});
this.data.sort((a: TimeEntry, b: TimeEntry) => {
return a.registeredAt.getTime() - b.registeredAt.getTime();
@@ -138,8 +137,10 @@ export class TimePage {
this.shouldAnimate.push(false);
}
this.updateCurrentAction();
this.saveData();
this.modal?.dismiss(null, 'submit');
this.modalDate = undefined;
}
public isToday(): boolean {