From 5724159b7bf5b9424f8dd427f0fc6d8921c343f4 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sun, 1 Dec 2024 00:10:07 +0200 Subject: [PATCH] verification --- app/javascript/application.js | 1 + app/javascript/application.scss | 17 ++ app/javascript/submission_form/area.vue | 8 +- app/javascript/submission_form/form.vue | 37 +++- app/javascript/submission_form/i18n.js | 39 ++++ .../submission_form/payment_step.vue | 1 - .../submission_form/verification_step.vue | 169 ++++++++++++++ app/javascript/template_builder/builder.vue | 10 +- .../template_builder/field_type.vue | 15 +- app/javascript/template_builder/fields.vue | 32 ++- app/javascript/template_builder/i18n.js | 12 + .../template_builder/mobile_fields.vue | 4 +- app/models/submission_event.rb | 2 + app/models/submitter.rb | 1 + config/initializers/active_storage.rb | 1 + config/locales/i18n.yml | 24 ++ lib/submissions/generate_audit_trail.rb | 17 +- .../generate_preview_attachments.rb | 33 ++- .../generate_result_attachments.rb | 10 + lib/submitters/submit_values.rb | 11 + package.json | 1 + yarn.lock | 209 +++++++++++++++++- 22 files changed, 623 insertions(+), 31 deletions(-) create mode 100644 app/javascript/submission_form/verification_step.vue diff --git a/app/javascript/application.js b/app/javascript/application.js index 15f31a72..2239d638 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -113,6 +113,7 @@ safeRegisterElement('template-builder', class extends HTMLElement { backgroundColor: '#faf7f5', locale: this.dataset.locale, withPhone: this.dataset.withPhone === 'true', + withVerification: ['true', 'false'].includes(this.dataset.withVerification) ? this.dataset.withVerification === 'true' : null, withLogo: this.dataset.withLogo !== 'false', editable: this.dataset.editable !== 'false', authenticityToken: document.querySelector('meta[name="csrf-token"]')?.content, diff --git a/app/javascript/application.scss b/app/javascript/application.scss index 1a6b527d..61d3f645 100644 --- a/app/javascript/application.scss +++ b/app/javascript/application.scss @@ -97,6 +97,23 @@ button[disabled] .enabled { bottom: auto; } +.tooltip-bottom-start:before { + transform: translateX(-31%); + top: var(--tooltip-offset); + left: 100%; + right: auto; + bottom: auto; +} + +.tooltip-bottom-start:after { + transform: translateX(-25%); + border-color: transparent transparent var(--tooltip-color) transparent; + top: var(--tooltip-tail-offset); + left: 50%; + right: auto; + bottom: auto; +} + .autocomplete { background: white; z-index: 1000; diff --git a/app/javascript/submission_form/area.vue b/app/javascript/submission_form/area.vue index 750228fa..2c3fc5d4 100644 --- a/app/javascript/submission_form/area.vue +++ b/app/javascript/submission_form/area.vue @@ -209,7 +209,7 @@ diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index 04c6dcaf..d8a9c3dc 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -455,6 +455,7 @@ export default { fieldTypes: this.fieldTypes, backgroundColor: this.backgroundColor, withPhone: this.withPhone, + withVerification: this.withVerification, withPayment: this.withPayment, isPaymentConnected: this.isPaymentConnected, withFormula: this.withFormula, @@ -635,6 +636,11 @@ export default { required: false, default: false }, + withVerification: { + type: Boolean, + required: false, + default: null + }, withPayment: { type: Boolean, required: false, @@ -1075,7 +1081,7 @@ export default { } else if (type === 'image') { area.w = pageMask.clientWidth / 5 / pageMask.clientWidth area.h = (pageMask.clientWidth / 5 / pageMask.clientWidth) * (pageMask.clientWidth / pageMask.clientHeight) - } else if (type === 'signature' || type === 'stamp') { + } else if (type === 'signature' || type === 'stamp' || type === 'verification') { area.w = pageMask.clientWidth / 5 / pageMask.clientWidth area.h = (pageMask.clientWidth / 5 / pageMask.clientWidth) * (pageMask.clientWidth / pageMask.clientHeight) / 2 } else if (type === 'initials') { @@ -1239,7 +1245,7 @@ export default { w: area.maskW / 5 / area.maskW, h: (area.maskW / 5 / area.maskW) * (area.maskW / area.maskH) } - } else if (field.type === 'signature' || field.type === 'stamp') { + } else if (field.type === 'signature' || field.type === 'stamp' || field.type === 'verification') { baseArea = { w: area.maskW / 5 / area.maskW, h: (area.maskW / 5 / area.maskW) * (area.maskW / area.maskH) / 2 diff --git a/app/javascript/template_builder/field_type.vue b/app/javascript/template_builder/field_type.vue index 3034f568..8f17d256 100644 --- a/app/javascript/template_builder/field_type.vue +++ b/app/javascript/template_builder/field_type.vue @@ -30,7 +30,7 @@ v-for="(icon, type) in fieldIconsSorted" :key="type" > -
  • +