|
Lines 1-6
Link Here
|
| 1 |
[% USE raw %] |
1 |
[% USE raw %] |
| 2 |
[% USE KohaDates %] |
2 |
[% USE KohaDates %] |
| 3 |
[% SET footerjs = 1 %] |
3 |
[% SET footerjs = 1 %] |
|
|
4 |
[% PROCESS 'i18n.inc' %] |
| 5 |
[% PROCESS 'patron-search.inc' %] |
| 4 |
[% INCLUDE 'doc-head-open.inc' %] |
6 |
[% INCLUDE 'doc-head-open.inc' %] |
| 5 |
<title>[% IF ( op ) %]Create routing list[% ELSE %]Edit routing list[% END %] › [% title | html %] › Serials › Koha</title> |
7 |
<title>[% IF ( op ) %]Create routing list[% ELSE %]Edit routing list[% END %] › [% title | html %] › Serials › Koha</title> |
| 6 |
[% INCLUDE 'doc-head-close.inc' %] |
8 |
[% INCLUDE 'doc-head-close.inc' %] |
|
Lines 87-95
Link Here
|
| 87 |
[% END %] |
89 |
[% END %] |
| 88 |
</table> |
90 |
</table> |
| 89 |
[% END %] |
91 |
[% END %] |
|
|
92 |
<input type="hidden" id="new_recipients" name="new_recipients" value=""> |
| 90 |
|
93 |
|
| 91 |
<p style="margin-left:10em;"> |
94 |
<p style="margin-left:10em;"> |
| 92 |
<a href="#" id="add_recipients"><i class="fa fa-plus"></i> Add recipients</a> |
95 |
<a href="#patron_search_modal" id="add_recipients" data-toggle="modal"><i class="fa fa-plus"></i> Add recipients</a> |
| 93 |
[% IF memberloop %] |
96 |
[% IF memberloop %] |
| 94 |
<a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscriptionid | uri %]&op=delete"><i class="fa fa-trash-can"></i> Delete all</a> |
97 |
<a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscriptionid | uri %]&op=delete"><i class="fa fa-trash-can"></i> Delete all</a> |
| 95 |
[% END %] |
98 |
[% END %] |
|
Lines 115-124
Link Here
|
| 115 |
[% MACRO jsinclude BLOCK %] |
118 |
[% MACRO jsinclude BLOCK %] |
| 116 |
<script> |
119 |
<script> |
| 117 |
$(document).ready(function(){ |
120 |
$(document).ready(function(){ |
| 118 |
$("#add_recipients").on("click",function(e){ |
|
|
| 119 |
e.preventDefault(); |
| 120 |
userPopup(); |
| 121 |
}); |
| 122 |
$(".itemrank").on("change",function(){ |
121 |
$(".itemrank").on("change",function(){ |
| 123 |
var subscriptionid = $(this).data("subscriptionid"); |
122 |
var subscriptionid = $(this).data("subscriptionid"); |
| 124 |
var routingid = $(this).data("routingid"); |
123 |
var routingid = $(this).data("routingid"); |
|
Lines 130-146
Link Here
|
| 130 |
window.location.href=mylocation; |
129 |
window.location.href=mylocation; |
| 131 |
} |
130 |
} |
| 132 |
|
131 |
|
| 133 |
function userPopup() { |
132 |
function add_user(borrowernumber) { |
| 134 |
window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,action&selection_type=add", |
133 |
let users = $("#new_recipients").val().split(':'); |
| 135 |
'PatronPopup', |
134 |
if ( !users.includes(borrowernumber) ) { |
| 136 |
'width=1024,height=768,scrollbars=yes,toolbar=no,' |
135 |
users.push(borrowernumber); |
| 137 |
+ 'scrollbars=yes,resize=yes' |
136 |
} |
| 138 |
); |
137 |
users = [...new Set(users)]; // unique |
|
|
138 |
$("#new_recipients").val(users.filter(Number).join(':')); // remove empty and join |
| 139 |
} |
139 |
} |
| 140 |
|
140 |
|
| 141 |
function add_user(borrowernumber) { |
141 |
</script> |
| 142 |
var myurl = "/cgi-bin/koha/serials/routing.pl?subscriptionid="+[% subscriptionid | html %]+"&borrowernumber="+borrowernumber+"&op=add"; |
142 |
|
| 143 |
window.location.href = myurl; |
143 |
[% INCLUDE 'select2.inc' %] |
|
|
144 |
[% SET columns = ['cardnumber','name','category','branch','action'] %] |
| 145 |
[% PROCESS patron_search_modal columns => columns, modal_title => t("Add recipients") %] |
| 146 |
[% PROCESS patron_search_js columns => columns, actions => ["add"], preview_on_name_click => 1 %] |
| 147 |
|
| 148 |
<script> |
| 149 |
$(document).on( |
| 150 |
"hidden.bs.modal", |
| 151 |
"#patron_search_modal", |
| 152 |
add_new_recipients); |
| 153 |
|
| 154 |
function add_new_recipients(e){ |
| 155 |
e.preventDefault(); |
| 156 |
let borrowernumbers = $("#new_recipients").val(); |
| 157 |
if(!borrowernumbers.length > 0) { |
| 158 |
return; |
| 159 |
} |
| 160 |
$.ajax({ |
| 161 |
data: { |
| 162 |
subscriptionid: [% subscriptionid | html %], |
| 163 |
borrowernumbers, |
| 164 |
op: 'add_new_recipients' |
| 165 |
}, |
| 166 |
type: 'POST', |
| 167 |
url: '/cgi-bin/koha/serials/routing.pl', |
| 168 |
success: function (data) { |
| 169 |
document.location.href = '/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscriptionid | uri %]'; |
| 170 |
return false; |
| 171 |
}, |
| 172 |
error: function (data) { |
| 173 |
alert(data); |
| 174 |
}, |
| 175 |
}); |
| 144 |
} |
176 |
} |
| 145 |
</script> |
177 |
</script> |
| 146 |
[% END %] |
178 |
[% END %] |