case 4377 FIRST REAL CODE COMMIT SINCE APRIL 2023

This commit is contained in:
2023-11-02 20:40:49 +00:00
parent 2df2ddce69
commit 5ecb3a2071
2 changed files with 44 additions and 13 deletions

View File

@@ -1,13 +1,21 @@
<template> <template>
<div> <div>
<v-text-field <!-- <v-text-field
ref="customerContactName" ref="customerContactName"
dense dense
v-model="value.customerContactName"
v-bind="$attrs" v-bind="$attrs"
prepend-icon="$ayiUsers" prepend-icon="$ayiUsers"
v-on="$listeners" v-on="$listeners"
@click:prepend="fetchContacts" @click:prepend="fetchContacts"
@input="fieldValueChanged('customerContactName')" @input="fieldValueChanged('customerContactName')"
></v-text-field> -->
<v-text-field
dense
v-bind="$attrs"
prepend-icon="$ayiUsers"
v-on="$listeners"
@click:prepend="fetchContacts"
></v-text-field> ></v-text-field>
<!-- ################################################################################--> <!-- ################################################################################-->
@@ -48,10 +56,10 @@
<script> <script>
export default { export default {
props: { props: {
value: { // value: {
default: null, // default: null,
type: Object // type: Object
}, // },
pvm: { pvm: {
default: null, default: null,
type: Object type: Object
@@ -70,15 +78,37 @@ export default {
}; };
}, },
methods: { methods: {
fetchContacts() { async fetchContacts() {
if (this.pvm.obj.customerId == null || this.pvm.obj.customerId == 0) {
return;
}
//get a list of contacts from the server for this customer //get a list of contacts from the server for this customer
//open a dialog to pick one
//if chosen then put it as the value const res = await window.$gz.api.get(
this.openDialog = true; `customer/contact-name-list/${this.pvm.obj.customerId}`
);
if (res.error) {
window.$gz.eventBus.$emit(
"notify-warning",
window.$gz.errorHandler.errorToString(res, this)
);
} else {
this.contacts = res.data;
//open a dialog to pick one
//if chosen then put it as the value
this.openDialog = true;
}
}, },
useSelectedContact() { useSelectedContact() {
this.value.customerContactName = this.selectedContact; this.pvm.obj.customerContactName = this.selectedContact;
this.pvm.formState.dirty = true; this.pvm.formState.dirty = true;
this.pvm.obj.isDirty = true;
// this.$emit("change");
this.openDialog = false; this.openDialog = false;
}, },
fieldValueChanged(ref) { fieldValueChanged(ref) {

View File

@@ -306,9 +306,9 @@
lg="4" lg="4"
xl="3" xl="3"
> >
<gz-wo-contact <GzWoContact
ref="customerContactName" ref="customerContactName"
v-model="value" v-model="value.customerContactName"
:pvm="pvm" :pvm="pvm"
dense dense
:readonly=" :readonly="
@@ -320,7 +320,8 @@
:label="$ay.t('WorkOrderCustomerContactName')" :label="$ay.t('WorkOrderCustomerContactName')"
data-cy="customerContactName" data-cy="customerContactName"
:error-messages="form().serverErrors(this, 'customerContactName')" :error-messages="form().serverErrors(this, 'customerContactName')"
></gz-wo-contact> @input="fieldValueChanged('customerContactName')"
></GzWoContact>
</v-col> </v-col>
<v-col <v-col