diff --git a/components/dropdown.vue b/components/dropdown.vue index cfb6085..1dff597 100644 --- a/components/dropdown.vue +++ b/components/dropdown.vue @@ -17,6 +17,7 @@ margin-top: 5px; z-index: 3; border: 1px solid black; + top: 100%; } .entry { diff --git a/components/estimate-test.vue b/components/estimate-test.vue index ce1d0b4..e0117f9 100644 --- a/components/estimate-test.vue +++ b/components/estimate-test.vue @@ -1,5 +1,6 @@ @@ -30,6 +35,7 @@ const doc = ref(null) const props = defineProps(['token', 'estimate', 'user']) const estimate = ref(null) const estimates = ref(null) +const pdfLink = ref('') const letterhead = computed(() => { if (!props.user.letterhead) return null @@ -43,7 +49,11 @@ const avatar = computed(() => { }) function makePDF() { - html2pdf(doc.value) + var opt = { + image: { type: 'png', quality: 1 }, + } + + html2pdf(doc.value, opt) } @@ -65,18 +75,62 @@ function getEstimates() { }) } +function getPdf() { + fetch(`/api/pdf`, + {method: 'GET', + headers: { + "Accept": "application/json", + "Authorization": `Bearer ${props.token}`, + }, + }).then(response => { + if (response.ok) { return response.blob() } + else { + return null + } + }).then (result => { + if (!result) return + pdfLink.value = URL.createObjectURL(result) + }) +} + onMounted(() => { getEstimates().then(() => estimate.value = estimates.value[0]) }) diff --git a/components/settings.vue b/components/settings.vue index fc48171..b966e7f 100644 --- a/components/settings.vue +++ b/components/settings.vue @@ -31,7 +31,7 @@ - +