re-factor / cleanup

This commit is contained in:
2022-01-11 22:08:38 +00:00
parent e871708b20
commit e0be8a7cfe
251 changed files with 14680 additions and 15693 deletions

View File

@@ -2,17 +2,17 @@
<div>
<v-row>
<v-col
v-if="value.serial != 0 && canEditSerial"
cols="12"
sm="6"
lg="4"
xl="3"
v-if="value.serial != 0 && canEditSerial"
>
<v-text-field
ref="serial"
v-model="value.serial"
:readonly="formState.readOnly"
:label="$ay.t('PMSerialNumber')"
ref="serial"
data-cy="serial"
:rules="[
form().integerValid(this, 'serial'),
@@ -24,13 +24,13 @@
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-pick-list
ref="customerId"
v-model="value.customerId"
:aya-type="$ay.ayt().Customer"
:show-edit-icon="!value.userIsRestrictedType"
v-model="value.customerId"
:readonly="formState.readOnly || value.userIsRestrictedType"
:label="$ay.t('Customer')"
:can-clear="false"
ref="customerId"
data-cy="customerId"
:rules="[form().required(this, 'customerId')]"
:error-messages="form().serverErrors(this, 'customerId')"
@@ -62,25 +62,25 @@
<v-row>
<v-col cols="5">
<v-text-field
ref="repeatInterval"
v-model="value.repeatInterval"
:readonly="formState.readOnly"
:label="$ay.t('RepeatInterval')"
ref="repeatInterval"
data-cy="repeatInterval"
:rules="[form().integerValid(this, 'repeatInterval')]"
:error-messages="form().serverErrors(this, 'repeatInterval')"
@input="fieldValueChanged('repeatInterval')"
type="number"
@input="fieldValueChanged('repeatInterval')"
></v-text-field>
</v-col>
<v-col cols="5">
<v-select
:ref="`repeatUnit`"
v-model="value.repeatUnit"
:items="pvm.selectLists.pmTimeUnits"
item-text="name"
item-value="id"
:readonly="formState.readOnly"
:ref="`repeatUnit`"
data-cy="usertype"
:rules="[form().integerValid(this, `repeatUnit`)]"
:error-messages="form().serverErrors(this, `repeatUnit`)"
@@ -94,27 +94,27 @@
<v-row>
<v-col cols="5">
<v-text-field
ref="generateBeforeInterval"
v-model="value.generateBeforeInterval"
:readonly="formState.readOnly"
:label="$ay.t('GenerateBefore')"
ref="generateBeforeInterval"
data-cy="generateBeforeInterval"
:rules="[form().integerValid(this, 'generateBeforeInterval')]"
:error-messages="
form().serverErrors(this, 'generateBeforeInterval')
"
@input="fieldValueChanged('generateBeforeInterval')"
type="number"
@input="fieldValueChanged('generateBeforeInterval')"
></v-text-field>
</v-col>
<v-col cols="5">
<v-select
:ref="`generateBeforeUnit`"
v-model="value.generateBeforeUnit"
:items="pvm.selectLists.pmTimeUnits"
item-text="name"
item-value="id"
:readonly="formState.readOnly"
:ref="`generateBeforeUnit`"
data-cy="usertype"
:rules="[form().integerValid(this, `generateBeforeUnit`)]"
:error-messages="form().serverErrors(this, `generateBeforeUnit`)"
@@ -126,10 +126,10 @@
<v-col cols="12" sm="6" lg="4" xl="3">
<GZDaysOfWeek
:label="$ay.t('ExcludeDaysOfWeek')"
v-model="value.excludeDaysOfWeek"
:readonly="formState.readOnly"
ref="excludeDaysOfWeek"
v-model="value.excludeDaysOfWeek"
:label="$ay.t('ExcludeDaysOfWeek')"
:readonly="formState.readOnly"
data-cy="excludeDaysOfWeek"
:error-messages="form().serverErrors(this, 'excludeDaysOfWeek')"
@input="fieldValueChanged('excludeDaysOfWeek')"
@@ -138,10 +138,10 @@
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-date-time-picker
:label="$ay.t('PMNextServiceDate')"
v-model="value.nextServiceDate"
:readonly="formState.readOnly"
ref="nextServiceDate"
v-model="value.nextServiceDate"
:label="$ay.t('PMNextServiceDate')"
:readonly="formState.readOnly"
data-cy="nextServiceDate"
:rules="[form().required(this, 'nextServiceDate')]"
:error-messages="form().serverErrors(this, 'nextServiceDate')"
@@ -151,10 +151,10 @@
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-date-time-picker
:label="$ay.t('PMStopGeneratingDate')"
v-model="value.stopGeneratingDate"
:readonly="formState.readOnly"
ref="stopGeneratingDate"
v-model="value.stopGeneratingDate"
:label="$ay.t('PMStopGeneratingDate')"
:readonly="formState.readOnly"
data-cy="stopGeneratingDate"
:error-messages="form().serverErrors(this, 'stopGeneratingDate')"
@input="fieldValueChanged('stopGeneratingDate')"
@@ -169,10 +169,10 @@
xl="3"
>
<v-checkbox
ref="copyWiki"
v-model="value.copyWiki"
:readonly="formState.readOnly"
:label="$ay.t('CopyWiki')"
ref="copyWiki"
data-cy="copyWiki"
:error-messages="form().serverErrors(this, 'copyWiki')"
@change="fieldValueChanged('copyWiki')"
@@ -187,10 +187,10 @@
xl="3"
>
<v-checkbox
ref="copyAttachments"
v-model="value.copyAttachments"
:readonly="formState.readOnly"
:label="$ay.t('CopyAttachments')"
ref="copyAttachments"
data-cy="copyAttachments"
:error-messages="form().serverErrors(this, 'copyAttachments')"
@change="fieldValueChanged('copyAttachments')"
@@ -199,10 +199,10 @@
<v-col cols="12" sm="6" lg="4" xl="3">
<v-checkbox
ref="active"
v-model="value.active"
:readonly="formState.readOnly"
:label="$ay.t('Active')"
ref="active"
data-cy="active"
:error-messages="form().serverErrors(this, 'active')"
@change="fieldValueChanged('active')"
@@ -221,14 +221,14 @@
cols="12"
>
<v-textarea
ref="notes"
v-model="value.notes"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('WorkOrderSummary')"
:error-messages="form().serverErrors(this, 'notes')"
ref="notes"
data-cy="notes"
@input="fieldValueChanged('notes')"
auto-grow
@input="fieldValueChanged('notes')"
></v-textarea>
</v-col>
@@ -246,12 +246,12 @@
xl="3"
>
<gz-pick-list
ref="contractId"
v-model="value.contractId"
:aya-type="$ay.ayt().Contract"
:show-edit-icon="!value.userIsRestrictedType"
v-model="value.contractId"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('Contract')"
ref="contractId"
data-cy="contractId"
:error-messages="form().serverErrors(this, 'contractId')"
@input="fieldValueChanged('contractId')"
@@ -272,12 +272,12 @@
xl="3"
>
<gz-pick-list
ref="projectId"
v-model="value.projectId"
:aya-type="$ay.ayt().Project"
:show-edit-icon="!value.userIsRestrictedType"
v-model="value.projectId"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('Project')"
ref="projectId"
data-cy="projectId"
:error-messages="form().serverErrors(this, 'projectId')"
@input="fieldValueChanged('projectId')"
@@ -292,6 +292,7 @@
xl="3"
>
<v-text-field
ref="customerContactName"
v-model="value.customerContactName"
:readonly="
formState.readOnly ||
@@ -300,7 +301,6 @@
value.userIsSubContractorRestricted
"
:label="$ay.t('WorkOrderCustomerContactName')"
ref="customerContactName"
data-cy="customerContactName"
:error-messages="form().serverErrors(this, 'customerContactName')"
@input="fieldValueChanged('customerContactName')"
@@ -321,10 +321,10 @@
xl="3"
>
<v-text-field
ref="customerReferenceNumber"
v-model="value.customerReferenceNumber"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('WorkOrderCustomerReferenceNumber')"
ref="customerReferenceNumber"
data-cy="customerReferenceNumber"
:error-messages="form().serverErrors(this, 'customerReferenceNumber')"
@input="fieldValueChanged('customerReferenceNumber')"
@@ -345,10 +345,10 @@
xl="3"
>
<v-text-field
ref="internalReferenceNumber"
v-model="value.internalReferenceNumber"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('WorkOrderInternalReferenceNumber')"
ref="internalReferenceNumber"
data-cy="internalReferenceNumber"
:error-messages="form().serverErrors(this, 'internalReferenceNumber')"
@input="fieldValueChanged('internalReferenceNumber')"
@@ -369,10 +369,10 @@
xl="3"
>
<v-checkbox
ref="onsite"
v-model="value.onsite"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('WorkOrderOnsite')"
ref="onsite"
data-cy="onsite"
:error-messages="form().serverErrors(this, 'onsite')"
@change="fieldValueChanged('onsite')"
@@ -390,9 +390,9 @@
cols="12"
>
<gz-tag-picker
ref="tags"
v-model="value.tags"
:readonly="formState.readOnly || value.userIsTechRestricted"
ref="tags"
data-cy="tags"
:error-messages="form().serverErrors(this, 'tags')"
@input="fieldValueChanged('tags')"
@@ -408,12 +408,12 @@
cols="12"
>
<gz-custom-fields
ref="customFields"
v-model="value.customFields"
:form-key="formCustomTemplateKey"
:readonly="formState.readOnly || value.userIsTechRestricted"
:parent-v-m="this"
key-start-with="WorkOrderCustom"
ref="customFields"
data-cy="customFields"
:error-messages="form().serverErrors(this, 'customFields')"
@input="fieldValueChanged('customFields')"
@@ -431,10 +431,10 @@
cols="12"
>
<gz-wiki
:aya-type="pvm.ayaType"
:aya-id="value.id"
ref="wiki"
v-model="value.wiki"
:aya-type="pvm.ayaType"
:aya-id="value.id"
:readonly="formState.readOnly || value.userIsTechRestricted"
@input="fieldValueChanged('wiki')"
></gz-wiki
@@ -468,13 +468,6 @@ export default {
GzWoAddress,
GZDaysOfWeek
},
data() {
return {
canEditSerial: window.$gz.role.hasRole([
window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull
])
};
},
props: {
value: {
@@ -486,6 +479,21 @@ export default {
type: Object
}
},
data() {
return {
canEditSerial: window.$gz.role.hasRole([
window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull
])
};
},
computed: {
formState: function() {
return this.pvm.formState;
},
formCustomTemplateKey: function() {
return this.pvm.formCustomTemplateKey;
}
},
methods: {
form() {
@@ -498,14 +506,6 @@ export default {
window.$gz.form.fieldValueChanged(this.pvm, ref);
}
}
},
computed: {
formState: function() {
return this.pvm.formState;
},
formCustomTemplateKey: function() {
return this.pvm.formCustomTemplateKey;
}
}
};
</script>