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