From 02cf673b77f0788ea0c42a3ded1fc6bfe51ee0e2 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 21 Jun 2021 21:44:55 +0000 Subject: [PATCH] --- .../src/components/work-order-signature.vue | 60 ++++++++++++------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/ayanova/src/components/work-order-signature.vue b/ayanova/src/components/work-order-signature.vue index 53674fb3..fc09bf8d 100644 --- a/ayanova/src/components/work-order-signature.vue +++ b/ayanova/src/components/work-order-signature.vue @@ -79,7 +79,9 @@ export default { sigOption: { penColor: "rgb(0, 0, 0)", backgroundColor: "rgb(245,245,245)" - } + }, + tempSig: null, + tempDate: null }; }, @@ -103,10 +105,8 @@ export default { methods: { showSign() { - //If it's already signed it shoudl be disabled until they click clear otherwise it's ready to sign immediately - //IOW can only view sig dialog, sign or clear, can't reopen and draw more (doesnt' work anyway) - const vm = this; - + this.tempSig = this.imgUrl; + this.tempDate = this.sigDate; this.openDialog = true; }, form() { @@ -118,30 +118,43 @@ export default { console.log("IS EMPTY"); svg = null; } - if (this.variant == "customer") { - this.value.customerSignature = svg; - this.value.customerSignatureCaptured = window.$gz.locale.nowUTC8601String(); - } else { - this.value.techSignature = svg; - this.value.techSignatureCaptured = window.$gz.locale.nowUTC8601String(); - } - + this.setSig(svg); + this.setCaptured(window.$gz.locale.nowUTC8601String()); console.log("SVG size IS ", svg == null ? 0 : svg.length); + this.value.isDirty = true; + this.pvm.formState.dirty = true; + this.$emit("change"); this.openDialog = false; }, + setSig(theSig) { + if (this.variant == "customer") { + this.value.customerSignature = theSig; + } else { + this.value.techSignature = theSig; + } + }, + setCaptured(theDate) { + if (this.variant == "customer") { + this.value.customerSignatureCaptured = theDate; + } else { + this.value.techSignatureCaptured = theDate; + } + }, cancelDialog() { + this.$refs.sigCtrl.fromDataURL(this.tempSig); + this.setSig(this.tempSig); + this.setCaptured(this.tempDate); this.openDialog = false; + this.tempSig = null; + this.tempDate = null; }, erase() { - if (this.variant == "customer") { - this.value.customerSignature = null; - this.value.customerSignatureCaptured = null; - } else { - this.value.techSignature = null; - this.value.techSignatureCaptured = null; - } + this.setSig(null); + this.setCaptured(null); this.$refs.sigCtrl.clear(); + this.value.isDirty = true; + this.pvm.formState.dirty = true; this.$emit("change"); }, fieldValueChanged(ref) { @@ -163,6 +176,13 @@ export default { } else { return null; } + }, + sigDate: function() { + if (this.variant == "customer") { + return this.value.customerSignatureCaptured; + } else { + return this.value.techSignatureCaptured; + } } } };