This commit is contained in:
2019-03-07 00:25:31 +00:00
parent feff51618d
commit a852a75d99
4 changed files with 50 additions and 85 deletions

View File

@@ -1,10 +1,10 @@
<template>
<v-flex xs12 md12>
<div>
<div v-if="this.formReady">
<v-toolbar flat>
<v-toolbar-title>
<v-icon large color="primary">fa-splotch</v-icon>
<span class="hidden-sm-and-down">{{ lt("WidgetList")}}</span>
<span class="hidden-sm-and-down">{{ this.$gzlocale.get("WidgetList")}}</span>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn icon @click="newItem()">
@@ -30,7 +30,7 @@
:total-items="totalItems"
:loading="loading"
:rows-per-page-items="rowsPerPageItems"
:rows-per-page-text="lt('RowsPerPage')"
:rows-per-page-text="this.$gzlocale.get('RowsPerPage')"
class="elevation-1"
>
<template slot="items" slot-scope="props">
@@ -52,29 +52,44 @@
<script>
/* Xeslint-disable */
import localeText from "../api/locale";
import api from "../api/apiutil";
/* eslint-disable */
// import localeText from "../api/locale";
// import api from "../api/apiutil";
import WidgetEdit from "../components/inventorywidgetedit";
export default {
ltKeysRequired: [
"Widget",
"WidgetList",
"WidgetName",
"WidgetSerial",
"WidgetDollarAmount",
"Active",
"WidgetRoles",
"WidgetStartDate",
"WidgetEndDate",
"WidgetNotes",
"RowsPerPage"
],
created() {
var that = this;
this.$gzlocale
.fetch([
"Widget",
"WidgetList",
"WidgetName",
"WidgetSerial",
"WidgetDollarAmount",
"Active",
"WidgetRoles",
"WidgetStartDate",
"WidgetEndDate",
"WidgetNotes",
"RowsPerPage"
])
.then(() => {
that.$_.forEach(that.headers, function(header) {
header.text = that.$gzlocale.get(header.text);
});
//this.headers[0].text = this.$gzlocale.get("WidgetName");
})
.then(() => (this.formReady = true))
.catch(err => {
throw err;
});
},
components: {
WidgetEdit
},
data() {
return {
formReady: false,
dialogdata: {
showeditdialog: false,
recordId: 0
@@ -88,15 +103,18 @@ export default {
rowsPerPageText: "blah per blah",
headers: [
{
text: this.lt("WidgetName"),
text: "WidgetName",
value: "name"
},
{ text: this.lt("WidgetSerial"), value: "serial" },
{ text: this.lt("WidgetDollarAmount"), value: "dollarAmount" },
{ text: this.lt("Active"), value: "active" },
{ text: this.lt("WidgetRoles"), value: "roles" },
{ text: this.lt("WidgetStartDate"), value: "startDate" },
{ text: this.lt("WidgetEndDate"), value: "endDate" }
{ text: "WidgetSerial", value: "serial" },
{
text: "WidgetDollarAmount",
value: "dollarAmount"
},
{ text: "Active", value: "active" },
{ text: "WidgetRoles", value: "roles" },
{ text: "WidgetStartDate", value: "startDate" },
{ text: "WidgetEndDate", value: "endDate" }
]
};
},
@@ -104,36 +122,11 @@ export default {
pagination: {
handler() {
this.getDataFromApi();
/*
{
descending: false,
page: 1,
rowsPerPage: 5,
sortBy: "name",
totalItems: 0
}
*/
},
deep: true
}
},
mounted() {
/* Check rights here?
e.g.
if (
roles.hasRole(roles.AuthorizationRoles.OpsAdminFull) ||
roles.hasRole(roles.AuthorizationRoles.OpsAdminLimited)
) {
addNavItem(lt.get("Operations"), "cogs", "ops");
}
*/
this.rowsPerPageText = this.lt("RowsPerPage");
},
computed: {},
methods: {
lt: function(key) {
return localeText.get(key);
},
newItem() {
this.dialogdata.recordId = -1;
this.dialogdata.showeditdialog = true;
@@ -157,8 +150,8 @@ export default {
this.loading = true;
//debugger;
var listUrl = "Widget/ListWidgets?" + api.buildQuery(listOptions);
api.get(listUrl).then(res => {
var listUrl = "Widget/ListWidgets?" + this.$gzapi.buildQuery(listOptions);
this.$gzapi.get(listUrl).then(res => {
// debugger;
this.loading = false;
this.Items = res.data;
@@ -170,18 +163,12 @@ export default {
name: "inventory-widget-edit",
params: { id: item.id }
});
//router.push({ name: 'user', params: { userId: '123' } })
// this.dialogdata.recordId = item.id;
// this.dialogdata.showeditdialog = true;
}
}
};
</script>
<style>
</style>
//Example api response
// {
// "data": [

View File

@@ -39,9 +39,7 @@ import PartAssemblyTop from "../components/inventorypartassemblytop";
export default {
beforeCreate() {
//Cache all required lt keys
var ltKeysRequired = ["Inventory"].concat(WidgetList.ltKeysRequired);
this.$gzlocale.fetch(ltKeysRequired);
this.$gzlocale.fetch(["Inventory"]);
},
components: {
WidgetList,

View File

@@ -1,5 +1,5 @@
<template>
<v-layout row v-if="this.ready">
<v-layout row v-if="this.formReady">
<v-flex>
<h1>{{ this.$gzlocale.get("Log")}}</h1>
<v-textarea v-model="logText" full-width readonly auto-grow></v-textarea>
@@ -19,13 +19,13 @@ export default {
this.$gzlocale
.fetch(["Log"])
.then(() => (this.ready = true))
.then(() => (this.formReady = true))
.catch(err => {
throw err;
});
},
data() {
return { logText: "", ready: false };
return { logText: "", formReady: false };
}
};
</script>

View File

@@ -38,24 +38,12 @@
</form>
</v-flex>
</v-layout>
<!-- <v-footer>
<v-layout>
<v-flex primary py-2 text-xs-center white--text xs12>
<div>
<a href="https://ayanova.com" target="_blank">
<span class="white--text caption">AyaNova ({{version}}) {{copyright}}</span>
</a>
</div>
</v-flex>
</v-layout>
</v-footer> -->
</v-container>
</template>
<script>
/* xeslint-disable */
import auth from "../api/auth";
// import aboutInfo from "../api/aboutinfo";
export default {
name: "Login",
data() {
@@ -82,14 +70,6 @@ export default {
}
}
},
computed: {
// copyright() {
// return aboutInfo.copyright;
// },
// version() {
// return aboutInfo.version;
// }
},
beforeRouteEnter(to, from, next) {
next(() => {
auth.logout();