Main Koha release repository https://koha-community.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

266 lines
14 KiB

[% USE raw %]
[% USE Asset %]
[% USE Branches %]
[% USE Price %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>
[% IF op =='add_form' %]
[% IF debit_type.code %]
Modify debit type
[% ELSE %]
New debit type
[% END %] &rsaquo; [% END %]
Debit types &rsaquo; Administration &rsaquo; Koha
</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="admin_debit_types" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'prefs-admin-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
</li>
[% IF op == 'add_form' %]
<li>
<a href="/cgi-bin/koha/admin/debit_types.pl">Debit types</a>
</li>
<li>
<a href="#" aria-current="page">
[% IF debit_type.code %]
Modify
[% ELSE %]
New
[% END %] debit type
</a>
</li>
[% ELSE %]
<li>
<a href="#" aria-current="page">
Debit types
</a>
</li>
[% END %]
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% FOREACH m IN messages %]
<div class="dialog [% m.type | html %]">
[% SWITCH m.code %]
[% CASE 'success_on_saving' %]
Debit type saved successfully.
[% CASE 'error_on_saving' %]
An error occurred when saving this debit type.
[% CASE 'success_on_archive' %]
Debit type archived successfully.
[% CASE 'success_on_restore' %]
Debit type restored successfully.
[% CASE %]
[% m.code | html %]
[% END %]
</div>
[% END %]
[% IF op == 'add_form' %]
[% IF debit_type %]
<h3>Modify a debit type</h3>
[% ELSE %]
<h3>New debit type</h3>
[% END %]
<form action="/cgi-bin/koha/admin/debit_types.pl" name="Aform" method="post" class="validated">
<input type="hidden" name="op" value="add_validate" />
<fieldset class="rows">
<ol>
<li>
<label for="code" class="required">Debit type code: </label>
[% IF debit_type %]
<strong>[% debit_type.code | html %]</strong>
<input type="hidden" name="code" value="[% code | html %]" />
[% ELSE %]
<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>
[% END %]
</li>
<li>
<label for="default_amount">Default amount: </label>
<input type="text" pattern="^\d+(\.\d{2})?$" name="default_amount" id="default_amount" size="80" maxlength="100" value="[% debit_type.default_amount | $Price on_editing => 1 %]" step="any" min="0"/>
</li>
<li>
<label for="description" class="required">Description: </label>
<input type="text" name="description" id="description" required="required" class="required" size="80" maxlength="100" value="[% debit_type.description | html %]" /> <span class="required">Required</span>
</li>
<li>
<label for="can_be_invoiced">Can be manually invoiced? </label>
[% IF debit_type.can_be_invoiced %]
<input type="checkbox" name="can_be_invoiced" id="can_be_invoiced" checked="checked" value="1" />
[% ELSE %]
<input type="checkbox" name="can_be_invoiced" id="can_be_invoiced" value="1" />
[% END %]
</li>
<li>
<label for="can_be_sold">Can be sold? </label>
[% IF debit_type.can_be_sold %]
<input type="checkbox" name="can_be_sold" id="can_be_sold" checked="checked" value="1" />
[% ELSE %]
<input type="checkbox" name="can_be_sold" id="can_be_sold" value="1" />
[% END %]
</li>
<li>
<label for="branches">Libraries limitation: </label>
<select id="branches" name="branches" multiple size="10">
<option value="">All libraries</option>
[% FOREACH branch IN branches_loop %]
[% IF ( branch.selected ) %]
<option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
[% ELSE %]
<option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
[% END %]
[% END %]
</select>
<span>Select 'All libraries' if this debit type should be available at all libraries. Otherwise select libraries you want to associate debit type with.</span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<button id="save_debit_type" class="btn btn-default">Save</button>
<a class="cancel" href="/cgi-bin/koha/admin/debit_types.pl">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF op == 'list' %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default" id="newdebittype" href="/cgi-bin/koha/admin/debit_types.pl?op=add_form"><i class="fa fa-plus"></i> New debit type</a>
</div>
<h3>Account debit types</h3>
[% IF debit_types.count %]
<table id="table_debit_types">
<thead>
<th>Archived</th>
<th>System</th>
<th>Code</th>
<th>Description</th>
<th>Default amount</th>
<th>Available for</th>
<th>Library limitations</th>
<th class="noExport">Actions</th>
</thead>
<tbody>
[% FOREACH debit_type IN debit_types %]
<tr>
<td>[% debit_type.archived | html %]</td>
<td>[% debit_type.is_system | html %]</td>
<td>[% debit_type.code | html %]</td>
<td>[% debit_type.description | html %]</td>
<td>[% debit_type.default_amount | $Price %]</td>
<td>[% IF debit_type.can_be_invoiced && debit_type.can_be_sold %]
<i class="fa fa-id-card-o"></i> Invoicing, <i class="fa fa-shopping-cart"></i> Sale
[% ELSIF debit_type.can_be_invoiced %]
<i class="fa fa-id-card-o"></i> Invoicing
[% ELSIF debit_type.can_be_sold %]
<i class="fa fa-shopping-cart"></i> Sale
[% END %]
</td>
<td>
[% IF debit_type.library_limits.count > 0 %]
[% library_limits_str = "" %]
[% FOREACH library IN debit_type.library_limits %]
[%- IF loop.first -%]
[% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %]
[% ELSE %]
[% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
[% END %]
[% END %]
<span class="library_limitation" title="[% library_limits_str | html %]">
[% IF debit_type.library_limits.count > 1 %]
[% debit_type.library_limits.count | html %] library limitations
[% ELSE %]
[% debit_type.library_limits.count | html %] library limitation
[% END %]
[% ELSE %]
No limitation
[% END %]
</td>
<td class="actions">
[% IF !debit_type.is_system && !debit_type.archived %]
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=add_form&amp;code=[% debit_type.code | uri %]&type=debit"><i class="fa fa-pencil"></i> Edit</a>
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=archive&amp;code=[% debit_type.code | uri %]"><i class="fa fa-archive"></i> Archive</a>
[% ELSIF debit_type.archived %]
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=unarchive&amp;code=[% debit_type.code | uri %]"><i class="fa fa-undo"></i> Restore</a>
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<div class="dialog message">
There are no account debit types defined. <a href="/cgi-bin/koha/admin/debit_types.pl?op=add_form">Create new debit type</a>
</div>
[% END %]
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'admin-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function() {
var txtActivefilter = _("Filter system debit types");
var txtInactivefilter = _("Show all debit types");
var table_debit_types = $("#table_debit_types").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
{ "aTargets": [ 0, 1 ], "bSortable": false, "bVisible": false },
],
"aaSorting": [[ 0, "asc" ],[ 2, "asc" ]],
"sDom": 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>',
"iDisplayLength": 20,
"sPaginationType": "full_numbers"
}));
$("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
$('#filter_system').click(function(e) {
e.preventDefault();
if ($(this).hasClass('filtered')) {
var filteredValue = '';
$(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
} else { //Not filtered. Let's do it!
var filteredValue = '0';
$(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
}
table_debit_types.fnFilter(filteredValue, 1, false, false);
$(this).toggleClass('filtered');
});
//Start filtered
$('#filter_system').click();
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]