|
|
|
@ -211,7 +211,7 @@
|
|
|
|
@input="updateWrittenSignature"
|
|
|
|
@input="updateWrittenSignature"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<select
|
|
|
|
<select
|
|
|
|
v-if="requireSigningReason && !isOtherReason"
|
|
|
|
v-if="withSigningReason && !isOtherReason"
|
|
|
|
class="select base-input !text-2xl w-full mt-6 text-center"
|
|
|
|
class="select base-input !text-2xl w-full mt-6 text-center"
|
|
|
|
:class="{ 'text-gray-300': !reason }"
|
|
|
|
:class="{ 'text-gray-300': !reason }"
|
|
|
|
required
|
|
|
|
required
|
|
|
|
@ -226,24 +226,37 @@
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{{ t('select_a_reason') }}
|
|
|
|
{{ t('select_a_reason') }}
|
|
|
|
</option>
|
|
|
|
</option>
|
|
|
|
<option
|
|
|
|
<template v-if="field.preferences?.reasons">
|
|
|
|
v-for="(label, option) in defaultReasons"
|
|
|
|
<option
|
|
|
|
:key="option"
|
|
|
|
v-for="option in field.preferences.reasons"
|
|
|
|
:value="option"
|
|
|
|
:key="option"
|
|
|
|
:selected="reason === option"
|
|
|
|
:value="option"
|
|
|
|
class="text-base-content"
|
|
|
|
:selected="reason === option"
|
|
|
|
>
|
|
|
|
class="text-base-content"
|
|
|
|
{{ label }}
|
|
|
|
>
|
|
|
|
</option>
|
|
|
|
{{ option }}
|
|
|
|
<option
|
|
|
|
</option>
|
|
|
|
value="other"
|
|
|
|
</template>
|
|
|
|
class="text-base-content"
|
|
|
|
<template v-else>
|
|
|
|
>
|
|
|
|
<option
|
|
|
|
{{ t('other') }}
|
|
|
|
v-for="(label, option) in defaultReasons"
|
|
|
|
</option>
|
|
|
|
:key="option"
|
|
|
|
|
|
|
|
:value="option"
|
|
|
|
|
|
|
|
:selected="reason === option"
|
|
|
|
|
|
|
|
class="text-base-content"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{{ label }}
|
|
|
|
|
|
|
|
</option>
|
|
|
|
|
|
|
|
<option
|
|
|
|
|
|
|
|
value="other"
|
|
|
|
|
|
|
|
class="text-base-content"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{{ t('other') }}
|
|
|
|
|
|
|
|
</option>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<input
|
|
|
|
<input
|
|
|
|
v-if="requireSigningReason && isOtherReason"
|
|
|
|
v-if="withSigningReason && isOtherReason"
|
|
|
|
class="base-input !text-2xl w-full mt-6"
|
|
|
|
class="base-input !text-2xl w-full mt-6"
|
|
|
|
required
|
|
|
|
required
|
|
|
|
:name="`values[${field.preferences.reason_field_uuid}]`"
|
|
|
|
:name="`values[${field.preferences.reason_field_uuid}]`"
|
|
|
|
@ -253,7 +266,7 @@
|
|
|
|
@input="$emit('update:reason', $event.target.value)"
|
|
|
|
@input="$emit('update:reason', $event.target.value)"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
<input
|
|
|
|
v-if="requireSigningReason"
|
|
|
|
v-if="withSigningReason"
|
|
|
|
hidden
|
|
|
|
hidden
|
|
|
|
name="with_reason"
|
|
|
|
name="with_reason"
|
|
|
|
:value="field.preferences.reason_field_uuid"
|
|
|
|
:value="field.preferences.reason_field_uuid"
|
|
|
|
@ -406,6 +419,9 @@ export default {
|
|
|
|
format () {
|
|
|
|
format () {
|
|
|
|
return this.field.preferences?.format
|
|
|
|
return this.field.preferences?.format
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
withSigningReason () {
|
|
|
|
|
|
|
|
return this.requireSigningReason || this.field.preferences?.reasons?.length
|
|
|
|
|
|
|
|
},
|
|
|
|
defaultReasons () {
|
|
|
|
defaultReasons () {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
[this.t('approved_by')]: this.t('approved'),
|
|
|
|
[this.t('approved_by')]: this.t('approved'),
|
|
|
|
@ -424,10 +440,11 @@ export default {
|
|
|
|
created () {
|
|
|
|
created () {
|
|
|
|
this.isSignatureStarted = !!this.computedPreviousValue
|
|
|
|
this.isSignatureStarted = !!this.computedPreviousValue
|
|
|
|
|
|
|
|
|
|
|
|
if (this.requireSigningReason) {
|
|
|
|
if (this.withSigningReason) {
|
|
|
|
this.field.preferences ||= {}
|
|
|
|
this.field.preferences ||= {}
|
|
|
|
this.field.preferences.reason_field_uuid ||= v4()
|
|
|
|
this.field.preferences.reason_field_uuid ||= v4()
|
|
|
|
this.isOtherReason = this.reason && !this.defaultReasons[this.reason]
|
|
|
|
this.isOtherReason = this.reason && !this.defaultReasons[this.reason] &&
|
|
|
|
|
|
|
|
(!this.field.preferences?.reasons?.length || !this.field.preferences.reasons.includes(this.reason))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async mounted () {
|
|
|
|
async mounted () {
|
|
|
|
|