This commit is contained in:
2021-06-21 21:44:55 +00:00
parent 5913da4ee6
commit 02cf673b77

View File

@@ -79,7 +79,9 @@ export default {
sigOption: { sigOption: {
penColor: "rgb(0, 0, 0)", penColor: "rgb(0, 0, 0)",
backgroundColor: "rgb(245,245,245)" backgroundColor: "rgb(245,245,245)"
} },
tempSig: null,
tempDate: null
}; };
}, },
@@ -103,10 +105,8 @@ export default {
methods: { methods: {
showSign() { showSign() {
//If it's already signed it shoudl be disabled until they click clear otherwise it's ready to sign immediately this.tempSig = this.imgUrl;
//IOW can only view sig dialog, sign or clear, can't reopen and draw more (doesnt' work anyway) this.tempDate = this.sigDate;
const vm = this;
this.openDialog = true; this.openDialog = true;
}, },
form() { form() {
@@ -118,30 +118,43 @@ export default {
console.log("IS EMPTY"); console.log("IS EMPTY");
svg = null; svg = null;
} }
if (this.variant == "customer") { this.setSig(svg);
this.value.customerSignature = svg; this.setCaptured(window.$gz.locale.nowUTC8601String());
this.value.customerSignatureCaptured = window.$gz.locale.nowUTC8601String();
} else {
this.value.techSignature = svg;
this.value.techSignatureCaptured = window.$gz.locale.nowUTC8601String();
}
console.log("SVG size IS ", svg == null ? 0 : svg.length); console.log("SVG size IS ", svg == null ? 0 : svg.length);
this.value.isDirty = true;
this.pvm.formState.dirty = true;
this.$emit("change"); this.$emit("change");
this.openDialog = false; 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() { cancelDialog() {
this.$refs.sigCtrl.fromDataURL(this.tempSig);
this.setSig(this.tempSig);
this.setCaptured(this.tempDate);
this.openDialog = false; this.openDialog = false;
this.tempSig = null;
this.tempDate = null;
}, },
erase() { erase() {
if (this.variant == "customer") { this.setSig(null);
this.value.customerSignature = null; this.setCaptured(null);
this.value.customerSignatureCaptured = null;
} else {
this.value.techSignature = null;
this.value.techSignatureCaptured = null;
}
this.$refs.sigCtrl.clear(); this.$refs.sigCtrl.clear();
this.value.isDirty = true;
this.pvm.formState.dirty = true;
this.$emit("change"); this.$emit("change");
}, },
fieldValueChanged(ref) { fieldValueChanged(ref) {
@@ -163,6 +176,13 @@ export default {
} else { } else {
return null; return null;
} }
},
sigDate: function() {
if (this.variant == "customer") {
return this.value.customerSignatureCaptured;
} else {
return this.value.techSignatureCaptured;
}
} }
} }
}; };