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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-50 / +53 lines)
Lines 35-95 Link Here
35
35
36
    <tbody>
36
    <tbody>
37
        [% FOREACH hold IN holds %]
37
        [% FOREACH hold IN holds %]
38
        [%- IF !hold.found && first_priority == 0 -%]
38
            [%- IF !hold.found && first_priority == 0 -%]
39
            [%- first_priority = hold.priority -%]
39
                [%- first_priority = hold.priority -%]
40
            [%- found_holds = loop.index() -%]
40
                [%- found_holds = loop.index() -%]
41
        [%- END -%]
41
            [%- END -%]
42
        [%- IF Koha.Preference('HoldsSplitQueueNumbering') == 'actual' -%]
42
            [%- IF Koha.Preference('HoldsSplitQueueNumbering') == 'actual' -%]
43
            [%- this_priority = hold.priority -%]
43
                [%- this_priority = hold.priority -%]
44
        [%- ELSE -%]
44
            [%- ELSE -%]
45
            [%- this_priority = loop.count() - found_holds -%]
45
                [%- this_priority = loop.count() - found_holds -%]
46
        [%- END -%]
46
            [%- END -%]
47
            [% IF hold.suspend %]
47
            [% SET tr_class = hold.suspend ? 'suspend' : '' %]
48
                <tr class="suspend">
48
            <tr class="[% tr_class | html %]">
49
            [% ELSE %]
49
                <td><input type="checkbox" class="select_hold" data-id="[% hold.reserve_id | html %]" /></td>
50
                <tr>
50
                <td style="min-width:185px;" data-order="[% priority | html %]">
51
            [% END %]
51
                    <div>
52
                <td><input type="checkbox" class="select_hold" data-id="[% hold.reserve_id | html %]"/></td>
52
                        <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
53
                <td>
53
                        <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" />
54
                    <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
54
                        <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" />
55
                    <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" />
55
                        [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
56
                    <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" />
56
                            [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]
57
                    [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
57
                                <label for="rank-request_[% hold.reserve_id | html %]">Change priority to:</label>
58
                        [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]
58
                                <select name="rank-request" id="rank-request_[% hold.reserve_id | html %]" class="rank-request" data-hold-id="[% hold.reserve_id | html %]">
59
                            <select name="rank-request" class="rank-request" data-hold-id="[% hold.reserve_id | html %]">
59
                                    [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
60
                            [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
60
                                        [% FOREACH priority IN all_priorities %]
61
                                [% FOREACH priority IN all_priorities %]
61
                                            [% IF priority == this_priority %]
62
                                    [% IF priority == this_priority %]
62
                                                <option value="[% priority | html %]" selected="selected">[% priority | html %]</option>
63
                                        <option value="[% priority | html %]" selected="selected">[% priority | html %]</option>
63
                                            [% ELSIF priority > 0 %]
64
                                        [% ELSIF priority > 0 %]
64
                                                <option value="[% priority | html %]">[% priority | html %]</option>
65
                                        <option value="[% priority | html %]">[% priority | html %]</option>
65
                                            [% END %]
66
                                        [% END %]
67
                                    [% ELSE %]
68
                                        <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
66
                                    [% END %]
69
                                    [% END %]
67
                                [% END %]
70
                                    <option value="del">del</option>
71
                                </select>
68
                            [% ELSE %]
72
                            [% ELSE %]
69
                                <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
73
                                <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]" />
74
                                <select name="rank-request" class="rank-request" disabled="disabled" data-hold-id="[% hold.reserve_id | html %]">
75
                                    [% IF ( hold.found ) %]
76
                                        [% IF ( hold.intransit ) %]
77
                                            <option value="T" selected="selected">In transit</option>
78
                                        [% ELSIF (hold.inprocessing) %]
79
                                            <option value="P" selected="selected">In processing</option>
80
                                        [% ELSE %]
81
                                            <option value="W" selected="selected">Waiting</option>
82
                                        [% END %]
83
                                    [% ELSE %]
84
                                        <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
85
                                    [% END %]
86
                                </select>
70
                            [% END %]
87
                            [% END %]
71
                                <option value="del">del</option>
72
                            </select>
73
                        [% ELSE %]
88
                        [% ELSE %]
74
                            <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
89
                            <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]" />
75
                            <select name="rank-request" class="rank-request" disabled="disabled" data-hold-id="[% hold.reserve_id | html %]">
76
                            [% IF ( hold.found ) %]
77
                                [% IF ( hold.intransit ) %]
78
                                    <option value="T" selected="selected">In transit</option>
79
                                [% ELSIF (hold.inprocessing) %]
80
                                    <option value="P" selected="selected">In processing</option>
81
                                [% ELSE %]
82
                                    <option value="W" selected="selected">Waiting</option>
83
                                [% END %]
84
                            [% ELSE %]
85
                                <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
86
                            [% END %]
87
                            </select>
88
                        [% END %]
90
                        [% END %]
89
                    [% ELSE %]
91
                        <div>
90
                        <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
92
                            <label for="current_priority_[% hold.reserve_id | html %]">Current priority: </label>
91
                        [% hold.priority | html %]
93
                            <span id="current_priority_[% hold.reserve_id | html %]" class="current_priority badge text-bg-info">[% hold.priority | html %]</span>
92
                    [% END %]
94
                        </div>
95
                    </div>
93
                </td>
96
                </td>
94
                [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
97
                [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
95
                [%- UNLESS hold.found -%]
98
                [%- UNLESS hold.found -%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-17 / +54 lines)
Lines 102-107 Link Here
102
        :disabled{
102
        :disabled{
103
            opacity:0.5
103
            opacity:0.5
104
        }
104
        }
105
        .current_priority {
106
            width: 50px;
107
            text-align: left;
108
            margin-top: 5px;
109
        }
110
        .rank-request {
111
            width: 50px;
112
        }
105
    </style>
113
    </style>
106
[% END %]
114
[% END %]
107
</head>
115
</head>
Lines 1815-1841 Link Here
1815
            });
1823
            });
