From d61bd0c9476aae6d0dfc906d6795587c30d7134f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 24 Mar 2022 15:53:40 +0100 Subject: [PATCH] Bug 32030: ERM - Add select to column filters See also "Bug 30063: Be more flexible for filters" This is ugly, we must improve that. I would want to prevent 1 fetch per column however. Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- .../js/vue/components/ERM/AgreementsList.vue | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue index f0ee2e12b9..a1c7c38fd1 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue @@ -32,18 +32,38 @@ export default { updated() { let edit_agreement = this.edit_agreement let delete_agreement = this.delete_agreement + window['av_vendors'] = this.vendors.map(e => { + e['_id'] = e['id'] + e['_str'] = e['name'] + return e + }) let vendors_map = this.vendors.reduce((map, e) => { map[e.id] = e return map }, {}) + window['av_statuses'] = this.av_statuses.map(e => { + e['_id'] = e['authorised_value'] + e['_str'] = e['lib'] + return e + }) let statuses_map = this.av_statuses.reduce((map, e) => { map[e.authorised_value] = e return map }, {}) + window['av_closure_reasons'] = this.av_closure_reasons.map(e => { + e['_id'] = e['authorised_value'] + e['_str'] = e['lib'] + return e + }) let closure_reasons_map = this.av_closure_reasons.reduce((map, e) => { map[e.authorised_value] = e return map }, {}) + window['av_renewal_priorities'] = this.av_renewal_priorities.map(e => { + e['_id'] = e['authorised_value'] + e['_str'] = e['lib'] + return e + }) let renewal_priorities_map = this.av_renewal_priorities.reduce((map, e) => { map[e.authorised_value] = e return map @@ -154,9 +174,12 @@ export default { render(n, e) }) }, - preDrawCallback: function(settings){ + preDrawCallback: function (settings) { var table_id = settings.nTable.id - $("#"+table_id).find("thead th").eq(1).attr('data-filter', 'vendors'); + $("#" + table_id).find("thead th").eq(1).attr('data-filter', 'av_vendors') + $("#" + table_id).find("thead th").eq(4).attr('data-filter', 'av_statuses') + $("#" + table_id).find("thead th").eq(5).attr('data-filter', 'av_closure_reasons') + $("#" + table_id).find("thead th").eq(7).attr('data-filter', 'av_renewal_priorities') } }, columns_settings, 1) -- 2.39.5