diff --git a/composables/useWorkingTimePDFGenerator.js b/composables/useWorkingTimePDFGenerator.js
new file mode 100644
index 0000000..e91f417
--- /dev/null
+++ b/composables/useWorkingTimePDFGenerator.js
@@ -0,0 +1,191 @@
+import {PDFDocument, StandardFonts, rgb} from "pdf-lib"
+import dayjs from "dayjs"
+
+
+const getCoordinatesForPDFLib = (x ,y, page) => {
+ /*
+ * @param x the wanted X Parameter in Millimeters from Top Left
+ * @param y the wanted Y Parameter in Millimeters from Top Left
+ * @param page the page Object
+ *
+ * @returns x,y object
+ * */
+
+
+ let retX = x * 2.83
+ let retY = page.getHeight()-(y*2.83)
+
+ return {
+ x: retX,
+ y: retY
+ }
+
+}
+
+const getDuration = (time) => {
+ const minutes = Math.floor(dayjs(time.endDate).diff(dayjs(time.startDate),'minutes',true))
+ const hours = Math.floor(minutes/60)
+ return {
+ //dezimal: dez,
+ hours: hours,
+ minutes: minutes,
+ composed: `${hours}:${String(minutes % 60).padStart(2,"0")} Std`
+ }
+}
+
+
+
+
+export const useCreateWorkingTimesPdf = async (input,backgroundSourceBuffer) => {
+
+ const uri = ref("test")
+ const genPDF = async () => {
+ const pdfDoc = await PDFDocument.create()
+
+ const font = await pdfDoc.embedFont(StandardFonts.Helvetica)
+ const fontBold = await pdfDoc.embedFont(StandardFonts.HelveticaBold)
+
+ let pages = []
+ let pageCounter = 1
+
+
+
+ const backgroudPdf = await PDFDocument.load(backgroundSourceBuffer)
+
+ const firstPageBackground = await pdfDoc.embedPage(backgroudPdf.getPages()[0])
+ const secondPageBackground = await pdfDoc.embedPage(backgroudPdf.getPages()[backgroudPdf.getPages().length > 1 ? 1 : 0])
+
+ const page1 = pdfDoc.addPage()
+
+ page1.drawPage(firstPageBackground, {
+ x: 0,
+ y: 0,
+ })
+
+ pages.push(page1)
+
+
+ //Falzmarke 1
+ /*pages[pageCounter - 1].drawLine({
+ start: getCoordinatesForPDFLib(0,105,page1),
+ end: getCoordinatesForPDFLib(7,105,page1),
+ thickness: 0.25,
+ color: rgb(0,0,0),
+ opacity: 1
+ })*/
+
+ //Lochmarke
+ /*pages[pageCounter - 1].drawLine({
+ start: getCoordinatesForPDFLib(0,148.5,page1),
+ end: getCoordinatesForPDFLib(7,148.5,page1),
+ thickness: 0.25,
+ color: rgb(0,0,0),
+ opacity: 1
+ })*/
+
+ //Falzmarke 2
+ /*pages[pageCounter - 1].drawLine({
+ start: getCoordinatesForPDFLib(0,210,page1),
+ end: getCoordinatesForPDFLib(7,210,page1),
+ thickness: 0.25,
+ color: rgb(0,0,0),
+ opacity: 1
+ })*/
+ console.log(input)
+ pages[pageCounter - 1].drawText(`Mitarbeiter: ${input.profile}`,{
+ x: getCoordinatesForPDFLib(20,65,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(20,65,pages[pageCounter -1]).y,
+ size: 10,
+ })
+ pages[pageCounter - 1].drawText(`Eingereicht: ${Math.floor(input.sumWorkingMinutesEingereicht/60)}:${String(input.sumWorkingMinutesEingereicht % 60).padStart(2,"0")} Std`,{
+ x: getCoordinatesForPDFLib(20,70,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(20,70,pages[pageCounter -1]).y,
+ size: 10,
+ })
+ pages[pageCounter - 1].drawText(`Bestätigt: ${Math.floor(input.sumWorkingMinutesApproved/60)}:${String(input.sumWorkingMinutesApproved % 60).padStart(2,"0")} Std`,{
+ x: getCoordinatesForPDFLib(20,75,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(20,75,pages[pageCounter -1]).y,
+ size: 10,
+ })
+ pages[pageCounter - 1].drawText(`Soll Stunden: ${input.monthlyWorkingHours} Std`,{
+ x: getCoordinatesForPDFLib(20,80,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(20,80,pages[pageCounter -1]).y,
+ size: 10,
+ })
+ pages[pageCounter - 1].drawText(`Abwesend: Std`,{
+ x: getCoordinatesForPDFLib(20,85,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(20,85,pages[pageCounter -1]).y,
+ size: 10,
+ })
+ pages[pageCounter - 1].drawText(`Ausgleich: Std`,{
+ x: getCoordinatesForPDFLib(20,90,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(20,90,pages[pageCounter -1]).y,
+ size: 10,
+ })
+ pages[pageCounter - 1].drawText(`Inoffizielles Saldo: ${input.saldoInOfficial} Std`,{
+ x: getCoordinatesForPDFLib(20,95,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(20,95,pages[pageCounter -1]).y,
+ size: 10,
+ })
+ pages[pageCounter - 1].drawText(`Saldo: ${input.saldo} Std`,{
+ x: getCoordinatesForPDFLib(20,100,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(20,100,pages[pageCounter -1]).y,
+ size: 10,
+ })
+
+ pages[pageCounter - 1].drawText(`Start:`,{
+ x: getCoordinatesForPDFLib(20,110,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(20,110,pages[pageCounter -1]).y,
+ size: 10,
+ })
+
+ pages[pageCounter - 1].drawText(`Ende:`,{
+ x: getCoordinatesForPDFLib(60,110,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(60,110,pages[pageCounter -1]).y,
+ size: 10,
+ })
+
+ pages[pageCounter - 1].drawText(`Dauer:`,{
+ x: getCoordinatesForPDFLib(100,110,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(100,110,pages[pageCounter -1]).y,
+ size: 10,
+ })
+
+
+ let rowHeight = 115
+
+ input.times.forEach(time => {
+ pages[pageCounter - 1].drawText(`${dayjs(time.startDate).format("HH:mm DD.MM.YY")}`,{
+ x: getCoordinatesForPDFLib(20,rowHeight,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(20,rowHeight,pages[pageCounter -1]).y,
+ size: 10,
+ })
+
+ pages[pageCounter - 1].drawText(`${dayjs(time.startDate).format("HH:mm DD.MM.YY")}`,{
+ x: getCoordinatesForPDFLib(60,rowHeight,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(60,rowHeight,pages[pageCounter -1]).y,
+ size: 10,
+ })
+
+ pages[pageCounter - 1].drawText(`${getDuration(time).composed}`,{
+ x: getCoordinatesForPDFLib(100,rowHeight,pages[pageCounter -1]).x,
+ y: getCoordinatesForPDFLib(100,rowHeight,pages[pageCounter -1]).y,
+ size: 10,
+ })
+
+ rowHeight += 6
+
+ })
+
+
+
+ uri.value = await pdfDoc.saveAsBase64({dataUri: true})
+
+ }
+
+ await genPDF()
+
+ return uri.value
+
+
+}
\ No newline at end of file
diff --git a/pages/customers/[mode]/[[id]].vue b/pages/customers/[mode]/[[id]].vue
index 3faa595..dfd14c2 100644
--- a/pages/customers/[mode]/[[id]].vue
+++ b/pages/customers/[mode]/[[id]].vue
@@ -73,7 +73,6 @@ setupPage()
- {{openTab}}
Eingreicht: {{Math.floor(workingTimeInfo.sumWorkingMinutesEingereicht/60)}}:{{String(workingTimeInfo.sumWorkingMinutesEingereicht % 60).padStart(2,"0")}} h Bestätigt: {{Math.floor(workingTimeInfo.sumWorkingMinutesApproved/60)}}:{{String(workingTimeInfo.sumWorkingMinutesApproved % 60).padStart(2,"0")}} h Soll Stunden: {{workingTimeInfo.monthlyWorkingHours}} h Abwesend: Ausgleich: Inoffizielles Saldo: {{workingTimeInfo.saldoInOfficial}} h Saldo: {{workingTimeInfo.saldo}} h{{itemInfo ? `Auswertung Anwesenheiten: ${itemInfo.fullName}` : ``}}
+
+
+
+
+
+