1816
            var prev_rank_request;
1824
            var prev_rank_request;
1817
            $("select[name=rank-request]").on("focus", function() {
1825
            $("select[name=rank-request]").on("focus", function() {
1818
                prev_rank_request = $(this).val();
1826
                prev_rank_request = parseInt($(this).val());
1819
                var row = $(this).parents("tr:first");
1820
            }).change(function() {
1827
            }).change(function() {
1821
                var row = $(this).parents("tr:first");
1828
                var this_rank = $(this);
1822
                var value = parseInt($(this).val());
1829
                var new_rank = parseInt(this_rank.val());
1823
                var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found
1830
                var old_rank = prev_rank_request;
1824
                if( !isNaN(value) ) {  //If moved to 'del'
1831
1825
                    var after = row.parent().find(`tr:nth-child(${value+found_holds})`); //Go to the row 1 after the new value (and skip found holds)
1832
                if ( isNaN( old_rank ) ) {
1826
                    if (prev_rank_request > value) {
1833
                    $("select[name=rank-request]").not('[disabled]').not(this_rank).each(function() {
1827
                        row.insertBefore(after);
1834
                        var current_rank = parseInt($(this).val());
1828
                    } else {
1835
                        if ( !isNaN(current_rank) && current_rank >= new_rank ) {
1829
                        row.insertAfter(after);
1836
                            $(this).val(current_rank + 1);
1837
                        }
1838
                    });
1839
                    prev_rank_request = new_rank;
1840
                    return;
1841
                }
1842
1843
                if ( isNaN( new_rank ) ) {
1844
                    if ( !isNaN( old_rank ) ) {
1845
                        $("select[name=rank-request]").not('[disabled]').not(this).each(function() {
1846
                            var current_rank = parseInt($(this).val());
1847
                            if ( !isNaN(current_rank) && current_rank > old_rank ) {
1848
                                $(this).val(current_rank - 1);
1849
                            }
1850
                        });
1830
                    }
1851
                    }
1852
                    prev_rank_request = NaN;
1853
                    return;
1831
                }
1854
                }
1832
1855
1833
                var next_priority = 1;
1856
                //if new rank is old rank, don't continue
1834
                $("select[name=rank-request]").each(function () {
1857
                if ( new_rank === old_rank ) return;
1835
                    if( isNaN( $(this).val() ) ){ return true; } //Don't reset found or del holds
1858
1836
                    $(this).val(next_priority);
1859
                // Adjust ranks
1837
                    next_priority++;
1860
                $("select[name=rank-request]").not('[disabled]').not(this).each(function() {
1861
                    var current_rank = parseInt($(this).val());
1862
                    //if current_rank is NaN, bail
1863
                    if ( isNaN( current_rank ) ) return;
1864
1865
                    if ( old_rank > new_rank ) {
1866
                        if ( current_rank >= new_rank && current_rank < old_rank ) {
1867
                            $(this).val(current_rank + 1);
1868
                        }
1869
                    } else {
1870
                        if ( current_rank > old_rank && current_rank <= new_rank ) {
1871
                            $(this).val(current_rank - 1);
1872
                        }
1873
                    }
1838
                });
1874
                });
1875
1876
                prev_rank_request = new_rank;
1839
            });
1877
            });
1840
1878
1841
            $(".clear-date").on("click",function(e){
1879
            $(".clear-date").on("click",function(e){
1842
- 

Return to bug 40654