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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt (-37 / +39 lines)
Lines 237-328 Link Here
237
    <script>
237
    <script>
238
        var table_settings = [% TablesSettings.GetTableSettings('members', 'patron-lists', 'patron-list-table', 'json') | $raw %]
238
        var table_settings = [% TablesSettings.GetTableSettings('members', 'patron-lists', 'patron-list-table', 'json') | $raw %]
239
    </script>
239
    </script>
240
241
    <script>
240
    <script>
242
        $(document).ready(function() {
241
        $(document).ready(function () {
243
            $('#patrons_to_add_fieldset').hide();
242
            $("#patrons_to_add_fieldset").hide();
244
243
245
                $("#patron-list-table").kohaTable(
244
            $("#patron-list-table").kohaTable(
246
                    {
245
                {
247
                        pagingType: "full",
246
                    pagingType: "full",
248
                    },
247
                },
249
                    table_settings
248
                table_settings
250
                );
249
            );
251
250
252
            function RemovePatron( cardnumber, container ) {
251
            function RemovePatron(cardnumber, container) {
253
                $( '#borrower_' + cardnumber ).remove();
252
                $("#borrower_" + cardnumber).remove();
254
253
255
                if ( ! $(container).html() ) {
254
                if (!$(container).html()) {
256
                    $(container).parent("fieldset").hide( 800 );
255
                    $(container).parent("fieldset").hide(800);
257
                }
256
                }
258
            }
257
            }
259
            patron_autocomplete($("#find_patron"), {
258
            patron_autocomplete($("#find_patron"), {
260
                "on-select-add-to": {
259
                "on-select-add-to": {
261
                    container: $("#patrons_to_add"),
260
                    container: $("#patrons_to_add"),
262
                    input_name: 'patrons_to_add',
261
                    input_name: "patrons_to_add",
263
                },
262
                },
264
                "on-select-callback": function( event, ui ) {
263
                "on-select-callback": function (event, ui) {
265
                    $("#find_patron").val('').focus();
264
                    $("#find_patron").val("").focus();
266
                    return false;
265
                    return false;
267
                }
266
                },
268
            });
267
            });
269
268
270
            $("body").on("click", "#CheckAll", function(e){
269
            $("body").on("click", "#CheckAll", function (e) {
271
                e.preventDefault();
270
                e.preventDefault();
272
                $("input[type='checkbox']","#patron-list-table").each(function(){
271
                $("input[type='checkbox']", "#patron-list-table").each(function () {
273
                    $(this).prop("checked",1);
272
                    $(this).prop("checked", 1);
274
                });
273
                });
275
            });
274
            });
276
            $("body").on("click", "#CheckNone", function(e){
275
            $("body").on("click", "#CheckNone", function (e) {
277
                e.preventDefault();
276
                e.preventDefault();
278
                $("input[type='checkbox']","#patron-list-table").each(function(){
277
                $("input[type='checkbox']", "#patron-list-table").each(function () {
279
                    $(this).prop("checked",0);
278
                    $(this).prop("checked", 0);
280
                });
279
                });
281
            });
280
            });
282
281
283
            $("#remove_patrons").submit(function(){
282
            $("#remove_patrons").submit(function () {
284
                var checkedItems = $("input:checked");
283
                var checkedItems = $("input:checked");
285
                if ($(checkedItems).size() == 0) {
284
                if ($(checkedItems).size() == 0) {
286
                    alert(_("You must select one or more patrons to remove"));
285
                    alert(_("You must select one or more patrons to remove"));
287
                    return false;
286
                    return false;
288
                }
287
                }
289
                $(checkedItems).parents('tr').addClass("warn");
288
                $(checkedItems).parents("tr").addClass("warn");
290
                if( confirm(_("Are you sure you want to remove the selected patrons?")) ) {
289
                if (confirm(_("Are you sure you want to remove the selected patrons?"))) {
291
                    return true;
290
                    return true;
292
                } else {
291
                } else {
293
                    $(checkedItems).parents('tr').removeClass("warn");
292
                    $(checkedItems).parents("tr").removeClass("warn");
294
                    return false;
293
                    return false;
295
                }
294
                }
296
            });
295
            });
297
296
298
            $("#add_patrons_by_id a").on("click", function(){
297
            $("#add_patrons_by_id a").on("click", function () {
299
                $("#add_patrons_by_id, #patron_search_line").hide();
298
                $("#add_patrons_by_id, #patron_search_line").hide();
300
                $("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").show();
299
                $("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").show();
301
            });
300
            });
302
301
303
            $("#add_patrons_by_search a").on("click", function(){
302
            $("#add_patrons_by_search a").on("click", function () {
304
                $("#add_patrons_by_id, #patron_search_line").show();
303
                $("#add_patrons_by_id, #patron_search_line").show();
305
                $("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").hide();
304
                $("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").hide();
306
            });
305
            });
307
306
308
            $('.merge-patrons').on('click', function() {
307
            $(".merge-patrons").on("click", function () {
309
                var checkedItems = $("input:checked");
308
                var checkedItems = $("input:checked");
310
                if ($(checkedItems).length < 2) {
309
                if ($(checkedItems).length < 2) {
311
                    alert(_("You must select two or more patrons to merge"));
310
                    alert(_("You must select two or more patrons to merge"));
312
                    return false;
311
                    return false;
313
                }
312
                }
314
                $(checkedItems).parents('tr').addClass("warn");
313
                $(checkedItems).parents("tr").addClass("warn");
315
                if (confirm(_("Are you sure you want to merge the selected patrons?"))) {
314
                if (confirm(_("Are you sure you want to merge the selected patrons?"))) {
316
                    var merge_patrons_url = '/cgi-bin/koha/members/merge-patrons.pl?' +
315
                    var merge_patrons_url =
317
                        $('.selection:checked')
316
                        "/cgi-bin/koha/members/merge-patrons.pl?" +
318
                        .map(function() {
317
                        $(".selection:checked")
319
                            return "id=" + $( '#borrowernumber_' + $(this).val() ).val()
318
                            .map(function () {
320
                        }).get().join('&');
319
                                return "id=" + $("#borrowernumber_" + $(this).val()).val();
320
                            })
321
                            .get()
322
                            .join("&");
321
323
322
                    window.location.href = merge_patrons_url;
324
                    window.location.href = merge_patrons_url;
323
                    return false;
325
                    return false;
324
                } else {
326
                } else {
325
                    $(checkedItems).parents('tr').removeClass("warn");
327
                    $(checkedItems).parents("tr").removeClass("warn");
326
                    return false;
328
                    return false;
327
                }
329
                }
328
            });
330
            });
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt (-19 / +17 lines)
Lines 166-174 Link Here
166
        const interface = "[% interface | html %]";
166
        const interface = "[% interface | html %]";
167
        const theme = "[% theme | html %]";
167
        const theme = "[% theme | html %]";
168
    </script>
168
    </script>
169
170
    <script>
169
    <script>
171
        $(document).ready(function() {
170
        $(document).ready(function () {
172
            var patronExportModal = $("#patronExportModal");
171
            var patronExportModal = $("#patronExportModal");
173
            var patronExportModalBody = $("#patronExportModal .modal-body");
172
            var patronExportModalBody = $("#patronExportModal .modal-body");
174
173
Lines 177-238 Link Here
177
            $("#patron-lists-table").kohaTable({
176
            $("#patron-lists-table").kohaTable({
178
                autoWidth: false,
177
                autoWidth: false,
179
                pagingType: "full",
178
                pagingType: "full",
180
                order: [[ 1, "asc" ]]
179
                order: [[1, "asc"]],
181
            });
180
            });
182
181
183
            $(".delete_patron").on("click", function(){
182
            $(".delete_patron").on("click", function () {
184
                $(".dropdown").removeClass("open");
183
                $(".dropdown").removeClass("open");
185
                var list = $(this).data("list-name");
184
                var list = $(this).data("list-name");
186
                return confirmDelete( _("Are you sure you want to delete the list %s?").format(list));
185
                return confirmDelete(_("Are you sure you want to delete the list %s?").format(list));
187
            });
186
            });
188
187
189
            $("#patrons_lists_form").submit(function(){
188
            $("#patrons_lists_form").submit(function () {
190
                var checkedItems = $("input[name=patron_lists_ids]:checked");
189
                var checkedItems = $("input[name=patron_lists_ids]:checked");
191
                if ( checkedItems.size() == 0) {
190
                if (checkedItems.size() == 0) {
192
                    alert(_("You must select one or more lists to delete"));
191
                    alert(_("You must select one or more lists to delete"));
193
                    return false;
192
                    return false;
194
                }
193
                }
195
                if( confirm(_("Are you sure you want to delete the selected lists?")) ) {
194
                if (confirm(_("Are you sure you want to delete the selected lists?"))) {
196
                    return true;
195
                    return true;
197
                } else {
196
                } else {
198
                    return false;
197
                    return false;
199
                }
198
                }
200
            });
199
            });
201
200
202
            $(document).on("click", ".select_list", function() {
201
            $(document).on("click", ".select_list", function () {
203
                var checkedItems = $("input[name=patron_lists_ids]:checked");
202
                var checkedItems = $("input[name=patron_lists_ids]:checked");
204
                if ( checkedItems.size() == 0 ) {
203
                if (checkedItems.size() == 0) {
205
                    $("#delete_selected_lists").addClass("disabled").prop("disabled", true);
204
                    $("#delete_selected_lists").addClass("disabled").prop("disabled", true);
206
                } else {
205
                } else {
207
                    $("#delete_selected_lists").removeClass("disabled").prop("disabled", false);
206
                    $("#delete_selected_lists").removeClass("disabled").prop("disabled", false);
208
                }
207
                }
209
            });
208
            });
210
209
211
            $(".print_cards").on("click", function(e){
210
            $(".print_cards").on("click", function (e) {
212
                e.preventDefault();
211
                e.preventDefault();
213
                var page = $(this).attr("href");
212
                var page = $(this).attr("href");
214
                patronExportModalBody.load(page + " #exportingf");
213
                patronExportModalBody.load(page + " #exportingf");
215
                patronExportModal.modal("show");
214
                patronExportModal.modal("show");
216
            });
215
            });
217
216
218
            patronExportModal.on("hidden.bs.modal", function(){
217
            patronExportModal.on("hidden.bs.modal", function () {
219
                patronExportModalBody.html("<div id=\"loading\"><img src=\"" + interface + "/" + theme + "/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
218
                patronExportModalBody.html('<div id="loading"><img src="' + interface + "/" + theme + '/img/spinner-small.gif" alt="" /> ' + _("Loading") + "</div>");
220
            });
219
            });
221
220
222
            patronExportModal.on("submit", "#exportingf", function(e){
221
            patronExportModal.on("submit", "#exportingf", function (e) {
223
                e.preventDefault();
222
                e.preventDefault();
224
                modal_body = patronExportModalBody;
223
                modal_body = patronExportModalBody;
225
                modal_body.html("<div id=\"loading\"><img src=\"" + interface + "/" + theme + "/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
224
                modal_body.html('<div id="loading"><img src="' + interface + "/" + theme + '/img/spinner-small.gif" alt="" /> ' + _("Loading") + "</div>");
226
                target_url = $(this).attr("action");
225
                target_url = $(this).attr("action");
227
                params =  $( this ).serialize();
226
                params = $(this).serialize();
228
                $("#patronExportModal .modal-body").load( target_url + "?" + params + " #export_patron_list");
227
                $("#patronExportModal .modal-body").load(target_url + "?" + params + " #export_patron_list");
229
            });
228
            });
230
229
231
            patronExportModal.on("click",".btn-close",function(e){
230
            patronExportModal.on("click", ".btn-close", function (e) {
232
                e.preventDefault();
231
                e.preventDefault();
233
                patronExportModal.modal("hide");
232
                patronExportModal.modal("hide");
234
            });
233
            });
235
236
        });
234
        });
237
    </script>
235
    </script>
238
[% END %]
236
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/patron-lists-tab.tt (-2 lines)
Lines 127-133 Link Here
127
        CAN_user_tools_manage_patron_lists: [% CAN_user_tools_manage_patron_lists ? 1 : 0 | html %],
127
        CAN_user_tools_manage_patron_lists: [% CAN_user_tools_manage_patron_lists ? 1 : 0 | html %],
128
    });
128
    });
129
</script>
129
</script>
130
131
<script>
130
<script>
132
    var patron_lists_dt_params = {
131
    var patron_lists_dt_params = {
133
        sPaginationType: "full",
132
        sPaginationType: "full",
134
- 

Return to bug 41573