Eintragung von HomeOffice ist über die Oberfläche möglich
This commit is contained in:
@@ -34,6 +34,7 @@ export const actions = {
|
||||
const body_data = {
|
||||
workingDay: data.get('workingDay'),
|
||||
workingTime: data.get('workingTime'),
|
||||
isHomeOffice: data.get('isHomeOffice'),
|
||||
}
|
||||
await WorkingHoursRepository.update(env.API_URL, data.get('workingDay'), body_data);
|
||||
},
|
||||
@@ -42,6 +43,7 @@ export const actions = {
|
||||
const body_data = {
|
||||
workingDay: form_data.get('workingDay'),
|
||||
workingTime: form_data.get('workingTime'),
|
||||
isHomeOffice: form_data.get('isHomeOffice'),
|
||||
}
|
||||
await WorkingHoursRepository.add(env.API_URL, body_data);
|
||||
},
|
||||
@@ -56,13 +58,19 @@ export const actions = {
|
||||
actualDayObject.setDate(actualDayObject.getDate() + 1)
|
||||
})
|
||||
for (const pair of form_data.entries()) {
|
||||
const working_day = day_list[pair[0]] ?? null
|
||||
if (working_day === null) {
|
||||
let key = /(?<day>\w+)\[time]/.exec(pair[0])
|
||||
if (key === null) {
|
||||
continue
|
||||
}
|
||||
let day = key?.groups?.day ?? ''
|
||||
const working_day = day_list[day] ?? null
|
||||
if (working_day === null || pair[1] === '00:00:00' || pair[1] === '00:00') {
|
||||
continue
|
||||
}
|
||||
const body_data = {
|
||||
workingDay: working_day,
|
||||
workingTime: pair[1],
|
||||
isHomeOffice: form_data.has(day + '[isHomeOffice]')
|
||||
}
|
||||
await WorkingHoursRepository.addOrUpdate(env.API_URL, working_day, body_data);
|
||||
}
|
||||
@@ -70,10 +78,15 @@ export const actions = {
|
||||
'import-csv': async ({ request }) => {
|
||||
const form_data = await request.formData();
|
||||
for (const pair of form_data.entries()) {
|
||||
const working_day = pair[0]
|
||||
let key = /^(?<day>\d{4}-\d{2}-\d{2})\[time]$/.exec(pair[0])
|
||||
if (key === null) {
|
||||
continue
|
||||
}
|
||||
let working_day = key?.groups?.day ?? ''
|
||||
const body_data = {
|
||||
workingDay: working_day,
|
||||
workingTime: pair[1],
|
||||
isHomeOffice: form_data.has(working_day + '[isHomeOffice]')
|
||||
}
|
||||
await WorkingHoursRepository.addOrUpdate(env.API_URL, working_day, body_data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user