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: {
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;
}
}
}
};