diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/BaseResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/BaseResource.vue
index 410faf9ad5..a5ef431354 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/BaseResource.vue
+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/BaseResource.vue
@@ -113,6 +113,7 @@ export default {
doResourceDelete: this.doResourceDelete,
goToResourceAdd: this.goToResourceAdd,
doResourceSelect: this.doResourceSelect,
+ getResourceShowURL: this.getResourceShowURL,
hasAdditionalFields: this.hasAdditionalFields,
getFieldGroupings: this.getFieldGroupings,
resourceAttrs: this.resourceAttrs,
@@ -125,16 +126,32 @@ export default {
/**
* Navigates to the show page of the given resource.
*
- * @param {Object} resource - The resource to navigate to
+ * @param {Object} [resource] - The resource to navigate to
+ * @param {DataTable} [dt] - The DataTable (optional)
+ * @param {Event} [event] - The event to prevent default handling of (optional)
* @return {void}
*/
- goToResourceShow(resource) {
+ goToResourceShow(resource, dt, event) {
+ event?.preventDefault();
this.$router.push({
name: this.showComponent,
params: { [this.idAttr]: resource[this.idAttr] },
});
},
+ /**
+ * Generates the URL for the show page of the given resource.
+ *
+ * @param {Object} resource - The resource to generate the URL for
+ * @return {string} The URL for the show page of the given resource
+ */
+ getResourceShowURL(id) {
+ return this.$router.resolve({
+ name: this.showComponent,
+ params: { [this.idAttr]: id },
+ }).href;
+ },
+
/**
* Navigates to the edit page of the given resource.
*
diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ResourceList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ResourceList.vue
index 54d0c69a9b..8a476c6876 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ResourceList.vue
+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ResourceList.vue
@@ -66,6 +66,7 @@ export default {
doResourceDelete: Function,
goToResourceAdd: Function,
doResourceSelect: Function,
+ getResourceShowURL: Function,
resourceName: String,
resourceNamePlural: String,
hasAdditionalFields: { type: Boolean, default: false },
@@ -152,6 +153,7 @@ export default {
},
getTableColumns(resourceAttrs) {
let get_lib_from_av = this.get_lib_from_av;
+ let thisResource = this;
const columns = resourceAttrs
?.filter(attr => attr.showInTable)
@@ -168,8 +170,12 @@ export default {
orderable: true,
render: function (data, type, row, meta) {
return (
- '' +
- escape_str(row[attr.name]) +
+ '' +
+ escape_str(row[thisResource.idAttr]) +
""
);
},
@@ -184,7 +190,11 @@ export default {
orderable: true,
render: function (data, type, row, meta) {
return (
- '' +
+ '' +
escape_str(row[attr.name]) +
""
);