alert message on missing submitter fields

pull/289/merge
Pete Matsyburka 1 year ago
parent f26bfe9acc
commit 6a31d2c722

@ -1129,6 +1129,15 @@ export default {
e.preventDefault() e.preventDefault()
alert('Please draw fields to prepare the document.') alert('Please draw fields to prepare the document.')
} else {
const submitterWithoutFields =
this.template.submitters.find((submitter) => !this.template.fields.some((f) => f.submitter_uuid === submitter.uuid))
if (submitterWithoutFields) {
e.preventDefault()
alert(`Please add fields for ${submitterWithoutFields.name} to prepare the document or remove the party.`)
}
} }
}, },
onSaveClick () { onSaveClick () {
@ -1142,16 +1151,23 @@ export default {
} }
} }
if (this.template.fields.length) { if (!this.template.fields.length) {
this.isSaving = true
this.save().then(() => {
window.Turbo.visit(`/templates/${this.template.id}`)
}).finally(() => {
this.isSaving = false
})
} else {
alert('Please draw fields to prepare the document.') alert('Please draw fields to prepare the document.')
} else {
const submitterWithoutFields =
this.template.submitters.find((submitter) => !this.template.fields.some((f) => f.submitter_uuid === submitter.uuid))
if (submitterWithoutFields) {
alert(`Please add fields for ${submitterWithoutFields.name} to prepare the document or remove the party.`)
} else {
this.isSaving = true
this.save().then(() => {
window.Turbo.visit(`/templates/${this.template.id}`)
}).finally(() => {
this.isSaving = false
})
}
} }
}, },
scrollToArea (area) { scrollToArea (area) {

Loading…
Cancel
Save