This commit is contained in:
2021-04-27 22:53:06 +00:00
parent dd082616c8
commit f607e5e4b1
2 changed files with 285 additions and 3 deletions

View File

@@ -57,6 +57,8 @@
:readonly="formState.readOnly"
:pvm="pvm"
data-cy="woState"
:all-states="pvm.selectLists.wostatus"
:allowed-states="pvm.selectLists.allowedwostatus"
/>
</v-col>
<v-col v-if="form().showMe(this, 'Notes')" cols="12">

View File

@@ -34,11 +34,13 @@
<v-list-item-title>{{ item }}</v-list-item-title>
</v-list-item>
</v-list> -->
<template v-for="item in value.states">
<!-- <template v-for="item in stateDisplayList">
<div :key="item.id">
{{ item }}
{{ item.user }}
</div>
</template>
</template> -->
{{ stateDisplayList }}
<template v-if="canAdd">
<div>
@@ -179,7 +181,10 @@ export default {
data() {
return {
selectedStatus: null,
openDialog: false
openDialog: false,
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
languageName: window.$gz.locale.getResolvedLanguage(),
hour12: window.$gz.locale.getHour12()
};
},
@@ -192,6 +197,14 @@ export default {
default: null,
type: Object
},
allStates: {
default: null,
type: Array
},
allowedStates: {
default: null,
type: Array
},
formKey: { type: String, default: "" }, //used to grab template from store
readonly: Boolean,
disabled: Boolean
@@ -215,6 +228,7 @@ export default {
workOrderId: this.value.id,
workOrderStatusId: this.selectedStatus,
userId: window.$gz.store.state.userId,
userViz: window.$gz.store.state.userName,
created: window.$gz.locale.nowUTC8601String()
});
@@ -225,6 +239,35 @@ export default {
this.pvm.formState.dirty = true;
}
},
getStateForDisplay(state) {
let ret = {
id: Date.now,
name: "??",
color: "#ffffff",
locked: false,
completed: false,
timeStamp: "??",
user: "??"
};
const s = this.allStates.find(z => z.id == state.workOrderStatusId);
if (s == null) {
return ret;
}
//make for display
ret.id = state.id;
ret.name = s.name;
ret.color = s.color;
ret.locked = s.locked;
ret.completed = s.completed;
ret.user = state.userViz;
ret.timeStamp = window.$gz.locale.utcDateToShortDateAndTimeLocalized(
state.created,
this.timeZoneName,
this.languageName,
this.hour12
);
return ret;
},
form() {
return window.$gz.form;
},
@@ -248,6 +291,16 @@ export default {
hasState() {
return this.value.states != null && this.value.states.length > 0;
},
stateDisplayList() {
let ret = [];
this.value.states.forEach(z => {
console.log("z", z);
let d = this.getStateForDisplay(z);
console.log("d", d);
ret.push(d);
});
return ret;
},
canAdd: function() {
//first check most obvious disqualifying properties
if (!this.pvm.rights.change || !this.pvm.subRights.states.create) {
@@ -279,4 +332,231 @@ export default {
}
}
};
/*
{
"data": {
"all": [
{
"id": 9,
"concurrency": 7790330,
"name": "Closed",
"active": true,
"notes": null,
"color": "#f2f2f2",
"selectRoles": 10,
"removeRoles": 10,
"completed": true,
"locked": true
},
{
"id": 1,
"concurrency": 7790306,
"name": "Manager approval required",
"active": true,
"notes": "Use to lock workorder and wait for approval from manager",
"color": "#c00000",
"selectRoles": 124927,
"removeRoles": 10,
"completed": false,
"locked": true
},
{
"id": 2,
"concurrency": 7790309,
"name": "Needs to be assigned",
"active": true,
"notes": "Waiting for technicians to be assigned to this work",
"color": "#80ffff",
"selectRoles": 124927,
"removeRoles": 124927,
"completed": false,
"locked": false
},
{
"id": 3,
"concurrency": 7790312,
"name": "Scheduled",
"active": true,
"notes": "Scheduled / ready for service",
"color": "#00ff00",
"selectRoles": 124927,
"removeRoles": 124927,
"completed": false,
"locked": false
},
{
"id": 4,
"concurrency": 7790315,
"name": "Service completed",
"active": true,
"notes": null,
"color": "#ff0000",
"selectRoles": 124927,
"removeRoles": 10,
"completed": true,
"locked": true
},
{
"id": 5,
"concurrency": 7790318,
"name": "Waiting on customer approval",
"active": true,
"notes": null,
"color": "#8080ff",
"selectRoles": 124927,
"removeRoles": 124927,
"completed": false,
"locked": true
},
{
"id": 6,
"concurrency": 7790321,
"name": "Waiting on parts",
"active": true,
"notes": null,
"color": "#c0c000",
"selectRoles": 124927,
"removeRoles": 124927,
"completed": false,
"locked": false
},
{
"id": 7,
"concurrency": 7790324,
"name": "Waiting on warranty return",
"active": true,
"notes": null,
"color": "#ff00ff",
"selectRoles": 124927,
"removeRoles": 124927,
"completed": false,
"locked": false
},
{
"id": 8,
"concurrency": 7790327,
"name": "Waiting to be invoiced",
"active": true,
"notes": null,
"color": "#ffc0c0",
"selectRoles": 124927,
"removeRoles": 32842,
"completed": false,
"locked": true
}
],
"allowed": [
{
"id": 9,
"concurrency": 7790330,
"name": "Closed",
"active": true,
"notes": null,
"color": "#f2f2f2",
"selectRoles": 10,
"removeRoles": 10,
"completed": true,
"locked": true
},
{
"id": 1,
"concurrency": 7790306,
"name": "Manager approval required",
"active": true,
"notes": "Use to lock workorder and wait for approval from manager",
"color": "#c00000",
"selectRoles": 124927,
"removeRoles": 10,
"completed": false,
"locked": true
},
{
"id": 2,
"concurrency": 7790309,
"name": "Needs to be assigned",
"active": true,
"notes": "Waiting for technicians to be assigned to this work",
"color": "#80ffff",
"selectRoles": 124927,
"removeRoles": 124927,
"completed": false,
"locked": false
},
{
"id": 3,
"concurrency": 7790312,
"name": "Scheduled",
"active": true,
"notes": "Scheduled / ready for service",
"color": "#00ff00",
"selectRoles": 124927,
"removeRoles": 124927,
"completed": false,
"locked": false
},
{
"id": 4,
"concurrency": 7790315,
"name": "Service completed",
"active": true,
"notes": null,
"color": "#ff0000",
"selectRoles": 124927,
"removeRoles": 10,
"completed": true,
"locked": true
},
{
"id": 5,
"concurrency": 7790318,
"name": "Waiting on customer approval",
"active": true,
"notes": null,
"color": "#8080ff",
"selectRoles": 124927,
"removeRoles": 124927,
"completed": false,
"locked": true
},
{
"id": 6,
"concurrency": 7790321,
"name": "Waiting on parts",
"active": true,
"notes": null,
"color": "#c0c000",
"selectRoles": 124927,
"removeRoles": 124927,
"completed": false,
"locked": false
},
{
"id": 7,
"concurrency": 7790324,
"name": "Waiting on warranty return",
"active": true,
"notes": null,
"color": "#ff00ff",
"selectRoles": 124927,
"removeRoles": 124927,
"completed": false,
"locked": false
},
{
"id": 8,
"concurrency": 7790327,
"name": "Waiting to be invoiced",
"active": true,
"notes": null,
"color": "#ffc0c0",
"selectRoles": 124927,
"removeRoles": 32842,
"completed": false,
"locked": true
}
]
}
}
*/
</script>