View | Details | Raw Unified | Return to bug 37351
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt (-28 / +29 lines)
Lines 265-303 Link Here
265
            });
265
            });
266
266
267
            $('.holds_table').each(function() {
267
            $('.holds_table').each(function() {
268
              var table = $(this);
268
                var table = $(this);
269
              var parent = table.parents('.tab-pane');
269
                var parent = table.parents('.tab-pane');
270
270
                var this_dt = $(this).closest('.holds_table').dataTable();
271
              $('.holds_table .select_hold_all', parent).each(function() {
271
                parent.find('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format(this_dt.$(".select_hold:checked", {"page": "all"}).length));
272
                  var count = $('.select_hold:not(:checked)', table).length;
272
                parent.find('.cancel_selected_holds').click(function(e) {
273
                  $('.select_hold_all', table).prop('checked', !count);
274
              });
275
276
              $('.cancel_selected_holds', parent).html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked', parent).length));
277
278
              $('.holds_table .select_hold_all', parent).click(function() {
279
                  var count = $('.select_hold:checked', table).length;
280
                  $('.select_hold', table).prop('checked', !count);
281
                  $(this).prop('checked', !count);
282
                  $('.cancel_selected_holds', parent).data('ids', $('.holds_table .select_hold:checked', parent).toArray().map(el => $(el).data('id'))).html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked', parent).length));
283
                  localStorage.selectedWaitingHolds = JSON.stringify($('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')));
284
              });
285
286
              $('.holds_table .select_hold', parent).click(function() {
287
                  var count = $('.select_hold:not(:checked)', table).length;
288
                  $('.select_hold_all', table).prop('checked', !count);
289
                  $('.cancel_selected_holds', parent).data('ids', $('.holds_table .select_hold:checked', parent).toArray().map(el => $(el).data('id'))).html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked', parent).length));
290
                  localStorage.selectedWaitingHolds = JSON.stringify($('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')));
291
              });
292
293
              $('.cancel_selected_holds', parent).click(function(e) {
294
                  e.preventDefault();
273
                  e.preventDefault();
295
                  if($('.select_hold:checked', table).length) {
274
                  if($('.select_hold:checked', table).length) {
296
                      cancel_link = $(this);
275
                      cancel_link = $(this);
297
                      $('#cancelModal').modal();
276
                      $('#cancelModal').modal();
298
                  }
277
                  }
299
                  return false;
278
                  return false;
300
              });
279
                });
280
            });
281
282
            $('.holds_table').on('click', '.select_hold_all', function() {
283
                var table = $(this);
284
                var parent = table.parents('.tab-pane');
285
                var this_dt = $(this).closest('.holds_table').dataTable();
286
                var all_pages = this_dt.fnGetNodes();
287
288
                var all_checked = this_dt.find('.select_hold_all').prop('checked');
289
                this_dt.find('.select_hold' , all_pages).prop('checked', all_checked);
290
291
                var count = this_dt.$(".select_hold:checked", {"page": "all"}).length;
292
                parent.find('.cancel_selected_holds').data('ids', this_dt.$(".select_hold:checked", {"page": "all"}).toArray().map(el => $(el).data('id'))).html(MSG_CANCEL_SELECTED.format(count));
293
                localStorage.selectedWaitingHolds = JSON.stringify(this_dt.$(".select_hold:checked", {"page": "all"}).toArray().map(el => $(el).data('id')));
294
            });
295
296
            $('.holds_table').on('click', '.select_hold', function() {
297
            var table = $(this);
298
            var parent = table.parents('.tab-pane');
299
            var this_dt = $(this).closest('.holds_table').dataTable();
300
                var count = this_dt.$(".select_hold:checked", {"page": "all"}).length;
301
                parent.find('.cancel_selected_holds').data('ids', this_dt.$(".select_hold:checked", {"page": "all"}).toArray().map(el => $(el).data('id'))).html(MSG_CANCEL_SELECTED.format(count));
302
                localStorage.selectedWaitingHolds = JSON.stringify(this_dt.$(".select_hold:checked", {"page": "all"}).toArray().map(el => $(el).data('id')));
301
            });
303
            });
302
304
303
            var activeTab = localStorage.getItem("waitingreserves_activetab");
305
            var activeTab = localStorage.getItem("waitingreserves_activetab");
304
- 

Return to bug 37351