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 IconifyIcon from '@iconify/svelte'
|
||||||
import checkIcon from '@iconify-icons/oi/check'
|
import checkIcon from '@iconify-icons/oi/check'
|
||||||
import xIcon from '@iconify-icons/oi/x'
|
import xIcon from '@iconify-icons/oi/x'
|
||||||
|
import {TimekeepingDate} from "../../components/TimekeepingDate.svelte"
|
||||||
|
|
||||||
export let activeRecord = null
|
export let activeRecord = null
|
||||||
export let newRecord = false
|
export let newRecord = false
|
||||||
@@ -10,14 +11,19 @@
|
|||||||
'saveRecord': () => {
|
'saveRecord': () => {
|
||||||
if (newRecord === true) {
|
if (newRecord === true) {
|
||||||
WorkingHoursRepository.add(activeRecord).then(() => {
|
WorkingHoursRepository.add(activeRecord).then(() => {
|
||||||
Controller.cancelActiveRecord()
|
Controller.nextDay()
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
WorkingHoursRepository.update(activeRecord.workingDay, activeRecord).then(() => {
|
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': () => {
|
'cancelActiveRecord': () => {
|
||||||
activeRecord = null;
|
activeRecord = null;
|
||||||
newRecord = false;
|
newRecord = false;
|
||||||
@@ -39,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset name="buttons">
|
<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"/>
|
<IconifyIcon icon={checkIcon} color="green"/>
|
||||||
</button>
|
</button>
|
||||||
<button on:click={Controller.cancelActiveRecord} type="button" class="sub-button">Abbrechen
|
<button on:click={Controller.cancelActiveRecord} type="button" class="sub-button">Abbrechen
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import {WorkingHoursRepository} from "../../components/Repositories.svelte"
|
import {WorkingHoursRepository} from "../../components/Repositories.svelte"
|
||||||
|
import {TimekeepingDate} from "../../components/TimekeepingDate.svelte"
|
||||||
|
|
||||||
export let activeRecord = null
|
export let activeRecord = null
|
||||||
export let newRecord = false
|
export let newRecord = false
|
||||||
@@ -19,7 +20,8 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
'newRecord': () => {
|
'newRecord': () => {
|
||||||
activeRecord = {workingTime: '00:00:00'};
|
const actDate = new TimekeepingDate()
|
||||||
|
activeRecord = {workingTime: '00:00:00', workingDay: actDate.getDateString()}
|
||||||
newRecord = true;
|
newRecord = true;
|
||||||
},
|
},
|
||||||
'selectActiveRecord': record => WorkingHoursRepository.read(record.workingDay).then(data => {
|
'selectActiveRecord': record => WorkingHoursRepository.read(record.workingDay).then(data => {
|
||||||
|
|||||||
Reference in New Issue
Block a user