This commit is contained in:
2020-12-22 16:09:35 +00:00
parent 1ad5246fba
commit 048fd308c7
4 changed files with 52 additions and 31 deletions

View File

@@ -70,7 +70,10 @@ currently doing: Review
Make sure can review from all edit forms Make sure can review from all edit forms
test it out full from front to back start to finish, lots of edges on this one test it out full from front to back start to finish, lots of edges on this one
todo: make new review from a review for the same object (new menu option in review)
todo: make a new review from review list
todo: not able to make a new review from review list when it's just a direct viewing of list
or should I add an object selector? NO
EACH OBJECT DEV CYCLE: EACH OBJECT DEV CYCLE:

View File

@@ -710,6 +710,22 @@ export default {
} }
} }
} }
},
///////////////////////////////////
// FETCH BIZ OBJECT NAME
//
//
async fetchBizObjectName(ayaType, objectId) {
//todo: this is a good candidate for a light weight cache
//maybe one hour or something to invalidate and volatile on refresh
let res = await this.get(`name/${ayaType}/${objectId}`);
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
return Promise.reject(res);
} else {
return res.data;
}
} }
//--------------- //---------------

View File

@@ -229,11 +229,20 @@ export default {
throw "ObjectType and ObjectId are required to set a reminder"; throw "ObjectType and ObjectId are required to set a reminder";
} }
vm.name = vm.$route.params.name; vm.name = vm.$route.params.name;
window.$gz.form.setFormState({ window.$gz.form.setFormState({
vm: vm, vm: vm,
loading: false loading: false
}); });
} }
if (!vm.name) {
vm.name = await window.$gz.api.fetchBizObjectName(
vm.obj.objectType,
vm.obj.objectId
);
}
window.$gz.form.setFormState({ window.$gz.form.setFormState({
vm: vm, vm: vm,
dirty: false, dirty: false,
@@ -681,9 +690,15 @@ async function clickHandler(menuItem) {
case "new": case "new":
m.vm.$router.push({ m.vm.$router.push({
name: "review-edit", name: "review-edit",
params: { recordid: 0, new: true } params: {
recordid: 0,
objectType: m.vm.obj.objectType,
objectId: m.vm.obj.objectId,
name: m.vm.name
}
}); });
break; break;
case "duplicate": case "duplicate":
m.vm.duplicate(); m.vm.duplicate();
break; break;

View File

@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<div v-if="objectType" class="mb-6"> <div v-if="objectType && objectId" class="mb-6">
<v-icon @click="navToTarget()" large>{{ iconForType() }}</v-icon <v-icon @click="navToTarget()" large>{{ iconForType() }}</v-icon
><span @click="navToTarget()" class="text-h5"> {{ name }}</span> ><span @click="navToTarget()" class="text-h5"> {{ name }}</span>
</div> </div>
@@ -40,12 +40,8 @@ export default {
vm.$route.params.objectType vm.$route.params.objectType
); );
console.log("route params ingested as: ", { if (vm.objectId && vm.objectId != 0 && vm.objectType) {
id: vm.objectId, console.log("reviews created:", { type: vm.objectType, id: vm.objectId });
type: vm.objectType
});
if (vm.objectId && vm.objectType) {
//pre-filter //pre-filter
vm.metaView = JSON.stringify([ vm.metaView = JSON.stringify([
{ {
@@ -61,7 +57,10 @@ export default {
} }
} }
]); ]);
await fetchObjectName(vm); vm.name = await window.$gz.api.fetchBizObjectName(
vm.objectType,
vm.objectId
);
} }
generateMenu(vm); generateMenu(vm);
@@ -190,13 +189,15 @@ function generateMenu(vm) {
}; };
if (vm.rights.change) { if (vm.rights.change) {
menuOptions.menuItems.push({ if (vm.objectId && vm.objectType) {
title: "New", menuOptions.menuItems.push({
icon: "$ayiPlus", title: "New",
surface: true, icon: "$ayiPlus",
key: FORM_KEY + ":new", surface: true,
vm: vm key: FORM_KEY + ":new",
}); vm: vm
});
}
} }
//REPORTS //REPORTS
@@ -227,18 +228,4 @@ function generateMenu(vm) {
}); });
window.$gz.eventBus.$emit("menu-change", menuOptions); window.$gz.eventBus.$emit("menu-change", menuOptions);
} }
///////////////////////////////////////////////////////////
//
//
async function fetchObjectName(vm) {
let res = await window.$gz.api.get(`name/${vm.objectType}/${vm.objectId}`);
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
return Promise.reject(res);
} else {
vm.name = res.data;
}
}
</script> </script>