Added hidden default break button

This commit is contained in:
2024-11-10 12:33:35 +01:00
parent dc567d24c3
commit 648a235b5b
4 changed files with 20 additions and 10 deletions

View File

@@ -28,8 +28,7 @@ export class AppComponent {
role: "cancel"
},
{
text: "Ja",
role: "destructive"
text: "Ja"
}
]
});
@@ -37,7 +36,7 @@ export class AppComponent {
await alert.present();
const result = await alert.onDidDismiss();
if (result.role == "destructive") {
if (result.role != "cancel") {
await this.updates.activateUpdate();
document.location.reload();
}

View File

@@ -1,6 +1,6 @@
<ion-header [translucent]="true">
<ion-toolbar>
<ion-title>
<ion-title (click)="addDefaultBreak()">
Zeiterfassung
</ion-title>
</ion-toolbar>
@@ -9,7 +9,7 @@
<ion-content [fullscreen]="true">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title size="large">Zeiterfassung</ion-title>
<ion-title size="large" (click)="addDefaultBreak()">Zeiterfassung</ion-title>
</ion-toolbar>
</ion-header>

View File

@@ -117,6 +117,9 @@ export class TimePage {
registeredAt: new Date(Date.now()),
type: this.currentAction
});
this.data.sort((a: TimeEntry, b: TimeEntry) => {
return a.registeredAt.getTime() - b.registeredAt.getTime();
});
this.saveData();
this.updateCurrentAction();
}
@@ -201,13 +204,18 @@ export class TimePage {
this.modal?.present();
}
public addModalEntry(): void {
public addModalEntry(hours?: number, minutes?: number, action?: TimeType): void {
const date = new Date(this.modalDate || Date.now());
date.setSeconds(0);
if (hours != undefined && minutes != undefined) {
date.setHours(hours);
date.setMinutes(minutes);
}
this.data.push({
registeredAt: date,
type: this.currentAction
type: action || this.currentAction
});
this.data.sort((a: TimeEntry, b: TimeEntry) => {
return a.registeredAt.getTime() - b.registeredAt.getTime();
@@ -224,9 +232,12 @@ export class TimePage {
this.modalDate = undefined;
}
public addDefaultBreak() {
this.addModalEntry(12, 0, 'logout');
this.addModalEntry(12, 30, 'login');
}
public isToday(): boolean {
return this.timeService.isToday(this.currentDate);
}
protected readonly open = open;
}