This commit is contained in:
2021-04-06 18:27:36 +00:00
parent 7eb993e23f
commit 91cebab9d4
3 changed files with 67 additions and 43 deletions

View File

@@ -74,7 +74,7 @@ export default {
},
canAdd: function() {
return (
!this.value.isLocked &&
!this.value.isLockedAtServer &&
this.pvm.rights.change &&
this.pvm.subRights.scheduledUsers.create
);

View File

@@ -4,12 +4,12 @@
<template v-if="hasState">
<br />
<span class="text-h6">{{ currentState.name }}</span>
<v-icon :color="currentState.color" class="ml-4">$ayiFlag</v-icon>
<v-icon color="primary" v-if="currentState.locked" class="ml-4"
<span class="text-h6">{{ pvm.currentState.name }}</span>
<v-icon :color="pvm.currentState.color" class="ml-4">$ayiFlag</v-icon>
<v-icon color="primary" v-if="pvm.currentState.locked" class="ml-4"
>$ayiLock</v-icon
>
<v-icon color="primary" v-if="currentState.completed" class="ml-4"
<v-icon color="primary" v-if="pvm.currentState.completed" class="ml-4"
>$ayiCheckCircle</v-icon
>
</template>
@@ -68,7 +68,7 @@
todo: it must be clear to user why they can not change if they have too low a role to change, perhaps text under state instead of selector box that says "Only select roles can change this state"
-->
{{ currentState }}
{{ pvm.currentState }}
</div>
</template>
<script>
@@ -122,31 +122,31 @@ export default {
hasState() {
return this.value.states != null && this.value.states.length > 0;
},
currentState() {
//return actual status object from top level shell based on current state
//if state is unknown then it should return a placeholder dummy state showing an error condition or empty I guess
// currentState() {
// //return actual status object from top level shell based on current state
// //if state is unknown then it should return a placeholder dummy state showing an error condition or empty I guess
if (this.value.states != null) {
//find it in the status collection
//and return here
let laststate = this.value.states[this.value.states.length - 1];
let found = this.pvm.selectLists.wostatus.find(
z => z.id == laststate.workOrderStatusId
);
if (found) {
return found;
}
}
//default
return {
id: 0,
name: "NOT SET YET",
active: true,
color: "#ffffff", //invisible
completed: false,
locked: false
};
},
// if (this.value.states != null) {
// //find it in the status collection
// //and return here
// let laststate = this.value.states[this.value.states.length - 1];
// let found = this.pvm.selectLists.wostatus.find(
// z => z.id == laststate.workOrderStatusId
// );
// if (found) {
// return found;
// }
// }
// //default
// return {
// id: 0,
// name: "NOT SET YET",
// active: true,
// color: "#ffffff", //invisible
// completed: false,
// locked: false
// };
// },
canAdd: function() {
//first check most obvious disqualifying properties
if (!this.pvm.rights.change || !this.pvm.subRights.states.create) {
@@ -154,7 +154,7 @@ export default {
}
//not currently locked, user has rights to do it so allow it
if (!this.value.isLocked) {
if (!this.value.isLockedAtServer) {
return true;
}
@@ -163,7 +163,7 @@ export default {
//ok, only thing left to check is if the current user can unlock this
//get remove roles required for current state
let cs = this.currentState;
let cs = pvm.currentState;
if (cs.removeRoles == null || cs.removeRoles == 0) {
//no state set yet
return true;
@@ -174,13 +174,7 @@ export default {
return true;
}
//failsafe
return false;
// return (
// !this.value.isLocked &&
// this.pvm.rights.change &&
// this.pvm.subRights.states.create
// );
}
}
};