Skip to content

Commit 89207ce

Browse files
author
kei5uke
committed
fix: agreement fields and signature
1 parent c1acbbb commit 89207ce

File tree

4 files changed

+560
-145
lines changed

4 files changed

+560
-145
lines changed

docs/.vitepress/theme/components/legacy/AgreementForm.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { ref, computed, watch, onMounted, nextTick, getCurrentInstance } from "v
33
44
import YAML from "yaml"
55
6-
// Dynamic import for PdfForm component
7-
// const PdfForm = defineAsyncComponent(() => import("./PdfForm.vue"))
86
97
const ISSERVER = typeof window === "undefined"
108

docs/.vitepress/theme/components/legacy/EmbedPdfViewer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
import { ref, watch, onMounted, nextTick } from "vue"
2+
import { ref, watch, onMounted, nextTick, shallowRef } from "vue"
33
44
defineOptions({
55
name: "EmbedPdfViewer",
@@ -10,7 +10,7 @@ const props = defineProps({
1010
pages: { type: Number, default: 1 },
1111
})
1212
13-
const PdfEmbed = ref(null)
13+
const PdfEmbed = shallowRef(null)
1414
const src = ref("")
1515
const showPdf = ref(false)
1616
const page = ref(null)

docs/.vitepress/theme/components/legacy/PdfForm.vue

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { PDFDocument } from "pdf-lib"
66
import { countries } from "country-list-json"
77
import SignaturePad from "signature_pad"
88
9-
// Dynamic / Async component import (Vue 3 style)
10-
// const CustomComponent = defineAsyncComponent(() => import("./CustomComponent.vue"))
119
1210
defineOptions({
1311
name: "PdfForm",
@@ -241,7 +239,6 @@ const updateAgreementFormCache = (key, fields) => {
241239
if (!localStorage.agreementFields) {
242240
localStorage.agreementFields = {}
243241
}
244-
console.log('is this updated', key, fields);
245242
if (key && fields) {
246243
localStorage.setItem(key, JSON.stringify(fields))
247244
}
@@ -292,11 +289,18 @@ const submit = () => {
292289
console.log(
293290
`Page ${pageNum} (${page.getWidth()} x ${page.getHeight()}) - insert image ${key}.png (${pngDims.width} x ${pngDims.height}) at position ${xpos} x ${ypos}`,
294291
)
292+
293+
const targetWidth = 300;
294+
const targetHeight = 30;
295+
const scaleX = targetWidth / pngImage.width;
296+
const scaleY = targetHeight / pngImage.height;
297+
const scale = Math.min(scaleX, scaleY);
298+
295299
page.drawImage(pngImage, {
296300
x: xpos,
297301
y: ypos,
298-
width: pngDims.width,
299-
height: pngDims.height,
302+
width: pngImage.width * scale,
303+
height: pngImage.height * scale,
300304
})
301305
})
302306
})
@@ -484,6 +488,8 @@ onMounted(() => {
484488
:ref="item.key"
485489
autocomplete="ignore-field"
486490
:items="item.options"
491+
item-title="text"
492+
item-value="value"
487493
:required="isFieldRequired(item.required)"
488494
:clearable="isBoolTrue(item.clearable)"
489495
clear-icon=""
@@ -524,22 +530,21 @@ onMounted(() => {
524530
persistent
525531
width="290px"
526532
>
527-
<template v-slot:activator="{ on, attrs }">
533+
<template #activator="{ props }">
528534
<v-text-field
529535
v-model="formData[item.key]"
530536
class="mt-1 mb-2"
531-
:placeholder="item.placeholder ? item.placeholder : ''"
537+
:placeholder="item.placeholder || ''"
532538
persistent-placeholder
533539
variant="outlined"
534540
density="compact"
535541
hide-details
536542
readonly
537-
v-bind="attrs"
538-
v-on="on"
543+
v-bind="props"
539544
>
540-
<template v-slot:label>
541-
{{ item.label
542-
}}<span v-if="isFieldRequired(item.required)" class="red--text text--darken-2"> * </span>
545+
<template #label>
546+
{{ item.label }}
547+
<span v-if="isFieldRequired(item.required)" class="red--text text--darken-2"> * </span>
543548
</template>
544549
</v-text-field>
545550
</template>

0 commit comments

Comments
 (0)