5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Administration ›
7 [% IF op =='add_form' %]
9 [% IF credit_type.code %]
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="admin_credit_types" class="admin">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'prefs-admin-search.inc' %]
25 <div id="breadcrumbs">
26 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
27 › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
28 › <a href="/cgi-bin/koha/admin/credit_types.pl">Credit types</a>
29 [% IF op == 'add_form' %]
30 › [% IF credit_type.code %]Modify credit type[% ELSE %]New credit type[% END %]
34 <div class="main container-fluid">
36 <div class="col-sm-10 col-sm-push-2">
39 [% FOREACH m IN messages %]
40 <div class="dialog [% m.type | html %]">
42 [% CASE 'success_on_saving' %]
43 Credit type saved successfully.
44 [% CASE 'error_on_saving' %]
45 An error occurred when saving this credit type.
46 [% CASE 'success_on_archive' %]
47 Credit type archived successfully.
48 [% CASE 'success_on_restore' %]
49 Credit type restored successfully.
56 [% IF op == 'add_form' %]
58 <h3>Modify a credit type</h3>
60 <h3>New credit type</h3>
63 <form action="/cgi-bin/koha/admin/credit_types.pl" name="Aform" method="post" class="validated">
64 <input type="hidden" name="op" value="add_validate" />
65 <fieldset class="rows">
68 <label for="code" class="required">Credit type code: </label>
70 <strong>[% credit_type.code | html %]</strong>
71 <input type="hidden" name="code" value="[% code | html %]" />
73 <input type="text" name="code" id="code" size="80" maxlength="64" class="required focus" required="required"><span class="required">Required. Maximum length is 64 letters</span>
77 <label for="description" class="required">Description: </label>
78 [% IF credit_type && credit_type.is_system %]
79 <span>[% credit_type.description | html %]</span>
81 <input type="text" name="description" id="description" required="required" class="required" size="80" maxlength="100" value="[% credit_type.description | html %]" /> <span class="required">Required</span>
85 <label for="can_be_added_manually">Can be manually added ? </label>
86 [% IF credit_type && credit_type.is_system %]
87 [% IF credit_type.can_be_added_manually %]Yes[% ELSE %]No[% END %]
88 [% ELSIF credit_type.can_be_added_manually %]
89 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
91 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
95 <label for="credit_number_enabled">Enable credit number</label>
96 [% IF credit_type.credit_number_enabled %]
97 <input type="checkbox" name="credit_number_enabled" id="credit_number_enabled" checked="checked" value="1" />
99 <input type="checkbox" name="credit_number_enabled" id="credit_number_enabled" value="1" />
101 <span>Enable automatic generation of credit number (see <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AutoCreditNumber">AutoCreditNumber</a>)</span>
104 <label for="branches">Libraries limitation: </label>
105 [% IF credit_type && credit_type.is_system %]
106 No library limitation
108 <select id="branches" name="branches" multiple size="10">
109 <option value="">All libraries</option>
110 [% FOREACH branch IN branches_loop %]
111 [% IF ( branch.selected ) %]
112 <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
114 <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
118 <span>Select 'All libraries' if this credit type should be available at all libraries. Otherwise select libraries you want to associate credit type with.</span>
124 <fieldset class="action">
125 <button id="save_credit_type" class="btn btn-default"><i class="fa fa-save"></i> Save</button>
126 <a class="cancel btn-link" href="/cgi-bin/koha/admin/credit_types.pl"><i class="fa fa-times"></i> Cancel</a>
131 [% IF op == 'list' %]
132 <div id="toolbar" class="btn-toolbar">
133 <a class="btn btn-default" id="newcredittype" href="/cgi-bin/koha/admin/credit_types.pl?op=add_form"><i class="fa fa-plus"></i> New credit type</a>
136 <h3>Account credit types</h3>
137 [% IF credit_types.count %]
138 <table id="table_credit_types">
144 <th>Available for</th>
145 <th>Credit number enabled</th>
146 <th>Library limitations</th>
147 <th class="noExport">Actions</th>
150 [% FOREACH credit_type IN credit_types %]
152 <td>[% credit_type.archived | html %]</td>
153 <td>[% credit_type.is_system | html %]</td>
154 <td>[% credit_type.code | html %]</td>
155 <td>[% credit_type.description | html %]</td>
156 <td>[% IF credit_type.can_be_added_manually %]Manual credit[% END %]</td>
157 <td>[% IF credit_type.credit_number_enabled %]Yes[% ELSE %]No[% END %]</td>
159 [% IF credit_type.library_limits.count > 0 %]
160 [% library_limits_str = "" %]
161 [% FOREACH library IN credit_type.library_limits %]
162 [%- IF loop.first -%]
163 [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
165 [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
168 <span class="library_limitation" title="[% library_limits_str | html %]">
169 [% limits_count = credit_type.library_limits.count %]
170 [% tnx('{count} library limitation', '{count} library limitations', limits_count, { count => limits_count }) %]
176 [% IF !credit_type.archived %]
177 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=add_form&code=[% credit_type.code | uri %]&type=credit"><i class="fa fa-pencil"></i> Edit</a>
179 [% IF !credit_type.is_system && !credit_type.archived %]
180 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=archive&code=[% credit_type.code | uri %]"><i class="fa fa-archive"></i> Archive</a>
183 [% IF !credit_type.is_system && credit_type.archived %]
184 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=unarchive&code=[% credit_type.code | uri %]"><i class="fa fa-undo"></i> Restore</a>
192 <div class="dialog message">
193 There are no account credit types defined.
194 <a href="/cgi-bin/koha/admin/credit_types.pl?op=add_form">Create new credit type</a>
199 </div> <!-- /.col-sm-10.col-sm-push-2 -->
201 <div class="col-sm-2 col-sm-pull-10">
203 [% INCLUDE 'admin-menu.inc' %]
205 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
206 </div> <!-- /.row -->
208 [% MACRO jsinclude BLOCK %]
209 [% Asset.js("js/admin-menu.js") | $raw %]
210 [% INCLUDE 'datatables.inc' %]
213 $(document).ready(function() {
214 var txtActivefilter = _("Filter system credit types");
215 var txtInactivefilter = _("Show all credit types");
216 var table_credit_types = $("#table_credit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
218 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
219 { "aTargets": [ 0, 1 ], "bSortable": false, "bVisible": false },
221 "aaSorting": [[ 0, "asc" ],[ 2, "asc" ]],
222 "sDom": 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
223 "iDisplayLength": 20,
224 "sPaginationType": "full_numbers"
226 $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
227 $('#filter_system').click(function(e) {
229 if ($(this).hasClass('filtered')) {
230 var filteredValue = '';
231 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
232 } else { //Not filtered. Let's do it!
233 var filteredValue = '0';
234 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
236 table_credit_types.fnFilter(filteredValue, 1, false, false);
237 $(this).toggleClass('filtered');
241 $('#filter_system').click();
246 [% INCLUDE 'intranet-bottom.inc' %]