From b79b1452e74043865220f6eae7d6a6886b01fbff Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Fri, 14 Feb 2025 11:41:43 +0000 Subject: [PATCH] Bug 38010: (QA follow-up) Fix toolbar on VendorShow The delete button was missing from VendorShow and bug 37301 has been removed as a dependency so some small fixes were required for that Signed-off-by: Michaela Sieber Signed-off-by: Jonathan Druart --- .../prog/js/fetch/acquisition-api-client.js | 2 +- .../js/vue/components/Vendors/VendorList.vue | 2 +- .../js/vue/components/Vendors/VendorShow.vue | 46 +++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/acquisition-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/acquisition-api-client.js index 06467777f91..6db8d0b0205 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/acquisition-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/acquisition-api-client.js @@ -12,7 +12,7 @@ export class AcquisitionAPIClient { endpoint: "vendors/" + id, headers: { "x-koha-embed": - "aliases,subscriptions+count,interfaces,contacts,contracts", + "aliases,subscriptions+count,interfaces,contacts,contracts,baskets", }, }), getAll: (query, params) => 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 99163403fb8..f8b2d8ff780 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 @@ -138,7 +138,7 @@ export default { event.preventDefault(); this.$router.push({ name: "VendorShow", - params: { vendor_id: id }, + params: { id: id }, }); }, doReceive({ id }, dt, event) { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue index 745331fbbe6..e0114e8b137 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue @@ -36,6 +36,11 @@ :title="$__('Edit vendor')" /> + {{ $__("Delete") }}

{{ vendor.name }} @@ -89,9 +105,13 @@ export default { setup() { const { setConfirmationDialog, setMessage } = inject("mainStore"); + const permissionsStore = inject("permissionsStore"); + const { isUserPermitted } = permissionsStore; + return { setConfirmationDialog, setMessage, + isUserPermitted, }; }, data() { @@ -116,6 +136,31 @@ export default { error => {} ); }, + doDelete(id, name) { + this.setConfirmationDialog( + { + title: this.$__( + "Are you sure you want to remove this vendor?" + ), + message: name, + accept_label: this.$__("Yes, delete"), + cancel_label: this.$__("No, do not delete"), + }, + () => { + const client = APIClient.acquisition; + client.vendors.delete(id).then( + success => { + this.setMessage( + this.$__("Vendor %s deleted").format(name), + true + ); + this.$router.push({ name: "VendorList" }); + }, + error => {} + ); + } + ); + }, }, components: { Toolbar, @@ -127,6 +172,7 @@ export default { VendorContacts, VendorSubscriptions, VendorContracts, + DropdownButtons, }, name: "VendorShow", }; -- 2.34.1