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" required="required"><span class="required">Required. Maximum length is 64 letters</span>
77 <label for="description" class="required">Description: </label>
78 <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>
81 <label for="can_be_added_manually">Can be manually added ? </label>
82 [% IF credit_type.can_be_added_manually %]
83 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
85 <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
89 <label for="branches">Libraries limitation: </label>
90 <select id="branches" name="branches" multiple size="10">
91 <option value="">All libraries</option>
92 [% FOREACH branch IN branches_loop %]
93 [% IF ( branch.selected ) %]
94 <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
96 <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
100 <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>
105 <fieldset class="action">
106 <button id="save_credit_type" class="btn btn-default"><i class="fa fa-save"></i> Save</button>
107 <a class="cancel btn-link" href="/cgi-bin/koha/admin/credit_types.pl"><i class="fa fa-times"></i> Cancel</a>
112 [% IF op == 'list' %]
113 <div id="toolbar" class="btn-toolbar">
114 <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>
117 <h3>Account credit types</h3>
118 [% IF credit_types.count %]
119 <table id="table_credit_types">
125 <th>Available for</th>
126 <th>Library limitations</th>
130 [% FOREACH credit_type IN credit_types %]
132 <td>[% credit_type.archived | html %]</td>
133 <td>[% credit_type.is_system | html %]</td>
134 <td>[% credit_type.code | html %]</td>
135 <td>[% credit_type.description | html %]</td>
136 <td>[% IF credit_type.can_be_added_manually %]Manual credit[% END %]</td>
138 [% IF credit_type.library_limits.count > 0 %]
139 [% library_limits_str = "" %]
140 [% FOREACH library IN credit_type.library_limits %]
141 [%- IF loop.first -%]
142 [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
144 [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
147 <span class="library_limitation" title="[% library_limits_str | html %]">
148 [% limits_count = credit_type.library_limits.count %]
149 [% tnx('{count} library limitation', '{count} library limitations', limits_count, { count => limits_count }) %]
155 [% IF !credit_type.is_system && !credit_type.archived %]
156 <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>
157 <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>
158 [% ELSIF credit_type.archived %]
159 <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>
167 <div class="dialog message">
168 There are no account credit types defined.
169 <a href="/cgi-bin/koha/admin/credit_types.pl?op=add_form">Create new credit type</a>
174 </div> <!-- /.col-sm-10.col-sm-push-2 -->
176 <div class="col-sm-2 col-sm-pull-10">
178 [% INCLUDE 'admin-menu.inc' %]
180 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
181 </div> <!-- /.row -->
183 [% MACRO jsinclude BLOCK %]
184 [% Asset.js("js/admin-menu.js") | $raw %]
185 [% INCLUDE 'datatables.inc' %]
188 $(document).ready(function() {
189 var txtActivefilter = _("Filter system credit types");
190 var txtInactivefilter = _("Show all credit types");
191 var table_credit_types = $("#table_credit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
193 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
194 { "aTargets": [ 0, 1 ], "bSortable": false, "bVisible": false },
196 "aaSorting": [[ 0, "asc" ],[ 2, "asc" ]],
197 "sDom": 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
198 "iDisplayLength": 20,
199 "sPaginationType": "full_numbers"
201 $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
202 $('#filter_system').click(function(e) {
204 if ($(this).hasClass('filtered')) {
205 var filteredValue = '';
206 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
207 } else { //Not filtered. Let's do it!
208 var filteredValue = '0';
209 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
211 table_credit_types.fnFilter(filteredValue, 1, false, false);
212 $(this).toggleClass('filtered');
216 $('#filter_system').click();
221 [% INCLUDE 'intranet-bottom.inc' %]