This commit is contained in:
2020-12-22 00:03:53 +00:00
parent cba9705974
commit a4b89671b4
2 changed files with 115 additions and 20 deletions

View File

@@ -9,6 +9,8 @@ todo: date picker component add drop down quick pick:
i.e. Hour from now, Day from now, Week from now, Month from now. i.e. Hour from now, Day from now, Week from now, Month from now.
todo: date and time defaults for appointments and shit todo: date and time defaults for appointments and shit
mainly what to do with stop date for example in reminder, can set start, how to set stop? mainly what to do with stop date for example in reminder, can set start, how to set stop?
todo: datetime picker read only mode is grayed out, should not be?
probably still setting both readonly and disabled like old times
todo: incorrect creds on login get "res is not defined" instead of proper error todo: incorrect creds on login get "res is not defined" instead of proper error
todo: vendor edit form has locale keys from headoffice, check all recent, may be more, memo etc todo: vendor edit form has locale keys from headoffice, check all recent, may be more, memo etc

View File

@@ -5,10 +5,61 @@
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error> <gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
<v-form ref="form"> <v-form ref="form">
<v-row> <v-row>
<v-col
v-if="
form().showMe(this, 'ReviewUserId') && currentUserIsASupervisor
"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-pick-list
:ayaType="ayaTypes().User"
:variant="'inside'"
:showEditIcon="true"
:allowNoSelection="false"
:canClear="false"
v-model="obj.userId"
:readonly="formState.readOnly"
:label="$ay.t('ReviewUserId')"
ref="userId"
data-cy="userId"
:error-messages="form().serverErrors(this, 'userId')"
@input="fieldValueChanged('userId')"
></gz-pick-list>
</v-col>
<v-col
v-if="
form().showMe(this, 'ReviewAssignedByUserId') &&
(selfAssigned || currentUserIsASupervisor)
"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-pick-list
:ayaType="ayaTypes().User"
:variant="'inside'"
:showEditIcon="true"
v-model="obj.assignedByUserId"
readonly
:label="$ay.t('ReviewAssignedByUserId')"
ref="assignedByUserId"
data-cy="assignedByUserId"
:error-messages="form().serverErrors(this, 'assignedByUserId')"
@input="fieldValueChanged('assignedByUserId')"
></gz-pick-list>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3"> <v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field <v-text-field
v-model="obj.name" v-model="obj.name"
:readonly="formState.readOnly" :readonly="
formState.readOnly ||
(!selfAssigned && !currentUserIsASupervisor)
"
:label="$ay.t('ReviewName')" :label="$ay.t('ReviewName')"
:rules="[form().required(this, 'name')]" :rules="[form().required(this, 'name')]"
:error-messages="form().serverErrors(this, 'name')" :error-messages="form().serverErrors(this, 'name')"
@@ -22,14 +73,31 @@
<gz-date-time-picker <gz-date-time-picker
:label="$ay.t('ReviewDueDate')" :label="$ay.t('ReviewDueDate')"
v-model="obj.dueDate" v-model="obj.dueDate"
:readonly="formState.readOnly" :readonly="
formState.readOnly ||
(!selfAssigned && !currentUserIsASupervisor)
"
ref="dueDate" ref="dueDate"
testId="dueDate" testId="dueDate"
:error-messages="form().serverErrors(this, 'dueDate')" :error-messages="form().serverErrors(this, 'dueDate')"
@input="fieldValueChanged('dueDate')" @input="fieldValueChanged('dueDate')"
></gz-date-time-picker> ></gz-date-time-picker>
</v-col> </v-col>
<v-col cols="12">
<v-textarea
v-model="obj.notes"
:readonly="
formState.readOnly ||
(!selfAssigned && !currentUserIsASupervisor)
"
:label="$ay.t('ReviewNotes')"
:error-messages="form().serverErrors(this, 'notes')"
ref="notes"
data-cy="notes"
@input="fieldValueChanged('notes')"
auto-grow
></v-textarea>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3"> <v-col cols="12" sm="6" lg="4" xl="3">
<gz-date-time-picker <gz-date-time-picker
:label="$ay.t('ReviewCompletedDate')" :label="$ay.t('ReviewCompletedDate')"
@@ -43,19 +111,6 @@
></gz-date-time-picker> ></gz-date-time-picker>
</v-col> </v-col>
<v-col cols="12">
<v-textarea
v-model="obj.notes"
:readonly="formState.readOnly"
:label="$ay.t('ReviewNotes')"
:error-messages="form().serverErrors(this, 'notes')"
ref="notes"
data-cy="notes"
@input="fieldValueChanged('notes')"
auto-grow
></v-textarea>
</v-col>
<v-col cols="12"> <v-col cols="12">
<v-textarea <v-textarea
v-model="obj.completionNotes" v-model="obj.completionNotes"
@@ -74,7 +129,10 @@
<v-col v-if="form().showMe(this, 'Tags')" cols="12"> <v-col v-if="form().showMe(this, 'Tags')" cols="12">
<gz-tag-picker <gz-tag-picker
v-model="obj.tags" v-model="obj.tags"
:readonly="formState.readOnly" :readonly="
formState.readOnly ||
(!selfAssigned && !currentUserIsASupervisor)
"
ref="tags" ref="tags"
data-cy="tags" data-cy="tags"
:error-messages="form().serverErrors(this, 'tags')" :error-messages="form().serverErrors(this, 'tags')"
@@ -101,14 +159,20 @@
:ayaId="obj.id" :ayaId="obj.id"
ref="wiki" ref="wiki"
v-model="obj.wiki" v-model="obj.wiki"
:readonly="formState.readOnly" :readonly="
formState.readOnly ||
(!selfAssigned && !currentUserIsASupervisor)
"
@input="fieldValueChanged('wiki')" @input="fieldValueChanged('wiki')"
></gz-wiki ></gz-wiki
></v-col> ></v-col>
<v-col v-if="form().showMe(this, 'Attachments') && obj.id" cols="12"> <v-col v-if="form().showMe(this, 'Attachments') && obj.id" cols="12">
<gz-attachments <gz-attachments
:readonly="formState.readOnly" :readonly="
formState.readOnly ||
(!selfAssigned && !currentUserIsASupervisor)
"
:ayaType="ayaType" :ayaType="ayaType"
:ayaId="obj.id" :ayaId="obj.id"
></gz-attachments ></gz-attachments
@@ -232,7 +296,14 @@ export default {
serverError: {} serverError: {}
}, },
rights: window.$gz.role.defaultRightsObject(), rights: window.$gz.role.defaultRightsObject(),
ayaType: window.$gz.type.Review ayaType: window.$gz.type.Review,
currentUserIsASupervisor: window.$gz.role.hasRole([
window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull,
window.$gz.role.AUTHORIZATION_ROLES.DispatchFull,
window.$gz.role.AUTHORIZATION_ROLES.InventoryFull,
window.$gz.role.AUTHORIZATION_ROLES.SalesFull,
window.$gz.role.AUTHORIZATION_ROLES.AccountingFull
])
}; };
}, },
//WATCHERS //WATCHERS
@@ -269,6 +340,28 @@ export default {
deep: true deep: true
} }
}, },
computed: {
selfAssigned: function() {
return this.obj.userId == this.obj.assignedByUserId;
},
hasSupervisorRole: function() {
//mirrored from ReviewBiz.cs validation rule at server
/*
CurrentUserRoles.HasFlag(AuthorizationRoles.BizAdminFull) ||
CurrentUserRoles.HasFlag(AuthorizationRoles.DispatchFull) ||
CurrentUserRoles.HasFlag(AuthorizationRoles.InventoryFull) ||
CurrentUserRoles.HasFlag(AuthorizationRoles.SalesFull) ||
CurrentUserRoles.HasFlag(AuthorizationRoles.AccountingFull);
*/
return window.$gz.role.hasRole([
window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull,
window.$gz.role.AUTHORIZATION_ROLES.DispatchFull,
window.$gz.role.AUTHORIZATION_ROLES.InventoryFull,
window.$gz.role.AUTHORIZATION_ROLES.SalesFull,
window.$gz.role.AUTHORIZATION_ROLES.AccountingFull
]);
}
},
methods: { methods: {
canSave: function() { canSave: function() {
return this.formState.valid && this.formState.dirty; return this.formState.valid && this.formState.dirty;