This commit is contained in:
2018-11-28 18:35:36 +00:00
parent 97fdab7a48
commit 5288c55d80
3 changed files with 48 additions and 16 deletions

View File

@@ -14,6 +14,7 @@ export default {
fetch(keys) {
return new Promise(function(resolve, reject) {
//step 1: build an array of keys that we don't have already
//Note: this will ensure only unique keys go into the store so it's safe to call this with dupes as can happen
var needIt = [];
for (var i = 0; i < keys.length; i++) {
if (!_.has(store.state.localeText, keys[i])) {

View File

@@ -50,16 +50,44 @@
<script>
/* xeslint-disable */
/* eslint-disable */
import localeText from "../api/locale";
import pagedList from "../api/pagedlist";
import WidgetEdit from "../components/inventorywidgetedit";
export default {
init() {
localeText.fetch(["Widget", "WidgetList"]).then(() => {
// alert("inventorywidgetlist::FULLY INITIALIZED");
});
return localeText
.fetch([
"Widget",
"WidgetList",
"WidgetName",
"WidgetSerial",
"WidgetDollarAmount",
"WidgetActive",
"WidgetRoles",
"WidgetStartDate",
"WidgetEndDate",
"WidgetNotes"
])
.then(() => {
console.log(
"inventorywidgetlist::FULLY INITIALIZED, widgetSerial=" +
localeText.get("WidgetSerial")
);
});
},
ltKeysRequired: [
"Widget",
"WidgetList",
"WidgetName",
"WidgetSerial",
"WidgetDollarAmount",
"WidgetActive",
"WidgetRoles",
"WidgetStartDate",
"WidgetEndDate",
"WidgetNotes"
],
components: {
WidgetEdit
},
@@ -76,10 +104,10 @@ export default {
selected: [],
headers: [
{
text: "Widget",
text: this.lt("Widget"),
value: "name"
},
{ text: "Serial", value: "serial" },
{ text: this.lt("WidgetSerial"), value: "serial" },
{ text: "Price", value: "dollarAmount" },
{ text: "Active", value: "active" },
{ text: "Roles", value: "roles" },
@@ -106,17 +134,17 @@ export default {
}
},
mounted() {
console.log("MOUNTED");
this.getDataFromApi();
},
computed: {},
methods: {
// init() {
// localeText.fetch(["Widget", "WidgetList"]).then(() => {
// alert("inventorywidgetlist::FULLY INITIALIZED");
// });
// },
lt: function(key) {
return localeText.get(key);
console.log("Calling LT for " + key);
var v = localeText.get(key);
console.log("LT: returning " + v);
return v;
//return localeText.get(key);
},
newItem() {
this.dialogdata.recordId = -1;

View File

@@ -37,7 +37,7 @@
</template>
<script>
/* xeslint-disable */
/* eslint-disable */
import WidgetList from "../components/inventorywidgetlist";
import WarehouseTop from "../components/inventorywarehousetop";
import POTop from "../components/inventorypotop";
@@ -71,9 +71,12 @@ export default {
},
beforeRouteEnter(to, from, next) {
//get lt, roles, populate top level components accordingly
lt.fetch(["Inventory"]).then(() => {
//init widgetlist
WidgetList.init();
var ltKeysRequired = ["Inventory"].concat(WidgetList.ltKeysRequired);
console.log("Inventory.vue, ltKeysRequiredIs:");
console.log(ltKeysRequired);
lt.fetch(ltKeysRequired).then(() => {
// //init widgetlist
// WidgetList.init().then(next());
next();
});
},