From 1da0edaa15fadd2cce74e50a64cb2fa1e7d863fa Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Fri, 27 Sep 2024 14:34:42 +0000 Subject: [PATCH] Bug 38010: Make the delete button conditional on whether a vendor has baskets or subscriptions --- .../js/vue/components/Vendors/VendorList.vue | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue index 9f3fe26e686..25b1a94f0a7 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue @@ -74,8 +74,20 @@ export default { }), }, actions: { - 0: ["show"], - "-1": ["edit", "delete"], + "-1": [ + "edit", + { + delete: { + text: this.$__("Delete"), + icon: "fa fa-trash", + should_display: row => + (!row.baskets || + row.baskets.length === 0) && + (!row.subscriptions || + row.subscriptions.length === 0), + }, + }, + ], }, }, before_route_entered: false, @@ -121,7 +133,7 @@ export default { cancel_label: this.$__("No, do not delete"), }, () => { - const client = APIClient.erm + const client = APIClient.acquisition client.vendors.delete(vendor.id).then( success => { this.setMessage( -- 2.39.3 (Apple Git-146)