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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt (-7 / +27 lines)
Lines 159-165 Link Here
159
[% INCLUDE 'calendar.inc' %]
159
[% INCLUDE 'calendar.inc' %]
160
    [% INCLUDE 'datatables.inc' %]
160
    [% INCLUDE 'datatables.inc' %]
161
    [% INCLUDE 'columns_settings.inc' %]
161
    [% INCLUDE 'columns_settings.inc' %]
162
    [% Asset.js("js/autocomplete/patrons.js") | $raw %]
163
    <script>
162
    <script>
164
        var MSG_REMOVE_PATRON = _("Remove");
163
        var MSG_REMOVE_PATRON = _("Remove");
165
        $(document).ready(function() {
164
        $(document).ready(function() {
Lines 168-179 Link Here
168
                "sPaginationType": "full"
167
                "sPaginationType": "full"
169
            }, table_settings );
168
            }, table_settings );
170
169
171
            patron_autocomplete({
170
            function AddPatron( patron_name, value, container, input_name ) {
172
                patron_container: $("#basket_creators"),
171
                div = "<div id='borrower_" + value + "'>" + patron_name + " ( <a href='#' class='removePatron'><i class='fa fa-trash' aria-hidden='true'></i> " + MSG_REMOVE_PATRON + " </a> ) <input type='hidden' name='" + input_name + "' value='" + value + "' /></div>";
173
                input_autocomplete: $("#find_patron"),
172
                $(container).append( div );
174
                patron_input_name: 'created_by',
173
175
                field_to_retrieve: 'borrowernumber'
174
                $(container).parent().show( 800 );
175
            }
176
            function RemovePatron( cardnumber, container ) {
177
                $( '#borrower_' + cardnumber ).remove();
178
179
                if ( ! $(container).html() ) {
180
                    $(container).parent("fieldset").hide( 800 );
181
                }
182
            }
183
            patron_autocomplete($("#find_patron"), {
184
                'on-select-callback': function( event, ui ) {
185
                    var field = ui.item.borrowernumber;
186
                    AddPatron( ui.item.firstname + " " + ( ui.item.middle_name || "" ) + " " + ui.item.surname, field, $("#basket_creators"), 'created_by' );
187
                    $("#find_patron").val('').focus();
188
                    return false;
189
                }
176
            });
190
            });
191
            $("body").on("click",".removePatron",function(e){
192
                e.preventDefault();
193
                var divid = $(this).parent().attr("id");
194
                var cardnumber = divid.replace("borrower_","");
195
                RemovePatron(cardnumber, $("#basket_creators"));
196
            });
197
177
        });
198
        });
178
    </script>
199
    </script>
179
[% END %]
200
[% END %]
180
- 

Return to bug 31782