This commit is contained in:
2021-07-14 22:46:48 +00:00
parent 64687ae222
commit 0c4aa5a92d
4 changed files with 197 additions and 76 deletions

View File

@@ -426,22 +426,23 @@ CURRENTLY DOING:
tasks:
Modify client to now show and / or prevent restricted actions
Maybe just mirror the UserIs* flags from server at client (or bring them with the work order for reporting dual usage as well??)
that way can consult the same basic fields and it's easier to remember and grok down the road
Modify client to not show and / or prevent restricted actions
Hide sections / fields as required
Test again and ensure it looks correct and works correct for each role
Test each of the three restricted roles and one full role
UserIsRestrictedType
UserIsTechRestricted
UserIsSubContractorFull
UserIsSubContractorRestricted
UserCanViewPartCosts
UserCanViewLaborOrTravelRateCosts
UserCanViewLoanerCosts
value.userIsRestrictedType
value.userIsTechRestricted
value.userIsSubContractorFull
value.userIsSubContractorRestricted
value.userCanViewPartCosts
value.userCanViewLaborOrTravelRateCosts
value.userCanViewLoanerCosts
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
@@ -461,6 +462,17 @@ Subcontractor / tech limited modifications
todo: units on work order are not limited to customer on work order??
todo: Status on work order doesn't seem to be preventing "Who can select" by role properly
Make it not present status that are not supposed to be available
put a back end rule in validation to prevent it as well
Also, the seeded data roles are really fucked up and include some dubious roles and needs to also have some for tech - restricted specfically
i.e. they need to be logically correct as to what roles can select
TODO 1: Test address / units select alternate when have units working
TODO 2: //MIGRATE_OUTSTANDING comment tag

View File

@@ -20,7 +20,7 @@
<v-card-text>
<v-row>
<v-col cols="12">
<v-menu offset-y v-if="!formState.readOnly">
<v-menu offset-y v-if="!readonly">
<template v-slot:activator="{ on, attrs }">
<span class="text-h6">
{{ $ay.t("AddressTypePhysical") }}</span
@@ -74,7 +74,7 @@
>
<v-text-field
v-model="value.address"
:readonly="formState.readOnly"
:readonly="readonly"
:label="$ay.t('AddressDeliveryAddress')"
ref="address"
data-cy="address"
@@ -92,7 +92,7 @@
>
<v-text-field
v-model="value.city"
:readonly="formState.readOnly"
:readonly="readonly"
:label="$ay.t('AddressCity')"
ref="city"
data-cy="city"
@@ -110,7 +110,7 @@
>
<v-text-field
v-model="value.region"
:readonly="formState.readOnly"
:readonly="readonly"
:label="$ay.t('AddressStateProv')"
ref="region"
data-cy="region"
@@ -128,7 +128,7 @@
>
<v-text-field
v-model="value.country"
:readonly="formState.readOnly"
:readonly="readonly"
:label="$ay.t('AddressCountry')"
ref="country"
data-cy="country"
@@ -146,7 +146,7 @@
>
<gz-decimal
v-model="value.latitude"
:readonly="formState.readOnly"
:readonly="readonly"
:label="$ay.t('AddressLatitude')"
ref="latitude"
data-cy="latitude"
@@ -166,7 +166,7 @@
>
<gz-decimal
v-model="value.longitude"
:readonly="formState.readOnly"
:readonly="readonly"
:label="$ay.t('AddressLongitude')"
ref="longitude"
data-cy="longitude"
@@ -178,7 +178,7 @@
</v-col>
<v-col cols="12">
<v-menu offset-y v-if="!formState.readOnly">
<v-menu offset-y v-if="!readonly">
<template v-slot:activator="{ on, attrs }">
<span class="text-h6">
{{ $ay.t("AddressTypePostal") }}</span
@@ -225,7 +225,7 @@
>
<v-text-field
v-model="value.postAddress"
:readonly="formState.readOnly"
:readonly="readonly"
:label="$ay.t('AddressPostalDeliveryAddress')"
ref="postAddress"
data-cy="postAddress"
@@ -243,7 +243,7 @@
>
<v-text-field
v-model="value.postCity"
:readonly="formState.readOnly"
:readonly="readonly"
:label="$ay.t('AddressPostalCity')"
ref="postCity"
data-cy="postCity"
@@ -261,7 +261,7 @@
>
<v-text-field
v-model="value.postRegion"
:readonly="formState.readOnly"
:readonly="readonly"
:label="$ay.t('AddressPostalStateProv')"
ref="postRegion"
data-cy="postRegion"
@@ -279,7 +279,7 @@
>
<v-text-field
v-model="value.postCountry"
:readonly="formState.readOnly"
:readonly="readonly"
:label="$ay.t('AddressPostalCountry')"
ref="postCountry"
data-cy="postCountry"
@@ -297,7 +297,7 @@
>
<v-text-field
v-model="value.postCode"
:readonly="formState.readOnly"
:readonly="readonly"
:label="$ay.t('AddressPostalPostal')"
ref="postCode"
data-cy="postCode"

