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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-3 / +11 lines)
Lines 164-187 function checkMultiHold() { Link Here
164
        }
164
        }
165
    });
165
    });
166
    var prev_rank_request;
166
    var prev_rank_request;
167
    var priorities;
167
    $("select[name=rank-request]").on("focus", function() {
168
    $("select[name=rank-request]").on("focus", function() {
168
        prev_rank_request = $(this).val();
169
        prev_rank_request = $(this).val();
170
171
        var row = $(this).parents("tr:first");
172
        priorities = row.parent().find("select[name=rank-request]").map( function() {
173
            return $(this).val();
174
        }).get();
169
    }).change(function() {
175
    }).change(function() {
170
        var row = $(this).parents("tr:first");
176
        var row = $(this).parents("tr:first");
177
171
        var value = parseInt($(this).val());
178
        var value = parseInt($(this).val());
172
        var rowsCount = row.parent().children('tr').length - 1;
179
        var rowsCount = row.parent().children('tr').length - 1;
173
        value = value > rowsCount ? rowsCount : value;
180
        value = value > rowsCount ? rowsCount : value;
174
        var after = row.parent().find("tr:nth-child("+(value+1)+")");
181
        var after = row.parent().find("tr:nth-child("+(value+1)+")");
175
182
183
184
176
        if (prev_rank_request > value) {
185
        if (prev_rank_request > value) {
177
            row.insertBefore(after);
186
            row.insertBefore(after);
178
        } else {
187
        } else {
179
            row.insertAfter(after);
188
            row.insertAfter(after);
180
        }
189
        }
181
190
182
        var next_priority = 1;
191
        var next_priority = 0;
183
        row.parent().find("select[name=rank-request]").each(function () {
192
        row.parent().find("select[name=rank-request]").each(function () {
184
            $(this).val(next_priority);
193
            $(this).val(priorities[next_priority]);
185
            next_priority++;
194
            next_priority++;
186
        });
195
        });
187
    });
196
    });
188
- 

Return to bug 19469