Koha/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
Owen Leonard 84de1f143b Bug 12258 [Template follow-up] Datatable in Patrons Account Fines
This follow-up corrects some of the QA issues affecting the other patch,
as well as changing the way the "filter" option is displayed:

- Added the use of the DataTables include file
- Removed redundant document.ready
- Fixed single quotes
- Fixed default sort (should be date descending to match the current
  functionality)
- Adding missing <tr>
- Converted filter button to a link

The last change is a judgement call, but the button in the DataTables
toolbar looked awkward and caused ugly wrapping at narrower viewport
sizes. I think a link is more keeping with the pattern established by
"select all / clear all" links.

To test, apply both patches and view the account page
(members/boraccount.pl) for a patron who has paid and unpaid fines (the
more the better).

- Confirm that the default sort is by date descending.
- Confirm that DataTables controls (paging, search, result count) work
  correctly.
- Confirm that clicking the "Filter paid transactions" link works
  correctly to toggle display of paid transactions.

Works as expected. Passed koha-qa.pl.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Works as described, no problems found.
Passes QA script and tests.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 15:20:49 -03:00

150 lines
5.7 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Patrons &rsaquo; Account for [% INCLUDE 'patron-title.inc' %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
$(document).ready(function() {
var txtActivefilter = _("Filter paid transactions");
var txtInactivefilter = _("Show all transactions");
var table_account_fines = $("#table_account_fines").dataTable($.extend(true, {}, dataTablesDefaults, {
"sPaginationType": "four_button",
'aaSorting': [[0, 'desc']],
"sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>'
}));
$("#filter_c").html('<p><a href="#" id="filter_transacs">'+txtActivefilter+'</a>');
$('#filter_transacs').click(function(e) {
e.preventDefault();
if ($(this).hasClass('filtered')) {
var filteredValue = '';
$(this).text(txtActivefilter);
} else { //Not filtered. Let's do it!
var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
$(this).text(txtInactivefilter);
}
table_account_fines.fnFilter(filteredValue, 4, true, false);
$(this).toggleClass('filtered');
});
});
</script>
</head>
<body id="pat_borraccount" class="pat">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'patron-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> &rsaquo; Account for [% INCLUDE 'patron-title.inc' %]</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% INCLUDE 'members-toolbar.inc' %]
<form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" /></form>
<!-- The manual invoice and credit buttons -->
<div class="statictabs">
<ul>
<li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]">Account</a></li>
<li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a></li>
<li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a></li>
<li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a></li>
</ul>
<div class="tabs-container">
<!-- The table with the account items -->
<table id="table_account_fines">
<thead>
<tr>
<th>Date</th>
<th>Description of charges</th>
<th>Note</th>
<th>Amount</th>
<th>Outstanding</th>
[% IF ( reverse_col ) %]
<th>&nbsp;</th>
[% END %]
<th>Print</th>
</tr>
</thead>
<!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
[% FOREACH account IN accounts %]
[% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
<td>[% account.date %]</td>
<td>
[% SWITCH account.accounttype %]
[% CASE 'Pay' %]Payment, thanks
[% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
[% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
[% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
[% CASE 'N' %]New card
[% CASE 'F' %]Fine
[% CASE 'A' %]Account management fee
[% CASE 'M' %]Sundry
[% CASE 'L' %]Lost item
[% CASE 'W' %]Writeoff
[% CASE 'FU' %]Accruing fine
[% CASE 'Rent' %]Rental fee
[% CASE 'FOR' %]Forgiven
[% CASE 'LR' %]Lost item fee refund
[% CASE 'PAY' %]Payment
[% CASE 'WO' %]Writeoff
[% CASE 'C' %]Credit
[% CASE 'CR' %]Credit
[% CASE %][% account.accounttype %]
[%- END -%]
[%- IF account.description %], [% account.description %][% END %]
&nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">View item</a>&nbsp;[% END %][% account.title |html %]</td>
<td>[% account.note | html_line_break %]</td>
[% IF ( account.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amount %]</td>
[% IF ( account.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amountoutstanding %]</td>
[% IF ( reverse_col ) %]
<td>
[% IF ( account.payment ) %]
<a href="boraccount.pl?action=reverse&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]">Reverse</a>
[% ELSE %]
&nbsp;
[% END %]
</td>
[% END %]
<td>
[% IF ( account.payment ) %]
<a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]">Print</a>
[% ELSE %]
<a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]">Print</a>
[% END %]
</td>
</tr>
[% END %]
<tfoot>
<tr>
<td colspan="4">Total due</td>
[% IF ( totalcredit ) %]
[% IF ( reverse_col ) %]
<td colspan="3" class="credit">
[% ELSE %]
<td colspan="2" class="credit">
[% END %]
[% ELSE %]
[% IF ( reverse_col ) %]
<td colspan="3" class="debit">
[% ELSE %]
<td colspan="2" class="credit">
[% END %]
[% END %]
[% total %]</td>
</tr>
</tfoot>
</table>
</div></div>
</div>
</div>
<div class="yui-b">
[% INCLUDE 'circ-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]