This commit is contained in:
2021-04-03 16:04:40 +00:00
parent 58af118e13
commit 9424a1e3e2
4 changed files with 173 additions and 39 deletions

View File

@@ -1,7 +1,5 @@
<template>
<div>
<h1>WorkOrder header</h1>
<v-row>
<v-col cols="12" sm="6" lg="4" xl="3" v-if="value.serial != 0">
<template v-if="canEditSerial">

View File

@@ -1,12 +1,34 @@
<template>
<div v-if="pvm != null">
<!-- implement the "four states" here -->
<!-- HIDDEN, EMPTY, SINGLE, MULTIPLE -->
<!-- implement the "four states" here -->
<!-- HIDDEN(already taken care of, just three I guess), EMPTY, SINGLE, MULTIPLE -->
<h5 class="ml-12">WorkOrderItemScheduledUsers</h5>
<!-- Title and menu -->
<v-col cols="12">
<v-menu offset-y>
<template v-slot:activator="{ on, attrs }">
<h3>
{{ $ay.t("WorkOrderItemScheduledUserList") }}
</h3>
<v-btn large icon v-bind="attrs" v-on="on">
<v-icon small color="primary">$ayiEllipsisV</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item v-if="canAdd" @click="newItem">
<v-list-item-icon>
<v-icon>$ayiPlus</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("New") }}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-col>
<!-- <h5 class="ml-12">WorkOrderItemScheduledUsers</h5>
<div v-if="pvm.hasSelectedWoItem">
{{ value.items[pvm.selectedItemIndex].scheduledUsers }}
</div>
</div> -->
</div>
</template>
<script>
@@ -31,6 +53,9 @@ export default {
},
methods: {
newItem() {
console.log("STUB: NEW ITEM");
},
form() {
return window.$gz.form;
},
@@ -46,6 +71,13 @@ export default {
},
formCustomTemplateKey: function() {
return this.pvm.formCustomTemplateKey;
},
canAdd: function() {
return (
!this.value.isLocked &&
this.pvm.rights.change &&
this.pvm.subRights.scheduledUsers.create
);
}
}
};

View File

@@ -10,8 +10,7 @@
<!-- Workorder item table here -->
</template>
<template v-if="pvm.hasSelectedWoItem">
<!-- Workorder item "header" form here ??table shows same info as below in form, maybe table is not everything in the columns but just enough to select?? -->
<!-- Has controls to navigate to other woitems so no need to go up and click on table if don't want to or it's huge -->
<!-- grid with edit form below in each collection section. Edit form Has controls to navigate to other collection items so no need to go up and click on table if don't want to or it's huge -->
<!-- Want to support the case that when it's a single woitem workorder then user can just scroll down and enter shit and doesn't need to open or go anywhere to enter things all the way down
so a single workorderitem workorder would have all fields exposed and if any grandchildren those are entered in a single form too until the user has more than one
@@ -24,7 +23,9 @@
This gives the user as much as possible at hand immediately to view and edit and the option of adding and selecting more items
It also ensures a clean interface more like a piece of paper with only stuff added showing
So every level and collection including woitem and down is shown as a control with 4 states:
So every level and collection including woitem and down is shown as a control with 4 major states (may have sub states or alternates):
HIDDEN, EMPTY, SINGLE, MULTIPLE
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Customized to not show at all or not allowed: is just not visible at all, doesn't render doesn't affect anything
None entered: it's exposed as a clean and not too intrusive "Section title" control affordance with a title so "Scheduled users +" taking up very little vertical space
but distinct enough and large enough to quickly find visually on the page (this is always visible)
@@ -54,10 +55,10 @@
todo: need an editable control at every level for proper test of partical update
todo: need the state control at least enough to test as it's a critical part
todo: need dirty tracking stuff for each level to set / check so top level save can know what to update
todo: need simple properties at top level to drive the 4 states of each level (see above for 4 states)
-->
<GzWoItemScheduledUsers
v-if="pvm.subRights.scheduledUsers.visible"
v-model="value"
:pvm="pvm"
data-cy="woItemScheduledUsers"

View File

@@ -68,7 +68,7 @@ export default {
//preset object so do things normally done in getdata
generateMenu(vm);
//update which areas are available to user
setAvailableSectionsFlags(vm);
setSubRights(vm);
window.$gz.form.setFormState({
vm: vm,
loading: false
@@ -170,7 +170,8 @@ export default {
longitude: null,
items: [],
states: [],
isDirty: false
isDirty: false,
isLocked: false
}
},
formState: {
@@ -183,20 +184,70 @@ export default {
appError: null,
serverError: {}
},
rights: window.$gz.role.defaultRightsObject(),
rights: window.$gz.role.defaultRightsObject(), //overall workorder rights, supersedes subrights
ayaType: window.$gz.type.WorkOrder,
selectedItemIndex: null,
availableSections: {
labors: true,
parts: true,
partRequests: true,
expenses: true,
loans: true,
scheduledUsers: true,
tasks: true,
travels: true,
units: true,
outsideServices: true
subRights: {
labors: {
visible: true,
create: true,
change: true,
delete: true
},
parts: {
visible: true,
create: true,
change: true,
delete: true
},
partRequests: {
visible: true,
create: true,
change: true,
delete: true
},
expenses: {
visible: true,
create: true,
change: true,
delete: true
},
loans: {
visible: true,
create: true,
change: true,
delete: true
},
scheduledUsers: {
visible: true,
create: true,
change: true,
delete: true
},
tasks: {
visible: true,
create: true,
change: true,
delete: true
},
travels: {
visible: true,
create: true,
change: true,
delete: true
},
units: {
visible: true,
create: true,
change: true,
delete: true
},
outsideServices: {
visible: true,
create: true,
change: true,
delete: true
}
}
};
},
@@ -297,7 +348,7 @@ export default {
//modify the menu as necessary
generateMenu(vm);
//update which areas are available to user
setAvailableSectionsFlags(vm);
setSubRights(vm);
//Update the form status
window.$gz.form.setFormState({
@@ -459,21 +510,72 @@ export default {
/////////////////////////////
//
//
function setAvailableSectionsFlags(vm) {
//determine which sections are hidden due to form customized out or rights / roles / state
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:
//## 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
/*
availableSections: {
labors: true,
parts: true,
partRequests: true,
expenses: true,
loans: true,
scheduledUsers: true,
tasks: true,
travels: true,
units: true,
outsideServices: true
subRights: {
labors: {
visible: true,
create: true,
change: true,
delete: true
},
parts: {
visible: true,
create: true,
change: true,
delete: true
},
partRequests: {
visible: true,
create: true,
change: true,
delete: true
},
expenses: {
visible: true,
create: true,
change: true,
delete: true
},
loans: {
visible: true,
create: true,
change: true,
delete: true
},
scheduledUsers: {
visible: true,
create: true,
change: true,
delete: true
},
tasks: {
visible: true,
create: true,
change: true,
delete: true
},
travels: {
visible: true,
create: true,
change: true,
delete: true
},
units: {
visible: true,
create: true,
change: true,
delete: true
},
outsideServices: {
visible: true,
create: true,
change: true,
delete: true
}
}
*/
}
@@ -661,7 +763,8 @@ async function fetchTranslatedText(vm) {
"WorkOrderCustom13",
"WorkOrderCustom14",
"WorkOrderCustom15",
"WorkOrderCustom16"
"WorkOrderCustom16",
"WorkOrderItemScheduledUserList"
]);
}
</script>