47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
/* xxxeslint-disable */
|
|
import ayatype from "./ayatype";
|
|
export default {
|
|
///////////////////////////////
|
|
// APP (GLOBAL) openobject CLICK HANDLER
|
|
//
|
|
// Deal with a request to open an object (from main datatables mainly)
|
|
// called from App.vue
|
|
handleOpenObjectClick(vm, tid) {
|
|
//expects extra data (tid) to be { type: [AYATYPE], id: [RECORDID] }
|
|
//NOTE: for new objects all edit pages assume record ID 0 means create rather than open
|
|
|
|
if (tid.type && tid.id) {
|
|
switch (tid.type) {
|
|
case ayatype.Widget:
|
|
vm.$router.push({
|
|
name: "inventory-widget-edit",
|
|
params: { id: tid.id }
|
|
});
|
|
break;
|
|
|
|
default:
|
|
window.$gz.eventBus.$emit(
|
|
"notify-warning",
|
|
"open-object-handler: unrecognized type [" + tid.type + "]"
|
|
);
|
|
}
|
|
}
|
|
},
|
|
|
|
///////////////////////////////////
|
|
// WIRE UP MENU EVENTS
|
|
//
|
|
// called once from app.vue only
|
|
//
|
|
wireUpEventHandlers(vm) {
|
|
var self = this;
|
|
//expects extra data (tid) to be { type: [AYATYPE], id: [RECORDID] }
|
|
window.$gz.eventBus.$on("openobject", function handleOpenObjectClickHandler(
|
|
tid
|
|
) {
|
|
self.handleOpenObjectClick(vm, tid);
|
|
});
|
|
}
|
|
//new functions above here
|
|
};
|