From 4d7d7506abb829a8d189f4ca17be34e6c7486915 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Tue, 29 Oct 2024 17:12:24 +0000 Subject: [PATCH] Bug 38262: Update UI --- .../en/modules/admin/additional-fields.tt | 3 +- .../vue/components/Vendors/VendorFormAdd.vue | 12 +++++ .../js/vue/components/Vendors/VendorList.vue | 53 ++++++++++++++++++- .../js/vue/components/Vendors/VendorShow.vue | 9 ++++ .../js/vue/fetch/acquisition-api-client.js | 2 +- 5 files changed, 75 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt index 3cf17ac6160..e4b79c62171 100755 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt @@ -24,7 +24,7 @@ [% marcfield_tables = ['subscription', 'aqorders'] %] -[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices', 'erm_licenses', 'erm_agreements', 'erm_packages'] %] +[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices', 'erm_licenses', 'erm_agreements', 'erm_packages', 'aqbooksellers'] %] [% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %] [% show_searchable = searchable_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %] @@ -125,6 +125,7 @@ [% IF CAN_user_acquisition_order_manage %] [% WRAPPER table_option value="aqbasket" %]Order baskets[% END %] [% WRAPPER table_option value="aqorders" %]Order lines[% END %] + [% WRAPPER table_option value="aqbooksellers:vendor" %]Vendors[% END %] [% END %] [% IF CAN_user_acquisition_edit_invoices %] [% WRAPPER table_option value="aqinvoices" %]Invoices[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue index 087524f457f..b3d7f591db8 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue @@ -11,6 +11,11 @@ +
@@ -153,6 +161,9 @@ export default { ) } }, + additionalFieldsChanged(additionalFieldValues) { + this.vendor.extended_attributes = additionalFieldValues + }, }, components: { ButtonSubmit, @@ -160,6 +171,7 @@ export default { VendorContacts, VendorOrderingInformation, VendorInterfaces, + AdditionalFieldsEntry, }, name: "VendorFormAdd", } 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 f1213eb1db6..61bed126dfb 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 @@ -12,6 +12,8 @@ this.tableURL(), add_filters: true, filters_options: { @@ -117,7 +123,15 @@ export default { }, beforeRouteEnter(to, from, next) { next(vm => { - vm.getVendorCount().then(() => (vm.initialized = true)) + vm.getVendorCount().then(() => + vm + .getSearchableAdditionalFields() + .then(() => + vm + .getSearchableAVOptions() + .then(() => (vm.initialized = true)) + ) + ) if (to.query.supplier) { vm.searchTerm = to.query.supplier } @@ -231,6 +245,41 @@ export default { }, ] }, + async getSearchableAdditionalFields() { + const client = APIClient.additional_fields + await client.additional_fields.getAll("vendor").then( + searchable_additional_fields => { + this.searchable_additional_fields = + searchable_additional_fields.filter( + field => field.searchable + ) + }, + error => {} + ) + }, + async getSearchableAVOptions() { + const client_av = APIClient.authorised_values + let av_cat_array = this.searchable_additional_fields + .filter(field => field.authorised_value_category_name) + .map(field => field.authorised_value_category_name) + + await client_av.values + .getCategoriesWithValues([ + ...new Set(av_cat_array.map(av_cat => '"' + av_cat + '"')), + ]) // unique + .then(av_categories => { + av_cat_array.forEach(av_cat => { + let av_match = av_categories.find( + element => element.category_name == av_cat + ) + this.searchable_av_options[av_cat] = + av_match.authorised_values.map(av => ({ + value: av.value, + label: av.description, + })) + }) + }) + }, }, components: { flatPickr, Toolbar, ToolbarButton, KohaTable }, name: "VendorList", 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 2104e01e769..82384a477c3 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 @@ -75,6 +75,13 @@
+
-- 2.39.3 (Apple Git-146)