5 [% INCLUDE 'doc-head-open.inc' %]
7 [% IF op =='add_form' %]
9 [% IF credit_type.code %]
16 [% END %] › Administration › Koha
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="admin_credit_types" class="admin">
22 [% WRAPPER 'header.inc' %]
23 [% INCLUDE 'prefs-admin-search.inc' %]
26 [% WRAPPER 'sub-header.inc' %]
27 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
30 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
33 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
36 [% IF op == 'add_form' %]
38 <a href="/cgi-bin/koha/admin/credit_types.pl">Credit types</a>
41 <a href="#" aria-current="page">
42 [% IF credit_type.code %]
52 <a href="#" aria-current="page">
61 <div class="main container-fluid">
63 <div class="col-sm-10 col-sm-push-2">
66 [% FOREACH m IN messages %]
67 <div class="dialog [% m.type | html %]">
69 [% CASE 'success_on_saving' %]
70 <span>Credit type saved successfully</span>
71 [% CASE 'error_on_saving' %]
72 <span>An error occurred when saving this credit type</span>
73 [% CASE 'success_on_archive' %]
74 <span>Credit type archived successfully</span>
75 [% CASE 'success_on_restore' %]
76 <span>Credit type restored successfully</span>
78 <span>[% m.code | html %]</span>
83 [% IF op == 'add_form' %]
85 <h1>Modify a credit type</h1>
87 <h1>New credit type</h1>
90 <form action="/cgi-bin/koha/admin/credit_types.pl" name="Aform" method="post" class="validated">
91 <input type="hidden" name="op" value="add_validate" />
92 <fieldset class="rows">
95 <label for="code" class="required">Credit type code: </label>
97 <strong>[% credit_type.code | html %]</strong>
98 <input type="hidden" name="code" value="[% code | html %]" />
100 <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>
104 <label for="description" class="required">Description: </label>
105 [% IF credit_type && credit_type.is_system %]
106 <span>[% credit_type.description | html %]</span>
108 <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>
112 <label for="can_be_added_manually">Can be manually added ? </label>
113 [% IF credit_type && credit_type.is_system %]
114 [% IF credit_type.can_be_added_manually %]<span>Yes</span>[% ELSE %]<span>No</span>[% END %]
115 [% ELSIF credit_type.can_be_added_manually %]
116 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
118 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
122 <label for="credit_number_enabled">Enable credit number</label>
123 [% IF credit_type.credit_number_enabled %]
124 <input type="checkbox" name="credit_number_enabled" id="credit_number_enabled" checked="checked" value="1" />
126 <input type="checkbox" name="credit_number_enabled" id="credit_number_enabled" value="1" />
128 <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>
131 <label for="branches">Libraries limitation: </label>
132 [% IF credit_type && credit_type.is_system %]
133 <span>No library limitation</span>
135 <select id="branches" name="branches" multiple size="10">
136 <option value="">All libraries</option>
137 [% FOREACH branch IN branches_loop %]
138 [% IF ( branch.selected ) %]
139 <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
141 <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
145 <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>
151 <fieldset class="action">
152 <button id="save_credit_type" class="btn btn-primary">Save</button>
153 <a class="cancel" href="/cgi-bin/koha/admin/credit_types.pl">Cancel</a>
158 [% IF op == 'list' %]
159 <div id="toolbar" class="btn-toolbar">
160 <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>
163 <h1>Account credit types</h1>
164 [% IF credit_types.count %]
165 <table id="table_credit_types">
171 <th>Available for</th>
172 <th>Credit number enabled</th>
173 <th>Library limitations</th>
174 <th class="noExport">Actions</th>
177 [% FOREACH credit_type IN credit_types %]
179 <td>[% credit_type.archived | html %]</td>
180 <td>[% credit_type.is_system | html %]</td>
181 <td>[% credit_type.code | html %]</td>
182 <td>[% credit_type.description | html %]</td>
183 <td>[% IF credit_type.can_be_added_manually %]Manual credit[% END %]</td>
184 <td>[% IF credit_type.credit_number_enabled %]Yes[% ELSE %]No[% END %]</td>
186 [% IF credit_type.library_limits.count > 0 %]
187 [% library_limits_str = "" %]
188 [% FOREACH library IN credit_type.library_limits %]
189 [%- IF loop.first -%]
190 [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
192 [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
195 <span class="library_limitation" title="[% library_limits_str | html %]">
196 [% limits_count = credit_type.library_limits.count %]
197 [% tnx('{count} library limitation', '{count} library limitations', limits_count, { count => limits_count }) %]
199 <span>No library limitation</span>
203 [% IF !credit_type.archived %]
204 <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>
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=archive&code=[% credit_type.code | uri %]"><i class="fa fa-archive"></i> Archive</a>
210 [% IF !credit_type.is_system && credit_type.archived %]
211 <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>
219 <div class="dialog message">
220 There are no account credit types defined.
221 <a href="/cgi-bin/koha/admin/credit_types.pl?op=add_form">Create new credit type</a>
226 </div> <!-- /.col-sm-10.col-sm-push-2 -->
228 <div class="col-sm-2 col-sm-pull-10">
230 [% INCLUDE 'admin-menu.inc' %]
232 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
233 </div> <!-- /.row -->
235 [% MACRO jsinclude BLOCK %]
236 [% Asset.js("js/admin-menu.js") | $raw %]
237 [% INCLUDE 'datatables.inc' %]
240 $(document).ready(function() {
241 var txtActivefilter = _("Filter system credit types");
242 var txtInactivefilter = _("Show all credit types");
243 var table_credit_types = $("#table_credit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
245 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
246 { "aTargets": [ 0, 1 ], "bSortable": false, "bVisible": false },
248 "aaSorting": [[ 0, "asc" ],[ 2, "asc" ]],
249 "sDom": 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
250 "iDisplayLength": 20,
251 "sPaginationType": "full_numbers"
253 $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
254 $('#filter_system').click(function(e) {
256 if ($(this).hasClass('filtered')) {
257 var filteredValue = '';
258 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
259 } else { //Not filtered. Let's do it!
260 var filteredValue = '0';
261 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
263 table_credit_types.fnFilter(filteredValue, 1, false, false);
264 $(this).toggleClass('filtered');
268 $('#filter_system').click();
273 [% INCLUDE 'intranet-bottom.inc' %]