Introduced Employee Number
Added Ability to Save Bericht
This commit is contained in:
@@ -3,7 +3,7 @@ const { $dayjs } = useNuxtApp()
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const auth = useAuthStore()
|
const auth = useAuthStore()
|
||||||
|
const toast = useToast()
|
||||||
// 🔹 State
|
// 🔹 State
|
||||||
const workingtimes = ref([])
|
const workingtimes = ref([])
|
||||||
const absencerequests = ref([])
|
const absencerequests = ref([])
|
||||||
@@ -81,10 +81,32 @@ async function generateDocument() {
|
|||||||
|
|
||||||
uri.value = await useFunctions().useCreatePDF({
|
uri.value = await useFunctions().useCreatePDF({
|
||||||
full_name: profile.value.full_name,
|
full_name: profile.value.full_name,
|
||||||
|
employee_number: profile.value.employee_number ? profile.value.employee_number : "-",
|
||||||
...workingTimeInfo.value}, path, "timesheet")
|
...workingTimeInfo.value}, path, "timesheet")
|
||||||
|
|
||||||
|
|
||||||
showDocument.value = true
|
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) {
|
async function onTabChange(index: number) {
|
||||||
@@ -157,6 +179,19 @@ changeRange()
|
|||||||
</UPopover>
|
</UPopover>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
</template>
|
</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>
|
</UDashboardToolbar>
|
||||||
|
|
||||||
<UDashboardPanelContent>
|
<UDashboardPanelContent>
|
||||||
|
|||||||
Reference in New Issue
Block a user