This commit is contained in:
@@ -55,6 +55,11 @@ todo: v8 migrate additions
|
|||||||
|
|
||||||
## CLIENT MISC ITEMS
|
## CLIENT MISC ITEMS
|
||||||
|
|
||||||
|
todo: gzdecimal triggering dirty just by clicking into and out of a field witha value in it.
|
||||||
|
also, it sometimes shows without the decimal then with the decimal for editing then without, it's crazy
|
||||||
|
the decimal thing is probbly what's triggering the dirty change.
|
||||||
|
saw this when developing the wo form and testing scheduled users estimated qty field
|
||||||
|
|
||||||
todo: generateMenu called on forms redundantly?
|
todo: generateMenu called on forms redundantly?
|
||||||
called for getdata, but also called in created in wrong place i.e. always rather than just when it's not a getdata situation due to already existing
|
called for getdata, but also called in created in wrong place i.e. always rather than just when it's not a getdata situation due to already existing
|
||||||
todo: select list templates under global is offering types that don't6 have select lists like memo etc
|
todo: select list templates under global is offering types that don't6 have select lists like memo etc
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="pvm != null">
|
<div v-if="pvm != null">
|
||||||
<!-- implement the "four states" here -->
|
selected row: {{ selectedRow }}
|
||||||
<!-- HIDDEN(already taken care of, just three I guess), EMPTY, SINGLE, MULTIPLE -->
|
|
||||||
|
|
||||||
<!-- Title and menu -->
|
<!-- Title and menu -->
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<v-menu offset-y>
|
<v-menu offset-y>
|
||||||
@@ -97,17 +95,18 @@
|
|||||||
></gz-decimal>
|
></gz-decimal>
|
||||||
</v-col>
|
</v-col>
|
||||||
</template>
|
</template>
|
||||||
<!-- {{ pvm.hasSelectedScheduledUserItem }}<br />
|
|
||||||
{{ pvm.hasSelectedWoItem }}<br />
|
|
||||||
{{ pvm.selectedScheduledUserItemIndex }}<br />
|
|
||||||
{{ value.items[pvm.selectedItemIndex].scheduledUsers }}<br /> -->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/* XXXeslint-disable */
|
/* XXXeslint-disable */
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/*
|
||||||
|
todo: sometimes grid row is not highlighted when edit form is exposed to match
|
||||||
|
I think after a new record is added it's not highlighting, needs some id wizardry I think
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return { selectedRow: [] };
|
return { selectedRow: [] };
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="pvm != null">
|
<div v-if="value != null">
|
||||||
|
selected row: {{ selectedRow }}
|
||||||
<!-- Title and menu -->
|
<!-- Title and menu -->
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<v-menu offset-y>
|
<v-menu offset-y>
|
||||||
@@ -29,11 +30,7 @@
|
|||||||
</v-menu>
|
</v-menu>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<!-- items:{{ value.items }}<br />
|
<template v-if="showTable">
|
||||||
<span class="text-caption"
|
|
||||||
>[selected index: {{ pvm.selectedItemIndex }}]</span
|
|
||||||
>-->
|
|
||||||
<template v-if="pvm.woItemCount > 1">
|
|
||||||
<!-- ################################ WORK ORDER ITEMS TABLE ############################### -->
|
<!-- ################################ WORK ORDER ITEMS TABLE ############################### -->
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<v-data-table
|
<v-data-table
|
||||||
@@ -49,24 +46,17 @@
|
|||||||
data-cy="itemsTable"
|
data-cy="itemsTable"
|
||||||
dense
|
dense
|
||||||
:item-class="itemRowClasses"
|
:item-class="itemRowClasses"
|
||||||
@click:row="selectItem"
|
@click:row="handleRowClick"
|
||||||
:show-select="$vuetify.breakpoint.xs"
|
:show-select="$vuetify.breakpoint.xs"
|
||||||
single-select
|
single-select
|
||||||
>
|
>
|
||||||
<!-- <template v-slot:[`item.actions`]="{ item }">
|
|
||||||
<v-btn icon @click="selectItem(item)">
|
|
||||||
<v-icon :class="itemRowClasses(item)">
|
|
||||||
$ayiEdit
|
|
||||||
</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</template> -->
|
|
||||||
</v-data-table>
|
</v-data-table>
|
||||||
</v-col>
|
</v-col>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="pvm.hasSelectedWoItem">
|
<template v-if="activeItemIndex != null">
|
||||||
<v-col v-if="form().showMe(this, 'WorkOrderItemSummary')" cols="12">
|
<v-col v-if="form().showMe(this, 'WorkOrderItemSummary')" cols="12">
|
||||||
<v-textarea
|
<v-textarea
|
||||||
v-model="value.items[pvm.selectedItemIndex].notes"
|
v-model="value.items[activeItemIndex].notes"
|
||||||
:readonly="formState.readOnly"
|
:readonly="formState.readOnly"
|
||||||
:label="$ay.t('WorkOrderItemSummary')"
|
:label="$ay.t('WorkOrderItemSummary')"
|
||||||
:error-messages="form().serverErrors(this, 'notes')"
|
:error-messages="form().serverErrors(this, 'notes')"
|
||||||
@@ -79,7 +69,7 @@
|
|||||||
|
|
||||||
<v-col v-if="form().showMe(this, 'WorkOrderItemTechNotes')" cols="12">
|
<v-col v-if="form().showMe(this, 'WorkOrderItemTechNotes')" cols="12">
|
||||||
<v-textarea
|
<v-textarea
|
||||||
v-model="value.items[pvm.selectedItemIndex].techNotes"
|
v-model="value.items[activeItemIndex].techNotes"
|
||||||
:readonly="formState.readOnly"
|
:readonly="formState.readOnly"
|
||||||
:label="$ay.t('WorkOrderItemTechNotes')"
|
:label="$ay.t('WorkOrderItemTechNotes')"
|
||||||
:error-messages="form().serverErrors(this, 'techNotes')"
|
:error-messages="form().serverErrors(this, 'techNotes')"
|
||||||
@@ -105,6 +95,9 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
import GzWoItemScheduledUsers from "../components/work-order-item-scheduled-users.vue";
|
import GzWoItemScheduledUsers from "../components/work-order-item-scheduled-users.vue";
|
||||||
/*
|
/*
|
||||||
|
todo: stop using parent vm directly to control state in graph and instead pass down values via props to children and pass up values to parent via events
|
||||||
|
https://www.smashingmagazine.com/2020/01/data-components-vue-js/
|
||||||
|
|
||||||
todo: can I turn control labels into hyperlinks for getting to feeder records? If not then need to find a way to accomplish it
|
todo: can I turn control labels into hyperlinks for getting to feeder records? If not then need to find a way to accomplish it
|
||||||
e.g. can workorder status title be changed to a hyper link to status list
|
e.g. can workorder status title be changed to a hyper link to status list
|
||||||
e.g. can projects title be turned to a hyper link to projects list
|
e.g. can projects title be turned to a hyper link to projects list
|
||||||
@@ -120,7 +113,10 @@ export default {
|
|||||||
GzWoItemScheduledUsers
|
GzWoItemScheduledUsers
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return { selectedRow: [] };
|
return {
|
||||||
|
activeItemIndex: null,
|
||||||
|
selectedRow: []
|
||||||
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
@@ -161,31 +157,27 @@ export default {
|
|||||||
units: [],
|
units: [],
|
||||||
outsideServices: []
|
outsideServices: []
|
||||||
});
|
});
|
||||||
this.pvm.setDirty();
|
this.$emit("change");
|
||||||
this.pvm.selectItem(newIndex);
|
this.selectedRow = [{ index: newIndex }];
|
||||||
|
this.activeItemIndex = newIndex;
|
||||||
},
|
},
|
||||||
async deleteItem() {
|
async deleteItem() {
|
||||||
if ((await window.$gz.dialog.confirmDelete()) != true) {
|
if ((await window.$gz.dialog.confirmDelete()) != true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.pvm.deleteItem(this.pvm.selectedItemIndex);
|
this.pvm.deleteItem(this.activeItemIndex);
|
||||||
},
|
},
|
||||||
selectItem: function(item) {
|
handleRowClick: function(item) {
|
||||||
this.selectedRow = [item];
|
this.activeItemIndex = item.index;
|
||||||
this.pvm.selectedItemIndex = item.index;
|
|
||||||
//select children if 1 record to expose edit form in place
|
|
||||||
//or select none if more than one so that data table shows instead for selection
|
|
||||||
let woitem = this.value.items[item.index];
|
|
||||||
this.pvm.selectedScheduledUserItemIndex =
|
|
||||||
woitem.scheduledUsers.length == 1 ? 0 : null;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
form() {
|
form() {
|
||||||
return window.$gz.form;
|
return window.$gz.form;
|
||||||
},
|
},
|
||||||
fieldValueChanged(ref) {
|
fieldValueChanged(ref) {
|
||||||
if (!this.formState.loading && !this.formState.readonly) {
|
if (!this.formState.loading && !this.formState.readonly) {
|
||||||
//flag this record dirty so it gets picked up by save
|
//flag this record dirty so it gets picked up by save
|
||||||
this.value.items[this.pvm.selectedItemIndex].isDirty = true;
|
this.value.items[this.activeItemIndex].isDirty = true;
|
||||||
window.$gz.form.fieldValueChanged(this.pvm, ref);
|
window.$gz.form.fieldValueChanged(this.pvm, ref);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -303,6 +295,9 @@ and it's probably not a big list to fill anyway
|
|||||||
formCustomTemplateKey: function() {
|
formCustomTemplateKey: function() {
|
||||||
return this.pvm.formCustomTemplateKey;
|
return this.pvm.formCustomTemplateKey;
|
||||||
},
|
},
|
||||||
|
showTable: function() {
|
||||||
|
return this.value.items.length > 1;
|
||||||
|
},
|
||||||
canAdd: function() {
|
canAdd: function() {
|
||||||
return (
|
return (
|
||||||
!this.value.isLockedAtServer &&
|
!this.value.isLockedAtServer &&
|
||||||
@@ -312,7 +307,7 @@ and it's probably not a big list to fill anyway
|
|||||||
},
|
},
|
||||||
canDelete: function() {
|
canDelete: function() {
|
||||||
return (
|
return (
|
||||||
this.pvm.hasSelectedWoItem &&
|
this.activeItemIndex != null &&
|
||||||
!this.value.isLockedAtServer &&
|
!this.value.isLockedAtServer &&
|
||||||
this.pvm.rights.change &&
|
this.pvm.rights.change &&
|
||||||
this.pvm.subRights.items.delete
|
this.pvm.subRights.items.delete
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
:readonly="formState.readOnly"
|
:readonly="formState.readOnly"
|
||||||
:pvm="this"
|
:pvm="this"
|
||||||
data-cy="woHeader"
|
data-cy="woHeader"
|
||||||
|
@change="setDirty()"
|
||||||
/>
|
/>
|
||||||
<GzWoItems
|
<GzWoItems
|
||||||
v-model="obj"
|
v-model="obj"
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
:readonly="formState.readOnly"
|
:readonly="formState.readOnly"
|
||||||
:pvm="this"
|
:pvm="this"
|
||||||
data-cy="woItems"
|
data-cy="woItems"
|
||||||
|
@change="setDirty()"
|
||||||
/>
|
/>
|
||||||
</v-form>
|
</v-form>
|
||||||
</div>
|
</div>
|
||||||
@@ -311,15 +313,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
hasSelectedWoItem: function() {
|
|
||||||
if (this.selectedItemIndex != null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
woItemCount: function() {
|
|
||||||
return this.obj.items.length;
|
|
||||||
},
|
|
||||||
hasSelectedScheduledUserItem: function() {
|
hasSelectedScheduledUserItem: function() {
|
||||||
if (
|
if (
|
||||||
this.hasSelectedWoItem &&
|
this.hasSelectedWoItem &&
|
||||||
@@ -362,25 +355,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
selectItem: function(itemIndex) {
|
|
||||||
if (itemIndex == this.selectedItemIndex) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (itemIndex == null) {
|
|
||||||
//if there is only one then it should be selected otherwise null is ok for a bunch
|
|
||||||
if (this.woItemCount == 1) {
|
|
||||||
itemIndex = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.selectedItemIndex = itemIndex;
|
|
||||||
//reset all children
|
|
||||||
this.selectedScheduledUserItemIndex = null;
|
|
||||||
//todo: all children here
|
|
||||||
//this.selectedLaborIndex...blahblah etc
|
|
||||||
},
|
|
||||||
deleteItem: function(itemIndex) {
|
deleteItem: function(itemIndex) {
|
||||||
if (itemIndex == null) {
|
if (itemIndex == null) {
|
||||||
itemIndex = this.selectedItemIndex;
|
throw new Error("svc-workorder: delete item itemIndex is null!");
|
||||||
}
|
}
|
||||||
//add to deleted items if has concurrency / id
|
//add to deleted items if has concurrency / id
|
||||||
let o = this.obj.items[itemIndex];
|
let o = this.obj.items[itemIndex];
|
||||||
|
|||||||
Reference in New Issue
Block a user