Removed no longer needed contract control due to new update on save process

This commit is contained in:
2021-05-18 19:13:49 +00:00
parent 4dc691e508
commit b13a2fb2ed

View File

@@ -1,132 +0,0 @@
<template>
<div>
<div class="mb-n2 ml-10">
<span class="text-caption">{{ $ay.t("Contract") }}</span>
</div>
<template>
<div class="mb-6 mb-sm-0">
<v-btn icon class="ml-n1 mr-2" @click="initAndOpen()">
<v-icon>$ayiEdit</v-icon>
</v-btn>
<span class="text-h6">{{ value.contractViz }}</span>
</div>
</template>
<v-row justify="center">
<v-dialog v-model="openDialog" max-width="600px">
<v-card>
<v-card-title>
<span class="text-h5">{{ $ay.t("ContractList") }}</span>
</v-card-title>
<v-card-text>
<gz-pick-list
:aya-type="$ay.ayt().Contract"
:show-edit-icon="true"
v-model="value.contractId"
:readonly="readonly"
:label="$ay.t('Contract')"
ref="contractId"
data-cy="contractId"
:error-messages="form().serverErrors(this, 'contractId')"
@input="fieldValueChanged('contractId')"
@update:name="contractChange"
></gz-pick-list>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="cancelDialog()">{{
$ay.t("Cancel")
}}</v-btn>
<v-btn color="blue darken-1" text @click="save()">{{
$ay.t("Save")
}}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
data() {
return {
openDialog: false,
contractIdAtStart: null,
contractNameAtStart: null
};
},
props: {
value: {
default: null,
type: Object
},
pvm: {
default: null,
type: Object
},
formKey: { type: String, default: "" }, //used to grab template from store
readonly: Boolean,
disabled: Boolean
},
methods: {
initAndOpen() {
//if form is dirty don't open, must save first
//Give a prompt for htat and exit, don't call save here because it might result in error
if (this.pvm.formState.dirty) {
window.$gz.eventBus.$emit(
"notify-info",
this.$ay.t("SaveRecordToProceed")
);
return;
} else {
this.contractIdAtStart = this.value.contractId;
this.contractNameAtStart = this.value.contractViz;
this.openDialog = true;
}
},
contractChange(newName) {
this.value.contractViz = newName;
},
form() {
return window.$gz.form;
},
handleEditStateClick: function() {
window.$gz.eventBus.$emit("openobject", {
type: window.$gz.type.Contract,
id: this.value.contractId
});
},
async save() {
await this.pvm.submitNewContract();
this.openDialog = false;
},
cancelDialog() {
this.value.contractId = this.contractIdAtStart;
this.value.contractViz = this.contractNameAtStart;
this.pvm.formState.dirty = false; //this only works because you can't be here and have a dirty form to start with
this.openDialog = false;
},
fieldValueChanged(ref) {
if (!this.pvm.formState.loading && !this.pvm.formState.readonly) {
this.value.isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref);
}
}
},
computed: {
formState: function() {
return this.pvm.formState;
}
}
};
</script>