This commit is contained in:
@@ -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.
|
||||
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?
|
||||
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: vendor edit form has locale keys from headoffice, check all recent, may be more, memo etc
|
||||
|
||||
@@ -5,10 +5,61 @@
|
||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||
<v-form ref="form">
|
||||
<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-text-field
|
||||
v-model="obj.name"
|
||||
:readonly="formState.readOnly"
|
||||
:readonly="
|
||||
formState.readOnly ||
|
||||
(!selfAssigned && !currentUserIsASupervisor)
|
||||
"
|
||||
:label="$ay.t('ReviewName')"
|
||||
:rules="[form().required(this, 'name')]"
|
||||
:error-messages="form().serverErrors(this, 'name')"
|
||||
@@ -22,14 +73,31 @@
|
||||
<gz-date-time-picker
|
||||
:label="$ay.t('ReviewDueDate')"
|
||||
v-model="obj.dueDate"
|
||||
:readonly="formState.readOnly"
|
||||
:readonly="
|
||||
formState.readOnly ||
|
||||
(!selfAssigned && !currentUserIsASupervisor)
|
||||
"
|
||||
ref="dueDate"
|
||||
testId="dueDate"
|
||||
:error-messages="form().serverErrors(this, 'dueDate')"
|
||||
@input="fieldValueChanged('dueDate')"
|
||||
></gz-date-time-picker>
|
||||
</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">
|
||||
<gz-date-time-picker
|
||||
:label="$ay.t('ReviewCompletedDate')"
|
||||
@@ -43,19 +111,6 @@
|
||||
></gz-date-time-picker>
|
||||
</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-textarea
|
||||
v-model="obj.completionNotes"
|
||||
@@ -74,7 +129,10 @@
|
||||
<v-col v-if="form().showMe(this, 'Tags')" cols="12">
|
||||
<gz-tag-picker
|
||||
v-model="obj.tags"
|
||||
:readonly="formState.readOnly"
|
||||
:readonly="
|
||||
formState.readOnly ||
|
||||
(!selfAssigned && !currentUserIsASupervisor)
|
||||
"
|
||||
ref="tags"
|
||||
data-cy="tags"
|
||||
:error-messages="form().serverErrors(this, 'tags')"
|
||||
@@ -101,14 +159,20 @@
|
||||
:ayaId="obj.id"
|
||||
ref="wiki"
|
||||
v-model="obj.wiki"
|
||||
:readonly="formState.readOnly"
|
||||
:readonly="
|
||||
formState.readOnly ||
|
||||
(!selfAssigned && !currentUserIsASupervisor)
|
||||
"
|
||||
@input="fieldValueChanged('wiki')"
|
||||
></gz-wiki
|
||||
></v-col>
|
||||
|
||||
<v-col v-if="form().showMe(this, 'Attachments') && obj.id" cols="12">
|
||||
<gz-attachments
|
||||
:readonly="formState.readOnly"
|
||||
:readonly="
|
||||
formState.readOnly ||
|
||||
(!selfAssigned && !currentUserIsASupervisor)
|
||||
"
|
||||
:ayaType="ayaType"
|
||||
:ayaId="obj.id"
|
||||
></gz-attachments
|
||||
@@ -232,7 +296,14 @@ export default {
|
||||
serverError: {}
|
||||
},
|
||||
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
|
||||
@@ -269,6 +340,28 @@ export default {
|
||||
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: {
|
||||
canSave: function() {
|
||||
return this.formState.valid && this.formState.dirty;
|
||||
|
||||
Reference in New Issue
Block a user