add initials field

This commit is contained in:
Alex Turchyn
2023-09-20 00:13:14 +03:00
parent dc02964d9b
commit ee350324e5
14 changed files with 426 additions and 29 deletions
+8 -3
View File
@@ -28,7 +28,7 @@
<a
:href="`/templates/${template.id}/submissions/new`"
data-turbo-frame="modal"
class="btn btn-primary"
class="btn btn-primary text-base"
>
<IconUsersPlus
width="20"
@@ -46,12 +46,12 @@
>
<IconInnerShadowTop
v-if="isSaving"
width="20"
width="22"
class="animate-spin"
/>
<IconDeviceFloppy
v-else
width="20"
width="22"
/>
<span class="hidden md:inline">
Save
@@ -473,6 +473,11 @@ export default {
w: area.maskW / 5 / area.maskW,
h: (area.maskW / 5 / area.maskW) * (area.maskW / area.maskH) / 2
}
} else if (this.dragFieldType === 'initials') {
baseArea = {
w: area.maskW / 10 / area.maskW,
h: area.maskW / 35 / area.maskW
}
} else {
baseArea = {
w: area.maskW / 5 / area.maskW,
+32 -1
View File
@@ -99,6 +99,19 @@
Draw New Area
</a>
</li>
<li v-if="field.areas?.length === 1 && ['date', 'signature', 'initials', 'text', 'cells'].includes(field.type)">
<a
href="#"
class="text-sm py-1 px-2"
@click.prevent="copyToAllPages(field)"
>
<IconCopy
:width="20"
:stroke-width="1.6"
/>
Copy to All Pages
</a>
</li>
</ul>
</span>
<button
@@ -183,7 +196,7 @@
<script>
import Contenteditable from './contenteditable'
import FieldType from './field_type'
import { IconShape, IconNewSection, IconTrashX } from '@tabler/icons-vue'
import { IconShape, IconNewSection, IconTrashX, IconCopy } from '@tabler/icons-vue'
export default {
name: 'TemplateField',
@@ -192,6 +205,7 @@ export default {
IconShape,
IconNewSection,
IconTrashX,
IconCopy,
FieldType
},
inject: ['template', 'save'],
@@ -221,6 +235,23 @@ export default {
}
},
methods: {
copyToAllPages (field) {
const areaString = JSON.stringify(field.areas[0])
this.template.documents.forEach((attachment) => {
attachment.preview_images.forEach((page) => {
if (!field.areas.find((area) => area.attachment_uuid === attachment.uuid && area.page === parseInt(page.filename))) {
field.areas.push({ ...JSON.parse(areaString), page: parseInt(page.filename) })
}
})
})
this.$nextTick(() => {
this.$emit('scroll-to', this.field.areas[this.field.areas.length - 1])
})
this.save()
},
onNameFocus (e) {
this.isNameFocus = true
@@ -43,7 +43,7 @@
</template>
<script>
import { IconTextSize, IconWritingSign, IconCalendarEvent, IconPhoto, IconCheckbox, IconPaperclip, IconSelect, IconCircleDot, IconChecks, IconColumns3, IconPhoneCheck } from '@tabler/icons-vue'
import { IconTextSize, IconWritingSign, IconCalendarEvent, IconPhoto, IconCheckbox, IconPaperclip, IconSelect, IconCircleDot, IconChecks, IconColumns3, IconPhoneCheck, IconLetterCaseUpper } from '@tabler/icons-vue'
export default {
name: 'FiledTypeDropdown',
@@ -75,6 +75,7 @@ export default {
return {
text: 'Text',
signature: 'Signature',
initials: 'Initials',
date: 'Date',
image: 'Image',
file: 'File',
@@ -90,14 +91,15 @@ export default {
return {
text: IconTextSize,
signature: IconWritingSign,
initials: IconLetterCaseUpper,
date: IconCalendarEvent,
image: IconPhoto,
file: IconPaperclip,
select: IconSelect,
checkbox: IconCheckbox,
cells: IconColumns3,
multiple: IconChecks,
radio: IconCircleDot,
multiple: IconChecks,
cells: IconColumns3,
phone: IconPhoneCheck
}
}
+1 -1
View File
@@ -73,7 +73,7 @@
</button>
<div
v-else
class="tooltip flex"
class="tooltip tooltip-bottom-end flex"
data-tip="Unlock SMS-verified phone number field with paid plan. Use text field for phone numbers without verification."
>
<a