From e90ccb7ff33d68263a62a4f0f2f5234c79481d5f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 11 Apr 2023 11:05:07 +0200 Subject: [PATCH] Bug 33480: Improve vendor aliases display in dropdown list On bug 33103 we are adding the ability to filter vendors by aliases. To make it possible in the ERM module we are adding the alias list in the dropdown list. However it's not nicely displayed, especially if there are several entries. This patch suggests to display the aliases in a different line, and not for the selected option. To acchieve that we create a new Vue component FormSelectVendors. Test plan: Create several vendors, and add some aliases to them (keep one vendor without alias) Go to the ERM module go to the following page, search for vendors by aliases, save the form, and confirm that everything is nice and works correctly: * Add/edit an agreement * Add/edit a license * Add/edit a local package * Add a new package to a title (edit a title) Signed-off-by: Pedro Amorim Signed-off-by: Tomas Cohen Arazi --- .../vue/components/ERM/AgreementsFormAdd.vue | 11 ++--- .../ERM/EHoldingsLocalPackagesFormAdd.vue | 10 ++-- .../EHoldingsLocalTitlesFormAddResources.vue | 16 ++----- .../js/vue/components/ERM/LicensesFormAdd.vue | 11 ++--- .../prog/js/vue/components/ERM/Main.vue | 11 +---- .../js/vue/components/FormSelectVendors.vue | 47 +++++++++++++++++++ 6 files changed, 61 insertions(+), 45 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/FormSelectVendors.vue diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue index e551a94532..645a13b5be 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue @@ -25,12 +25,9 @@ -
  • @@ -178,15 +175,13 @@ import AgreementLicenses from "./AgreementLicenses.vue" import AgreementRelationships from "./AgreementRelationships.vue" import Documents from "./Documents.vue" import ButtonSubmit from "../ButtonSubmit.vue" +import FormSelectVendors from "../FormSelectVendors.vue" import { setMessage, setError, setWarning } from "../../messages" import { APIClient } from "../../fetch/api-client.js" import { storeToRefs } from "pinia" export default { setup() { - const vendorStore = inject("vendorStore") - const { vendors } = storeToRefs(vendorStore) - const AVStore = inject("AVStore") const { av_agreement_statuses, @@ -199,7 +194,6 @@ export default { } = storeToRefs(AVStore) return { - vendors, av_agreement_statuses, av_agreement_closure_reasons, av_agreement_renewal_priorities, @@ -402,6 +396,7 @@ export default { AgreementRelationships, Documents, ButtonSubmit, + FormSelectVendors, }, name: "AgreementsFormAdd", } diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesFormAdd.vue index 3c0a94fa18..75da1c2a68 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesFormAdd.vue @@ -25,12 +25,9 @@ -
  • @@ -86,20 +83,18 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue index 9df7727489..b14f93bb25 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue @@ -25,12 +25,9 @@ -
  • @@ -137,21 +134,18 @@ import { inject } from "vue" import flatPickr from "vue-flatpickr-component" import UserRoles from "./UserRoles.vue" import Documents from "./Documents.vue" +import FormSelectVendors from "../FormSelectVendors.vue" import { setMessage, setWarning } from "../../messages" import { APIClient } from "../../fetch/api-client.js" import { storeToRefs } from "pinia" export default { setup() { - const vendorStore = inject("vendorStore") - const { vendors } = storeToRefs(vendorStore) - const AVStore = inject("AVStore") const { av_license_types, av_license_statuses, av_user_roles } = storeToRefs(AVStore) return { - vendors, av_license_types, av_license_statuses, av_user_roles, @@ -271,6 +265,7 @@ export default { flatPickr, UserRoles, Documents, + FormSelectVendors, }, name: "LicensesFormAdd", } diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue index 12e569e28d..aac16c48e2 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue @@ -76,16 +76,7 @@ export default { const acq_client = APIClient.acquisition acq_client.vendors.getAll().then( vendors => { - this.vendorStore.vendors = vendors.map(v => ({ - ...v, - display_name: - v.name + - (v.aliases.length > 0 - ? " (" + - v.aliases.map(a => a.alias).join(", ") + - ")" - : ""), - })) + this.vendorStore.vendors = vendors }, error => {} ) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormSelectVendors.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormSelectVendors.vue new file mode 100644 index 0000000000..fe6db5a102 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/FormSelectVendors.vue @@ -0,0 +1,47 @@ + + + -- 2.39.5