+
+[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'calendar.inc' %]
+ <script type="text/javascript" language="JavaScript">
+ $(document).ready(function(){
+ $(".renew_subscription").on("click",function(e){
+ e.preventDefault();
+ var subscriptionid = $(this).data("subscriptionid");
+ newin=window.open("/cgi-bin/koha/serials/subscription-renew.pl?mode=popup&subscriptionid="+subscriptionid,'popup','width=590,height=440,toolbar=false,scrollbars=yes,resize=yes');
+ });
+ $('a.itemselection_action_renew').on("click", function(e){
+ e.preventDefault();
+ newin=window.open($(this).attr('href'),'popup','width=590,height=440,toolbar=false,scrollbars=yes,resize=yes');
+ });
+ function itemSelectionBuildRenewLink() {
+ var subscription_ids= new Array();
+ $("input[name='subscriptionid'][type='checkbox']:checked").each(function() {
+ subscription_ids.push($(this).val());
+ });
+ if (subscription_ids.length > 0) {
+ var url = '/cgi-bin/koha/serials/subscription-renew.pl?op=multi_renew';
+ url += '&subscriptionid=' + subscription_ids.join('&subscriptionid=');
+ $('a.itemselection_action_renew').attr('href', url);
+ } else {
+ return false;
+ }
+ return true;
+ }
+
+ function itemSelectionBuildActionLinks() {
+ var export_link_ok = itemSelectionBuildRenewLink();
+ if (export_link_ok) {
+ $('.itemselection_actions').show();
+ } else {
+ $('.itemselection_actions').hide();
+ }
+ }
+
+ itemSelectionBuildActionLinks();
+
+ $("input[name='subscriptionid'][type='checkbox']").change(function() {
+ itemSelectionBuildActionLinks();
+ });
+
+ $(".SelectAll, .ClearAll").on("click",function(e){
+ e.preventDefault();
+ var checkboxes = $(this).parent().siblings('table').first().find('input[type="checkbox"]');
+ checkboxes.prop('checked', $(this).hasClass('SelectAll'));
+ itemSelectionBuildActionLinks();
+ });
+
+ });
+ </script>
+[% END %]
+