diff --git a/app/controllers/templates_preferences_controller.rb b/app/controllers/templates_preferences_controller.rb index 24aedbd4b..7e358537a 100644 --- a/app/controllers/templates_preferences_controller.rb +++ b/app/controllers/templates_preferences_controller.rb @@ -22,7 +22,7 @@ def template_params preferences: %i[bcc_completed request_email_subject request_email_body documents_copy_email_subject documents_copy_email_body documents_copy_email_enabled documents_copy_email_attach_audit - documents_copy_email_attach_documents + documents_copy_email_attach_documents documents_copy_email_reply_to completed_notification_email_attach_documents completed_redirect_url submitters_order diff --git a/app/javascript/elements/download_button.js b/app/javascript/elements/download_button.js index 1332d2ec7..160fc770a 100644 --- a/app/javascript/elements/download_button.js +++ b/app/javascript/elements/download_button.js @@ -20,7 +20,8 @@ export default targetable(class extends HTMLElement { fetch(this.dataset.src).then(async (response) => { if (response.ok) { const urls = await response.json() - const isSafariIos = /iPhone|iPad|iPod/i.test(navigator.userAgent) + const isMobileSafariIos = 'ontouchstart' in window && navigator.maxTouchPoints > 0 && /AppleWebKit/i.test(navigator.userAgent) + const isSafariIos = isMobileSafariIos || /iPhone|iPad|iPod/i.test(navigator.userAgent) if (isSafariIos && urls.length > 1) { this.downloadSafariIos(urls) diff --git a/app/javascript/submission_form/area.vue b/app/javascript/submission_form/area.vue index d3f7015e6..1c7052289 100644 --- a/app/javascript/submission_form/area.vue +++ b/app/javascript/submission_form/area.vue @@ -197,7 +197,10 @@ {{ formattedDate }} - + {{ formatNumber(modelValue, field.preferences?.format) }} { if (response.ok) { const urls = await response.json() - const isSafariIos = /iPhone|iPad|iPod/i.test(navigator.userAgent) + const isMobileSafariIos = 'ontouchstart' in window && navigator.maxTouchPoints > 0 && /AppleWebKit/i.test(navigator.userAgent) + const isSafariIos = isMobileSafariIos || /iPhone|iPad|iPod/i.test(navigator.userAgent) if (isSafariIos && urls.length > 1) { this.downloadSafariIos(urls) diff --git a/app/javascript/submission_form/form.vue b/app/javascript/submission_form/form.vue index 4468e4948..c1d0d8a1c 100644 --- a/app/javascript/submission_form/form.vue +++ b/app/javascript/submission_form/form.vue @@ -15,7 +15,7 @@ /> 0 && /AppleWebKit/i.test(navigator.userAgent) + + return isMobileSafariIos || /android|iphone|ipad/i.test(navigator.userAgent) + }, + readonlyConditionalFieldValues () { + return this.readonlyConditionalFields.reduce((acc, f) => { + acc[f.uuid] = (this.values[f.uuid] || f.default_value) + + return acc + }, {}) }, attachmentConditionsIndex () { return this.schema.reduce((acc, item) => { @@ -1103,7 +1113,9 @@ export default { this.minimizeForm() } - if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) { + const isMobileSafariIos = 'ontouchstart' in window && navigator.maxTouchPoints > 0 && /AppleWebKit/i.test(navigator.userAgent) + + if (isMobileSafariIos || /iPhone|iPad|iPod/i.test(navigator.userAgent)) { this.$nextTick(() => { const root = this.$root.$el.parentNode.getRootNode() const scrollbox = root.getElementById('scrollbox') diff --git a/app/javascript/submission_form/formula_areas.vue b/app/javascript/submission_form/formula_areas.vue index 51632a0e2..02030e77c 100644 --- a/app/javascript/submission_form/formula_areas.vue +++ b/app/javascript/submission_form/formula_areas.vue @@ -38,6 +38,11 @@ export default { required: false, default: () => [] }, + readonlyValues: { + type: Object, + required: false, + default: () => ({}) + }, values: { type: Object, required: false, @@ -87,7 +92,7 @@ export default { }, calculateFormula (field) { const transformedFormula = field.preferences.formula.replace(/{{(.*?)}}/g, (match, uuid) => { - return this.values[uuid] || 0.0 + return this.readonlyValues[uuid] || this.values[uuid] || 0.0 }) return this.math.evaluate(transformedFormula.toLowerCase()) diff --git a/app/javascript/submission_form/verification_step.vue b/app/javascript/submission_form/verification_step.vue index dff8ac478..59310714d 100644 --- a/app/javascript/submission_form/verification_step.vue +++ b/app/javascript/submission_form/verification_step.vue @@ -125,12 +125,16 @@ export default { async mounted () { this.isLoading = true - Promise.all([ - import('@eid-easy/eideasy-widget'), - this.start() - ]).finally(() => { - this.isLoading = false - }) + if (new URLSearchParams(window.location.search).get('submit') === 'true') { + this.$emit('submit') + } else { + Promise.all([ + import('@eid-easy/eideasy-widget'), + this.start() + ]).finally(() => { + this.isLoading = false + }) + } }, methods: { start () { diff --git a/app/javascript/template_builder/area.vue b/app/javascript/template_builder/area.vue index 61b1a200f..afd6d62c9 100644 --- a/app/javascript/template_builder/area.vue +++ b/app/javascript/template_builder/area.vue @@ -10,7 +10,7 @@
{{ optionIndexText }} {{ (defaultField ? (field.title || field.name) : field.name) || defaultName }} + >{{ optionIndexText }} {{ (defaultField ? (defaultField.title || field.title || field.name) : field.name) || defaultName }}
0 && /AppleWebKit/i.test(navigator.userAgent) + + return isMobileSafariIos || /android|iphone|ipad/i.test(navigator.userAgent) }, defaultDateFormat () { const isUsBrowser = Intl.DateTimeFormat().resolvedOptions().locale.endsWith('-US') @@ -770,13 +774,17 @@ export default { } }) + const defineSubmittersUuids = this.defineSubmitters.map((name) => { + return this.template.submitters.find(e => e.name === name)?.uuid + }) + this.defineSubmitters.forEach((name, index) => { const submitter = (this.template.submitters[index] ||= {}) submitter.name = name || this.submitterDefaultNames[index] - if (existingSubmittersUuids.filter(Boolean).length) { - submitter.uuid = existingSubmittersUuids[index] || submitter.uuid || v4() + if (defineSubmittersUuids.filter(Boolean).length || existingSubmittersUuids.filter(Boolean).length) { + submitter.uuid = defineSubmittersUuids[index] || existingSubmittersUuids[index] || submitter.uuid || v4() } else { submitter.uuid ||= v4() } diff --git a/app/javascript/template_builder/document.vue b/app/javascript/template_builder/document.vue index 33ac6adce..88680e540 100644 --- a/app/javascript/template_builder/document.vue +++ b/app/javascript/template_builder/document.vue @@ -7,6 +7,7 @@ :input-mode="inputMode" :number="index" :editable="editable" + :data-page="index" :areas="areasIndex[index]" :allow-draw="allowDraw" :is-drag="isDrag" diff --git a/app/javascript/template_builder/field.vue b/app/javascript/template_builder/field.vue index b5a38f62a..169f2ae36 100644 --- a/app/javascript/template_builder/field.vue +++ b/app/javascript/template_builder/field.vue @@ -23,7 +23,7 @@ /> {{ submitter.name }} @@ -101,7 +101,7 @@ >