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 <div class="page-section">
166 <table id="table_credit_types">
172 <th>Available for</th>
173 <th>Credit number enabled</th>
174 <th>Library limitations</th>
175 <th class="noExport">Actions</th>
178 [% FOREACH credit_type IN credit_types %]
180 <td>[% credit_type.archived | html %]</td>
181 <td>[% credit_type.is_system | html %]</td>
182 <td>[% credit_type.code | html %]</td>
183 <td>[% credit_type.description | html %]</td>
184 <td>[% IF credit_type.can_be_added_manually %]Manual credit[% END %]</td>
185 <td>[% IF credit_type.credit_number_enabled %]Yes[% ELSE %]No[% END %]</td>
187 [% IF credit_type.library_limits.count > 0 %]
188 [% library_limits_str = "" %]
189 [% FOREACH library IN credit_type.library_limits %]
190 [%- IF loop.first -%]
191 [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
193 [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
196 <span class="library_limitation" title="[% library_limits_str | html %]">
197 [% limits_count = credit_type.library_limits.count %]
198 [% tnx('{count} library limitation', '{count} library limitations', limits_count, { count => limits_count }) %]
200 <span>No library limitation</span>
204 [% IF !credit_type.archived %]
205 <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>
207 [% IF !credit_type.is_system && !credit_type.archived %]
208 <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>
211 [% IF !credit_type.is_system && credit_type.archived %]
212 <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><!-- /.page-section -->
221 <div class="dialog message">
222 There are no account credit types defined.
223 <a href="/cgi-bin/koha/admin/credit_types.pl?op=add_form">Create new credit type</a>
228 </div> <!-- /.col-sm-10.col-sm-push-2 -->
230 <div class="col-sm-2 col-sm-pull-10">
232 [% INCLUDE 'admin-menu.inc' %]
234 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
235 </div> <!-- /.row -->
237 [% MACRO jsinclude BLOCK %]
238 [% Asset.js("js/admin-menu.js") | $raw %]
239 [% INCLUDE 'datatables.inc' %]
242 $(document).ready(function() {
243 var txtActivefilter = _("Filter system credit types");
244 var txtInactivefilter = _("Show all credit types");
245 var table_credit_types = $("#table_credit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
247 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
248 { "aTargets": [ 0, 1 ], "bSortable": false, "bVisible": false },
250 "aaSorting": [[ 0, "asc" ],[ 2, "asc" ]],
251 "sDom": 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
252 "iDisplayLength": 20,
253 "sPaginationType": "full_numbers"
255 $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
256 $('#filter_system').click(function(e) {
258 if ($(this).hasClass('filtered')) {
259 var filteredValue = '';
260 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
261 } else { //Not filtered. Let's do it!
262 var filteredValue = '0';
263 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
265 table_credit_types.fnFilter(filteredValue, 1, false, false);
266 $(this).toggleClass('filtered');
270 $('#filter_system').click();
275 [% INCLUDE 'intranet-bottom.inc' %]