Feature: Schnellere Eingabe der Daten ist möglich
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<script context="module">
|
||||
export class TimekeepingDate extends Date {
|
||||
getDateString() {
|
||||
return this.getFullYear() + "-"
|
||||
+ (this.getMonth() + 1).toString().padStart(2, '0') + "-"
|
||||
+ this.getDate().toString().padStart(2, '0')
|
||||
}
|
||||
|
||||
getNextDay() {
|
||||
let nextDay = new TimekeepingDate(this);
|
||||
nextDay.setDate(this.getDate() + 1)
|
||||
return nextDay
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -3,6 +3,7 @@
|
||||
import IconifyIcon from '@iconify/svelte'
|
||||
import checkIcon from '@iconify-icons/oi/check'
|
||||
import xIcon from '@iconify-icons/oi/x'
|
||||
import {TimekeepingDate} from "../../components/TimekeepingDate.svelte"
|
||||
|
||||
export let activeRecord = null
|
||||
export let newRecord = false
|
||||
@@ -10,14 +11,19 @@
|
||||
'saveRecord': () => {
|
||||
if (newRecord === true) {
|
||||
WorkingHoursRepository.add(activeRecord).then(() => {
|
||||
Controller.cancelActiveRecord()
|
||||
Controller.nextDay()
|
||||
});
|
||||
} else {
|
||||
WorkingHoursRepository.update(activeRecord.workingDay, activeRecord).then(() => {
|
||||
Controller.cancelActiveRecord()
|
||||
Controller.nextDay()
|
||||
});
|
||||
}
|
||||
},
|
||||
'nextDay': () => {
|
||||
let actDate = new TimekeepingDate(activeRecord.workingDay)
|
||||
let nextDay = actDate.getNextDay()
|
||||
activeRecord = {workingTime: '00:00:00', workingDay: nextDay.getDateString()}
|
||||
},
|
||||
'cancelActiveRecord': () => {
|
||||
activeRecord = null;
|
||||
newRecord = false;
|
||||
@@ -39,7 +45,7 @@
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset name="buttons">
|
||||
<button on:click={Controller.saveRecord} type="button">Übernehmen
|
||||
<button on:click={Controller.saveRecord} type="button">Übernehmen und Weiter
|
||||
<IconifyIcon icon={checkIcon} color="green"/>
|
||||
</button>
|
||||
<button on:click={Controller.cancelActiveRecord} type="button" class="sub-button">Abbrechen
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import {WorkingHoursRepository} from "../../components/Repositories.svelte"
|
||||
import {TimekeepingDate} from "../../components/TimekeepingDate.svelte"
|
||||
|
||||
export let activeRecord = null
|
||||
export let newRecord = false
|
||||
@@ -19,7 +20,8 @@
|
||||
});
|
||||
},
|
||||
'newRecord': () => {
|
||||
activeRecord = {workingTime: '00:00:00'};
|
||||
const actDate = new TimekeepingDate()
|
||||
activeRecord = {workingTime: '00:00:00', workingDay: actDate.getDateString()}
|
||||
newRecord = true;
|
||||
},
|
||||
'selectActiveRecord': record => WorkingHoursRepository.read(record.workingDay).then(data => {
|
||||
|
||||
Reference in New Issue
Block a user