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({ vm.$router.push({
name: "home-reviews", name: "home-reviews",
params: { params: {
objectType: Number.parseInt(item.data.ayaType, 10), objectType: window.$gz.util.stringToIntOrNull(item.data.ayaType),
objectId: Number.parseInt(item.data.recordId, 10), objectId: window.$gz.util.stringToIntOrNull(item.data.recordId),
name: objName name: objName
} }
}); });

View File

@@ -607,6 +607,18 @@ export default {
return obj === true || obj === false || typeof variable === "boolean"; 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 // Use geolocation api to attempt to get current location
// try high accuracy first and downgrade if unavailable // try high accuracy first and downgrade if unavailable
//https://www.openstreetmap.org/?mlat=48.3911&mlon=-124.7353#map=12/48.3910/-124.7353 //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 { } else {
//New record so there has to be a object type and objectId in route //New record so there has to be a object type and objectId in route
// path: "/home-reviews/:recordid/:objectType?/:objectId?", // 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) { if (!vm.obj.objectId || !vm.obj.objectType) {
throw "ObjectType and ObjectId are required to set a reminder"; throw "ObjectType and ObjectId are required to set a reminder";
} }
@@ -346,9 +350,7 @@ export default {
}, },
iconForType() { iconForType() {
return window.$gz.util.iconForType( return window.$gz.util.iconForType(this.obj.objectType);
Number.parseInt(this.obj.objectType, 10)
);
}, },
hasSupervisorRole: function() { hasSupervisorRole: function() {
//mirrored from ReviewBiz.cs validation rule at server //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); vm.rights = window.$gz.role.getRights(window.$gz.type.Review);
window.$gz.eventBus.$on("menu-click", clickHandler); window.$gz.eventBus.$on("menu-click", clickHandler);
vm.objectId = vm.$route.params.objectId; vm.objectId = window.$gz.util.stringToIntOrNull(vm.$route.params.objectId);
vm.objectType = vm.$route.params.objectType; 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) { if (vm.objectId && vm.objectType) {
//pre-filter //pre-filter
@@ -44,13 +51,13 @@ export default {
{ {
fld: "metareviewobjectid", fld: "metareviewobjectid",
filter: { 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", fld: "AyaType",
filter: { filter: {
items: [{ op: "=", value: Number.parseInt(vm.objectType, 10) }] items: [{ op: "=", value: vm.objectType }]
} }
} }
]); ]);
@@ -94,7 +101,7 @@ export default {
this.selectedItems = selected; this.selectedItems = selected;
}, },
iconForType() { iconForType() {
return window.$gz.util.iconForType(Number.parseInt(this.objectType, 10)); return window.$gz.util.iconForType(this.objectType, 10);
} }
} }
}; };