6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha › Administration ›
8 [% IF op =='add_form' %]
9 [% t('Credit types') %] ›
10 [% IF credit_type.code %]
11 [% t('Modify credit type') %]
13 [% t('New credit type') %]
16 [% t('Credit types') %]
19 [% INCLUDE 'doc-head-close.inc' %]
22 <body id="admin_credit_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">[% t('Home') %]</a>
28 › <a href="/cgi-bin/koha/admin/admin-home.pl">[% t('Administration') %]</a>
29 › <a href="/cgi-bin/koha/admin/credit_types.pl">[% t('Credit types') %]</a>
30 [% IF op == 'add_form' %]
31 › [% IF credit_type.code %][% t('Modify credit type') %][% ELSE %][% t('New credit type') %][% END %]
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 [% t('Credit type saved successfully.') %]
45 [% CASE 'error_on_saving' %]
46 [% t('An error occurred when saving this credit type.') %]
47 [% CASE 'success_on_archive' %]
48 [% t('Credit type archived successfully.') %]
49 [% CASE 'success_on_restore' %]
50 [% t('Credit type restored successfully.') %]
57 [% IF op == 'add_form' %]
59 <h3>[% t('Modify a credit type') %]</h3>
61 <h3>[% t('New credit type') %]</h3>
64 <form action="/cgi-bin/koha/admin/credit_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">[% t('Credit type code:') %] </label>
71 <strong>[% credit_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">[% t('Required. Maximum length is 64 letters') %]</span>
78 <label for="description" class="required">[% t('Description:') %] </label>
79 <input type="text" name="description" id="description" required="required" class="required" size="80" maxlength="100" value="[% credit_type.description | html %]" /> <span class="required">[% t('Required') %]</span>
82 <label for="can_be_added_manually">[% t('Can be manually added ?') %] </label>
83 [% IF credit_type.can_be_added_manually %]
84 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
86 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
90 <label for="branches">[% t('Libraries limitation:') %] </label>
91 <select id="branches" name="branches" multiple size="10">
92 <option value="">[% t('All libraries') %]</option>
93 [% FOREACH branch IN branches_loop %]
94 [% IF ( branch.selected ) %]
95 <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
97 <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
101 <span>[% t("Select 'All libraries' if this credit type should be available at all libraries. Otherwise select libraries you want to associate credit type with.") %]</span>
106 <fieldset class="action">
107 <button id="save_credit_type" class="btn btn-default"><i class="fa fa-save"></i> [% t('Save') %]</button>
108 <a class="cancel btn-link" href="/cgi-bin/koha/admin/credit_types.pl"><i class="fa fa-times"></i> [% t('Cancel') %]</a>
113 [% IF op == 'list' %]
114 <div id="toolbar" class="btn-toolbar">
115 <a class="btn btn-default" id="newcredittype" href="/cgi-bin/koha/admin/credit_types.pl?op=add_form"><i class="fa fa-plus"></i> [% t('New credit type') %]</a>
118 <h3>[% t('Account credit types') %]</h3>
119 [% IF credit_types.count %]
120 <table id="table_credit_types">
122 <th>[% t('Archived') %]</th>
123 <th>[% t('System') %]</th>
124 <th>[% t('Code') %]</th>
125 <th>[% t('Description') %]</th>
126 <th>[% t('Available for') %]</th>
127 <th>[% t('Library limitations') %]</th>
128 <th>[% t('Actions') %]</th>
131 [% FOREACH credit_type IN credit_types %]
133 <td>[% credit_type.archived | html %]</td>
134 <td>[% credit_type.is_system | html %]</td>
135 <td>[% credit_type.code | html %]</td>
136 <td>[% credit_type.description | html %]</td>
137 <td>[% IF credit_type.can_be_added_manually %][% t('Manual credit') %][% END %]</td>
139 [% IF credit_type.library_limits.count > 0 %]
140 [% library_limits_str = "" %]
141 [% FOREACH library IN credit_type.library_limits %]
142 [%- IF loop.first -%]
143 [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
145 [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
148 <span class="library_limitation" title="[% library_limits_str | html %]">
149 [% limits_count = credit_type.library_limits.count %]
150 [% tnx('{count} library limitation', '{count} library limitations', limits_count, { count => limits_count }) %]
152 [% t('No limitation') %]
156 [% IF !credit_type.is_system && !credit_type.archived %]
157 <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> [% t('Edit') %]</a>
158 <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> [% t('Archive') %]</a>
159 [% ELSIF credit_type.archived %]
160 <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> [% t('Restore') %]</a>
168 <div class="dialog message">
169 [% t('There are no account credit types defined.') %]
170 <a href="/cgi-bin/koha/admin/credit_types.pl?op=add_form">[% t('Create new credit type') %]</a>
175 </div> <!-- /.col-sm-10.col-sm-push-2 -->
177 <div class="col-sm-2 col-sm-pull-10">
179 [% INCLUDE 'admin-menu.inc' %]
181 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
182 </div> <!-- /.row -->
184 [% MACRO jsinclude BLOCK %]
185 [% Asset.js("js/admin-menu.js") | $raw %]
186 [% INCLUDE 'datatables.inc' %]
189 $(document).ready(function() {
190 var txtActivefilter = _("Filter system credit types");
191 var txtInactivefilter = _("Show all credit types");
192 var table_credit_types = $("#table_credit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
194 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
195 { "aTargets": [ 0, 1 ], "bSortable": false, "bVisible": false },
197 "aaSorting": [[ 0, "asc" ],[ 2, "asc" ]],
198 "sDom": 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
199 "iDisplayLength": 20,
200 "sPaginationType": "full_numbers"
202 $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
203 $('#filter_system').click(function(e) {
205 if ($(this).hasClass('filtered')) {
206 var filteredValue = '';
207 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
208 } else { //Not filtered. Let's do it!
209 var filteredValue = '0';
210 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
212 table_credit_types.fnFilter(filteredValue, 1, false, false);
213 $(this).toggleClass('filtered');
217 $('#filter_system').click();
222 [% INCLUDE 'intranet-bottom.inc' %]