This commit is contained in:
2022-03-03 19:25:18 +00:00
parent e8d58ad834
commit 11f9aa87c2
4 changed files with 299 additions and 37 deletions

View File

@@ -53,44 +53,13 @@ Should LIST types have a fixed limit of maximum records returned??
- Widgets to make for beta in order of priority
**MUST HAVE***
BAR Count of wo within each status by time period / tags
shows all status types that are in the data returned only, not *all* status though I think it does that automatically
future: click on status bar it opens a filtered list of all wo by that status
SELECT COUNT(AWORKORDER.ID) Y,DATE_TRUNC('month', AWORKORDER.createddate) X, aworkorder.laststatusid Z
FROM AWORKORDER
LEFT JOIN AWORKORDERSTATUS ON (AWORKORDER.LASTSTATUSID = AWORKORDERSTATUS.ID)
WHERE AWORKORDER.createddate >'2022-01-01T07:59:59.9990000Z' AND AWORKORDER.createddate <'2023-01-01T08:00:00.0000000Z'
GROUP BY Z, X
ORDER BY X ASC
BAR same as above?? but by % wo within each status by time range / tags
this will show the state of things overall
WITH SUBQ AS
(SELECT COUNT(AWORKORDER.ID) WOCOUNT, DATE_TRUNC('month', AWORKORDER.CREATEDDATE) X,
AWORKORDER.LASTSTATUSID Z
FROM AWORKORDER
LEFT JOIN AWORKORDERSTATUS ON (AWORKORDER.LASTSTATUSID = AWORKORDERSTATUS.ID)
WHERE AWORKORDER.CREATEDDATE > '2022-01-01T07:59:59.9990000Z'
AND AWORKORDER.CREATEDDATE < '2023-01-01T08:00:00.0000000Z'
GROUP BY Z, X)
SELECT X,Z,
ROUND(WOCOUNT / SUM(WOCOUNT) OVER (PARTITION BY X) * 100,2) AS Y
FROM SUBQ
ORDER BY X ASC, y desc
LIST work orders by status (case 1974)
LIST work orders filtered by status (case 1974)
this *does* make sense because it can be hyper specific to something like a "waiting for parts" status so
if that is useful to a user then can see that list
needs limit, could bring in thousands if not careful
criteria:
wo status
wo status required
timespan
tags wo, woitem
@@ -891,13 +860,16 @@ BUILD 8.0.0-beta.1-rc3 CHANGES OF NOTE
- added dashboard widget "Reviews" available to all dashboardable users which shows today's Reviews
- added dashboard widget "Reminders" available to all dashboardable users which shows today's Reminders
- added dashboard widget Open customer service requests in a list
- added dashboard widget Overdue showing overdue personal work orders for logged in tech
- added dashboard widget Overdue showing all overdue work orders for management
- added dashboard widget Not Scheduled showing unscheduled work orders in a list
- added dashboard widget Service rate quantity showing personal service rate quantity on chart as line or bar version
- added dashboard widget Service rate quantity - All showing all selected criteria users service rate quantity on chart as line or bar version
- added dashboard widget Count of work orders created per day over time as bar and line chart for management
- added dashboard widget % of work orders completed on time as bar chart for management
- TODO: statuscount
- TODO: status pct
- added dashboard widget wo count by status bar bar management chart
- added dashboard widget wo percentage by status bar management chart
- added dashboard widget workorder by status list with status selection and other criteria
- Added *back* User color as it now ties in with widget charts (user edit form, import, backend, docs etc)
- v8-migrate plugin, fixed new issue related to removal of unused locale / translation keys preventing migrate
- Login form added prominent warning "beta test - not for production use"

View File

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

View File

@@ -0,0 +1,265 @@
<template>
<gz-dash
icon="$ayiTools"
:count="obj.length"
: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"
class="mt-4"
:label="$ay.t('Tags') + ' - ' + $ay.t('WorkOrder')"
></gz-tag-picker>
<v-radio-group
v-if="localSettings.wotags.length > 1"
v-model="localSettings.wotagsany"
row
class="mt-n3"
>
<v-radio
:label="$ay.t('GridFilterDialogAndRadioText')"
:value="false"
></v-radio>
<v-radio
:label="$ay.t('GridFilterDialogOrRadioText')"
:value="true"
></v-radio>
</v-radio-group>
<gz-tag-picker
v-model="localSettings.woitemtags"
class="mt-4"
:label="$ay.t('Tags') + ' - ' + $ay.t('WorkOrderItem')"
></gz-tag-picker>
<v-radio-group
v-if="localSettings.woitemtags.length > 1"
v-model="localSettings.woitemtagsany"
row
class="mt-n3"
>
<v-radio
:label="$ay.t('GridFilterDialogAndRadioText')"
:value="false"
></v-radio>
<v-radio
:label="$ay.t('GridFilterDialogOrRadioText')"
:value="true"
></v-radio>
</v-radio-group>
<v-text-field
v-model="localSettings.customTitle"
class="mt-4"
: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.wotagsany = this.localSettings.wotagsany;
this.settings.woitemtags = this.localSettings.woitemtags;
this.settings.woitemtagsany = this.localSettings.woitemtagsany;
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: "WorkOrderByStatusList",
criteria: {
wostatus: this.settings.wostatus,
wotags: this.settings.wotags,
wotagsany: this.settings.wotagsany,
woitemtags: this.settings.woitemtags,
woitemtagsany: this.settings.woitemtagsany
},
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",
"GridFilterDialogAndRadioText",
"GridFilterDialogOrRadioText"
]);
}
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

@@ -99,6 +99,7 @@ import GzDashWorkOrderCreatedCountBar from "../components/dash-work-order-create
import GzDashPctWorkOrderCompletedOnTimeBar from "../components/dash-work-order-completed-on-time-pct-bar.vue";
import GzDashWorkOrderStatusCount from "../components/dash-work-order-status-count-bar.vue";
import GzDashWorkOrderStatusPct from "../components/dash-work-order-status-pct-bar.vue";
import GzDashWorkorderByStatusList from "../components/dash-workorder-by-status-list.vue";
export default {
components: {
GzDashLaborHoursPersonalLine,
@@ -116,7 +117,8 @@ export default {
GzDashWorkOrderCreatedCountBar,
GzDashPctWorkOrderCompletedOnTimeBar,
GzDashWorkOrderStatusCount,
GzDashWorkOrderStatusPct
GzDashWorkOrderStatusPct,
GzDashWorkorderByStatusList
},
data() {
return {