Added hidden default break button
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "WorkTime",
|
"name": "WorkTime",
|
||||||
"version": "0.3.4",
|
"version": "0.3.5",
|
||||||
"author": "Ionic Framework",
|
"author": "Ionic Framework",
|
||||||
"homepage": "https://ionicframework.com/",
|
"homepage": "https://ionicframework.com/",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ export class AppComponent {
|
|||||||
role: "cancel"
|
role: "cancel"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "Ja",
|
text: "Ja"
|
||||||
role: "destructive"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -37,7 +36,7 @@ export class AppComponent {
|
|||||||
await alert.present();
|
await alert.present();
|
||||||
const result = await alert.onDidDismiss();
|
const result = await alert.onDidDismiss();
|
||||||
|
|
||||||
if (result.role == "destructive") {
|
if (result.role != "cancel") {
|
||||||
await this.updates.activateUpdate();
|
await this.updates.activateUpdate();
|
||||||
document.location.reload();
|
document.location.reload();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<ion-header [translucent]="true">
|
<ion-header [translucent]="true">
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-title>
|
<ion-title (click)="addDefaultBreak()">
|
||||||
Zeiterfassung
|
Zeiterfassung
|
||||||
</ion-title>
|
</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<ion-content [fullscreen]="true">
|
<ion-content [fullscreen]="true">
|
||||||
<ion-header collapse="condense">
|
<ion-header collapse="condense">
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-title size="large">Zeiterfassung</ion-title>
|
<ion-title size="large" (click)="addDefaultBreak()">Zeiterfassung</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ export class TimePage {
|
|||||||
registeredAt: new Date(Date.now()),
|
registeredAt: new Date(Date.now()),
|
||||||
type: this.currentAction
|
type: this.currentAction
|
||||||
});
|
});
|
||||||
|
this.data.sort((a: TimeEntry, b: TimeEntry) => {
|
||||||
|
return a.registeredAt.getTime() - b.registeredAt.getTime();
|
||||||
|
});
|
||||||
this.saveData();
|
this.saveData();
|
||||||
this.updateCurrentAction();
|
this.updateCurrentAction();
|
||||||
}
|
}
|
||||||
@@ -201,13 +204,18 @@ export class TimePage {
|
|||||||
this.modal?.present();
|
this.modal?.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
public addModalEntry(): void {
|
public addModalEntry(hours?: number, minutes?: number, action?: TimeType): void {
|
||||||
const date = new Date(this.modalDate || Date.now());
|
const date = new Date(this.modalDate || Date.now());
|
||||||
date.setSeconds(0);
|
date.setSeconds(0);
|
||||||
|
|
||||||
|
if (hours != undefined && minutes != undefined) {
|
||||||
|
date.setHours(hours);
|
||||||
|
date.setMinutes(minutes);
|
||||||
|
}
|
||||||
|
|
||||||
this.data.push({
|
this.data.push({
|
||||||
registeredAt: date,
|
registeredAt: date,
|
||||||
type: this.currentAction
|
type: action || this.currentAction
|
||||||
});
|
});
|
||||||
this.data.sort((a: TimeEntry, b: TimeEntry) => {
|
this.data.sort((a: TimeEntry, b: TimeEntry) => {
|
||||||
return a.registeredAt.getTime() - b.registeredAt.getTime();
|
return a.registeredAt.getTime() - b.registeredAt.getTime();
|
||||||
@@ -224,9 +232,12 @@ export class TimePage {
|
|||||||
this.modalDate = undefined;
|
this.modalDate = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addDefaultBreak() {
|
||||||
|
this.addModalEntry(12, 0, 'logout');
|
||||||
|
this.addModalEntry(12, 30, 'login');
|
||||||
|
}
|
||||||
|
|
||||||
public isToday(): boolean {
|
public isToday(): boolean {
|
||||||
return this.timeService.isToday(this.currentDate);
|
return this.timeService.isToday(this.currentDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly open = open;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user