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 <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2024-01-08 14:17:40 +01:00
parent e3743529eb
commit 7c5b691808
Signed by: jonathan.druart
GPG key ID: A085E712BEF0E0F0
2 changed files with 14 additions and 14 deletions

View file

@ -5,6 +5,7 @@
[% USE TablesSettings %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[% PROCESS 'patron-search.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% FILTER collapse %]
[% t("E-resource management") | html %] &rsaquo;
@ -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' %]

View file

@ -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