Introduced Employee Number

Added Ability to Save Bericht
This commit is contained in:
2025-11-14 17:34:15 +01:00
parent c4d0a20bbc
commit 32c71fe49b

View File

@@ -3,7 +3,7 @@ const { $dayjs } = useNuxtApp()
const router = useRouter()
const route = useRoute()
const auth = useAuthStore()
const toast = useToast()
// 🔹 State
const workingtimes = ref([])
const absencerequests = ref([])
@@ -81,10 +81,32 @@ async function generateDocument() {
uri.value = await useFunctions().useCreatePDF({
full_name: profile.value.full_name,
employee_number: profile.value.employee_number ? profile.value.employee_number : "-",
...workingTimeInfo.value}, path, "timesheet")
showDocument.value = true
}
const fileSaved = ref(false)
async function saveFile() {
try {
let fileData = {
auth_profile: profile.value.id,
tenant: auth.activeTenant
}
let file = useFiles().dataURLtoFile(uri.value, `${profile.value.full_name}-${$dayjs(selectedStartDay.value).format("YYYY-MM-DD")}-${$dayjs(selectedEndDay.value).format("YYYY-MM-DD")}.pdf`)
await useFiles().uploadFiles(fileData, [file])
toast.add({title:"Auswertung erfolgreich gespeichert"})
fileSaved.value = true
} catch (error) {
toast.add({title:"Fehler beim Speichern der Auswertung", color: "rose"})
}
}
async function onTabChange(index: number) {
@@ -157,6 +179,19 @@ changeRange()
</UPopover>
</UFormGroup>
</template>
<template #right>
<UTooltip
:text="fileSaved ? 'Bericht bereits gespeichert' : 'Bericht speichern'"
v-if="openTab === 1 && uri"
>
<UButton
icon="i-mdi-content-save"
:disabled="fileSaved"
@click="saveFile"
>Bericht</UButton>
</UTooltip>
</template>
</UDashboardToolbar>
<UDashboardPanelContent>