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) { fetch(keys) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
//step 1: build an array of keys that we don't have already //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 = []; var needIt = [];
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
if (!_.has(store.state.localeText, keys[i])) { if (!_.has(store.state.localeText, keys[i])) {

View File

@@ -50,16 +50,44 @@
<script> <script>
/* xeslint-disable */ /* eslint-disable */
import localeText from "../api/locale"; import localeText from "../api/locale";
import pagedList from "../api/pagedlist"; import pagedList from "../api/pagedlist";
import WidgetEdit from "../components/inventorywidgetedit"; import WidgetEdit from "../components/inventorywidgetedit";
export default { export default {
init() { init() {
localeText.fetch(["Widget", "WidgetList"]).then(() => { return localeText
// alert("inventorywidgetlist::FULLY INITIALIZED"); .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: { components: {
WidgetEdit WidgetEdit
}, },
@@ -76,10 +104,10 @@ export default {
selected: [], selected: [],
headers: [ headers: [
{ {
text: "Widget", text: this.lt("Widget"),
value: "name" value: "name"
}, },
{ text: "Serial", value: "serial" }, { text: this.lt("WidgetSerial"), value: "serial" },
{ text: "Price", value: "dollarAmount" }, { text: "Price", value: "dollarAmount" },
{ text: "Active", value: "active" }, { text: "Active", value: "active" },
{ text: "Roles", value: "roles" }, { text: "Roles", value: "roles" },
@@ -106,17 +134,17 @@ export default {
} }
}, },
mounted() { mounted() {
console.log("MOUNTED");
this.getDataFromApi(); this.getDataFromApi();
}, },
computed: {}, computed: {},
methods: { methods: {
// init() {
// localeText.fetch(["Widget", "WidgetList"]).then(() => {
// alert("inventorywidgetlist::FULLY INITIALIZED");
// });
// },
lt: function(key) { 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() { newItem() {
this.dialogdata.recordId = -1; this.dialogdata.recordId = -1;

View File

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