Tiny Fixes in Profile Editor

This commit is contained in:
2025-02-03 20:16:49 +01:00
parent 984831eaff
commit d3d7799812

View File

@@ -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}` : ''}}</h1>
</template>
</UDashboardNavbar>
<UTabs
v-if="itemInfo.id"
class="p-5"
@@ -378,6 +404,7 @@ const saveProfile = async () => {
<UInput
v-model="itemInfo.weeklyRegularWorkingHours[1]"
type="number"
@keyup="calcWeeklyWorkingHours"
@change="calcWeeklyWorkingHours"
/>
@@ -389,6 +416,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[2]"
type="number"
@change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/>
</UFormGroup>
@@ -400,7 +428,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[3]"
type="number"
@change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/>
</UFormGroup>
<UFormGroup
@@ -411,7 +439,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[4]"
type="number"
@change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/>
</UFormGroup>
<UFormGroup
@@ -422,7 +450,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[5]"
type="number"
@change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/>
</UFormGroup>
<UFormGroup
@@ -433,7 +461,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[6]"
type="number"
@change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/>
</UFormGroup>
<UFormGroup
@@ -444,7 +472,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[7]"
type="number"
@change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/>
</UFormGroup>
</InputGroup>