This commit is contained in:
@@ -3,11 +3,45 @@ const role = authorizationroles.AUTHORIZATION_ROLES;
|
||||
export default {
|
||||
registry: [
|
||||
{
|
||||
id: "dash-today-reminders-wo",
|
||||
roles: [role.Tech, role.TechRestricted],
|
||||
id: "dash-today-reminders",
|
||||
roles: [
|
||||
role.BizAdmin,
|
||||
role.BizAdminRestricted,
|
||||
role.ServiceRestricted,
|
||||
role.Service,
|
||||
role.InventoryRestricted,
|
||||
role.Inventory,
|
||||
role.Accounting,
|
||||
role.Tech,
|
||||
role.TechRestricted,
|
||||
role.OpsAdmin,
|
||||
role.OpsAdminRestricted,
|
||||
role.Sales,
|
||||
role.SalesRestricted
|
||||
],
|
||||
title: "ReminderList",
|
||||
type: "GzDashTodayReminders"
|
||||
},
|
||||
{
|
||||
id: "dash-today-reviews",
|
||||
roles: [
|
||||
role.BizAdmin,
|
||||
role.BizAdminRestricted,
|
||||
role.ServiceRestricted,
|
||||
role.Service,
|
||||
role.InventoryRestricted,
|
||||
role.Inventory,
|
||||
role.Accounting,
|
||||
role.Tech,
|
||||
role.TechRestricted,
|
||||
role.OpsAdmin,
|
||||
role.OpsAdminRestricted,
|
||||
role.Sales,
|
||||
role.SalesRestricted
|
||||
],
|
||||
title: "ReviewList",
|
||||
type: "GzDashTodayReviews"
|
||||
},
|
||||
{
|
||||
id: "dash-today-scheduled-wo",
|
||||
roles: [role.Tech, role.TechRestricted],
|
||||
|
||||
@@ -62,8 +62,18 @@ export default {
|
||||
},
|
||||
|
||||
computed: {},
|
||||
created() {
|
||||
//console.log("reminders-created");
|
||||
},
|
||||
updated() {
|
||||
//console.log("reminders-updated");
|
||||
},
|
||||
beforeUpdate() {
|
||||
//console.log("reminders-beforeUpdate");
|
||||
},
|
||||
async mounted() {
|
||||
//must be called from mounted to have refs available
|
||||
//console.log("reminders-mounted");
|
||||
await this.getDataFromApi();
|
||||
},
|
||||
methods: {
|
||||
@@ -80,6 +90,7 @@ export default {
|
||||
},
|
||||
|
||||
async getDataFromApi() {
|
||||
//console.log("reminders-getdata");
|
||||
let now = new Date();
|
||||
|
||||
//set now for the calendar to trigger a refresh
|
||||
|
||||
149
ayanova/src/components/dash-today-reviews.vue
Normal file
149
ayanova/src/components/dash-today-reviews.vue
Normal file
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<gz-dash
|
||||
icon="$ayiCalendarCheck"
|
||||
:show-more-button="false"
|
||||
:update-frequency="65000"
|
||||
:error-message="errorMessage"
|
||||
v-bind="$attrs"
|
||||
@dash-refresh="getDataFromApi()"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<template slot="main">
|
||||
<v-calendar
|
||||
ref="rvwcalendar"
|
||||
color="primary"
|
||||
type="day"
|
||||
hide-header
|
||||
:now="now"
|
||||
:interval-count="intervalCount"
|
||||
:first-time="startAt"
|
||||
:events="events"
|
||||
:event-color="getEventColor"
|
||||
:locale="languageName"
|
||||
@click:event="showEvent"
|
||||
>
|
||||
<template v-slot:event="{ event, eventSummary }">
|
||||
<div>
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<span
|
||||
:class="event.textColor + '--text'"
|
||||
v-html="eventSummary()"
|
||||
/><v-icon v-if="!event.editable" x-small :color="event.textColor">
|
||||
$ayiLock</v-icon
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</v-calendar>
|
||||
</template>
|
||||
</gz-dash>
|
||||
</template>
|
||||
<script>
|
||||
import GzDash from "./dash-base.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
GzDash
|
||||
},
|
||||
props: {
|
||||
maxListItems: { type: Number, default: 10 }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
events: [],
|
||||
errorMessage: null,
|
||||
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
|
||||
languageName: window.$gz.locale.getResolvedLanguage(),
|
||||
hour12: window.$gz.locale.getHour12(),
|
||||
startAt: "00:00",
|
||||
intervalCount: 24,
|
||||
now: null
|
||||
};
|
||||
},
|
||||
|
||||
computed: {},
|
||||
async mounted() {
|
||||
//must be called from mounted to have refs available
|
||||
await this.getDataFromApi();
|
||||
},
|
||||
methods: {
|
||||
getEventColor(event) {
|
||||
return event.color;
|
||||
},
|
||||
showEvent({ nativeEvent, event }) {
|
||||
nativeEvent.stopPropagation();
|
||||
|
||||
window.$gz.eventBus.$emit("openobject", {
|
||||
type: event.type,
|
||||
id: event.id
|
||||
});
|
||||
},
|
||||
|
||||
async getDataFromApi() {
|
||||
let now = new Date();
|
||||
|
||||
//set now for the calendar to trigger a refresh
|
||||
//if this doesn't work then need to trigger the change event: https://vuetifyjs.com/en/api/v-calendar/#events
|
||||
this.now = now.toLocaleString("sv-SE", {
|
||||
timeZone: this.timeZoneName
|
||||
});
|
||||
|
||||
this.$refs.rvwcalendar.scrollToTime({
|
||||
hour: now.getHours(),
|
||||
minute: 0
|
||||
});
|
||||
|
||||
try {
|
||||
this.errorMessage = null;
|
||||
const now = window.$gz.locale.nowUTC8601String(this.timeZoneName);
|
||||
const res = await window.$gz.api.post("schedule/personal", {
|
||||
view: 1,
|
||||
dark: this.$store.state.darkMode,
|
||||
start: window.$gz.locale.addDurationToUTC8601String(now, {
|
||||
hours: -24
|
||||
}),
|
||||
end: window.$gz.locale.addDurationToUTC8601String(now, { hours: 24 }),
|
||||
wisu: false,
|
||||
reviews: true,
|
||||
reminders: false
|
||||
});
|
||||
if (res.error) {
|
||||
this.errorMessage = res.error;
|
||||
} else {
|
||||
this.events.splice(0);
|
||||
const timeZoneName = this.timeZoneName;
|
||||
let i = res.data.length;
|
||||
while (i--) {
|
||||
const x = res.data[i];
|
||||
this.events.push({
|
||||
start: new Date(
|
||||
new Date(x.start)
|
||||
.toLocaleString("sv-SE", {
|
||||
timeZone: timeZoneName
|
||||
})
|
||||
.replace(" ", "T")
|
||||
).getTime(),
|
||||
end: new Date(
|
||||
new Date(x.end)
|
||||
.toLocaleString("sv-SE", {
|
||||
timeZone: timeZoneName
|
||||
})
|
||||
.replace(" ", "T")
|
||||
).getTime(),
|
||||
timed: true,
|
||||
name: x.name,
|
||||
color: x.color,
|
||||
textColor: x.textColor,
|
||||
type: x.type,
|
||||
id: x.id,
|
||||
editable: x.editable,
|
||||
userId: x.userId
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.errorMessage = error.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,74 +1,77 @@
|
||||
<template>
|
||||
<v-row v-if="formState.ready">
|
||||
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
|
||||
<v-col cols="12">
|
||||
<h2>DASHBOARD UNDER CONSTRUCTION</h2>
|
||||
</v-col>
|
||||
<v-col v-if="showSelector" cols="12">
|
||||
<v-dialog
|
||||
v-model="showSelector"
|
||||
scrollable
|
||||
max-width="600px"
|
||||
data-cy="dashSelector"
|
||||
@keydown.esc="cancel"
|
||||
>
|
||||
<v-card elevation="24">
|
||||
<v-card-title class="text-h5 lighten-2" primary-title>
|
||||
<span> {{ $ay.t("Add") }} </span>
|
||||
</v-card-title>
|
||||
<div>
|
||||
<v-row v-if="formState.ready">
|
||||
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
|
||||
|
||||
<v-card-text style="height: 500px;">
|
||||
<v-list>
|
||||
<v-list-item
|
||||
v-for="item in availableItems()"
|
||||
:key="item.id"
|
||||
@click="addItem(item)"
|
||||
<v-col v-if="showSelector" cols="12">
|
||||
<v-dialog
|
||||
v-model="showSelector"
|
||||
scrollable
|
||||
max-width="600px"
|
||||
data-cy="dashSelector"
|
||||
@keydown.esc="cancel"
|
||||
>
|
||||
<v-card elevation="24">
|
||||
<v-card-title class="text-h5 lighten-2" primary-title>
|
||||
<span> {{ $ay.t("Add") }} </span>
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text style="height: 500px;">
|
||||
<v-list>
|
||||
<v-list-item
|
||||
v-for="item in availableItems()"
|
||||
:key="item.id"
|
||||
@click="addItem(item)"
|
||||
>
|
||||
<v-list-item-title>{{ $ay.t(item.title) }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-card-text>
|
||||
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-btn
|
||||
color="primary"
|
||||
text
|
||||
data-cy="dashSelector:cancel"
|
||||
@click.native="showSelector = false"
|
||||
>{{ $ay.t("Cancel") }}</v-btn
|
||||
>
|
||||
<v-list-item-title>{{ $ay.t(item.title) }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-card-text>
|
||||
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-btn
|
||||
color="primary"
|
||||
text
|
||||
data-cy="dashSelector:cancel"
|
||||
@click.native="showSelector = false"
|
||||
>{{ $ay.t("Cancel") }}</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-col>
|
||||
<v-col v-if="!hasItems()" cols="12">
|
||||
<v-btn outlined @click.native="showSelector = true">{{
|
||||
$ay.t("Add")
|
||||
}}</v-btn>
|
||||
</v-col>
|
||||
<v-col
|
||||
v-for="(item, i) in effectiveView"
|
||||
:key="i"
|
||||
class="d-flex child-flex"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<component
|
||||
:is="item.type"
|
||||
v-bind="item"
|
||||
:max-list-items="10"
|
||||
@dash-remove="dashRemove"
|
||||
@dash-move-start="dashMoveStart"
|
||||
@dash-move-back="dashMoveBack"
|
||||
@dash-move-forward="dashMoveForward"
|
||||
@dash-move-end="dashMoveEnd"
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col
|
||||
v-for="(item, i) in effectiveView"
|
||||
:key="i"
|
||||
class="d-flex child-flex"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
</component>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<component
|
||||
:is="item.type"
|
||||
:ref="item.ref"
|
||||
v-bind="item"
|
||||
:max-list-items="10"
|
||||
@dash-remove="dashRemove"
|
||||
@dash-move-start="dashMoveStart"
|
||||
@dash-move-back="dashMoveBack"
|
||||
@dash-move-forward="dashMoveForward"
|
||||
@dash-move-end="dashMoveEnd"
|
||||
>
|
||||
</component>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-btn outlined @click.native="showSelector = true">{{
|
||||
$ay.t("Add")
|
||||
}}</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -81,6 +84,7 @@ import GzDashTestLineWidgetMonthlyTotalPrice from "../components/dash-test-line-
|
||||
import GzDashTestDayCalendarWidget from "../components/dash-test-day-calendar-widget.vue";
|
||||
import GzDashTodayScheduledWo from "../components/dash-today-scheduled-wo.vue";
|
||||
import GzDashTodayReminders from "../components/dash-today-reminders.vue";
|
||||
import GzDashTodayReviews from "../components/dash-today-reviews.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -89,7 +93,8 @@ export default {
|
||||
GzDashTestLineWidgetMonthlyTotalPrice,
|
||||
GzDashTestDayCalendarWidget,
|
||||
GzDashTodayScheduledWo,
|
||||
GzDashTodayReminders
|
||||
GzDashTodayReminders,
|
||||
GzDashTodayReviews
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -139,9 +144,9 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
hasItems: function() {
|
||||
return this.effectiveView && this.effectiveView.length > 0;
|
||||
},
|
||||
// hasItems: function() {
|
||||
// return this.effectiveView && this.effectiveView.length > 0;
|
||||
// },
|
||||
dashMoveStart: function(id) {
|
||||
this.move("start", id);
|
||||
},
|
||||
@@ -204,6 +209,7 @@ export default {
|
||||
},
|
||||
addItem: function(item) {
|
||||
this.showSelector = false;
|
||||
item.ref = "db" + Date.now();
|
||||
this.effectiveView.push(item);
|
||||
this.saveView();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user