This commit is contained in:
@@ -219,6 +219,12 @@ export default {
|
||||
params: { recordid: tid.id }
|
||||
});
|
||||
break;
|
||||
case ayatype.Unit:
|
||||
vm.$router.push({
|
||||
name: "unit-edit",
|
||||
params: { recordid: tid.id }
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
window.$gz.eventBus.$emit(
|
||||
|
||||
@@ -13,24 +13,18 @@
|
||||
<v-row>
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="obj.name"
|
||||
v-model="obj.serial"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('UnitName')"
|
||||
:rules="[form().required(this, 'name')]"
|
||||
:error-messages="form().serverErrors(this, 'name')"
|
||||
ref="name"
|
||||
data-cy="name"
|
||||
@input="fieldValueChanged('name')"
|
||||
:label="$ay.t('UnitSerial')"
|
||||
:rules="[form().required(this, 'serial')]"
|
||||
:error-messages="form().serverErrors(this, 'serial')"
|
||||
ref="serial"
|
||||
data-cy="serial"
|
||||
@input="fieldValueChanged('serial')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'Active')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-checkbox
|
||||
v-model="obj.active"
|
||||
:readonly="formState.readOnly"
|
||||
@@ -43,23 +37,200 @@
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'AccountNumber')"
|
||||
v-if="form().showMe(this, 'UnitDescription')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="obj.accountNumber"
|
||||
v-model="obj.description"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('UnitAccountNumber')"
|
||||
ref="accountNumber"
|
||||
data-cy="accountNumber"
|
||||
:error-messages="form().serverErrors(this, 'accountNumber')"
|
||||
@input="fieldValueChanged('accountNumber')"
|
||||
:label="$ay.t('UnitDescription')"
|
||||
ref="description"
|
||||
data-cy="description"
|
||||
:error-messages="form().serverErrors(this, 'description')"
|
||||
@input="fieldValueChanged('description')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'UnitReplacedByUnitID')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<gz-pick-list
|
||||
:ayaType="ayaTypes().Unit"
|
||||
:showEditIcon="true"
|
||||
v-model="obj.replacedByUnitId"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('UnitReplacedByUnitID')"
|
||||
ref="replacedByUnitId"
|
||||
data-cy="replacedByUnitId"
|
||||
:error-messages="
|
||||
form().serverErrors(this, 'replacedByUnitId')
|
||||
"
|
||||
@input="fieldValueChanged('replacedByUnitId')"
|
||||
></gz-pick-list>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'UnitModel')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<gz-pick-list
|
||||
:ayaType="ayaTypes().UnitModel"
|
||||
:showEditIcon="true"
|
||||
v-model="obj.unitModelId"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('UnitModel')"
|
||||
ref="unitModelId"
|
||||
data-cy="unitModelId"
|
||||
:error-messages="form().serverErrors(this, 'unitModelId')"
|
||||
@input="fieldValueChanged('unitModelId')"
|
||||
></gz-pick-list>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'UnitParentUnitID')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<gz-pick-list
|
||||
:ayaType="ayaTypes().Unit"
|
||||
:showEditIcon="true"
|
||||
v-model="obj.parentUnitId"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('UnitParentUnitID')"
|
||||
ref="parentUnitId"
|
||||
data-cy="parentUnitId"
|
||||
:error-messages="form().serverErrors(this, 'parentUnitId')"
|
||||
@input="fieldValueChanged('parentUnitId')"
|
||||
></gz-pick-list>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-checkbox
|
||||
v-model="obj.unitHasOwnAddress"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('UnitUnitHasOwnAddress')"
|
||||
ref="unitHasOwnAddress"
|
||||
data-cy="unitHasOwnAddress"
|
||||
:error-messages="
|
||||
form().serverErrors(this, 'unitHasOwnAddress')
|
||||
"
|
||||
@change="fieldValueChanged('unitHasOwnAddress')"
|
||||
></v-checkbox>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'UsesBanking')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-checkbox
|
||||
v-model="obj.usesBanking"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('UsesBanking')"
|
||||
ref="usesBanking"
|
||||
data-cy="usesBanking"
|
||||
:error-messages="form().serverErrors(this, 'usesBanking')"
|
||||
@change="fieldValueChanged('usesBanking')"
|
||||
>
|
||||
<template v-slot:append v-if="canOpenServiceBank()">
|
||||
<v-btn
|
||||
outlined
|
||||
small
|
||||
color="primary"
|
||||
@click="openServiceBank"
|
||||
class="ml-12"
|
||||
>
|
||||
<v-icon>$ayiCarBattery</v-icon></v-btn
|
||||
>
|
||||
</template>
|
||||
</v-checkbox>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'UnitMetered')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-checkbox
|
||||
v-model="obj.metered"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('UnitMetered')"
|
||||
ref="metered"
|
||||
data-cy="metered"
|
||||
:error-messages="form().serverErrors(this, 'metered')"
|
||||
@change="fieldValueChanged('metered')"
|
||||
>
|
||||
<template v-slot:append v-if="canOpenMeter()">
|
||||
<v-btn
|
||||
outlined
|
||||
small
|
||||
color="primary"
|
||||
@click="openMeter"
|
||||
class="ml-12"
|
||||
>
|
||||
<v-icon>$ayiWeight</v-icon></v-btn
|
||||
>
|
||||
</template>
|
||||
</v-checkbox>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'UnitBoughtHere')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-checkbox
|
||||
v-model="obj.boughtHere"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('UnitBoughtHere')"
|
||||
ref="boughtHere"
|
||||
data-cy="boughtHere"
|
||||
:error-messages="form().serverErrors(this, 'boughtHere')"
|
||||
@change="fieldValueChanged('boughtHere')"
|
||||
></v-checkbox>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'UnitPurchaseFromID')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<gz-pick-list
|
||||
:ayaType="ayaTypes().Vendor"
|
||||
:showEditIcon="true"
|
||||
v-model="obj.purchasedFromVendorId"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('UnitPurchaseFromID')"
|
||||
ref="purchasedFromVendorId"
|
||||
data-cy="purchasedFromVendorId"
|
||||
:error-messages="
|
||||
form().serverErrors(this, 'purchasedFromVendorId')
|
||||
"
|
||||
@input="fieldValueChanged('purchasedFromVendorId')"
|
||||
></gz-pick-list>
|
||||
</v-col>
|
||||
<!-- -------------------------------------------- -->
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'WebAddress')"
|
||||
cols="12"
|
||||
@@ -314,14 +485,7 @@
|
||||
$ay.t("CopyToClipboard")
|
||||
}}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item @click="AddressCopyToPostal">
|
||||
<v-list-item-icon>
|
||||
<v-icon>$ayiClone</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-title>{{
|
||||
$ay.t("AddressCopyToPostal")
|
||||
}}</v-list-item-title>
|
||||
</v-list-item>
|
||||
|
||||
<v-list-item @click="GeoCapture">
|
||||
<v-list-item-icon>
|
||||
<v-icon>$ayiMapMarker</v-icon>
|
||||
@@ -447,129 +611,6 @@
|
||||
:precision="6"
|
||||
></gz-decimal>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-menu offset-y v-if="rights.change">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<span class="text-h6">
|
||||
{{ $ay.t("AddressTypePostal") }}</span
|
||||
><v-btn icon v-bind="attrs" v-on="on">
|
||||
<v-icon small>$ayiEllipsisV</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-item @click="AddressCopyPostalToClipBoard()">
|
||||
<v-list-item-icon>
|
||||
<v-icon>$ayiCopy</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-title>{{
|
||||
$ay.t("CopyToClipboard")
|
||||
}}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item @click="AddressCopyToPhysical">
|
||||
<v-list-item-icon>
|
||||
<v-icon>$ayiClone</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-title>{{
|
||||
$ay.t("AddressCopyToPostal")
|
||||
}}</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<span class="text-h6" v-else>
|
||||
{{ $ay.t("AddressTypePhysical") }}</span
|
||||
>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'PostAddress')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="obj.postAddress"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('AddressPostalDeliveryAddress')"
|
||||
ref="postAddress"
|
||||
data-cy="postAddress"
|
||||
:error-messages="form().serverErrors(this, 'postAddress')"
|
||||
@input="fieldValueChanged('postAddress')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'PostCity')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="obj.postCity"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('AddressPostalCity')"
|
||||
ref="postCity"
|
||||
data-cy="postCity"
|
||||
:error-messages="form().serverErrors(this, 'postCity')"
|
||||
@input="fieldValueChanged('postCity')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'PostRegion')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="obj.postRegion"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('AddressPostalStateProv')"
|
||||
ref="postRegion"
|
||||
data-cy="postRegion"
|
||||
:error-messages="form().serverErrors(this, 'postRegion')"
|
||||
@input="fieldValueChanged('postRegion')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'PostCountry')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="obj.postCountry"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('AddressPostalCountry')"
|
||||
ref="postCountry"
|
||||
data-cy="postCountry"
|
||||
:error-messages="form().serverErrors(this, 'postCountry')"
|
||||
@input="fieldValueChanged('postCountry')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'PostCode')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="obj.postCode"
|
||||
:readonly="formState.readOnly"
|
||||
:label="$ay.t('AddressPostalPostal')"
|
||||
ref="postCode"
|
||||
data-cy="postCode"
|
||||
:error-messages="form().serverErrors(this, 'postCode')"
|
||||
@input="fieldValueChanged('postCode')"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-tab-item>
|
||||
</v-tabs-items>
|
||||
@@ -660,31 +701,77 @@ export default {
|
||||
//IMPORTANT NOTE: Fields that are NON NULLABLE in the schema for the table but *are* hideable **MUST** have a default value set here or else there will be no way to save the record
|
||||
//I.E. Serial, usertype fields, ACTIVE
|
||||
//Also, if it's a non-nullable Enum backed field then it should have a valid selection i.e. not zero if there is no zero
|
||||
/*
|
||||
{
|
||||
"data": {
|
||||
"id": 90979,
|
||||
"concurrency": 2880802,
|
||||
"active": true,
|
||||
"notes": "Autem quia quod beatae reprehenderit et voluptatem aut animi.",
|
||||
"wiki": null,
|
||||
"customFields": null,
|
||||
"tags": [
|
||||
"zone3"
|
||||
],
|
||||
"serial": "00008962",
|
||||
"customerId": 19027,
|
||||
"parentUnitId": null,
|
||||
"unitModelId": 40,
|
||||
"unitHasOwnAddress": true,
|
||||
"boughtHere": true,
|
||||
"purchasedFromVendorId": null,
|
||||
"receipt": "376373",
|
||||
"purchasedDate": "2012-04-09T04:26:32.454688Z",
|
||||
"description": "Intelligent Metal Shirt",
|
||||
"replacedByUnitId": null,
|
||||
"overrideModelWarranty": false,
|
||||
"warrantyLength": null,
|
||||
"warrantyTerms": null,
|
||||
"usesBanking": false,
|
||||
"metered": false,
|
||||
"lifeTimeWarranty": false,
|
||||
"text1": null,
|
||||
"text2": null,
|
||||
"text3": null,
|
||||
"text4": null,
|
||||
"address": "453 Isabelle Alley",
|
||||
"city": "Douglasshire",
|
||||
"region": "California",
|
||||
"country": "Saint Lucia",
|
||||
"latitude": -22.1701,
|
||||
"longitude": 167.3475
|
||||
}
|
||||
}
|
||||
*/
|
||||
{
|
||||
id: 0,
|
||||
concurrency: 0,
|
||||
name: null,
|
||||
serial: null,
|
||||
active: true,
|
||||
notes: null,
|
||||
wiki: null,
|
||||
customFields: "{}",
|
||||
tags: [],
|
||||
webAddress: null,
|
||||
popUpNotes: null,
|
||||
contactNotes: null,
|
||||
contact: null,
|
||||
accountNumber: null,
|
||||
phone1: null,
|
||||
phone2: null,
|
||||
phone3: null,
|
||||
phone4: null,
|
||||
phone5: null,
|
||||
emailAddress: null,
|
||||
postAddress: null,
|
||||
postCity: null,
|
||||
postRegion: null,
|
||||
postCountry: null,
|
||||
postCode: null,
|
||||
customerId: null,
|
||||
parentUnitId: null,
|
||||
unitModelId: null,
|
||||
unitHasOwnAddress: null,
|
||||
boughtHere: null,
|
||||
purchasedFromVendorId: null,
|
||||
receipt: null,
|
||||
purchasedDate: null,
|
||||
description: null,
|
||||
replacedByUnitId: null,
|
||||
overrideModelWarranty: null,
|
||||
warrantyLength: null,
|
||||
warrantyTerms: null,
|
||||
usesBanking: null,
|
||||
metered: null,
|
||||
lifeTimeWarranty: null,
|
||||
text1: null,
|
||||
text2: null,
|
||||
text3: null,
|
||||
text4: null,
|
||||
address: null,
|
||||
city: null,
|
||||
region: null,
|
||||
@@ -742,6 +829,34 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
canOpenServiceBank: function() {
|
||||
return this.obj.usesBanking == true && this.$route.params.recordid != 0;
|
||||
},
|
||||
openServiceBank: function() {
|
||||
if (this.canOpenServiceBank()) {
|
||||
this.$router.push({
|
||||
name: "service-banks",
|
||||
params: {
|
||||
objectType: window.$gz.type.Unit,
|
||||
objectId: this.$route.params.recordid
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
canOpenMeter: function() {
|
||||
return this.obj.usesBanking == true && this.$route.params.recordid != 0;
|
||||
},
|
||||
openMeter: function() {
|
||||
if (this.canOpenMeter()) {
|
||||
this.$router.push({
|
||||
name: "meter-readings",
|
||||
params: {
|
||||
objectType: window.$gz.type.Unit,
|
||||
objectId: this.$route.params.recordid
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
canSave: function() {
|
||||
return this.formState.valid && this.formState.dirty;
|
||||
},
|
||||
@@ -1210,29 +1325,30 @@ async function initForm(vm) {
|
||||
async function fetchTranslatedText(vm) {
|
||||
await window.$gz.translation.cacheTranslations([
|
||||
"Unit",
|
||||
"UnitName",
|
||||
"UnitSerial",
|
||||
"UnitNotes",
|
||||
"WebAddress",
|
||||
"UnitPopUpNotes",
|
||||
"UnitAccountNumber",
|
||||
"UnitContact",
|
||||
"UnitContactNotes",
|
||||
"UnitPhone1",
|
||||
"UnitPhone2",
|
||||
"UnitPhone3",
|
||||
"UnitPhone4",
|
||||
"UnitPhone5",
|
||||
"UnitEmail",
|
||||
"Customer",
|
||||
"UnitParentUnitID",
|
||||
"UnitModel",
|
||||
"UnitUnitHasOwnAddress",
|
||||
"UnitBoughtHere",
|
||||
"UnitPurchaseFromID",
|
||||
"UnitReceipt",
|
||||
"UnitPurchasedDate",
|
||||
"UnitDescription",
|
||||
"UnitReplacedByUnitID",
|
||||
"UnitOverrideWarranty",
|
||||
"UnitOverrideLength",
|
||||
"UnitOverrideWarrantyTerms",
|
||||
"UsesBanking",
|
||||
"UnitMetered",
|
||||
"UnitOverrideLifeTime",
|
||||
"UnitText1",
|
||||
"UnitText2",
|
||||
"UnitText3",
|
||||
"UnitText4",
|
||||
"AddressTypePhysical",
|
||||
"AddressTypePostal",
|
||||
"AddressCopyToPostal",
|
||||
"AddressCopyToPhysical",
|
||||
"Address",
|
||||
"AddressPostalDeliveryAddress",
|
||||
"AddressPostalCity",
|
||||
"AddressPostalStateProv",
|
||||
"AddressPostalCountry",
|
||||
"AddressPostalPostal",
|
||||
"AddressDeliveryAddress",
|
||||
"AddressCity",
|
||||
"AddressStateProv",
|
||||
|
||||
Reference in New Issue
Block a user