This commit is contained in:
2021-05-04 22:56:20 +00:00
parent 5b11e3324e
commit cbb3b07497
4 changed files with 239 additions and 213 deletions

View File

@@ -1,213 +1,240 @@
<template>
<div v-if="value != null">
<!-- Title and menu -->
<v-col cols="12">
<v-menu offset-y>
<template v-slot:activator="{ on, attrs }">
<div class="text-h6">
<v-icon large color="primary">$ayiWrench</v-icon>
{{ $ay.t("WorkOrderItemList") }}
<v-btn large icon v-bind="attrs" v-on="on">
<v-icon small color="primary">$ayiEllipsisV</v-icon>
</v-btn>
</div>
</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-item v-if="canDelete && !isDeleted" @click="deleteItem">
<v-list-item-icon>
<v-icon>$ayiTrashAlt</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("SoftDelete") }}</v-list-item-title>
</v-list-item>
<v-list-item v-if="canDelete && isDeleted" @click="unDeleteItem">
<v-list-item-icon>
<v-icon>$ayiTrashRestoreAlt</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("Undelete") }}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-col>
<v-row>
<!-- Title and menu -->
<v-col cols="12">
<v-menu offset-y>
<template v-slot:activator="{ on, attrs }">
<div class="text-h6">
<v-icon large color="primary">$ayiWrench</v-icon>
{{ $ay.t("WorkOrderItemList") }}
<v-btn large icon v-bind="attrs" v-on="on">
<v-icon small color="primary">$ayiEllipsisV</v-icon>
</v-btn>
</div>
</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-item v-if="canDelete && !isDeleted" @click="deleteItem">
<v-list-item-icon>
<v-icon>$ayiTrashAlt</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("SoftDelete") }}</v-list-item-title>
</v-list-item>
<v-list-item v-if="canDelete && isDeleted" @click="unDeleteItem">
<v-list-item-icon>
<v-icon>$ayiTrashRestoreAlt</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("Undelete") }}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-col>
<template v-if="showTable">
<!-- ################################ WORK ORDER ITEMS TABLE ############################### -->
<v-col cols="12" class="mb-10">
<v-data-table
:headers="headerList"
:items="itemList"
item-key="index"
v-model="selectedRow"
class="elevation-1"
disable-pagination
disable-filtering
disable-sort
hide-default-footer
data-cy="itemsTable"
dense
:item-class="itemRowClasses"
@click:row="handleRowClick"
:show-select="$vuetify.breakpoint.xs"
single-select
<template v-if="showTable">
<!-- ################################ WORK ORDER ITEMS TABLE ############################### -->
<v-col cols="12" class="mb-10">
<v-data-table
:headers="headerList"
:items="itemList"
item-key="index"
v-model="selectedRow"
class="elevation-1"
disable-pagination
disable-filtering
disable-sort
hide-default-footer
data-cy="itemsTable"
dense
:item-class="itemRowClasses"
@click:row="handleRowClick"
:show-select="$vuetify.breakpoint.xs"
single-select
>
</v-data-table>
</v-col>
</template>
<template v-if="activeItemIndex != null">
<v-btn
v-if="canDelete && isDeleted"
large
@click="unDeleteItem"
color="primary"
>{{ $ay.t("Undelete")
}}<v-icon right large>$ayiTrashRestoreAlt</v-icon></v-btn
>
</v-data-table>
</v-col>
</template>
<template v-if="activeItemIndex != null">
<v-btn
v-if="canDelete && isDeleted"
large
@click="unDeleteItem"
color="primary"
>{{ $ay.t("Undelete")
}}<v-icon right large>$ayiTrashRestoreAlt</v-icon></v-btn
>
<v-col v-if="form().showMe(this, 'WorkOrderItemSummary')" cols="12">
<v-textarea
v-model="value.items[activeItemIndex].notes"
:readonly="formState.readOnly"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemSummary')"
:error-messages="
form().serverErrors(this, `items[${activeItemIndex}].notes`)
"
ref="notes"
data-cy="notes"
@input="fieldValueChanged('notes')"
auto-grow
></v-textarea>
</v-col>
<v-col v-if="form().showMe(this, 'WorkOrderItemSummary')" cols="12">
<v-textarea
v-model="value.items[activeItemIndex].notes"
:readonly="formState.readOnly"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemSummary')"
:error-messages="
form().serverErrors(this, `items[${activeItemIndex}].notes`)
"
ref="notes"
data-cy="notes"
@input="fieldValueChanged('notes')"
auto-grow
></v-textarea>
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderItemSequence')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<v-text-field
v-model="value.items[activeItemIndex].sequence"
:readonly="formState.readOnly"
:disabled="isDeleted"
:label="$ay.t('Sequence')"
ref="sequence"
:rules="[form().integerValid(this, 'sequence')]"
:error-messages="form().serverErrors(this, 'sequence')"
@input="fieldValueChanged('sequence')"
type="number"
></v-text-field>
</v-col>
<v-col v-if="form().showMe(this, 'WorkOrderItemTechNotes')" cols="12">
<v-textarea
v-model="value.items[activeItemIndex].techNotes"
:readonly="formState.readOnly"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemTechNotes')"
:error-messages="form().serverErrors(this, 'techNotes')"
ref="techNotes"
data-cy="techNotes"
@input="fieldValueChanged('techNotes')"
auto-grow
></v-textarea>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-autocomplete
v-model="value.items[activeItemIndex].workorderItemStatusId"
@input="fieldValueChanged('workorderItemStatusId')"
:items="pvm.selectLists.woItemStatus"
item-text="name"
item-value="id"
:label="$ay.t('WorkOrderItemWorkOrderStatusID')"
prepend-icon="$ayiEdit"
@click:prepend="handleEditItemStatusClick()"
<v-col
v-if="form().showMe(this, 'WorkOrderItemSequence')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<template v-slot:selection="{ item }">
<v-icon class="mr-3" :color="item.color">$ayiCircle</v-icon
>{{ item.name }}
</template>
<v-text-field
v-model="value.items[activeItemIndex].sequence"
:readonly="formState.readOnly"
:disabled="isDeleted"
:label="$ay.t('Sequence')"
ref="sequence"
:rules="[form().integerValid(this, 'sequence')]"
:error-messages="form().serverErrors(this, 'sequence')"
@input="fieldValueChanged('sequence')"
type="number"
></v-text-field>
</v-col>
<template v-slot:item="{ item }">
<v-list-item-avatar>
<v-icon :color="item.color">$ayiCircle</v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title
><span
:class="
item.active
? ''
: 'disabled--text text-decoration-line-through'
"
>{{ item.name }}</span
></v-list-item-title
>
<v-list-item-subtitle> {{ item.notes }}</v-list-item-subtitle>
</v-list-item-content>
</template>
</v-autocomplete>
</v-col>
<v-col v-if="form().showMe(this, 'WorkOrderItemTechNotes')" cols="12">
<v-textarea
v-model="value.items[activeItemIndex].techNotes"
:readonly="formState.readOnly"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemTechNotes')"
:error-messages="form().serverErrors(this, 'techNotes')"
ref="techNotes"
data-cy="techNotes"
@input="fieldValueChanged('techNotes')"
auto-grow
></v-textarea>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-autocomplete
v-model="value.items[activeItemIndex].workorderItemPriorityId"
@input="fieldValueChanged('workorderItemPriorityId')"
:items="pvm.selectLists.woItemPriorities"
item-text="name"
item-value="id"
:label="$ay.t('WorkOrderItemPriorityID')"
prepend-icon="$ayiEdit"
@click:prepend="handleEditItemPriorityClick()"
<v-col
v-if="form().showMe(this, 'WorkOrderItemWorkOrderStatusID')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<template v-slot:selection="{ item }">
<v-icon class="mr-3" :color="item.color">$ayiFireAlt</v-icon
>{{ item.name }}
</template>
<v-autocomplete
v-model="value.items[activeItemIndex].workorderItemStatusId"
:readonly="formState.readOnly"
:disabled="isDeleted"
@input="fieldValueChanged('workorderItemStatusId')"
:items="pvm.selectLists.woItemStatus"
item-text="name"
item-value="id"
:label="$ay.t('WorkOrderItemWorkOrderStatusID')"
:error-messages="form().serverErrors(this, 'workorderItemStatusId')"
ref="workorderItemStatusId"
data-cy="workorderItemStatusId"
prepend-icon="$ayiEdit"
@click:prepend="handleEditItemStatusClick()"
>
<template v-slot:selection="{ item }">
<v-icon class="mr-3" :color="item.color">$ayiCircle</v-icon
>{{ item.name }}
</template>
<template v-slot:item="{ item }">
<v-list-item-avatar>
<v-icon :color="item.color">$ayiFireAlt</v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title
><span
:class="
item.active
? ''
: 'disabled--text text-decoration-line-through'
"
>{{ item.name }}</span
></v-list-item-title
>
</v-list-item-content>
</template>
</v-autocomplete>
</v-col>
<template v-slot:item="{ item }">
<v-list-item-avatar>
<v-icon :color="item.color">$ayiCircle</v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title
><span
:class="
item.active
? ''
: 'disabled--text text-decoration-line-through'
"
>{{ item.name }}</span
></v-list-item-title
>
<v-list-item-subtitle> {{ item.notes }}</v-list-item-subtitle>
</v-list-item-content>
</template>
</v-autocomplete>
</v-col>
//status WorkOrderItemWorkOrderStatusID WorkorderItemStatusId //priority
<v-col
v-if="form().showMe(this, 'WorkOrderItemPriorityID')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<v-autocomplete
v-model="value.items[activeItemIndex].workorderItemPriorityId"
:readonly="formState.readOnly"
:disabled="isDeleted"
@input="fieldValueChanged('workorderItemPriorityId')"
:items="pvm.selectLists.woItemPriorities"
item-text="name"
item-value="id"
:label="$ay.t('WorkOrderItemPriorityID')"
:error-messages="
form().serverErrors(this, 'workorderItemPriorityId')
"
ref="workorderItemPriorityId"
data-cy="workorderItemPriorityId"
prepend-icon="$ayiEdit"
@click:prepend="handleEditItemPriorityClick()"
>
<template v-slot:selection="{ item }">
<v-icon class="mr-3" :color="item.color">$ayiFireAlt</v-icon
>{{ item.name }}
</template>
<template v-slot:item="{ item }">
<v-list-item-avatar>
<v-icon :color="item.color">$ayiFireAlt</v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title
><span
:class="
item.active
? ''
: 'disabled--text text-decoration-line-through'
"
>{{ item.name }}</span
></v-list-item-title
>
</v-list-item-content>
</template>
</v-autocomplete>
</v-col>
<!-- //status WorkOrderItemWorkOrderStatusID WorkorderItemStatusId //priority
WorkOrderItemPriorityID WorkorderItemPriorityId //requestdate
WorkOrderItemRequestDate RequestDate //warrantyservice
WorkOrderItemWarrantyService WarrantyService
<GzWoItemScheduledUsers
v-if="
pvm.subRights.scheduledUsers.visible &&
form().showMe(this, 'WorkOrderItemScheduledUserList')
"
v-model="value"
:pvm="pvm"
:active-wo-item-index="activeItemIndex"
data-cy="woItemScheduledUsers"
@change="$emit('change')"
/>
</template>
WorkOrderItemWarrantyService WarrantyService -->
<v-col cols="12">
<GzWoItemScheduledUsers
v-if="
pvm.subRights.scheduledUsers.visible &&
form().showMe(this, 'WorkOrderItemScheduledUserList')
"
v-model="value"
:pvm="pvm"
:active-wo-item-index="activeItemIndex"
data-cy="woItemScheduledUsers"
@change="$emit('change')"
/>
</v-col>
</template>
</v-row>
</div>
</template>
<script>
@@ -453,7 +480,7 @@ and it's probably not a big list to fill anyway
x.quantityReceived,
this.pvm.languageName
),
status: x.workorderItemStatusId, //todo: get real status name etc here
status: x.workorderItemStatusId, //todo: get real status name etc here use
requestDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
x.requestDate,
this.pvm.timeZoneName,
@@ -492,5 +519,10 @@ and it's probably not a big list to fill anyway
);
}
}
//TODO: Function status name from woitemstatusid
//and priority same
//this.pvm.pickLists.woItemStatus.find(x=>x.id==x.workorderItemStatusId)
};
</script>

View File

@@ -392,7 +392,7 @@ function generateMenu(vm) {
let menuOptions = {
isMain: false,
readOnly: vm.formState.readOnly,
icon: "$ayiCircle",
icon: "$ayiFireAlt",
title: "WorkOrderItemPriority",
helpUrl: "svc-work-order-item-priority",
formData: {

View File

@@ -89,7 +89,7 @@ async function clickHandler(menuItem) {
function generateMenu(vm) {
let menuOptions = {
isMain: true,
icon: "$ayiCircle",
icon: "$ayiFireAlt",
title: "WorkOrderItemPriorityList",
helpUrl: "svc-work-order-item-priority",
menuItems: [],