|
|
|
@ -77,6 +77,7 @@
|
|
|
|
:item="item"
|
|
|
|
:item="item"
|
|
|
|
:document="sortedDocuments[index]"
|
|
|
|
:document="sortedDocuments[index]"
|
|
|
|
:accept-file-types="acceptFileTypes"
|
|
|
|
:accept-file-types="acceptFileTypes"
|
|
|
|
|
|
|
|
:with-replace-button="withUploadButton"
|
|
|
|
:editable="editable"
|
|
|
|
:editable="editable"
|
|
|
|
:template="template"
|
|
|
|
:template="template"
|
|
|
|
:is-direct-upload="isDirectUpload"
|
|
|
|
:is-direct-upload="isDirectUpload"
|
|
|
|
@ -96,7 +97,7 @@
|
|
|
|
:class="{ 'bg-base-100': withStickySubmitters }"
|
|
|
|
:class="{ 'bg-base-100': withStickySubmitters }"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Upload
|
|
|
|
<Upload
|
|
|
|
v-if="sortedDocuments.length && editable"
|
|
|
|
v-if="sortedDocuments.length && editable && withUploadButton"
|
|
|
|
:accept-file-types="acceptFileTypes"
|
|
|
|
:accept-file-types="acceptFileTypes"
|
|
|
|
:template-id="template.id"
|
|
|
|
:template-id="template.id"
|
|
|
|
:is-direct-upload="isDirectUpload"
|
|
|
|
:is-direct-upload="isDirectUpload"
|
|
|
|
@ -110,7 +111,7 @@
|
|
|
|
class="pr-3.5 pl-0.5"
|
|
|
|
class="pr-3.5 pl-0.5"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Dropzone
|
|
|
|
<Dropzone
|
|
|
|
v-if="!sortedDocuments.length"
|
|
|
|
v-if="!sortedDocuments.length && withUploadButton"
|
|
|
|
:template-id="template.id"
|
|
|
|
:template-id="template.id"
|
|
|
|
:accept-file-types="acceptFileTypes"
|
|
|
|
:accept-file-types="acceptFileTypes"
|
|
|
|
:is-direct-upload="isDirectUpload"
|
|
|
|
:is-direct-upload="isDirectUpload"
|
|
|
|
@ -126,9 +127,10 @@
|
|
|
|
:areas-index="fieldAreasIndex[document.uuid]"
|
|
|
|
:areas-index="fieldAreasIndex[document.uuid]"
|
|
|
|
:selected-submitter="selectedSubmitter"
|
|
|
|
:selected-submitter="selectedSubmitter"
|
|
|
|
:document="document"
|
|
|
|
:document="document"
|
|
|
|
:is-drag="!!dragFieldType"
|
|
|
|
:is-drag="!!dragField"
|
|
|
|
:draw-field="drawField"
|
|
|
|
:draw-field="drawField"
|
|
|
|
:editable="editable"
|
|
|
|
:editable="editable"
|
|
|
|
|
|
|
|
:base-url="baseUrl"
|
|
|
|
@draw="onDraw"
|
|
|
|
@draw="onDraw"
|
|
|
|
@drop-field="onDropfield"
|
|
|
|
@drop-field="onDropfield"
|
|
|
|
@remove-area="removeArea"
|
|
|
|
@remove-area="removeArea"
|
|
|
|
@ -137,6 +139,7 @@
|
|
|
|
v-if="isBreakpointLg && editable"
|
|
|
|
v-if="isBreakpointLg && editable"
|
|
|
|
:with-arrows="template.schema.length > 1"
|
|
|
|
:with-arrows="template.schema.length > 1"
|
|
|
|
:item="template.schema.find((item) => item.attachment_uuid === document.uuid)"
|
|
|
|
:item="template.schema.find((item) => item.attachment_uuid === document.uuid)"
|
|
|
|
|
|
|
|
:with-replace-button="withUploadButton"
|
|
|
|
:document="document"
|
|
|
|
:document="document"
|
|
|
|
:template="template"
|
|
|
|
:template="template"
|
|
|
|
:is-direct-upload="isDirectUpload"
|
|
|
|
:is-direct-upload="isDirectUpload"
|
|
|
|
@ -153,6 +156,7 @@
|
|
|
|
class="pb-4"
|
|
|
|
class="pb-4"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Upload
|
|
|
|
<Upload
|
|
|
|
|
|
|
|
v-if="withUploadButton"
|
|
|
|
:template-id="template.id"
|
|
|
|
:template-id="template.id"
|
|
|
|
:is-direct-upload="isDirectUpload"
|
|
|
|
:is-direct-upload="isDirectUpload"
|
|
|
|
@success="updateFromUpload"
|
|
|
|
@success="updateFromUpload"
|
|
|
|
@ -168,7 +172,7 @@
|
|
|
|
:selected-submitter="selectedSubmitter"
|
|
|
|
:selected-submitter="selectedSubmitter"
|
|
|
|
class="md:hidden"
|
|
|
|
class="md:hidden"
|
|
|
|
:editable="editable"
|
|
|
|
:editable="editable"
|
|
|
|
@cancel="drawField = null"
|
|
|
|
@cancel="[drawField = null, drawOption = null]"
|
|
|
|
@change-submitter="[selectedSubmitter = $event, drawField.submitter_uuid = $event.uuid]"
|
|
|
|
@change-submitter="[selectedSubmitter = $event, drawField.submitter_uuid = $event.uuid]"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<FieldType
|
|
|
|
<FieldType
|
|
|
|
@ -209,7 +213,7 @@
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
class="base-button"
|
|
|
|
class="base-button"
|
|
|
|
@click="drawField = null"
|
|
|
|
@click="[drawField = null, drawOption = null]"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
Cancel
|
|
|
|
Cancel
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
@ -222,12 +226,13 @@
|
|
|
|
:fields="template.fields"
|
|
|
|
:fields="template.fields"
|
|
|
|
:submitters="template.submitters"
|
|
|
|
:submitters="template.submitters"
|
|
|
|
:selected-submitter="selectedSubmitter"
|
|
|
|
:selected-submitter="selectedSubmitter"
|
|
|
|
|
|
|
|
:default-fields="defaultFields"
|
|
|
|
:with-sticky-submitters="withStickySubmitters"
|
|
|
|
:with-sticky-submitters="withStickySubmitters"
|
|
|
|
:editable="editable"
|
|
|
|
:editable="editable"
|
|
|
|
@set-draw="drawField = $event"
|
|
|
|
@set-draw="[drawField = $event.field, drawOption = $event.option]"
|
|
|
|
@set-drag="dragFieldType = $event"
|
|
|
|
@set-drag="dragField = $event"
|
|
|
|
@change-submitter="selectedSubmitter = $event"
|
|
|
|
@change-submitter="selectedSubmitter = $event"
|
|
|
|
@drag-end="dragFieldType = null"
|
|
|
|
@drag-end="dragField = null"
|
|
|
|
@scroll-to-area="scrollToArea"
|
|
|
|
@scroll-to-area="scrollToArea"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@ -300,6 +305,16 @@ export default {
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
default: true
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
defaultFields: {
|
|
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
|
|
required: false,
|
|
|
|
|
|
|
|
default: () => []
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
defaultSubmitters: {
|
|
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
|
|
required: false,
|
|
|
|
|
|
|
|
default: () => []
|
|
|
|
|
|
|
|
},
|
|
|
|
acceptFileTypes: {
|
|
|
|
acceptFileTypes: {
|
|
|
|
type: String,
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
@ -320,6 +335,11 @@ export default {
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
default: true
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
withUploadButton: {
|
|
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
|
|
required: false,
|
|
|
|
|
|
|
|
default: true
|
|
|
|
|
|
|
|
},
|
|
|
|
withPhone: {
|
|
|
|
withPhone: {
|
|
|
|
type: Boolean,
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
@ -340,7 +360,9 @@ export default {
|
|
|
|
drawField: null,
|
|
|
|
drawField: null,
|
|
|
|
dragFieldType: null,
|
|
|
|
dragFieldType: null,
|
|
|
|
isLoading: false,
|
|
|
|
isLoading: false,
|
|
|
|
isDeleting: false
|
|
|
|
isDeleting: false,
|
|
|
|
|
|
|
|
drawOption: null,
|
|
|
|
|
|
|
|
dragField: null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
@ -372,6 +394,13 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created () {
|
|
|
|
created () {
|
|
|
|
|
|
|
|
this.defaultSubmitters.forEach((name, index) => {
|
|
|
|
|
|
|
|
const submitter = (this.template.submitters[index] ||= {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
submitter.name = name
|
|
|
|
|
|
|
|
submitter.uuid ||= v4()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.selectedSubmitter = this.template.submitters[0]
|
|
|
|
this.selectedSubmitter = this.template.submitters[0]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted () {
|
|
|
|
mounted () {
|
|
|
|
@ -408,10 +437,11 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (['select', 'multiple', 'radio'].includes(type)) {
|
|
|
|
if (['select', 'multiple', 'radio'].includes(type)) {
|
|
|
|
field.options = ['']
|
|
|
|
field.options = [{ value: '', uuid: v4() }]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.drawField = field
|
|
|
|
this.drawField = field
|
|
|
|
|
|
|
|
this.drawOption = null
|
|
|
|
},
|
|
|
|
},
|
|
|
|
undo () {
|
|
|
|
undo () {
|
|
|
|
if (this.undoStack.length > 1) {
|
|
|
|
if (this.undoStack.length > 1) {
|
|
|
|
@ -460,6 +490,7 @@ export default {
|
|
|
|
onKeyUp (e) {
|
|
|
|
onKeyUp (e) {
|
|
|
|
if (e.code === 'Escape') {
|
|
|
|
if (e.code === 'Escape') {
|
|
|
|
this.drawField = null
|
|
|
|
this.drawField = null
|
|
|
|
|
|
|
|
this.drawOption = null
|
|
|
|
this.selectedAreaRef.value = null
|
|
|
|
this.selectedAreaRef.value = null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -506,6 +537,16 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onDraw (area) {
|
|
|
|
onDraw (area) {
|
|
|
|
if (this.drawField) {
|
|
|
|
if (this.drawField) {
|
|
|
|
|
|
|
|
if (this.drawOption) {
|
|
|
|
|
|
|
|
const areaWithoutOption = this.drawField.areas?.find((a) => !a.option_uuid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (areaWithoutOption && !this.drawField.areas.find((a) => a.option_uuid === this.drawField.options[0].uuid)) {
|
|
|
|
|
|
|
|
areaWithoutOption.option_uuid = this.drawField.options[0].uuid
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
area.option_uuid = this.drawOption.uuid
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.drawField.areas ||= []
|
|
|
|
this.drawField.areas ||= []
|
|
|
|
this.drawField.areas.push(area)
|
|
|
|
this.drawField.areas.push(area)
|
|
|
|
|
|
|
|
|
|
|
|
@ -514,6 +555,7 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.drawField = null
|
|
|
|
this.drawField = null
|
|
|
|
|
|
|
|
this.drawOption = null
|
|
|
|
|
|
|
|
|
|
|
|
this.selectedAreaRef.value = area
|
|
|
|
this.selectedAreaRef.value = area
|
|
|
|
|
|
|
|
|
|
|
|
@ -563,14 +605,14 @@ export default {
|
|
|
|
onDropfield (area) {
|
|
|
|
onDropfield (area) {
|
|
|
|
const field = {
|
|
|
|
const field = {
|
|
|
|
name: '',
|
|
|
|
name: '',
|
|
|
|
type: this.dragFieldType,
|
|
|
|
|
|
|
|
uuid: v4(),
|
|
|
|
uuid: v4(),
|
|
|
|
submitter_uuid: this.selectedSubmitter.uuid,
|
|
|
|
submitter_uuid: this.selectedSubmitter.uuid,
|
|
|
|
required: this.dragFieldType !== 'checkbox'
|
|
|
|
required: this.dragField.type !== 'checkbox',
|
|
|
|
|
|
|
|
...this.dragField
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (['select', 'multiple', 'radio'].includes(this.dragFieldType)) {
|
|
|
|
if (['select', 'multiple', 'radio'].includes(field.type)) {
|
|
|
|
field.options = ['']
|
|
|
|
field.options = [{ value: '', uuid: v4() }]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const fieldArea = {
|
|
|
|
const fieldArea = {
|
|
|
|
@ -584,27 +626,27 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
let baseArea
|
|
|
|
let baseArea
|
|
|
|
|
|
|
|
|
|
|
|
if (this.selectedField?.type === this.dragFieldType) {
|
|
|
|
if (this.selectedField?.type === field.type) {
|
|
|
|
baseArea = this.selectedAreaRef.value
|
|
|
|
baseArea = this.selectedAreaRef.value
|
|
|
|
} else if (previousField?.areas?.length) {
|
|
|
|
} else if (previousField?.areas?.length) {
|
|
|
|
baseArea = previousField.areas[previousField.areas.length - 1]
|
|
|
|
baseArea = previousField.areas[previousField.areas.length - 1]
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (['checkbox'].includes(this.dragFieldType)) {
|
|
|
|
if (['checkbox'].includes(field.type)) {
|
|
|
|
baseArea = {
|
|
|
|
baseArea = {
|
|
|
|
w: area.maskW / 30 / area.maskW,
|
|
|
|
w: area.maskW / 30 / area.maskW,
|
|
|
|
h: area.maskW / 30 / area.maskW * (area.maskW / area.maskH)
|
|
|
|
h: area.maskW / 30 / area.maskW * (area.maskW / area.maskH)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (this.dragFieldType === 'image') {
|
|
|
|
} else if (field.type === 'image') {
|
|
|
|
baseArea = {
|
|
|
|
baseArea = {
|
|
|
|
w: area.maskW / 5 / area.maskW,
|
|
|
|
w: area.maskW / 5 / area.maskW,
|
|
|
|
h: (area.maskW / 5 / area.maskW) * (area.maskW / area.maskH)
|
|
|
|
h: (area.maskW / 5 / area.maskW) * (area.maskW / area.maskH)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (this.dragFieldType === 'signature') {
|
|
|
|
} else if (field.type === 'signature') {
|
|
|
|
baseArea = {
|
|
|
|
baseArea = {
|
|
|
|
w: area.maskW / 5 / area.maskW,
|
|
|
|
w: area.maskW / 5 / area.maskW,
|
|
|
|
h: (area.maskW / 5 / area.maskW) * (area.maskW / area.maskH) / 2
|
|
|
|
h: (area.maskW / 5 / area.maskW) * (area.maskW / area.maskH) / 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (this.dragFieldType === 'initials') {
|
|
|
|
} else if (field.type === 'initials') {
|
|
|
|
baseArea = {
|
|
|
|
baseArea = {
|
|
|
|
w: area.maskW / 10 / area.maskW,
|
|
|
|
w: area.maskW / 10 / area.maskW,
|
|
|
|
h: area.maskW / 35 / area.maskW
|
|
|
|
h: area.maskW / 35 / area.maskW
|
|
|
|
@ -621,7 +663,7 @@ export default {
|
|
|
|
fieldArea.h = baseArea.h
|
|
|
|
fieldArea.h = baseArea.h
|
|
|
|
fieldArea.y = fieldArea.y - baseArea.h / 2
|
|
|
|
fieldArea.y = fieldArea.y - baseArea.h / 2
|
|
|
|
|
|
|
|
|
|
|
|
if (this.dragFieldType === 'cells') {
|
|
|
|
if (field.type === 'cells') {
|
|
|
|
fieldArea.cell_w = baseArea.cell_w || (baseArea.w / 5)
|
|
|
|
fieldArea.cell_w = baseArea.cell_w || (baseArea.w / 5)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|