diff --git a/package.json b/package.json index 341a816..392cfa1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "WorkTime", - "version": "0.3.4", + "version": "0.3.5", "author": "Ionic Framework", "homepage": "https://ionicframework.com/", "scripts": { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index f972550..fc98444 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -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(); } diff --git a/src/app/time/time.page.html b/src/app/time/time.page.html index 909dd5f..1dd2c9c 100644 --- a/src/app/time/time.page.html +++ b/src/app/time/time.page.html @@ -1,6 +1,6 @@ - + Zeiterfassung @@ -9,7 +9,7 @@ - Zeiterfassung + Zeiterfassung diff --git a/src/app/time/time.page.ts b/src/app/time/time.page.ts index fb36752..fa72811 100644 --- a/src/app/time/time.page.ts +++ b/src/app/time/time.page.ts @@ -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; }