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

(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (-15 / +17 lines)
Lines 2071-2092 li { Link Here
2071
}
2071
}
2072
2072
2073
#searchresults {
2073
#searchresults {
2074
    ul {
2074
    td {
2075
        li {
2075
        ul {
2076
            clear: left;
2076
            li {
2077
            font-size: 90%;
2077
                clear: left;
2078
            list-style: url("../img/item-bullet.svg");
2078
                font-size: 90%;
2079
            padding: .2em 0;
2079
                list-style: url("../img/item-bullet.svg");
2080
2080
                padding: .2em 0;
2081
            &.result_itype_image {
2081
2082
                list-style: none;
2082
                &.result_itype_image {
2083
                list-style-type: none;
2083
                    list-style: none;
2084
            }
2084
                    list-style-type: none;
2085
                }
2085
2086
2086
            img {
2087
                img {
2087
                float: left;
2088
                    float: left;
2088
                margin: 3px 5px 3px -5px;
2089
                    margin: 3px 5px 3px -5px;
2089
                max-width: 25px;
2090
                    max-width: 25px;
2091
                }
2090
            }
2092
            }
2091
        }
2093
        }
2092
    }
2094
    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt (-101 / +122 lines)
Lines 45-51 Link Here
45
            <main>
45
            <main>
46
46
47
          [% IF CAN_user_tools_manage_patron_lists %]
47
          [% IF CAN_user_tools_manage_patron_lists %]
48
            <div id="patron_list_dialog" class="dialog alert">
48
            <div id="patron_list_dialog" class="dialog message">
49
              Added <span class="patrons-length"></span> patrons to <a></a>.
49
              Added <span class="patrons-length"></span> patrons to <a></a>.
50
            </div>
50
            </div>
51
          [% END %]
51
          [% END %]
Lines 72-109 Link Here
72
            [% IF CAN_user_tools_manage_patron_lists || CAN_user_borrowers_edit_borrowers %]
72
            [% IF CAN_user_tools_manage_patron_lists || CAN_user_borrowers_edit_borrowers %]
73
              <div class="searchheader fh-fixedHeader" id="searchheader">
73
              <div class="searchheader fh-fixedHeader" id="searchheader">
74
                  <div>
74
                  <div>
75
                      <a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
75
                      <a href="#" class="btn btn-link" id="select_all"><i class="fa fa-check"></i> Select all</a>
76
                      |
76
                      |
77
                      <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
77
                      <a href="#" class="btn btn-link" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
78
                    [% IF CAN_user_tools_manage_patron_lists %]
78
                    [% IF CAN_user_tools_manage_patron_lists %]
79
                      |
79
80
                      <span>
81
                          <label for="add_to_patron_list">Add selected patrons to:</label>
82
                          <select id="add_to_patron_list" name="add_to_patron_list">
83
                              <option value=""></option>
84
                              [% IF patron_lists %]
85
                                  <optgroup label="Patron lists:">
86
                                      [% FOREACH pl IN patron_lists %]
87
                                          <option value="[% pl.patron_list_id | html %]">[% pl.name | html %]</option>
88
                                      [% END %]
89
                                  </optgroup>
90
                              [% END %]
91
92
                              <option value="new">[ New list ]</option>
93
                          </select>
94
95
                          <input type="text" id="new_patron_list" name="new_patron_list" id="new_patron_list" />
96
97
                          <input id="add_to_patron_list_submit" type="submit" class="submit" value="Save">
98
                      </span>
99
                    [% END %]
80
                    [% END %]
100
81
101
                    [% IF CAN_user_tools_manage_patron_lists && CAN_user_borrowers_edit_borrowers %]
82
                    [% IF CAN_user_tools_manage_patron_lists %]
102
                        |
83
                        <div id="patronlist-dropdown" class="btn-group">
84
                            <button id="patronlist-menu" type="button" class="btn btn-sm btn-default dropdown-toggle patron-edits disabled" disabled="disabled" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
85
                                Add to patron list <span class="caret"></span>
86
                            </button>
87
                            <ul class="dropdown-menu">
88
                                [% IF patron_lists %]
89
                                    [% FOREACH pl IN patron_lists %]
90
                                        <li><a href="#" class="patron-list-add" data-listid="[% pl.patron_list_id | html %]">[% pl.name | html %]</a></li>
91
                                    [% END %]
92
                                [% END %]
93
                                <li role="separator" class="divider"></li>
94
                                <li><a href="#" class="patron-list-add" data-listid="new">New list</a></li>
95
                            </ul>
96
                        </div>
103
                    [% END %]
97
                    [% END %]
104
98
105
                    [% IF CAN_user_borrowers_edit_borrowers %]
99
                    [% IF CAN_user_borrowers_edit_borrowers %]
106
                          <button id="merge-patrons" type="submit">Merge selected patrons</button>
100
                          <button id="merge-patrons" class="btn btn-sm btn-default disabled" disabled="disabled" type="submit"><i class="fa fa-compress" aria-hidden="true"></i> Merge selected patrons</button>
107
                    [% END %]
101
                    [% END %]
108
                  </div>
102
                  </div>
109
                </div>
103
                </div>
Lines 210-215 Link Here
210
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
204
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
211
    </div> <!-- /.row -->
205
    </div> <!-- /.row -->
212
206
207
    <!-- New Patron List Modal -->
208
    <div class="modal" id="new-patron-list" tabindex="-1" role="dialog" aria-labelledby="new-patron-listLabel">
209
        <div class="modal-dialog" role="document">
210
            <div class="modal-content">
211
                <div class="modal-header">
212
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
213
                    <h4 class="modal-title" id="new-patron-listLabel">Add patrons to a new patron list</h4>
214
                </div>
215
                <form id="new-patron-list_form">
216
                    <div class="modal-body">
217
                        <div class="form-group">
218
                            <label for="new_patron_list" class="required">Patron list name: </label>
219
                            <input class="form-control required" type="text" name="new_patron_list" id="new_patron_list" required="required" />
220
                            <input type="hidden" name="add_to_patron_list" id="add_to_patron_list" />
221
                            <span class="required">Required</span>
222
                        </div>
223
                    </div> <!-- /.modal-body -->
224
                    <div class="modal-footer">
225
                        <button type="submit" id="add_to_patron_list_submit" class="btn btn-default approve">Submit</button>
226
                        <button type="button" class="btn btn-default deny" data-dismiss="modal">Cancel</button>
227
                    </div> <!-- /.modal-footer -->
228
                </form> <!-- /#new-patron-list_form -->
229
            </div> <!-- /.modal-content -->
230
        </div> <!-- /.modal-dialog -->
231
    </div> <!-- /#new-patron-list -->
232
213
[% MACRO jsinclude BLOCK %]
233
[% MACRO jsinclude BLOCK %]
214
    [% INCLUDE 'datatables.inc' %]
234
    [% INCLUDE 'datatables.inc' %]
215
    [% INCLUDE 'columns_settings.inc' %]
235
    [% INCLUDE 'columns_settings.inc' %]
Lines 229-329 Link Here
229
            $('#merge-patrons').prop('disabled', true);
249
            $('#merge-patrons').prop('disabled', true);
230
            $('#memberresultst').on('change', 'input.selection', function() {
250
            $('#memberresultst').on('change', 'input.selection', function() {
231
                if ( $('.selection:checked').length > 1 ) {
251
                if ( $('.selection:checked').length > 1 ) {
232
                    $('#merge-patrons').prop('disabled', false);
252
                    /* More than one checkbox has been checked */
253
                    $('#merge-patrons').prop('disabled', false).removeClass("disabled");
254
                    $("#patronlist-menu").removeClass("disabled").prop("disabled", false);
255
                } else if ( $('.selection:checked').length == 1 ) {
256
                    /* At least one checkbox has been checked */
257
                    $('#merge-patrons').prop('disabled', true).addClass("disabled");
258
                    $("#patronlist-menu").removeClass("disabled").prop("disabled", false);
233
                } else {
259
                } else {
234
                    $('#merge-patrons').prop('disabled', true);
260
                    /* No checkbox has been checked */
261
                    $('#merge-patrons').prop('disabled', true).addClass("disabled");
262
                    $("#patronlist-menu").addClass("disabled").prop("disabled", true);
235
                }
263
                }
236
            });
264
            });
265
237
            $('#merge-patrons').on('click', function() {
266
            $('#merge-patrons').on('click', function() {
238
                var merge_patrons_url = 'merge-patrons.pl?' + $('.selection:checked')
267
                var merge_patrons_url = 'merge-patrons.pl?' + $('.selection:checked')
239
                    .map(function() {
268
                    .map(function() {
240
                       return "id=" + $(this).val()
269
                       return "id=" + $(this).val()
241
                    }).get().join('&');
270
                    }).get().join('&');
242
243
                window.location.href = merge_patrons_url;
271
                window.location.href = merge_patrons_url;
244
            });
272
            });
245
273
246
            $('#add_to_patron_list_submit').prop('disabled', true);
274
            $("#patronlist-dropdown").on("click", ".patron-list-add", function(e){
247
            $('#new_patron_list').hide();
275
                e.preventDefault();
248
276
249
            $('#add_to_patron_list').change(function() {
277
                if ( $("#memberresultst input:checkbox:checked").length == 0 ) {
250
                var value = $('#add_to_patron_list').val();
278
                    alert( _("You have not selected any patrons to add to a list!") );
251
                if ( value == 'new' ) {
279
                    $(".btn-group").removeClass("open"); /* Close button menu */
252
                    $('#new_patron_list').val('')
280
                    return false;
253
                    $('#new_patron_list').show();
254
                    $('#new_patron_list').focus();
255
                } else if ( value ) {
256
                    $('#new_patron_list').hide();
257
                    $('#add_to_patron_list_submit').prop('disabled', false);
258
                } else {
259
                    $('#new_patron_list').hide();
260
                    $('#add_to_patron_list_submit').prop('disabled', true);
261
                }
281
                }
262
            });
263
282
264
            $('#new_patron_list').on('input', function() {
283
                var listid = $(this).data("listid");
265
                if ( $('#new_patron_list').val() ) {
284
                $("#add_to_patron_list").val( listid );
266
                    $('#add_to_patron_list_submit').prop('disabled', false);
285
                if( listid == "new" ){
286
                    /* #add_to_patron_list value "new" in the modal form will tell API to create a new list */
287
                    $("#new-patron-list").modal("show");
267
                } else {
288
                } else {
268
                    $('#add_to_patron_list_submit').prop('disabled', true);
289
                    /* Ajax submit the patrons to list */
269
                }
270
            });
271
290
272
            $("#add_to_patron_list_submit").on('click', function(e){
291
                    patronListAdd();
273
                if ( $('#add_to_patron_list').val() == 'new' ) {
274
                    if ( $('#new_patron_list').val() ) {
275
                        $("#add_to_patron_list option").each(function() {
276
                            if ( $(this).text() == $('#new_patron_list').val() ) {
277
                                alert( _("You already have a list with that name!") );
278
                                return false;
279
                            }
280
                        });
281
                    } else {
282
                        alert( _("You must give your new patron list a name!") );
283
                        return false;
284
                    }
285
                }
292
                }
293
            })
286
294
287
                if ( $("#memberresultst input:checkbox:checked").length == 0 ) {
295
            /* Submit selected patrons to a list via AJAX */
288
                    alert( _("You have not selected any patrons to add to a list!") );
296
            $("#new-patron-list_form").on('submit', function(e){
297
                e.preventDefault();
298
                /* Upon submitting modal patron list add form... */
299
                if ( $('#new_patron_list').val() ) {
300
                    $(".patron-list-add").each(function() {
301
                        /* Check each list name in the menu of patron lists */
302
                        /* If submitted list name matches... */
303
                        if ( $(this).text() == $('#new_patron_list').val() ) {
304
                            alert( _("You already have a list with that name!") );
305
                            return false;
306
                        }
307
                    });
308
                } else {
309
                    alert( _("You must give your new patron list a name!") );
289
                    return false;
310
                    return false;
290
                }
311
                }
291
312
                $("#new-patron-list").modal("hide");
292
                var borrowernumbers = [];
313
                patronListAdd();
293
                $("#memberresultst").find("input:checkbox:checked").each(function(){
294
                    borrowernumbers.push($(this).val());
295
                });
296
                var data = {
297
                    add_to_patron_list: $("#add_to_patron_list").val(),
298
                    new_patron_list: $("#new_patron_list").val(),
299
                    borrowernumbers: borrowernumbers
300
                };
301
                $.ajax({
302
                    data: data,
303
                    type: 'POST',
304
                    url: '/cgi-bin/koha/svc/members/add_to_list',
305
                    success: function(data) {
306
                        $("#patron_list_dialog").show();
307
                        $("#patron_list_dialog > span.patrons-length").html(data.patrons_added_to_list);
308
                        $("#patron_list_dialog > a").attr("href", "/cgi-bin/koha/patron_lists/list.pl?patron_list_id=" + data.patron_list.patron_list_id);
309
                        $("#patron_list_dialog > a").html(data.patron_list.name);
310
                        if ( $('#add_to_patron_list').val() == 'new' ) {
311
                            var new_patron_list_added = $("<option>", {
312
                                value: data.patron_list.patron_list_id,
313
                                text: data.patron_list.name
314
                            });
315
                            $("#add_to_patron_list optgroup").append(new_patron_list_added);
316
                            $("#add_to_patron_list").val(data.patron_list.patron_list_id);
317
                            $("#new_patron_list").val('');
318
                            $('#add_to_patron_list').change();
319
                        }
320
                    },
321
                    error: function() {
322
                        alert("an error occurred");
323
                    }
324
                });
325
                return true;
326
            });
314
            });
315
327
            $(".filterByLetter").on("click",function(e){
316
            $(".filterByLetter").on("click",function(e){
328
                e.preventDefault();
317
                e.preventDefault();
329
                filterByFirstLetterSurname( $(this).text(), true );
318
                filterByFirstLetterSurname( $(this).text(), true );
Lines 510-515 Link Here
510
499
511
        });
500
        });
512
501
502
        function patronListAdd(){
503
            var borrowernumbers = [];
504
            $("#memberresultst").find("input:checkbox:checked").each(function(){
505
                borrowernumbers.push($(this).val());
506
            });
507
            var data = {
508
                add_to_patron_list: $("#add_to_patron_list").val(),
509
                new_patron_list: $("#new_patron_list").val(),
510
                borrowernumbers: borrowernumbers
511
            };
512
            $.ajax({
513
                data: data,
514
                type: 'POST',
515
                url: '/cgi-bin/koha/svc/members/add_to_list',
516
                success: function(data) {
517
                    $("#patron_list_dialog").show();
518
                    $("#patron_list_dialog > span.patrons-length").html(data.patrons_added_to_list);
519
                    $("#patron_list_dialog > a").attr("href", "/cgi-bin/koha/patron_lists/list.pl?patron_list_id=" + data.patron_list.patron_list_id);
520
                    $("#patron_list_dialog > a").html(data.patron_list.name);
521
522
                    if ( $('#add_to_patron_list').val() == 'new' ) {
523
                        /* Add a new entry to the menu */
524
                        $("#patronlist-dropdown .divider").before('<li><a class="patron-list-add" href="#" data-listid="' + data.patron_list.patron_list_id + '">' + data.patron_list.name + '</li>');
525
                    }
526
                },
527
                error: function() {
528
                    alert("an error occurred");
529
                }
530
            });
531
            return true;
532
        }
533
513
        function getSearchByLocation( setstate ){
534
        function getSearchByLocation( setstate ){
514
            /* Check to see if the URL contains a search parameter */
535
            /* Check to see if the URL contains a search parameter */
515
            if( location.search != ""){
536
            if( location.search != ""){
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt (-2 / +1 lines)
Lines 13-19 Link Here
13
            {
13
            {
14
                [% IF CAN_user_borrowers_edit_borrowers || CAN_user_tools_manage_patron_lists %]
14
                [% IF CAN_user_borrowers_edit_borrowers || CAN_user_tools_manage_patron_lists %]
15
                "dt_borrowernumber":
15
                "dt_borrowernumber":
16
                    "<input type='checkbox' id='check[% data.borrowernumber | html %]' class='selection' name='borrowernumber' value='[% data.borrowernumber | html %]' />",
16
                    "<input type='checkbox' id='check[% data.borrowernumber | html %]' data-cardnumber='[% data.cardnumber | html %]' class='selection' name='borrowernumber' value='[% data.borrowernumber | html %]' />",
17
                [% END %]
17
                [% END %]
18
                "dt_cardnumber":
18
                "dt_cardnumber":
19
                    "<label for='check[% data.borrowernumber | html %]'>[% data.cardnumber | html | $To %]</label>",
19
                    "<label for='check[% data.borrowernumber | html %]'>[% data.cardnumber | html | $To %]</label>",
20
- 

Return to bug 28867