This commit is contained in:
2022-03-01 17:51:05 +00:00
parent aa3f111179
commit a23af8f9fc
5 changed files with 250 additions and 33 deletions

View File

@@ -51,36 +51,6 @@ https://www.ayanova.com/AyaNova7webHelp/index.html?dashboard.htm
- Widgets to make for beta in order of priority
**MUST HAVE***
* LIST not scheduled work orders list for service manager [wo#], [date?best one],[customer],[summary]
criteria?
tags, currentstatus?
description:
"Not assigned provides links to service workorders that have not yet been assigned to any schedulable resources."
wo that is not a closed status, has no techs assigned to it in woitemscheduledusers (null or not extant)
oldest to newest in list, maybe just a limited number like most recent 50 or something
more button opens grid query for it if possible
Query stuff:
SELECT AWORKORDER.SERIAL,
AWORKORDER.SERVICEDATE,
ACUSTOMER.NAME,
AWORKORDER.NOTES
FROM AWORKORDER
LEFT JOIN AWORKORDERITEM ON AWORKORDER.ID = AWORKORDERITEM.WORKORDERID
LEFT JOIN AWORKORDERITEMSCHEDULEDUSER ON AWORKORDERITEM.ID = AWORKORDERITEMSCHEDULEDUSER.WORKORDERITEMID
LEFT JOIN AWORKORDERSTATUS ON (AWORKORDER.LASTSTATUSID = AWORKORDERSTATUS.ID)
LEFT JOIN ACUSTOMER ON (AWORKORDER.CUSTOMERID = ACUSTOMER.ID)
WHERE (LASTSTATUSID IS NULL OR AWORKORDERSTATUS.COMPLETED = FALSE)
AND AWORKORDERITEMSCHEDULEDUSER.ID IS NULL
AND LASTSTATUSID = 2
ORDER BY AWORKORDER.ID ASC
SELECT count(*)
FROM aworkorder
LEFT JOIN AWORKORDERSTATUS ON (aworkorder.LASTSTATUSID = AWORKORDERSTATUS.ID)
WHERE (laststatusid is null or AWORKORDERSTATUS.completed = false)
* LIST CSR's with OPEN status only in reverse chronological order for service manager
* BAR/LINE Billed hours for all users available to service manager roles

View File

@@ -5,6 +5,26 @@ const role = authorizationroles.AUTHORIZATION_ROLES;
*/
export default {
registry: [
{
roles: [
role.BizAdmin,
role.BizAdminRestricted,
role.ServiceRestricted,
role.Service,
role.Tech,
role.TechRestricted
],
title: "DashboardOpenCSR",
icon: "$ayiListAlt",
type: "GzDashCSROpenList",
singleOnly: false,
settings: {
customTitle: null,
wotags: [],
woitemtags: [],
wostatus: null
}
},
{
roles: [
role.BizAdmin,

View File

@@ -0,0 +1,226 @@
<template>
<gz-dash
icon="$ayiTools"
:add-url="'svc-workorders/0'"
:show-context-button="true"
:update-frequency="300000"
v-bind="[$props, $attrs]"
@dash-refresh="getDataFromApi()"
@dash-context="showContext()"
v-on="$listeners"
>
<template slot="main">
<v-sheet height="400" class="overflow-y-auto">
<div
v-if="obj.length == 0"
class="ml-6 mt-6 text-h4 grey--text text--lighten-1"
>
{{ $ay.t("NoData") }}
</div>
<template v-for="(item, i) in obj">
<v-list-item :key="i" two-line :to="'/svc-workorders/' + item.id">
<v-list-item-content>
<v-list-item-title
><span class="text-h6 primary--text">{{ item.serial }}</span
><span class="ml-4">{{ $ay.dt(item.servicedate) }}</span>
<span class="ml-4">{{ item.name }}</span></v-list-item-title
>
<v-list-item-subtitle>{{ item.notes }}</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</template>
</v-sheet>
</template>
<template slot="settings">
<div></div>
<v-col v-if="context" cols="12">
<v-dialog
v-model="context"
scrollable
max-width="400px"
data-cy="dashSettings"
@keydown.esc="cancel"
>
<v-card elevation="24">
<v-card-title class="text-h5 lighten-2" primary-title>
<span> {{ $ay.t("Settings") }} </span>
</v-card-title>
<v-card-text>
<v-autocomplete
v-model="localSettings.wostatus"
class="mt-5"
:items="selectLists.wostatus"
item-text="name"
item-value="id"
dense
:label="$ay.t('WorkOrderStatus')"
>
<template v-slot:item="data">
<v-list-item-avatar>
<v-icon :color="data.item.color">$ayiFlag</v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title
><span class="text-subtitle-2">{{ data.item.name }}</span
><v-icon
v-if="data.item.locked"
small
color="disabled"
class="ml-2"
>$ayiLock</v-icon
>
<!-- <v-icon
v-if="data.item.completed"
color="disabled"
class="ml-1"
small
>$ayiCheckCircle</v-icon
> -->
</v-list-item-title>
</v-list-item-content>
<v-list-item-action> </v-list-item-action>
</template>
</v-autocomplete>
<gz-tag-picker
v-model="localSettings.wotags"
:label="$ay.t('Tags') + ' - ' + $ay.t('WorkOrder')"
></gz-tag-picker>
<gz-tag-picker
v-model="localSettings.woitemtags"
:label="$ay.t('Tags') + ' - ' + $ay.t('WorkOrderItem')"
></gz-tag-picker>
<v-text-field
v-model="localSettings.customTitle"
:label="$ay.t('Name')"
></v-text-field>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-btn color="primary" text @click.native="context = false">{{
$ay.t("Cancel")
}}</v-btn>
<v-spacer></v-spacer>
<v-btn
color="primary"
text
class="ml-4"
@click="updateSettings"
>{{ $ay.t("Save") }}</v-btn
>
</v-card-actions>
</v-card>
</v-dialog>
</v-col>
</template>
</gz-dash>
</template>
<script>
import GzDash from "./dash-base.vue";
export default {
components: {
GzDash
},
props: {
settings: { type: Object, default: null }
},
data() {
return {
obj: {},
context: false,
localSettings: {},
selectLists: {
dateFilterTokens: [],
units: [],
wostatus: []
}
};
},
computed: {},
async created() {
await initWidget(this);
},
async mounted() {
//must be called from mounted to have refs available
await this.getDataFromApi();
},
methods: {
showContext: function() {
this.localSettings = window.$gz.util.deepCopySkip(this.settings);
this.context = true;
},
updateSettings: function() {
//copy settings from local to parent settings, need to do it this way or get error about mutating prop directly which is vexing and has no easy solution seemingly
this.settings.customTitle = this.localSettings.customTitle;
this.settings.wostatus = this.localSettings.wostatus;
this.settings.wotags = this.localSettings.wotags;
this.settings.woitemtags = this.localSettings.woitemtags;
this.$emit("dash-change"); //trigger save to server
this.context = false;
this.getDataFromApi();
},
async getDataFromApi() {
try {
this.errorMessage = null;
const res = await window.$gz.api.post("kpi", {
KPIName: "WorkOrderUnscheduledOpenList",
criteria: {
wostatus: this.settings.wostatus,
wotags: this.settings.wotags,
woitemtags: this.settings.woitemtags
},
clientTimeStamp: window.$gz.locale.clientLocalZoneTimeStamp()
});
if (res.error) {
this.errorMessage = res.error;
} else {
this.obj = res.data;
}
} catch (error) {
this.errorMessage = error.toString();
}
}
}
};
/////////////////////////////////
//
//
async function initWidget(vm) {
await fetchTranslatedText();
await fetchWorkorderStatusList(vm);
//populateSelectionLists(vm);
}
//////////////////////////////////////////////////////////
//
// Ensures UI translated text is available
//
async function fetchTranslatedText() {
await window.$gz.translation.cacheTranslations([
"Name",
"WorkOrder",
"WorkOrderItem",
"WorkOrderStatus",
"NoData"
]);
}
async function fetchWorkorderStatusList(vm) {
let res = await window.$gz.api.get("work-order-status/list");
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
vm.selectLists.wostatus = res.data.all.filter(z => z.completed == false); //TODO: weed out closed status
vm.selectLists.wostatus.unshift(window.$gz.form.getNoSelectionItem(true));
}
}
</script>

View File

@@ -147,7 +147,6 @@ export default {
},
async mounted() {
//must be called from mounted to have refs available
//console.log("reminders-mounted");
await this.getDataFromApi();
},
methods: {

View File

@@ -89,6 +89,7 @@ import GzDashTodayReviews from "../components/dash-today-reviews.vue";
import GzDashLaborHoursPersonalLine from "../components/dash-labor-hours-personal-line.vue";
import GzDashLaborHoursPersonalBar from "../components/dash-labor-hours-personal-bar.vue";
import GzDashWorkorderUnscheduledOpenList from "../components/dash-workorder-unscheduled-open-list.vue";
import GzDashCSROpenList from "../components/dash-csr-open-list";
export default {
components: {
@@ -97,7 +98,8 @@ export default {
GzDashTodayScheduledWo,
GzDashTodayReminders,
GzDashTodayReviews,
GzDashWorkorderUnscheduledOpenList
GzDashWorkorderUnscheduledOpenList,
GzDashCSROpenList
},
data() {
return {