diff --git a/pages/profiles/show/[id].vue b/pages/profiles/show/[id].vue index 5862e93..66f5b45 100644 --- a/pages/profiles/show/[id].vue +++ b/pages/profiles/show/[id].vue @@ -19,14 +19,41 @@ const supabase = useSupabaseClient() const toast = useToast() const itemInfo = ref({ - weeklyRegularWorkingHours: {} + weeklyRegularWorkingHours: { + "1":0, + "2":0, + "3":0, + "4":0, + "5":0, + "6":0, + "7":0, + } }) const oldItemInfo = ref({}) const setupPage = async () => { + console.log(itemInfo.value) + if(route.params.id) { itemInfo.value = await useSupabaseSelectSingle("profiles",route.params.id,"*, documents(*), checks(*)") + + if(Object.keys(itemInfo.value.weeklyRegularWorkingHours).length === 0) { + itemInfo.value.weeklyRegularWorkingHours = { + "1":0, + "2":0, + "3":0, + "4":0, + "5":0, + "6":0, + "7":0, + } + } + + if(!itemInfo.value.weeklyWorkingHours) itemInfo.value.weeklyWorkingHours = 0 + if(!itemInfo.value.weeklyWorkingDays) itemInfo.value.weeklyWorkingDays = 0 + if(!itemInfo.value.annualPaidLeaveDays) itemInfo.value.annualPaidLeaveDays = 0 + } if(itemInfo.value.id) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value)) @@ -126,7 +153,6 @@ const saveProfile = async () => { >{{itemInfo ? `Mitarbeiter: ${itemInfo.fullName}` : ''}} - { @@ -389,6 +416,7 @@ const saveProfile = async () => { v-model="itemInfo.weeklyRegularWorkingHours[2]" type="number" @change="calcWeeklyWorkingHours" + @keyup="calcWeeklyWorkingHours" /> @@ -400,7 +428,7 @@ const saveProfile = async () => { v-model="itemInfo.weeklyRegularWorkingHours[3]" type="number" @change="calcWeeklyWorkingHours" - + @keyup="calcWeeklyWorkingHours" /> { v-model="itemInfo.weeklyRegularWorkingHours[4]" type="number" @change="calcWeeklyWorkingHours" - + @keyup="calcWeeklyWorkingHours" /> { v-model="itemInfo.weeklyRegularWorkingHours[5]" type="number" @change="calcWeeklyWorkingHours" - + @keyup="calcWeeklyWorkingHours" /> { v-model="itemInfo.weeklyRegularWorkingHours[6]" type="number" @change="calcWeeklyWorkingHours" - + @keyup="calcWeeklyWorkingHours" /> { v-model="itemInfo.weeklyRegularWorkingHours[7]" type="number" @change="calcWeeklyWorkingHours" - + @keyup="calcWeeklyWorkingHours" />