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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt (-10 / +84 lines)
Lines 12-27 Link Here
12
    [% Asset.css('css/datatables.css') %]
12
    [% Asset.css('css/datatables.css') %]
13
    [% INCLUDE 'doc-head-close.inc' %]
13
    [% INCLUDE 'doc-head-close.inc' %]
14
    [% INCLUDE 'datatables.inc' %]
14
    [% INCLUDE 'datatables.inc' %]
15
    [% Asset.js('lib/jquery/plugins/jquery.dataTables.columnFilter.js') %]
16
    <script type="text/javascript">
15
    <script type="text/javascript">
17
        $(document).ready(function() {
16
        $(document).ready(function() {
18
            var options = {
17
            var options = {
19
                "paging": false,
18
                "paging": false,
20
                "autoWidth": false,
19
                "autoWidth": false,
21
                "columnDefs": [
20
                "columnDefs": [
22
                    { "visible": false, "targets": 1 },
21
                    { "visible": false, "targets": [1, 8] },
23
                    { "orderable": false, "targets": -1 }
22
                    { "orderable": false, "targets": -1 }
24
                ],
23
                ],
24
                "orderCellsTop": true,
25
                "orderFixed": [[ 1, 'asc' ]]
25
                "orderFixed": [[ 1, 'asc' ]]
26
            };
26
            };
27
            [% UNLESS bookseller %]
27
            [% UNLESS bookseller %]
Lines 40-46 Link Here
40
                    });
40
                    });
41
                };
41
                };
42
            [% END %]
42
            [% END %]
43
            $("#basketgroups-table").kohaDataTable(options);
43
44
            var thead = $('#basketgroups-table thead');
45
            var filterRow = thead.find('tr').clone();
46
            thead.append(filterRow);
47
48
            var dt = $("#basketgroups-table").kohaDataTable(options);
49
50
            // Enable per-column filtering
51
            filterRow.find('th').each(function() {
52
                if ($(this).is(':last-child')) {
53
                    $(this).html('');
54
                    return;
55
                }
56
57
                var input = $('<input>')
58
                    .attr('type', 'text')
59
                    .attr('placeholder', $(this).text())
60
                    .on('keyup change', function () {
61
                        var idx = $(this).parents('th').index();
62
                        dt.column(idx + ':visIdx').search($(this).val()).draw();
63
                    });
64
                var span = $('<span>')
65
                    .addClass('filter_column')
66
                    .append(input);
67
                $(this).html(span);
68
            });
69
70
            // Open/Closed filter
71
            $('#status-filter input[name="status"]').on('change', function() {
72
                if ($(this).is(':checked')) {
73
                    var value = $(this).val();
74
                    switch (value) {
75
                        case 'open':
76
                            var visIdx = dt.column(7).index('visible');
77
                            $(dt.table().header())
78
                                .find('th:nth-child(' + (visIdx + 1) + ') input')
79
                                .val('')
80
                                .change();
81
                            dt.column(7).visible(false);
82
                            dt.column(8).search('0');
83
                            break;
84
85
                        case 'closed':
86
                            dt.column(7).visible(true);
87
                            dt.column(8).search('1');
88
                            break;
89
90
                        case 'all':
91
                            dt.column(7).visible(true);
92
                            dt.column(8).search('');
93
                            break;
94
95
                        default:
96
                            console.warn('Wrong value for status');
97
                    }
98
                    dt.draw();
99
                }
100
            }).change();
