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

(-)a/admin/debit_types.pl (-6 / +1 lines)
Lines 134-147 elsif ( $op eq 'delete_confirmed' ) { Link Here
134
}
134
}
135
135
136
if ( $op eq 'list' ) {
136
if ( $op eq 'list' ) {
137
    my $defaults = Koha::Account::DebitType::defaults;
137
    my $debit_types = Koha::Account::DebitTypes->search();
138
    my $system_types =
139
      Koha::Account::DebitTypes->search( { code => { 'in' => $defaults } } );
140
    my $debit_types = Koha::Account::DebitTypes->search(
141
        { code => { 'not_in' => $defaults } } );
142
    $template->param(
138
    $template->param(
143
        debit_types  => $debit_types,
139
        debit_types  => $debit_types,
144
        system_types => $system_types
145
    );
140
    );
146
}
141
}
147
142
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt (-32 / +24 lines)
Lines 152-161 Link Here
152
                    </div>
152
                    </div>
153
153
154
                    <h3>Account debit types</h3>
154
                    <h3>Account debit types</h3>
155
                    <h4>Custom types</h4>
156
                    [% IF debit_types.count %]
155
                    [% IF debit_types.count %]
157
                        <table id="table_debit_types">
156
                        <table id="table_debit_types">
158
                            <thead>
157
                            <thead>
158
                                <th>System</th>
159
                                <th>Account type code</th>
159
                                <th>Account type code</th>
160
                                <th>Description</th>
160
                                <th>Description</th>
161
                                <th>Default amount</th>
161
                                <th>Default amount</th>
Lines 166-171 Link Here
166
                            <tbody>
166
                            <tbody>
167
                                [% FOREACH debit_type IN debit_types %]
167
                                [% FOREACH debit_type IN debit_types %]
168
                                <tr>
168
                                <tr>
169
                                    <td>[% debit_type.is_system | html %]</td>
169
                                    <td>[% debit_type.code | html %]</td>
170
                                    <td>[% debit_type.code | html %]</td>
170
                                    <td>[% debit_type.description | html %]</td>
171
                                    <td>[% debit_type.description | html %]</td>
171
                                    <td>[% debit_type.default_amount | $Price %]</td>
172
                                    <td>[% debit_type.default_amount | $Price %]</td>
Lines 205-229 Link Here
205
                            There are no account debit types defined. <a href="/cgi-bin/koha/admin/debit_types.pl?op=add_form&type=debit">Create new debit type</a>
206
                            There are no account debit types defined. <a href="/cgi-bin/koha/admin/debit_types.pl?op=add_form&type=debit">Create new debit type</a>
206
                        </div>
207
                        </div>
207
                    [% END %]
208
                    [% END %]
208
                    <h4>System types</h4>
209
                    <table id="table_system_types">
210
                        <thead>
211
                            <th>Account type code</th>
212
                            <th>Description</th>
213
                            <th>Default amount</th>
214
                            <th>Can be added manually</th>
215
                        </thead>
216
                        <tbody>
217
                            [% FOREACH system_type IN system_types %]
218
                            <tr>
219
                                <td>[% system_type.code | html %]</td>
220
                                <td>[% system_type.description | html %]</td>
221
                                <td>[% system_type.default_amount | $Price %]</td>
222
                                <td>[% IF system_type.can_be_added_manually %]Yes[% ELSE %]No[% END %]</td>
223
                            </tr>
224
                            [% END %]
225
                        </tbody>
226
                    </table>
227
                [% END %]
209
                [% END %]
228
            </main>
210
            </main>
229
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
211
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
Lines 241-263 Link Here
241
223
242
    <script>
224
    <script>
243
        $(document).ready(function() {
225
        $(document).ready(function() {
244
            $("#table_debit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
226
            var txtActivefilter = _("Filter system debit types");
245
                "aoColumnDefs": [
227
            var txtInactivefilter = _("Show all debit types");
246
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
228
            var table_debit_types = $("#table_debit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
247
                ],
248
                "aaSorting": [[ 1, "asc" ]],
249
                "iDisplayLength": 10,
250
                "sPaginationType": "full_numbers"
251
            }));
252
            
253
            $("#table_system_types").dataTable($.extend(true, {}, dataTablesDefaults, {
254
                "aoColumnDefs": [
229
                "aoColumnDefs": [
255
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
230
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
231
                    { "aTargets": [ 0 ], "bSortable": false, "bVisible": false },
256
                ],
232
                ],
257
                "aaSorting": [[ 1, "asc" ]],
233
                "aaSorting": [[ 1, "asc" ]],
258
                "iDisplayLength": 10,
234
                "sDom": 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
235
                "iDisplayLength": 20,
259
                "sPaginationType": "full_numbers"
236
                "sPaginationType": "full_numbers"
260
            }));
237
            }));
238
            $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
239
            $('#filter_system').click(function(e) {
240
                e.preventDefault();
241
                if ($(this).hasClass('filtered')) {
242
                    var filteredValue = '';
243
                    $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
244
                } else { //Not filtered. Let's do it!
245
                    var filteredValue = '0';
246
                    $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
247
                }
248
                table_debit_types.fnFilter(filteredValue, 0, false, false);
249
                $(this).toggleClass('filtered');
250
            });
251
252
            //Start filtered
253
            $('#filter_system').click();
261
        });
254
        });
262
    </script>
255
    </script>
263
[% END %]
256
[% END %]
264
- 

Return to bug 23049