This commit is contained in:
2021-04-29 22:54:04 +00:00
parent 40f1d67607
commit f376187418
6 changed files with 68 additions and 41 deletions

View File

@@ -137,16 +137,19 @@
</div>
</template>
</v-navigation-drawer>
<!-- :color="appBar.isMain ? 'primary' : 'secondary'" -->
<!-- :color="appBar.isMain ? 'primary' : 'secondary'" style="width: 300px" -->
<v-app-bar v-if="isAuthenticated" :color="appBar.color" dark fixed app>
<v-app-bar-nav-icon
@click.stop="drawer = !drawer"
data-cy="navicon"
></v-app-bar-nav-icon>
<v-toolbar-title style="width: 300px" class="ml-0 pl-4">
<v-icon>{{ appBar.icon }}</v-icon
>&nbsp;
<span v-if="appBar.title">{{ $ay.t(appBar.title) }}</span>
<v-toolbar-title class="ml-n5 ml-sm-0 pl-sm-4">
<v-icon>{{ appBar.icon }}</v-icon>
<span
v-if="appBar.title"
class="text-subtitle-2 ml-2 text-sm-h6 ml-sm-4"
>{{ appBar.title }}</span
>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn text icon to="/home-notifications" data-cy="notification">
@@ -383,6 +386,22 @@ export default {
source: { type: String, default: null }
},
methods: {
titleDisplay() {
//Allow for extra info in title
if (this.appBar.title == null) {
return null;
}
if (this.appBar.title.includes(":")) {
const t = this.appBar.title.split(":");
// if (this.$vuetify.breakpoint.smAndUp) {
// return this.$ay.t(t[0]) + " " + t[1];
// } else {
return t[1] + " " + this.$ay.t(t[0]);
//}
}
return this.$ay.t(this.appBar.title);
},
afterLeave() {
this.$root.$emit("triggerScroll");
},

View File

@@ -1,5 +1,7 @@
/* xxxeslint-disable */
import { VMain } from "vuetify/lib";
/////////////////////////////////
// Menu utils and handlers
//
@@ -44,7 +46,8 @@ export default {
vm.appBar.isMain = ctx.isMain;
vm.appBar.icon = ctx.icon;
vm.appBar.title = ctx.title;
vm.appBar.title = ""; //this prevents fou[translated]c
vm.appBar.readOnly = ctx.readOnly;
if (ctx.readOnly === true) {
@@ -52,20 +55,30 @@ export default {
} else {
vm.appBar.color = ctx.isMain ? "primary" : "secondary";
}
let recordName = "";
//ctx.title if set is a Translation key
//ctx.formData.recordName is the object name or serial number or whatever identifies it uniquely
let recordName = "";
if (ctx && ctx.formData && ctx.formData.recordName) {
recordName = ctx.formData.recordName;
}
let hasRecordName = recordName != "";
if (ctx.title) {
//it has a title translation key
if (hasRecordName) {
//recordname takes all precedence in AppBar in order to conserve space (narrow view etc)
//also it just looks cleaner, the icon is already there to indicate where the user is at
//vm.appBar.title = `${ctx.title}:${recordName}`;
vm.appBar.title = recordName;
document.title = `${recordName} - ${vm.$ay.t(ctx.title)} AyaNova `;
} else {
vm.appBar.title = ctx.title;
document.title = `${vm.$ay.t(ctx.title)} ${recordName}`;
}
} else {
if (hasRecordName) {
//not title but has record name
vm.appBar.title = recordName;
document.title = `${recordName} AyaNova`;
} else {
document.title = "AyaNova";

View File

@@ -1,32 +1,26 @@
<template>
<div>
<v-row>
<v-col cols="12" sm="6" lg="4" xl="3" v-if="value.serial != 0">
<template v-if="canEditSerial">
<v-text-field
v-model="value.serial"
:readonly="formState.readOnly"
:label="$ay.t('WorkOrderSerialNumber')"
ref="serial"
data-cy="serial"
:rules="[
form().integerValid(this, 'serial'),
form().required(this, 'serial')
]"
:error-messages="form().serverErrors(this, 'serial')"
@input="fieldValueChanged('serial')"
></v-text-field>
</template>
<template v-else>
<div>
<span class="text-caption">
{{ $ay.t("WorkOrderSerialNumber") }}</span
>
</div>
<div>
<span class="text-h5">{{ value.serial }}</span>
</div>
</template>
<v-col
cols="12"
sm="6"
lg="4"
xl="3"
v-if="value.serial != 0 && canEditSerial"
>
<v-text-field
v-model="value.serial"
:readonly="formState.readOnly"
:label="$ay.t('WorkOrderSerialNumber')"
ref="serial"
data-cy="serial"
:rules="[
form().integerValid(this, 'serial'),
form().required(this, 'serial')
]"
:error-messages="form().serverErrors(this, 'serial')"
@input="fieldValueChanged('serial')"
></v-text-field>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-pick-list

View File

@@ -1687,7 +1687,7 @@ function generateMenu(vm) {
ayaType: window.$gz.type.PurchaseOrder,
recordId: vm.$route.params.recordid,
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
recordName: vm.obj.serial
recordName: vm.obj.serial.toString()
},
menuItems: []
};

View File

@@ -371,7 +371,12 @@ export default {
},
async created() {
let vm = this;
//debugger;
window.$gz.eventBus.$emit("menu-change", {
isMain: true,
icon: "",
title: null
});
//reset password redirects here with preset creds
//this will help the user identify it and hopefully remember it
@@ -384,11 +389,6 @@ export default {
vm.mediumLogoUrl = window.$gz.api.logoUrl("medium");
vm.largeLogoUrl = window.$gz.api.logoUrl("large");
window.$gz.eventBus.$emit("menu-change", {
isMain: true,
icon: "",
title: ""
});
try {
let res = await window.$gz.api.get("notify/hello");
if (res.data != null) {
@@ -533,6 +533,7 @@ export default {
},
async login() {
let vm = this;
if (vm.input.username != "" && vm.input.password != "") {
vm.errorBadCreds = false;
vm.loggedInWithKnownPassword =

View File

@@ -979,7 +979,7 @@ function generateMenu(vm) {
ayaType: window.$gz.type.WorkOrder,
recordId: vm.$route.params.recordid,
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
recordName: vm.obj.serial
recordName: vm.obj.serial.toString()
},
menuItems: []
};