4 [% PROCESS 'i18n.inc' %]
6 [% PROCESS 'accounts.inc' %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% FILTER collapse %]
9 [% IF op =='add_form' %]
10 [% IF credit_type.code %]
11 [% t("Modify credit type") | html %] ›
13 [% t("New credit type") | html %] ›
15 [% t("Credit types") | html %]
17 [% t("Credit types") | html %]
19 [% t("Administration") | html %] ›
20 [% t("Koha") | html %]
22 [% INCLUDE 'doc-head-close.inc' %]
25 <body id="admin_credit_types" class="admin">
26 [% WRAPPER 'header.inc' %]
27 [% INCLUDE 'prefs-admin-search.inc' %]
30 [% WRAPPER 'sub-header.inc' %]
31 [% WRAPPER breadcrumbs %]
32 [% WRAPPER breadcrumb_item %]
33 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
36 [% IF op == 'add_form' %]
37 [% WRAPPER breadcrumb_item %]
38 <a href="/cgi-bin/koha/admin/credit_types.pl">Credit types</a>
40 [% WRAPPER breadcrumb_item bc_active= 1 %]
41 [% IF credit_type.code %]
42 <span>Modify credit type</span>
44 <span>New credit type</span>
49 [% WRAPPER breadcrumb_item bc_active= 1 %]
50 <span>Credit types</span>
53 [% END #/ WRAPPER breadcrumbs %]
54 [% END #/ WRAPPER sub-header.inc %]
56 <div class="main container-fluid">
58 <div class="col-sm-10 col-sm-push-2">
61 [% FOREACH m IN messages %]
62 <div class="dialog [% m.type | html %]">
64 [% CASE 'success_on_saving' %]
65 <span>Credit type saved successfully</span>
66 [% CASE 'error_on_saving' %]
67 <span>An error occurred when saving this credit type</span>
68 [% CASE 'success_on_archive' %]
69 <span>Credit type archived successfully</span>
70 [% CASE 'success_on_restore' %]
71 <span>Credit type restored successfully</span>
73 <span>[% m.code | html %]</span>
78 [% IF op == 'add_form' %]
80 <h1>Modify a credit type</h1>
82 <h1>New credit type</h1>
85 <form action="/cgi-bin/koha/admin/credit_types.pl" name="Aform" method="post" class="validated">
86 <input type="hidden" name="op" value="add_validate" />
87 <fieldset class="rows">
90 <label for="code" class="required">Credit type code: </label>
92 <strong>[% credit_type.code | html %]</strong>
93 <input type="hidden" name="code" value="[% code | html %]" />
95 <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>
99 <label for="description" class="required">Description: </label>
100 [% IF credit_type && credit_type.is_system %]
101 <span>[%- PROCESS credit_type_description credit_type = credit_type -%]</span>
103 <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>
107 <label for="can_be_added_manually">Can be manually added ? </label>
108 [% IF credit_type && credit_type.is_system %]
109 [% IF credit_type.can_be_added_manually %]<span>Yes</span>[% ELSE %]<span>No</span>[% END %]
110 [% ELSIF credit_type.can_be_added_manually %]
111 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
113 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
117 <label for="credit_number_enabled">Enable credit number</label>
118 [% IF credit_type.credit_number_enabled %]
119 <input type="checkbox" name="credit_number_enabled" id="credit_number_enabled" checked="checked" value="1" />
121 <input type="checkbox" name="credit_number_enabled" id="credit_number_enabled" value="1" />
123 <span class="hint">Enable automatic generation of credit number (see <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AutoCreditNumber">AutoCreditNumber</a>)</span>
126 <label for="branches">Libraries limitation: </label>
127 [% IF credit_type && credit_type.is_system %]
128 <span>No library limitation</span>
130 <select id="branches" name="branches" multiple size="10">
131 <option value="">All libraries</option>
132 [% FOREACH branch IN branches_loop %]
133 [% IF ( branch.selected ) %]
134 <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
136 <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
140 <div class="hint">Select 'All libraries' if this credit type should be available at all libraries. Otherwise select libraries you want to associate credit type with.</div>
146 <fieldset class="action">
147 <button id="save_credit_type" class="btn btn-primary">Save</button>
148 <a class="cancel" href="/cgi-bin/koha/admin/credit_types.pl">Cancel</a>
153 [% IF op == 'list' %]
154 <div id="toolbar" class="btn-toolbar">
155 <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>
158 <h1>Account credit types</h1>
159 [% IF credit_types.count %]
160 <div class="page-section">
161 <table id="table_credit_types">
167 <th>Available for</th>
168 <th>Credit number enabled</th>
169 <th>Library limitations</th>
170 <th class="noExport">Actions</th>
173 [% FOREACH credit_type IN credit_types %]
175 <td>[% credit_type.archived | html %]</td>
176 <td>[% credit_type.is_system | html %]</td>
177 <td>[% credit_type.code | html %]</td>
178 <td>[%- PROCESS credit_type_description credit_type = credit_type -%]</td>
179 <td>[% IF credit_type.can_be_added_manually %]Manual credit[% END %]</td>
180 <td>[% IF credit_type.credit_number_enabled %]Yes[% ELSE %]No[% END %]</td>
182 [% IF credit_type.library_limits.count > 0 %]
183 [% library_limits_str = "" %]
184 [% FOREACH library IN credit_type.library_limits %]
185 [%- IF loop.first -%]
186 [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
188 [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
191 <span class="library_limitation" title="[% library_limits_str | html %]">
192 [% limits_count = credit_type.library_limits.count %]
193 [% tnx('{count} library limitation', '{count} library limitations', limits_count, { count => limits_count }) %]
195 <span>No library limitation</span>
199 [% IF !credit_type.archived %]
200 <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-solid fa-pencil" aria-hidden="true"></i> Edit</a>
202 [% IF !credit_type.is_system && !credit_type.archived %]
203 <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>
206 [% IF !credit_type.is_system && credit_type.archived %]
207 <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>
214 </div><!-- /.page-section -->
216 <div class="dialog message">
217 There are no account credit types defined.
218 <a href="/cgi-bin/koha/admin/credit_types.pl?op=add_form">Create new credit type</a>
223 </div> <!-- /.col-sm-10.col-sm-push-2 -->
225 <div class="col-sm-2 col-sm-pull-10">
227 [% INCLUDE 'admin-menu.inc' %]
229 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
230 </div> <!-- /.row -->
232 [% MACRO jsinclude BLOCK %]
233 [% Asset.js("js/admin-menu.js") | $raw %]
234 [% INCLUDE 'datatables.inc' %]
237 $(document).ready(function() {
238 var txtActivefilter = _("Filter system credit types");
239 var txtInactivefilter = _("Show all credit types");
240 var table_credit_types = $("#table_credit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
242 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
243 { "aTargets": [ 0, 1 ], "bSortable": false, "bVisible": false },
245 "aaSorting": [[ 0, "asc" ],[ 2, "asc" ]],
246 "sDom": 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
247 "iDisplayLength": 20,
248 "sPaginationType": "full_numbers"
250 $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
251 $('#filter_system').click(function(e) {
253 if ($(this).hasClass('filtered')) {
254 var filteredValue = '';
255 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
256 } else { //Not filtered. Let's do it!
257 var filteredValue = '0';
258 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
260 table_credit_types.fnFilter(filteredValue, 1, false, false);
261 $(this).toggleClass('filtered');
265 $('#filter_system').click();
270 [% INCLUDE 'intranet-bottom.inc' %]