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 toast = useToast()
const itemInfo = ref({ const itemInfo = ref({
weeklyRegularWorkingHours: {} weeklyRegularWorkingHours: {
"1":0,
"2":0,
"3":0,
"4":0,
"5":0,
"6":0,
"7":0,
}
}) })
const oldItemInfo = ref({}) const oldItemInfo = ref({})
const setupPage = async () => { const setupPage = async () => {
console.log(itemInfo.value)
if(route.params.id) { if(route.params.id) {
itemInfo.value = await useSupabaseSelectSingle("profiles",route.params.id,"*, documents(*), checks(*)") 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)) if(itemInfo.value.id) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
@@ -126,7 +153,6 @@ const saveProfile = async () => {
>{{itemInfo ? `Mitarbeiter: ${itemInfo.fullName}` : ''}}</h1> >{{itemInfo ? `Mitarbeiter: ${itemInfo.fullName}` : ''}}</h1>
</template> </template>
</UDashboardNavbar> </UDashboardNavbar>
<UTabs <UTabs
v-if="itemInfo.id" v-if="itemInfo.id"
class="p-5" class="p-5"
@@ -378,6 +404,7 @@ const saveProfile = async () => {
<UInput <UInput
v-model="itemInfo.weeklyRegularWorkingHours[1]" v-model="itemInfo.weeklyRegularWorkingHours[1]"
type="number" type="number"
@keyup="calcWeeklyWorkingHours"
@change="calcWeeklyWorkingHours" @change="calcWeeklyWorkingHours"
/> />
@@ -389,6 +416,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[2]" v-model="itemInfo.weeklyRegularWorkingHours[2]"
type="number" type="number"
@change="calcWeeklyWorkingHours" @change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/> />
</UFormGroup> </UFormGroup>
@@ -400,7 +428,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[3]" v-model="itemInfo.weeklyRegularWorkingHours[3]"
type="number" type="number"
@change="calcWeeklyWorkingHours" @change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/> />
</UFormGroup> </UFormGroup>
<UFormGroup <UFormGroup
@@ -411,7 +439,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[4]" v-model="itemInfo.weeklyRegularWorkingHours[4]"
type="number" type="number"
@change="calcWeeklyWorkingHours" @change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/> />
</UFormGroup> </UFormGroup>
<UFormGroup <UFormGroup
@@ -422,7 +450,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[5]" v-model="itemInfo.weeklyRegularWorkingHours[5]"
type="number" type="number"
@change="calcWeeklyWorkingHours" @change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/> />
</UFormGroup> </UFormGroup>
<UFormGroup <UFormGroup
@@ -433,7 +461,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[6]" v-model="itemInfo.weeklyRegularWorkingHours[6]"
type="number" type="number"
@change="calcWeeklyWorkingHours" @change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/> />
</UFormGroup> </UFormGroup>
<UFormGroup <UFormGroup
@@ -444,7 +472,7 @@ const saveProfile = async () => {
v-model="itemInfo.weeklyRegularWorkingHours[7]" v-model="itemInfo.weeklyRegularWorkingHours[7]"
type="number" type="number"
@change="calcWeeklyWorkingHours" @change="calcWeeklyWorkingHours"
@keyup="calcWeeklyWorkingHours"
/> />
</UFormGroup> </UFormGroup>
</InputGroup> </InputGroup>