44
101
45
            $('#basketgroups-table').on('click', '.closeandprint', function(e) {
102
            $('#basketgroups-table').on('click', '.closeandprint', function(e) {
46
                e.preventDefault();
103
                e.preventDefault();
Lines 88-93 Link Here
88
                        <h1>Basket groups for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name %]</a></h1>
145
                        <h1>Basket groups for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name %]</a></h1>
89
                    [% END %]
146
                    [% END %]
90
147
148
                    <form id="status-filter">
149
                        <div class="btn-group" data-toggle="buttons">
150
                            <label class="btn btn-default btn-sm active">
151
                                <input type="radio" name="status" value="open" autocomplete="off" checked> Open
152
                            </label>
153
                            <label class="btn btn-default btn-sm">
154
                                <input type="radio" name="status" value="closed" autocomplete="off"> Closed
155
                            </label>
156
                            <label class="btn btn-default btn-sm">
157
                                <input type="radio" name="status" value="all" autocomplete="off"> All
158
                            </label>
159
                        </div>
160
                    </form>
161
91
                    [% IF basketgroups.size > 0 %]
162
                    [% IF basketgroups.size > 0 %]
92
                        <table id="basketgroups-table" class="group">
163
                        <table id="basketgroups-table" class="group">
93
                            <thead>
164
                            <thead>
Lines 100-105 Link Here
100
                                    <th>No. of ordered titles</th>
171
                                    <th>No. of ordered titles</th>
101
                                    <th>No. of received titles</th>
172
                                    <th>No. of received titles</th>
102
                                    <th>Date closed</th>
173
                                    <th>Date closed</th>
174
                                    <th>Closed</th>
103
                                    <th>Action</th>
175
                                    <th>Action</th>
104
                                </tr>
176
                                </tr>
105
                            </thead>
177
                            </thead>
Lines 107-119 Link Here
107
                                [% FOREACH basketgroup IN basketgroups %]
179
                                [% FOREACH basketgroup IN basketgroups %]
108
                                    <tr>
180
                                    <tr>
109
                                        <td>
181
                                        <td>
110
                                            [% IF ( basketgroup.name ) %]
182
                                            <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% basketgroup.bookseller.id %]&basketgroupid=[% basketgroup.id %]">
111
                                                [% basketgroup.name %]
183
                                                [% IF ( basketgroup.name ) %]
112
                                            [% ELSE %]
184
                                                    [% basketgroup.name %] (#[% basketgroup.id %])
113
                                                Basket group no. [% basketgroup.id %]
185
                                                [% ELSE %]
114
                                            [% END %]
186
                                                    <em>Unnamed basket group</em> (#[% basketgroup.id %])
187
                                                [% END %]
188
                                            </a>
115
                                        </td>
189
                                        </td>
116
                                        <td>[% basketgroup.bookseller.name %]</td>
190
                                        <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% basketgroup.bookseller.id %]">[% basketgroup.bookseller.name %]</a></td>
117
                                        <td>[% Branches.GetName(basketgroup.billingplace) %]</td>
191
                                        <td>[% Branches.GetName(basketgroup.billingplace) %]</td>
118
                                        <td>
192
                                        <td>
119
                                            [% IF (basketgroup.freedeliveryplace) %]
193
                                            [% IF (basketgroup.freedeliveryplace) %]
Lines 126-131 Link Here
126
                                        <td>[% basketgroup.ordered_titles_count %]</td>
200
                                        <td>[% basketgroup.ordered_titles_count %]</td>
127
                                        <td>[% basketgroup.received_titles_count %]</td>
201
                                        <td>[% basketgroup.received_titles_count %]</td>
128
                                        <td>[% basketgroup.closeddate | $KohaDates %]</td>
202
                                        <td>[% basketgroup.closeddate | $KohaDates %]</td>
203
                                        <td>[% basketgroup.closeddate ? '1' : '0' %]</td>
129
                                        <td>
204
                                        <td>
130
                                            <div class="dropdown">
205
                                            <div class="dropdown">
131
                                            <a class="btn btn-default btn-xs dropdown-toggle" id="actions-[% basketgroup.id %]" role="button" data-toggle="dropdown">Actions <b class="caret"></b></a>
206
                                            <a class="btn btn-default btn-xs dropdown-toggle" id="actions-[% basketgroup.id %]" role="button" data-toggle="dropdown">Actions <b class="caret"></b></a>
132
- 

Return to bug 20810