From 7c5b691808bd54a9fc3101675956ee5e92209a53 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 8 Jan 2024 14:17:40 +0100 Subject: [PATCH] Bug 35329: Move patron search to modal - erm Test plan: Edit an agreement or a license Add new user and click "Select user" to open the modal Test with different user for the same agreement/license Signed-off-by: Owen Leonard Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- .../intranet-tmpl/prog/en/modules/erm/erm.tt | 5 ++++ .../prog/js/vue/components/ERM/UserRoles.vue | 23 ++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt index 5ff4bd56e6..76746b5cd8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt @@ -5,6 +5,7 @@ [% USE TablesSettings %] [% PROCESS 'i18n.inc' %] [% SET footerjs = 1 %] +[% PROCESS 'patron-search.inc' %] [% INCLUDE 'doc-head-open.inc' %] [% FILTER collapse %] [% t("E-resource management") | html %] › @@ -48,6 +49,10 @@ </script> [% Asset.js("js/vue/dist/erm.js") | $raw %] + [% INCLUDE 'select2.inc' %] + [% SET columns = ['cardnumber','name','category','branch','action'] %] + [% PROCESS patron_search_modal columns => columns, modal_title => t("Select user") %] + [% PROCESS patron_search_js columns => columns, filter => erm_users, actions => ["select"], preview_on_name_click => 1 %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UserRoles.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UserRoles.vue index b01bf183e2..dfb27d41a0 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UserRoles.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UserRoles.vue @@ -22,10 +22,11 @@ {{ user_role.patron_str }} </span> (<a - href="#" + href="#patron_search_modal" @click="selectUser(counter)" class="btn btn-default" - >{{ $__("Select user") }}</a + data-toggle="modal" + ><i class="fa fa-plus"></i> {{ $__("Select user") }}</a >) <span class="required">{{ $__("Required") }}</span> </li> @@ -91,23 +92,17 @@ export default { this.user_roles.splice(counter, 1) }, selectUser(counter) { - let select_user_window = window.open( - "/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,action&selection_type=select&filter=erm_users", - "PatronPopup", - "width=740,height=450,location=yes,toolbar=no," + - "scrollbars=yes,resize=yes" - ) // This is a bit dirty, the "select user" window should be rewritten and be a Vue component // but that's not for now... - select_user_window.addEventListener( - "beforeunload", - this.newUserSelected, - false + $(document).on( + "hidden.bs.modal", + "#patron_search_modal", + this.newUserSelected ) - select_user_window.counter = counter + this.selected_user_counter = counter }, newUserSelected(e) { - let c = e.currentTarget.counter + let c = this.selected_user_counter let selected_patron_id = document.getElementById("selected_patron_id").value let patron -- 2.39.5