This commit is contained in:
@@ -74,7 +74,7 @@ export default {
|
||||
},
|
||||
canAdd: function() {
|
||||
return (
|
||||
!this.value.isLocked &&
|
||||
!this.value.isLockedAtServer &&
|
||||
this.pvm.rights.change &&
|
||||
this.pvm.subRights.scheduledUsers.create
|
||||
);
|
||||
|
||||
@@ -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
|
||||
// );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -171,7 +171,7 @@ export default {
|
||||
items: [],
|
||||
states: [],
|
||||
isDirty: false,
|
||||
isLocked: false
|
||||
isLockedAtServer: false
|
||||
}
|
||||
},
|
||||
formState: {
|
||||
@@ -312,6 +312,31 @@ export default {
|
||||
return 0;
|
||||
}
|
||||
return this.obj.items.length;
|
||||
},
|
||||
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.obj.states != null) {
|
||||
//find it in the status collection
|
||||
//and return here
|
||||
let laststate = this.obj.states[this.obj.states.length - 1];
|
||||
let found = this.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
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -406,7 +431,10 @@ export default {
|
||||
let fail = false;
|
||||
|
||||
//STATE first if unlocking only
|
||||
if (this.obj.isLocked) {
|
||||
//if moving to another locked state this will block further updates below but we're accepting that
|
||||
//and user can unlock first to finish updating
|
||||
if (this.obj.isLockedAtServer) {
|
||||
console.log("savestateFirst");
|
||||
fail = await saveState(vm);
|
||||
}
|
||||
|
||||
@@ -416,7 +444,7 @@ export default {
|
||||
|
||||
//STATE last normally in case it locks
|
||||
//or is completed
|
||||
if (!this.obj.isLocked) {
|
||||
if (!this.obj.isLockedAtServer) {
|
||||
fail = await saveState(vm);
|
||||
}
|
||||
|
||||
@@ -572,6 +600,8 @@ async function saveState(vm) {
|
||||
return false;
|
||||
} else {
|
||||
vm.obj.states[i] = res.data;
|
||||
//set locked status of entire wo now
|
||||
vm.obj.isLockedAtServer = vm.currentState.locked;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -584,7 +614,7 @@ async function saveState(vm) {
|
||||
function setSubRights(vm) {
|
||||
//determine rights to each which sections are hidden due to form customized out or rights / roles
|
||||
//todo: determine this and set accordingly, for now all set to available true during init
|
||||
//## NOTE: these are subrights only, descendents still need to first check if workorder isLocked and rights are read only etc before this level is checked
|
||||
//## NOTE: these are subrights only, descendents still need to first check if workorder isLockedAtServer and rights are read only etc before this level is checked
|
||||
/*
|
||||
*/
|
||||
}
|
||||
@@ -982,7 +1012,7 @@ Example workorder
|
||||
}
|
||||
],
|
||||
isDirty: false,
|
||||
isLocked: false
|
||||
isLockedAtServer: false
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user