Bugzilla – Attachment 175714 Details for
Bug 38262
Add additional fields to Vendors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38262: Update UI
Bug-38262-Update-UI.patch (text/plain), 10.00 KB, created by
Matt Blenkinsop
on 2024-12-19 12:25:34 UTC
(
hide
)
Description:
Bug 38262: Update UI
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2024-12-19 12:25:34 UTC
Size:
10.00 KB
patch
obsolete
>From 6748bc6570e2132b88afe211b892b7fdea0d0f24 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Tue, 29 Oct 2024 17:12:24 +0000 >Subject: [PATCH] Bug 38262: Update UI > >--- > .../en/modules/admin/additional-fields.tt | 5 +- > .../vue/components/Vendors/VendorFormAdd.vue | 12 +++++ > .../js/vue/components/Vendors/VendorList.vue | 51 ++++++++++++++++++- > .../js/vue/components/Vendors/VendorShow.vue | 9 ++++ > .../js/vue/fetch/acquisition-api-client.js | 2 +- > 5 files changed, 74 insertions(+), 5 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 62e85cc3eab..0db21aa7981 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 @@ > </head> > > [% 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 %] > >@@ -130,7 +130,8 @@ > [% IF CAN_user_acquisition_order_manage %] > [% WRAPPER table_option value="aqbasket" %]<span>Order baskets</span>[% END %] > [% WRAPPER table_option value="aqorders" %]<span>Order lines</span>[% END %] >- [% END %] >+ [% WRAPPER table_option value="aqbooksellers:vendor" %]<span>Vendors</span>[% END %] >+ [% END %] > </ul> > [% END %] > [% IF CAN_user_erm %] >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 8abe3d977d8..c38128ac262 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 @@ > <VendorContacts :vendor="vendor" /> > <VendorInterfaces :vendor="vendor" /> > <VendorOrderingInformation :vendor="vendor" /> >+ <AdditionalFieldsEntry >+ resource_type="vendor" >+ :additional_field_values="vendor.extended_attributes" >+ @additional-fields-changed="additionalFieldsChanged" >+ /> > <fieldset class="action"> > <ButtonSubmit /> > <router-link >@@ -33,6 +38,7 @@ import VendorDetails from "./VendorDetails.vue" > import VendorContacts from "./VendorContacts.vue" > import VendorOrderingInformation from "./VendorOrderingInformation.vue" > import VendorInterfaces from "./VendorInterfaces.vue" >+import AdditionalFieldsEntry from "../AdditionalFieldsEntry.vue" > > export default { > data() { >@@ -64,6 +70,7 @@ export default { > aliases: [], > contacts: [], > interfaces: [], >+ extended_attributes: [], > }, > initialized: false, > } >@@ -113,6 +120,7 @@ export default { > } > delete vendor.physical > delete vendor.subscriptions_count >+ delete vendor._strings > > vendor.contacts = vendor.contacts.map( > ({ id, booksellerid, ...requiredProperties }) => >@@ -142,6 +150,9 @@ export default { > ) > } > }, >+ additionalFieldsChanged(additionalFieldValues) { >+ this.vendor.extended_attributes = additionalFieldValues >+ }, > }, > components: { > ButtonSubmit, >@@ -149,6 +160,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 7d3c30ba3ef..71c7f72e2f2 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 @@ > <KohaTable > ref="table" > v-bind="tableOptions" >+ :searchable_additional_fields="searchable_additional_fields" >+ :searchable_av_options="searchable_av_options" > @edit="goToResourceEdit" > @delete="doResourceDelete" > @receive="doReceive" >@@ -66,10 +68,12 @@ export default { > vendor_count: 0, > initialized: false, > searchTerm: null, >+ searchable_av_options: [], >+ searchable_additional_fields: [], > tableOptions: { > columns: this.getTableColumns(), > options: { >- embed: "aliases,baskets,subscriptions+count,invoices", >+ embed: "aliases,baskets,subscriptions+count,invoices,extended_attributes,+strings", > }, > url: () => this.tableURL(), > add_filters: true, >@@ -120,7 +124,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 > } >@@ -230,6 +242,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 8208a1b4472..653f7c43aab 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 >@@ -57,6 +57,13 @@ > <div class="col-sm-6"> > <VendorContacts :vendor="vendor" :display="true" /> > <VendorSubscriptions :vendor="vendor" /> >+ <AdditionalFieldsDisplay >+ v-if="vendor._strings" >+ resource_type="vendor" >+ :additional_field_values=" >+ vendor._strings.additional_field_values >+ " >+ /> > </div> > </div> > <div >@@ -80,6 +87,7 @@ import VendorContacts from "./VendorContacts.vue" > import VendorSubscriptions from "./VendorSubscriptions.vue" > import VendorContracts from "./VendorContracts.vue" > import DropdownButtons from "../DropdownButtons.vue" >+import AdditionalFieldsDisplay from "../AdditionalFieldsDisplay.vue" > import VendorResource from "./VendorResource.vue" > > export default { >@@ -126,6 +134,7 @@ export default { > VendorContacts, > VendorSubscriptions, > VendorContracts, >+ AdditionalFieldsDisplay, > DropdownButtons, > }, > name: "VendorShow", >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js >index 7e3e59b4e58..cf78cab5fee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js >@@ -14,7 +14,7 @@ export class AcquisitionAPIClient extends HttpClient { > endpoint: "vendors/" + id, > headers: { > "x-koha-embed": >- "aliases,subscriptions+count,interfaces,contacts,contracts", >+ "aliases,subscriptions+count,interfaces,contacts,contracts,extended_attributes,+strings", > }, > }), > getAll: (query, params) => >-- >2.39.5 (Apple Git-154)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38262
:
175147
|
175148
|
175149
|
175712
|
175713
| 175714