This commit is contained in:
2020-12-22 15:35:24 +00:00
parent 295cf4c0c4
commit 1ad5246fba
4 changed files with 33 additions and 12 deletions

View File

@@ -305,8 +305,8 @@ export default {
vm.$router.push({
name: "home-reviews",
params: {
objectType: Number.parseInt(item.data.ayaType, 10),
objectId: Number.parseInt(item.data.recordId, 10),
objectType: window.$gz.util.stringToIntOrNull(item.data.ayaType),
objectId: window.$gz.util.stringToIntOrNull(item.data.recordId),
name: objName
}
});

View File

@@ -607,6 +607,18 @@ export default {
return obj === true || obj === false || typeof variable === "boolean";
},
///////////////////////////////////////////////
// parse to number or null if not a number
// used because route params can turn into strings
// on their own
//
stringToIntOrNull: function(n) {
const ret = Number.parseInt(n, 10);
if (Number.isNaN(ret)) {
return null;
}
return ret;
},
///////////////////////////////////////////////
// Use geolocation api to attempt to get current location
// try high accuracy first and downgrade if unavailable
//https://www.openstreetmap.org/?mlat=48.3911&mlon=-124.7353#map=12/48.3910/-124.7353

View File

@@ -218,9 +218,13 @@ export default {
} else {
//New record so there has to be a object type and objectId in route
// path: "/home-reviews/:recordid/:objectType?/:objectId?",
vm.obj.objectId = window.$gz.util.stringToIntOrNull(
vm.$route.params.objectId
);
vm.obj.objectType = window.$gz.util.stringToIntOrNull(
vm.$route.params.objectType
);
vm.obj.objectId = vm.$route.params.objectId;
vm.obj.objectType = vm.$route.params.objectType;
if (!vm.obj.objectId || !vm.obj.objectType) {
throw "ObjectType and ObjectId are required to set a reminder";
}
@@ -346,9 +350,7 @@ export default {
},
iconForType() {
return window.$gz.util.iconForType(
Number.parseInt(this.obj.objectType, 10)
);
return window.$gz.util.iconForType(this.obj.objectType);
},
hasSupervisorRole: function() {
//mirrored from ReviewBiz.cs validation rule at server

View File

@@ -35,8 +35,15 @@ export default {
vm.rights = window.$gz.role.getRights(window.$gz.type.Review);
window.$gz.eventBus.$on("menu-click", clickHandler);
vm.objectId = vm.$route.params.objectId;
vm.objectType = vm.$route.params.objectType;
vm.objectId = window.$gz.util.stringToIntOrNull(vm.$route.params.objectId);
vm.objectType = window.$gz.util.stringToIntOrNull(
vm.$route.params.objectType
);
console.log("route params ingested as: ", {
id: vm.objectId,
type: vm.objectType
});
if (vm.objectId && vm.objectType) {
//pre-filter
@@ -44,13 +51,13 @@ export default {
{
fld: "metareviewobjectid",
filter: {
items: [{ op: "=", value: Number.parseInt(vm.objectId, 10) }] //oddly still need this to turn it from a string even when it wasn't a string
items: [{ op: "=", value: vm.objectId }]
}
},
{
fld: "AyaType",
filter: {
items: [{ op: "=", value: Number.parseInt(vm.objectType, 10) }]
items: [{ op: "=", value: vm.objectType }]
}
}
]);
@@ -94,7 +101,7 @@ export default {
this.selectedItems = selected;
},
iconForType() {
return window.$gz.util.iconForType(Number.parseInt(this.objectType, 10));
return window.$gz.util.iconForType(this.objectType, 10);
}
}
};