6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha › Administration ›
8 [% IF op =='add_form' %]
10 [% IF debit_type.code %]
19 [% INCLUDE 'doc-head-close.inc' %]
22 <body id="admin_debit_types" class="admin">
23 [% INCLUDE 'header.inc' %]
24 [% INCLUDE 'prefs-admin-search.inc' %]
26 <div id="breadcrumbs">
27 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
28 › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
29 › <a href="/cgi-bin/koha/admin/debit_types.pl">Debit types</a>
30 [% IF op == 'add_form' %]
31 › [% IF debit_type.code %]Modify[% ELSE %]New[% END %] debit type
35 <div class="main container-fluid">
37 <div class="col-sm-10 col-sm-push-2">
40 [% FOREACH m IN messages %]
41 <div class="dialog [% m.type | html %]">
43 [% CASE 'success_on_saving' %]
44 Debit type saved successfully.
45 [% CASE 'error_on_saving' %]
46 An error occurred when saving this debit type.
47 [% CASE 'success_on_archive' %]
48 Debit type archived successfully.
49 [% CASE 'success_on_restore' %]
50 Debit type restored successfully.
57 [% IF op == 'add_form' %]
59 <h3>Modify a debit type</h3>
61 <h3>New debit type</h3>
64 <form action="/cgi-bin/koha/admin/debit_types.pl" name="Aform" method="post" class="validated">
65 <input type="hidden" name="op" value="add_validate" />
66 <fieldset class="rows">
69 <label for="code" class="required">Debit type code: </label>
71 <strong>[% debit_type.code | html %]</strong>
72 <input type="hidden" name="code" value="[% code | html %]" />
74 <input type="text" name="code" id="code" size="80" maxlength="64" class="required" required="required"><span class="required">Required. Maximum length is 64 letters</span>
78 <label for="default_amount">Default amount: </label>
79 <input type="text" pattern="^\d+(\.\d{2})?$" name="default_amount" id="default_amount" size="80" maxlength="100" value="[% debit_type.default_amount | $Price on_editing => 1 %]" step="any" min="0"/>
82 <label for="description" class="required">Description: </label>
83 <input type="text" name="description" id="description" required="required" class="required" size="80" maxlength="100" value="[% debit_type.description | html %]" /> <span class="required">Required</span>
86 <label for="can_be_added_manually">Can be added manually? </label>
87 [% IF debit_type.can_be_added_manually %]
88 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
90 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
94 <label for="branches">Libraries limitation: </label>
95 <select id="branches" name="branches" multiple size="10">
96 <option value="">All libraries</option>
97 [% FOREACH branch IN branches_loop %]
98 [% IF ( branch.selected ) %]
99 <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
101 <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
105 <span>Select 'All libraries' if this debit type should be available at all libraries. Otherwise select libraries you want to associate debit type with.</span>
110 <fieldset class="action">
111 <button id="save_debit_type" class="btn btn-default"><i class="fa fa-save"></i> Save</button>
112 <a class="cancel btn-link" href="/cgi-bin/koha/admin/debit_types.pl"><i class="fa fa-times"></i> Cancel</a>
117 [% IF op == 'list' %]
118 <div id="toolbar" class="btn-toolbar">
119 <a class="btn btn-default" id="newdebittype" href="/cgi-bin/koha/admin/debit_types.pl?op=add_form"><i class="fa fa-plus"></i> New debit type</a>
122 <h3>Account debit types</h3>
123 [% IF debit_types.count %]
124 <table id="table_debit_types">
130 <th>Default amount</th>
131 <th>Can be added manually</th>
132 <th>Library limitations</th>
136 [% FOREACH debit_type IN debit_types %]
138 <td>[% debit_type.archived | html %]</td>
139 <td>[% debit_type.is_system | html %]</td>
140 <td>[% debit_type.code | html %]</td>
141 <td>[% debit_type.description | html %]</td>
142 <td>[% debit_type.default_amount | $Price %]</td>
143 <td>[% IF debit_type.can_be_added_manually %]Yes[% ELSE %]No[% END %]</td>
145 [% IF debit_type.library_limits.count > 0 %]
146 [% library_limits_str = "" %]
147 [% FOREACH library IN debit_type.library_limits %]
148 [%- IF loop.first -%]
149 [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
151 [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
154 <span class="library_limitation" title="[% library_limits_str | html %]">
155 [% IF debit_type.library_limits.count > 1 %]
156 [% debit_type.library_limits.count | html %] library limitations
158 [% debit_type.library_limits.count | html %] library limitation
165 [% IF !debit_type.is_system && !debit_type.archived %]
166 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=add_form&code=[% debit_type.code | uri %]&type=debit"><i class="fa fa-pencil"></i> Edit</a>
167 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=archive&code=[% debit_type.code | uri %]"><i class="fa fa-archive"></i> Archive</a>
168 [% ELSIF debit_type.archived %]
169 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=unarchive&code=[% debit_type.code | uri %]"><i class="fa fa-undo"></i> Restore</a>
177 <div class="dialog message">
178 There are no account debit types defined. <a href="/cgi-bin/koha/admin/debit_types.pl?op=add_form">Create new debit type</a>
183 </div> <!-- /.col-sm-10.col-sm-push-2 -->
185 <div class="col-sm-2 col-sm-pull-10">
187 [% INCLUDE 'admin-menu.inc' %]
189 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
190 </div> <!-- /.row -->
192 [% MACRO jsinclude BLOCK %]
193 [% Asset.js("js/admin-menu.js") | $raw %]
194 [% INCLUDE 'datatables.inc' %]
197 $(document).ready(function() {
198 var txtActivefilter = _("Filter system debit types");
199 var txtInactivefilter = _("Show all debit types");
200 var table_debit_types = $("#table_debit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
202 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
203 { "aTargets": [ 0, 1 ], "bSortable": false, "bVisible": false },
205 "aaSorting": [[ 0, "asc" ],[ 2, "asc" ]],
206 "sDom": 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
207 "iDisplayLength": 20,
208 "sPaginationType": "full_numbers"
210 $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
211 $('#filter_system').click(function(e) {
213 if ($(this).hasClass('filtered')) {
214 var filteredValue = '';
215 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
216 } else { //Not filtered. Let's do it!
217 var filteredValue = '0';
218 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
220 table_debit_types.fnFilter(filteredValue, 1, false, false);
221 $(this).toggleClass('filtered');
225 $('#filter_system').click();
230 [% INCLUDE 'intranet-bottom.inc' %]