This commit is contained in:
2021-04-30 19:05:25 +00:00
parent ae8cf1bacc
commit 2a0b7be75f
4 changed files with 168 additions and 14 deletions

View File

@@ -294,10 +294,13 @@ CURRENTLY DOING: front end full in
Address
- add get route customer/billing-address
returns mailto address of customer or of head office if it has a head office and bill head office is checked
returns mailto address of customer AND of head office if it has a head office and bill head office is checked
{client:{addressfields},headoffice:{addressfields}}
- add get route customer/service-address
returns physical address of customer
{client:{addressfields}}
- add get route unit/service-address
{unit:{addressfields}}
UI
wo address control

View File

@@ -33,11 +33,8 @@ export default {
return window.$gz.form;
},
fieldValueChanged(ref) {
if (
!this.parentVM.formState.loading &&
!this.parentVM.formState.readonly
) {
window.$gz.form.fieldValueChanged(this.parentVM, ref);
if (!this.pvm.formState.loading && !this.pvm.formState.readonly) {
window.$gz.form.fieldValueChanged(this.pvm, ref);
}
}
},

View File

@@ -0,0 +1,147 @@
<template>
<div>
<div class="mb-n2 ml-10">
<span class="text-caption">{{ $ay.t("Address") }}</span>
</div>
<template>
<div class="mb-6 mb-sm-0">
<v-btn icon class="ml-n1 mr-2" @click="openDialog = true">
<v-icon>$ayiEdit</v-icon>
</v-btn>
<p class="text-caption">{{ displayServiceAddress }}</p>
</div>
</template>
</div>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
export default {
data() {
return { openDialog: false };
},
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: {
form() {
return window.$gz.form;
},
fieldValueChanged(ref) {
if (!this.pvm.formState.loading && !this.pvm.formState.readonly) {
window.$gz.form.fieldValueChanged(this.pvm, ref);
}
}
},
computed: {
displayServiceAddress() {
//Address as displayed on workorder form
//as compact as possible
let ret = "";
if (!window.$gz.util.stringIsNullOrEmpty(this.value.address)) {
ret += this.value.address + " ";
}
if (!window.$gz.util.stringIsNullOrEmpty(this.value.city)) {
ret += this.value.city + " ";
}
if (!window.$gz.util.stringIsNullOrEmpty(this.value.region)) {
ret += this.value.region + " ";
}
if (!window.$gz.util.stringIsNullOrEmpty(this.value.country)) {
ret += this.value.country + " ";
}
return ret;
}
}
};
/*
postAddress: null,
postCity: null,
postRegion: null,
postCountry: null,
postCode: null,
address: null,
city: null,
region: null,
country: null,
latitude: null,
longitude: null,
/// <summary>
/// Get complete address as single string for display
/// following US / Canadian postal regulations recommendations:
/// DELIVERY ADDRESS
/// CITY/STATE/ZIP
/// COUNTRY
/// </summary>
public string FullAddress
{
get
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
if(mDeliveryAddress!=null && mDeliveryAddress.Length>0)
{
sb.Append(mDeliveryAddress);
sb.Append(" \r\n");
}
if(mCity!=null && mCity.Length>0)
{
sb.Append(mCity);
sb.Append(" ");
}
if(mStateProv!=null && mStateProv.Length>0)
{
sb.Append(mStateProv);
sb.Append(" ");
}
if(mPostal!=null && mPostal.Length>0)
{
//Postal codes should have two spaces before them according to regs.
sb.Append(" ");
sb.Append(mPostal);
sb.Append(" \r\n");
}
if(mCountry!=null && mCountry.Length>0)
{
sb.Append(mCountry);
}
if(mAddressType==AddressTypes.Physical)
{
if(mLatitude!=0 || mLongitude!=0)
{
sb.Append(" \r\n");
sb.Append(LongitudeToString(mLongitude));
sb.Append(" ");
sb.Append(LatitudeToString(mLatitude));
sb.Append(" \r\n");
}
}
return sb.ToString();
}
}
*/
</script>

View File

@@ -37,13 +37,7 @@
@input="fieldValueChanged('customerId')"
></gz-pick-list>
</v-col>
<v-col
v-if="form().showMe(this, 'ProjectAccountNumber')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<v-col cols="12" sm="6" lg="4" xl="3">
<GzWoState
v-if="pvm.subRights.states.visible"
v-model="value"
@@ -55,6 +49,17 @@
:allowed-states="pvm.selectLists.allowedwostatus"
/>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<GzWoAddress
v-model="value"
:form-key="formCustomTemplateKey"
:readonly="formState.readOnly"
:pvm="pvm"
data-cy="woAddress"
/>
</v-col>
<v-col v-if="form().showMe(this, 'Notes')" cols="12">
<v-textarea
v-model="value.notes"
@@ -75,9 +80,11 @@
/* XXXeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
import GzWoState from "./work-order-state.vue";
import GzWoAddress from "./work-order-address.vue";
export default {
components: {
GzWoState
GzWoState,
GzWoAddress
},
data() {
return {