Lines 2-7
Link Here
|
2 |
[% USE I18N %] |
2 |
[% USE I18N %] |
3 |
[% USE Branches %] |
3 |
[% USE Branches %] |
4 |
[% USE ExtendedAttributeTypes %] |
4 |
[% USE ExtendedAttributeTypes %] |
|
|
5 |
[% USE Categories %] |
5 |
[% USE raw %] |
6 |
[% USE raw %] |
6 |
[% USE Asset %] |
7 |
[% USE Asset %] |
7 |
[% USE To %] |
8 |
[% USE To %] |
Lines 55-61
Link Here
|
55 |
<label for="categorycode_filter">Category:</label> |
56 |
<label for="categorycode_filter">Category:</label> |
56 |
<select id="categorycode_filter"> |
57 |
<select id="categorycode_filter"> |
57 |
<option value="">Any</option> |
58 |
<option value="">Any</option> |
58 |
[% FOREACH category IN categories %] |
59 |
[% FOREACH category IN Categories.limited.unblessed %] |
59 |
<option value="[% category.categorycode | html %]">[% category.description | html %]</option> |
60 |
<option value="[% category.categorycode | html %]">[% category.description | html %]</option> |
60 |
[% END %] |
61 |
[% END %] |
61 |
</select> |
62 |
</select> |
Lines 109-114
Link Here
|
109 |
[%# columns: See patron_search_js %] |
110 |
[%# columns: See patron_search_js %] |
110 |
[% BLOCK patron_search_table %] |
111 |
[% BLOCK patron_search_table %] |
111 |
|
112 |
|
|
|
113 |
[% UNLESS table_id %] |
114 |
[% SET table_id = "memberresultst" %] |
115 |
[% END %] |
116 |
|
112 |
[% IF filter == 'suggestions_managers' %] |
117 |
[% IF filter == 'suggestions_managers' %] |
113 |
<div class="hint">Only staff with superlibrarian or suggestions_manage permissions are returned in the search results</div> |
118 |
<div class="hint">Only staff with superlibrarian or suggestions_manage permissions are returned in the search results</div> |
114 |
[% ELSIF filter == 'orders_managers' OR filter == 'baskets_managers' %] |
119 |
[% ELSIF filter == 'orders_managers' OR filter == 'baskets_managers' %] |
Lines 130-136
Link Here
|
130 |
[% END %] |
135 |
[% END %] |
131 |
</div> |
136 |
</div> |
132 |
|
137 |
|
133 |
|
|
|
134 |
<h3 style="display: none;">Patrons found for: <span id="searchpattern"></span></h3> |
138 |
<h3 style="display: none;">Patrons found for: <span id="searchpattern"></span></h3> |
135 |
|
139 |
|
136 |
<div id="[% table_id | html %]_search_results" style="display:none;"> |
140 |
<div id="[% table_id | html %]_search_results" style="display:none;"> |
Lines 175-192
Link Here
|
175 |
<div class="modal" id="patronPreview" tabindex="-1" role="dialog" aria-labelledby="patronPreviewLabel"> |
179 |
<div class="modal" id="patronPreview" tabindex="-1" role="dialog" aria-labelledby="patronPreviewLabel"> |
176 |
<div class="modal-dialog" role="document"> |
180 |
<div class="modal-dialog" role="document"> |
177 |
<div class="modal-content"> |
181 |
<div class="modal-content"> |
178 |
<div class="modal-header"> |
|
|
179 |
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
180 |
<h4 class="modal-title" id="patronPreviewLabel"></h4> |
181 |
</div> |
182 |
<div class="modal-body"> |
182 |
<div class="modal-body"> |
183 |
<div id="loading"> |
183 |
<div id="loading"> |
184 |
<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading |
184 |
<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading |
185 |
</div> |
185 |
</div> |
186 |
</div> |
186 |
</div> |
187 |
<div class="modal-footer"> |
|
|
188 |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
189 |
</div> |
190 |
</div> |
187 |
</div> |
191 |
</div> |
188 |
</div> |
192 |
</div> |
189 |
</div> |
Lines 213-218
Link Here
|
213 |
[% END %] |
210 |
[% END %] |
214 |
|
211 |
|
215 |
<script> |
212 |
<script> |
|
|
213 |
[% SET libraries = Branches.all %] |
214 |
[% SET categories = Categories.limited.unblessed %] |
216 |
let categories = [% To.json(categories) | $raw %].map(e => { |
215 |
let categories = [% To.json(categories) | $raw %].map(e => { |
217 |
e['_id'] = e.categorycode.toLowerCase(); |
216 |
e['_id'] = e.categorycode.toLowerCase(); |
218 |
e['_str'] = e.description; |
217 |
e['_str'] = e.description; |
Lines 650-671
Link Here
|
650 |
e.preventDefault(); |
649 |
e.preventDefault(); |
651 |
var borrowernumber = $(this).data("borrowernumber"); |
650 |
var borrowernumber = $(this).data("borrowernumber"); |
652 |
var borrower_data = JSON.parse($("#borrower_data"+borrowernumber).val()); |
651 |
var borrower_data = JSON.parse($("#borrower_data"+borrowernumber).val()); |
653 |
add_user( borrowernumber, $patron_to_html( borrower_data, { display_cardnumber: false, url: false } ) ); |
652 |
modal_add_user( borrowernumber, $patron_to_html( borrower_data, { display_cardnumber: false, url: false } ) ); |
654 |
}); |
653 |
}); |
655 |
|
|
|
656 |
$("body").on("click",".select_user",function(e){ |
654 |
$("body").on("click",".select_user",function(e){ |
657 |
e.preventDefault(); |
655 |
e.preventDefault(); |
658 |
var borrowernumber = $(this).data("borrowernumber"); |
656 |
var borrowernumber = $(this).data("borrowernumber"); |
659 |
var borrower_data = JSON.parse($("#borrower_data"+borrowernumber).val()); |
657 |
var borrower_data = JSON.parse($("#borrower_data"+borrowernumber).val()); |
660 |
select_user( borrowernumber, borrower_data ); |
658 |
modal_select_user( borrowernumber, borrower_data ); |
|
|
659 |
$(this).closest(".modal").modal('hide'); |
661 |
}); |
660 |
}); |
662 |
|
661 |
|
663 |
$("body").on("click",".patron_preview", function( e ){ |
662 |
$("body").on("click",".patron_preview", function( e ){ |
664 |
e.preventDefault(); |
663 |
e.preventDefault(); |
665 |
var borrowernumber = $(this).data("borrowernumber"); |
664 |
var borrowernumber = $(this).data("borrowernumber"); |
666 |
var page = "/cgi-bin/koha/members/moremember.pl?print=brief&borrowernumber=" + borrowernumber; |
665 |
var page = "/cgi-bin/koha/members/moremember.pl?print=brief&borrowernumber=" + borrowernumber; |
667 |
$("#patronPreview .modal-body").load( page + " div.container-fluid" ); |
666 |
$("#patron_preview_modal").load( page + " div.container-fluid", function(){ |
668 |
$('#patronPreview').modal({show:true}); |
667 |
$("#patron_preview_modal").find(".close").on("click", function(){ |
|
|
668 |
$('#patron_preview_modal').html(_("Loading...")).removeClass("show"); |
669 |
}); |
670 |
}); |
671 |
$("#patron_preview_modal").addClass("show"); |
669 |
}); |
672 |
}); |
670 |
|
673 |
|
671 |
$("#patronPreview").on('hidden.bs.modal', function (e) { |
674 |
$("#patronPreview").on('hidden.bs.modal', function (e) { |
Lines 827-866
Link Here
|
827 |
} |
830 |
} |
828 |
|
831 |
|
829 |
// modify parent window owner element |
832 |
// modify parent window owner element |
830 |
function add_user(borrowernumber, borrowername) { |
833 |
function modal_add_user(borrowernumber, borrowername) { |
831 |
var p = window.opener; |
834 |
[%# Note that add_user could sent data instead of borrowername too %] |
832 |
// In one place (serials/routing.tt), the page is reload on every add |
835 |
$("#info").hide(); |
833 |
// We have to wait for the page to be there |
836 |
$("#error").hide(); |
834 |
function wait_for_opener () { |
837 |
if ( add_user(borrowernumber, borrowername) < 0 ) { |
835 |
if ( ! $(opener.document).find('body').size() ) { |
838 |
$("#error").html(_("Patron '%s' is already in the list.").format(borrowername)); |
836 |
setTimeout(wait_for_opener, 500); |
839 |
$("#error").show(); |
837 |
} else { |
840 |
} else { |
838 |
[%# Note that add_user could sent data instead of borrowername too %] |
841 |
$("#info").html(_("Patron '%s' added.").format(borrowername)); |
839 |
$("#info").hide(); |
842 |
$("#info").show(); |
840 |
$("#error").hide(); |
|
|
841 |
if ( p.add_user(borrowernumber, borrowername) < 0 ) { |
842 |
$("#error").html(_("Patron '%s' is already in the list.").format(borrowername)); |
843 |
$("#error").show(); |
844 |
} else { |
845 |
$("#info").html(_("Patron '%s' added.").format(borrowername)); |
846 |
$("#info").show(); |
847 |
} |
848 |
} |
849 |
} |
843 |
} |
850 |
wait_for_opener(); |
|
|
851 |
} |
844 |
} |
852 |
function select_user(borrowernumber, data) { |
845 |
function modal_select_user(borrowernumber, data) { |
853 |
var p = window.opener; |
846 |
if ( document.getElementById("selected_patron_id") ) { |
854 |
if ( p.document.getElementById("selected_patron_id") ) { |
847 |
document.getElementById("selected_patron_id").value = borrowernumber; |
855 |
p.document.getElementById("selected_patron_id").value = borrowernumber; |
|
|
856 |
} else { |
848 |
} else { |
857 |
[% IF callback %] |
849 |
[% IF callback %] |
858 |
p.[% callback | html %](borrowernumber, data); |
850 |
[% callback | html %](borrowernumber, data); |
859 |
[% ELSE %] |
851 |
[% ELSE %] |
860 |
p.select_user(borrowernumber, data); |
852 |
select_user(borrowernumber, data); |
861 |
[% END %] |
853 |
[% END %] |
862 |
} |
854 |
} |
863 |
window.close(); |
|
|
864 |
} |
855 |
} |
865 |
</script> |
856 |
</script> |
866 |
[% END %] |
857 |
[% END %] |
|
|
858 |
|
859 |
|
860 |
[% BLOCK patron_search_modal %] |
861 |
[% UNLESS patron_search_modal_id %] |
862 |
[% patron_search_modal_id = "patron_search_modal" %] |
863 |
[% END %] |
864 |
<div id="[% patron_search_modal_id | html %]" class="modal modal-full" tabindex="-1" role="dialog" aria-labelledby="patronSearchLabel" aria-hidden="true" data-backdrop=""> |
865 |
<div class="modal-dialog" role="document"> |
866 |
<div class="modal-content"> |
867 |
<div class="modal-header"> |
868 |
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
869 |
<h4 class="modal-title" id="patronSearchLabel">[% modal_title | html %]</h4> |
870 |
</div> |
871 |
<div class="modal-body"> |
872 |
[% PROCESS patron_search_filters filters => ['branch','category','sort1','sort2'] %] |
873 |
|
874 |
<div id="searchresults"> |
875 |
[% IF columns.grep('checkbox').size %] |
876 |
<div class="searchheader fh-fixedHeader" id="searchheader" style="display:none;"> |
877 |
<div> |
878 |
<a href="#" class="btn btn-link" id="select_all"><i class="fa fa-check"></i> Select all</a> |
879 |
| |
880 |
<a href="#" class="btn btn-link" id="clear_all"><i class="fa fa-remove"></i> Clear all</a> |
881 |
[% IF selection_type == 'add' %] |
882 |
<button id="add-selected" class="btn btn-sm btn-default" type="submit">Add selected patrons</button> |
883 |
[% END %] |
884 |
</div> |
885 |
</div> |
886 |
[% END %] |
887 |
[% PROCESS patron_search_table table_id => 'memberresultst' columns => columns %] |
888 |
</div> |
889 |
</div> |
890 |
<div class="modal-footer"> |
891 |
<a href="#" class="btn btn-default cancel" data-dismiss="modal" aria-hidden="true">Close</a> |
892 |
</div> |
893 |
</div> |
894 |
</div> |
895 |
</div> |
896 |
<div id="patron_preview_modal" class="basicModal"></div> |
897 |
[% END %] |