View File

@@ -1,5 +1,14 @@
<template>
<div>
{{
{
isRestrictedType: value.userIsRestrictedType,
isTechRestricted: value.userIsTechRestricted,
subfull: value.userIsSubContractorFull,
subRestricted: value.userIsSubContractorRestricted
}
}}
<v-row>
<v-col
cols="12"
@@ -25,9 +34,9 @@
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-pick-list
:aya-type="$ay.ayt().Customer"
:show-edit-icon="true"
:show-edit-icon="!value.userIsRestrictedType"
v-model="value.customerId"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsRestrictedType"
:label="$ay.t('Customer')"
:can-clear="false"
ref="customerId"
@@ -38,7 +47,13 @@
></gz-pick-list>
</v-col>
<v-col
v-if="form().showMe(this, 'CustomerSignature')"
v-if="
form().showMe(this, 'CustomerSignature') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
@@ -47,7 +62,7 @@
<GzWoSignature
v-model="value"
:form-key="formCustomTemplateKey"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
:pvm="pvm"
variant="customer"
data-cy="customerSignature"
@@ -57,7 +72,11 @@
<GzWoState
v-if="
pvm.subRights.states.visible &&
form().showMe(this, 'WorkOrderStatus')
form().showMe(this, 'WorkOrderStatus') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
v-model="value"
:form-key="formCustomTemplateKey"
@@ -71,17 +90,26 @@
<v-col cols="12" sm="6" lg="4" xl="3">
<GzWoAddress
v-if="form().showMe(this, 'Address')"
v-if="
form().showMe(this, 'Address') &&
!value.userIsSubContractorRestricted
"
v-model="value"
:form-key="formCustomTemplateKey"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsRestrictedType"
:pvm="pvm"
data-cy="woAddress"
/>
</v-col>
<v-col
v-if="form().showMe(this, 'TechSignature')"
v-if="
form().showMe(this, 'TechSignature') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
@@ -90,17 +118,26 @@
<GzWoSignature
v-model="value"
:form-key="formCustomTemplateKey"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
:pvm="pvm"
variant="tech"
data-cy="techSignature"
/>
</v-col>
<v-col v-if="form().showMe(this, 'WorkOrderSummary')" cols="12">
<v-col
v-if="
form().showMe(this, 'WorkOrderSummary') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
>
<v-textarea
v-model="value.notes"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('WorkOrderSummary')"
:error-messages="form().serverErrors(this, 'notes')"
ref="notes"
@@ -111,7 +148,13 @@
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderCloseByDate')"
v-if="
form().showMe(this, 'WorkOrderCloseByDate') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
@@ -120,7 +163,7 @@
<gz-date-time-picker
:label="$ay.t('WorkOrderCloseByDate')"
v-model="value.completeByDate"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
ref="completeByDate"
data-cy="completeByDate"
:error-messages="form().serverErrors(this, 'completeByDate')"
@@ -128,25 +171,14 @@
></gz-date-time-picker>
</v-col>
<!-- <v-col
v-if="form().showMe(this, 'Contract')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<GzWoContract
v-if="form().showMe(this, 'Contract')"
v-model="value"
:form-key="formCustomTemplateKey"
:readonly="formState.readOnly"
:pvm="pvm"
data-cy="woContract"
/>
</v-col> -->
<v-col
v-if="form().showMe(this, 'Contract')"
v-if="
form().showMe(this, 'Contract') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
@@ -156,7 +188,7 @@
:aya-type="$ay.ayt().Contract"
:show-edit-icon="true"
v-model="value.contractId"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('Contract')"
ref="contractId"
data-cy="contractId"
@@ -166,7 +198,13 @@
</v-col>
<v-col
v-if="form().showMe(this, 'Project')"
v-if="
form().showMe(this, 'Project') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
@@ -176,7 +214,7 @@
:aya-type="$ay.ayt().Project"
:show-edit-icon="true"
v-model="value.projectId"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('Project')"
ref="projectId"
data-cy="projectId"
@@ -186,7 +224,13 @@
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderInvoiceNumber')"
v-if="
form().showMe(this, 'WorkOrderInvoiceNumber') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
@@ -194,7 +238,7 @@
>
<v-text-field
v-model="value.invoiceNumber"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('WorkOrderInvoiceNumber')"
ref="invoiceNumber"
data-cy="invoiceNumber"
@@ -204,7 +248,13 @@
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderServiceDate')"
v-if="
form().showMe(this, 'WorkOrderServiceDate') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
@@ -213,7 +263,7 @@
<gz-date-time-picker
:label="$ay.t('WorkOrderServiceDate')"
v-model="value.serviceDate"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
ref="serviceDate"
data-cy="serviceDate"
:error-messages="form().serverErrors(this, 'serviceDate')"
@@ -230,7 +280,12 @@
>
<v-text-field
v-model="value.customerContactName"
:readonly="formState.readOnly"
:readonly="
formState.readOnly ||
value.userIsTechRestricted ||
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
"
:label="$ay.t('WorkOrderCustomerContactName')"
ref="customerContactName"
data-cy="customerContactName"
@@ -240,7 +295,13 @@
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderCustomerReferenceNumber')"
v-if="
form().showMe(this, 'WorkOrderCustomerReferenceNumber') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
@@ -248,7 +309,7 @@
>
<v-text-field
v-model="value.customerReferenceNumber"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('WorkOrderCustomerReferenceNumber')"
ref="customerReferenceNumber"
data-cy="customerReferenceNumber"
@@ -258,7 +319,13 @@
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderInternalReferenceNumber')"
v-if="
form().showMe(this, 'WorkOrderInternalReferenceNumber') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
@@ -266,7 +333,7 @@
>
<v-text-field
v-model="value.internalReferenceNumber"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('WorkOrderInternalReferenceNumber')"
ref="internalReferenceNumber"
data-cy="internalReferenceNumber"
@@ -276,7 +343,13 @@
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderOnsite')"
v-if="
form().showMe(this, 'WorkOrderOnsite') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
sm="6"
lg="4"
@@ -284,7 +357,7 @@
>
<v-checkbox
v-model="value.onsite"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
:label="$ay.t('WorkOrderOnsite')"
ref="onsite"
data-cy="onsite"
@@ -293,10 +366,19 @@
></v-checkbox>
</v-col>
<v-col v-if="form().showMe(this, 'Tags')" cols="12">
<v-col
v-if="
form().showMe(this, 'Tags') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
>
<gz-tag-picker
v-model="value.tags"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
ref="tags"
data-cy="tags"
:error-messages="form().serverErrors(this, 'tags')"
@@ -304,11 +386,18 @@
></gz-tag-picker>
</v-col>
<v-col cols="12">
<v-col
v-if="
!(
value.userIsSubContractorFull || value.userIsSubContractorRestricted
)
"
cols="12"
>
<gz-custom-fields
v-model="value.customFields"
:form-key="formCustomTemplateKey"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
:parent-v-m="this"
key-start-with="WorkOrderCustom"
ref="customFields"
@@ -318,20 +407,39 @@
></gz-custom-fields>
</v-col>
<v-col v-if="form().showMe(this, 'Wiki')" cols="12">
<v-col
v-if="
form().showMe(this, 'Wiki') &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
>
<gz-wiki
:aya-type="pvm.ayaType"
:aya-id="value.id"
ref="wiki"
v-model="value.wiki"
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
@input="fieldValueChanged('wiki')"
></gz-wiki
></v-col>
<v-col v-if="form().showMe(this, 'Attachments') && value.id" cols="12">
<v-col
v-if="
form().showMe(this, 'Attachments') &&
value.id &&
!(
value.userIsSubContractorFull ||
value.userIsSubContractorRestricted
)
"
cols="12"
>
<gz-attachments
:readonly="formState.readOnly"
:readonly="formState.readOnly || value.userIsTechRestricted"
:aya-type="pvm.ayaType"
:aya-id="value.id"
></gz-attachments

View File

@@ -152,6 +152,7 @@ export default {
methods: {
showSign() {
if (this.readonly) return;
this.tempSig = this.imgUrl;
this.tempDate = this.sigDate;
this.tempName = this.sigName;