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

@@ -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>