This commit is contained in:
2021-06-21 20:09:31 +00:00
parent 2d3797e6cd
commit 8f99ce1b2f

View File

@@ -8,9 +8,9 @@
</div> </div>
<template> <template>
<div class="mb-6 mb-sm-0" @click="openDialog = true"> <div class="mb-6 mb-sm-0" @click="showSign()">
<v-row> <v-row>
<v-btn icon class="ml-n1 mr-2" @click="openDialog = true"> <v-btn icon class="ml-n1 mr-2">
<v-icon>$ayiEdit</v-icon> <v-icon>$ayiEdit</v-icon>
</v-btn> </v-btn>
<img class="grey lighten-5" height="40px" :src="imgUrl" /> <img class="grey lighten-5" height="40px" :src="imgUrl" />
@@ -25,22 +25,12 @@
<span class="text-h5">{{ $ay.t("Signaturehere") }}</span> <span class="text-h5">{{ $ay.t("Signaturehere") }}</span>
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<template v-if="$vuetify.breakpoint.smAndUp"> <vueSignature
<!-- WIDE VIEW --> ref="sigCtrl"
<vueSignature :sig-option="sigOption"
ref="sigCtrl" :disabled="disabled || imgUrl != null"
:sig-option="sigOption" :default-url="imgUrl"
:disabled="disabled" ></vueSignature>
></vueSignature>
</template>
<template v-else>
<!-- NARROW VIEW -->
<vueSignature
ref="sigCtrl"
:sig-option="sigOption"
:disabled="disabled"
></vueSignature>
</template>
<template> <template>
<div class="mt-8"> <div class="mt-8">
@@ -74,6 +64,7 @@ export default {
components: { components: {
vueSignature vueSignature
}, },
data() { data() {
return { return {
selectedStatus: null, selectedStatus: null,
@@ -104,17 +95,31 @@ export default {
}, },
methods: { 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.openDialog = true;
},
form() { form() {
return window.$gz.form; return window.$gz.form;
}, },
save() { save() {
let svg = this.$refs.sigCtrl.save("image/svg+xml"); let svg = this.$refs.sigCtrl.save("image/svg+xml");
if (this.$refs.sigCtrl.isEmpty()) {
console.log("IS EMPTY");
svg = null;
}
if (this.variant == "customer") { if (this.variant == "customer") {
this.value.customerSignature = svg; this.value.customerSignature = svg;
this.value.customerSignatureCaptured = window.$gz.locale.nowUTC8601String();
} else { } else {
this.value.techSignature = svg; this.value.techSignature = svg;
this.value.techSignatureCaptured = window.$gz.locale.nowUTC8601String();
} }
console.log("SVG size IS ", svg == null ? 0 : svg.length);
this.$emit("change"); this.$emit("change");
this.openDialog = false; this.openDialog = false;
}, },
@@ -122,8 +127,15 @@ export default {
this.openDialog = false; this.openDialog = false;
}, },
erase() { erase() {
this.selectedStatus = null; if (this.variant == "customer") {
this.openDialog = false; this.value.customerSignature = null;
this.value.customerSignatureCaptured = null;
} else {
this.value.techSignature = null;
this.value.techSignatureCaptured = null;
}
this.$refs.sigCtrl.clear();
this.$emit("change");
}, },
fieldValueChanged(ref) { fieldValueChanged(ref) {
if (!this.pvm.formState.loading && !this.pvm.formState.readonly) { if (!this.pvm.formState.loading && !this.pvm.formState.readonly) {