Show prefill date in pdf and view

pull/150/merge^2
iozeey 2 years ago
parent ae570b3e31
commit fece0825f8

@ -300,8 +300,7 @@ export default {
data () {
return {
textOverflowChars: 0,
showLocalText: '',
showLocalDate: ''
showLocalText: ''
}
},
computed: {
@ -393,9 +392,8 @@ export default {
}
},
getFormattedDate () {
if (this.field.type === 'my_date' && this.showLocalDate) {
console.log('date returned ___-----', new Intl.DateTimeFormat([], { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' }).format(new Date(this.showLocalDate)))
return new Intl.DateTimeFormat([], { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' }).format(new Date(this.showLocalDate))
if (this.field.type === 'my_date' && this.templateValues[this.field.uuid]) {
return new Intl.DateTimeFormat([], { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' }).format(new Date(this.templateValues[this.field.uuid]))
} else {
return ''
}
@ -435,15 +433,6 @@ export default {
}
}
if (this.field.type === 'my_date') {
const fieldUuid = this.field.uuid
if (this.templateValues && this.templateValues[fieldUuid]) {
this.showLocalDate = this.templateValues[fieldUuid]
} else {
this.showLocalDate = ''
}
}
if (this.field.type === 'text' && this.$refs.textContainer) {
this.$nextTick(() => {
this.textOverflowChars = this.$refs.textContainer.scrollHeight > this.$refs.textContainer.clientHeight ? this.modelValue.length : 0

@ -66,7 +66,7 @@
@focus="$refs.areas.scrollIntoField(currentField)"
/>
</div>
<div v-if="['my_text', 'my_signature', 'my_initials'].includes(currentField.type)">
<div v-if="['my_text', 'my_signature', 'my_initials', 'my_date'].includes(currentField.type)">
<!-- do nothing on this side just chill for now -->
</div>
<DateStep
@ -692,7 +692,7 @@ export default {
stepPromise().then(async () => {
const emptyRequiredField = this.stepFields.find((fields, index) => {
if (['redact', 'my_text', 'my_signature', 'my_initials'].includes(fields[0].type)) {
if (['redact', 'my_text', 'my_signature', 'my_initials', 'my_date'].includes(fields[0].type)) {
fields[0].required = 'false'
return false
} else {

@ -39,7 +39,7 @@
@pointerdown.stop
>
<FieldSubmitter
v-if="!['my_text', 'my_signature', 'my_initials'].includes(field.type)"
v-if="!['my_text', 'my_signature', 'my_initials', 'my_date'].includes(field.type)"
v-model="field.submitter_uuid"
class="border-r"
:compact="true"
@ -50,7 +50,7 @@
@click="selectedAreaRef.value = area"
/>
<FieldType
v-if="!['my_text', 'my_signature', 'my_initials'].includes(field.type)"
v-if="!['my_text', 'my_signature', 'my_initials', 'my_date'].includes(field.type)"
v-model="field.type"
:button-width="27"
:editable="editable"
@ -70,7 +70,7 @@
@blur="onNameBlur"
>{{ optionIndexText }} {{ field.name || defaultName }}</span>
<div
v-if="isNameFocus && !['checkbox', 'phone', 'redact', 'my_text', 'my_signature', 'my_initials'].includes(field.type)"
v-if="isNameFocus && !['checkbox', 'phone', 'redact', 'my_text', 'my_signature', 'my_initials', 'my_date'].includes(field.type)"
class="flex items-center ml-1.5"
>
<input

@ -453,7 +453,7 @@ export default {
submitter_uuid: this.selectedSubmitter.uuid,
type
}
if (['redact', 'my_text', 'my_signature', 'my_initials'].includes(type)) {
if (['redact', 'my_text', 'my_signature', 'my_initials', 'my_date'].includes(type)) {
field.required = 'false'
}
if (['select', 'multiple', 'radio'].includes(type)) {
@ -631,7 +631,7 @@ export default {
...this.dragField
}
if (['redact', 'my_text', 'my_signature', 'my_initials'].includes(field.type)) {
if (['redact', 'my_text', 'my_signature', 'my_initials', 'my_date'].includes(field.type)) {
field.required = 'false'
}
if (['select', 'multiple', 'radio'].includes(field.type)) {

@ -164,7 +164,7 @@
Draw New Area
</a>
</li>
<li v-if="field.areas?.length === 1 && ['date', 'signature', 'initials', 'text', 'cells', 'my_text', 'redact', 'my_signature', 'my_initials'].includes(field.type)">
<li v-if="field.areas?.length === 1 && ['date', 'signature', 'initials', 'text', 'cells', 'my_text', 'redact', 'my_signature', 'my_initials', 'my_date'].includes(field.type)">
<a
href="#"
class="text-sm py-1 px-2"

@ -292,7 +292,7 @@ export default {
submitter_uuid: this.selectedSubmitter.uuid,
type
}
if (['redact', 'my_text', 'my_signature', 'my_initials'].includes(type)) {
if (['redact', 'my_text', 'my_signature', 'my_initials', 'my_date'].includes(type)) {
field.required = 'false'
}
if (['select', 'multiple', 'radio'].includes(type)) {

@ -34,6 +34,10 @@
<div class="flex items-center px-0.5">
<%= l(Date.parse(value), format: :long, locale: local_assigns[:locale]) %>
</div>
<% elsif field['type'] == 'my_date' %>
<div class="flex items-center px-0.5">
<%= l(Date.parse(value), format: :long, locale: local_assigns[:locale]) %>
</div>
<% elsif field['type'] == 'redact' %>
<div class="flex absolute" style="width: 100%; height: 100%;" :style="{ backgroundColor: 'black' }"></div>
<% elsif field['type'] == 'my_text' %>

@ -59,7 +59,7 @@
<%= render 'submissions/annotation', annot: %>
<% end %>
<% fields_index.dig(document.uuid, index)&.each do |(area, field)| %>
<% if ['my_text', 'my_signature', 'my_initials'].include?(field['type']) %>
<% if ['my_text', 'my_signature', 'my_initials', 'my_date'].include?(field['type']) %>
<% value = @submission.template.values[field['uuid']] %>
<% else %>
<% value = values[field['uuid']] %>

@ -33,7 +33,7 @@ module Submissions
pdfs_index = build_pdfs_index(submitter)
submitter.submission.template_fields.each do |field|
unless ['my_text', 'my_signature', 'my_initials'].include?(field['type'])
unless ['my_text', 'my_signature', 'my_initials', 'my_date'].include?(field['type'])
next if field['submitter_uuid'] != submitter.uuid
end
field.fetch('areas', []).each do |area|
@ -205,7 +205,7 @@ module Submissions
layouter_my_text.fit([text_my_text], w, height_diff_my_text.positive? ? box_height_my_text : h)
.draw(canvas, x + TEXT_LEFT_MARGIN, y - height_diff_my_text + 17)
else
value = I18n.l(Date.parse(value), format: :default, locale: account.locale) if field['type'] == 'date'
value = I18n.l(Date.parse(value), format: :default, locale: account.locale) if field['type'] == 'date'|| field['type'] == 'my_date'
text = HexaPDF::Layout::TextFragment.create(Array.wrap(value).join(', '), font: pdf.fonts.add(FONT_NAME),
font_size:)

Loading…
Cancel
Save