Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / boraccount.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE KohaDates %]
6 [% USE ColumnsSettings %]
7 [% USE AuthorisedValues %]
8 [% USE Price %]
9 [% USE Branches %]
10 [% SET footerjs = 1 %]
11 [% INCLUDE 'doc-head-open.inc' %]
12 <title>Koha &rsaquo; Patrons &rsaquo; Account for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
13 [% INCLUDE 'doc-head-close.inc' %]
14 [% Asset.css("css/datatables.css") | $raw %]
15 </head>
16
17 <body id="pat_borraccount" class="pat">
18 [% INCLUDE 'header.inc' %]
19 [% INCLUDE 'patron-search.inc' %]
20
21 <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>
22
23 <div id="doc3" class="yui-t2">
24
25    <div id="bd">
26         <div id="yui-main">
27         <div class="yui-b">
28 [% INCLUDE 'members-toolbar.inc' %]
29 <form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
30
31 <!-- The manual invoice and credit buttons -->
32 <div class="statictabs">
33 <ul>
34     <li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | html %]">Account</a></li>
35     <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]" >Pay fines</a></li>
36     <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | html %]" >Create manual invoice</a></li>
37     <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | html %]" >Create manual credit</a></li>
38 </ul>
39 <div class="tabs-container">
40 <!-- The table with the account items -->
41 <table id="table_account_fines">
42     <thead>
43       <tr>
44           <th class="title-string">Date</th>
45           <th>Description of charges</th>
46           <th>Home library</th>
47           <th>Note</th>
48           <th>Amount</th>
49           <th>Outstanding</th>
50           [% IF ( reverse_col ) %]
51               <th>Actions</th>
52           [% ELSE %]
53               <th>&nbsp;</th>
54           [% END %]
55         </tr>
56     </thead>
57
58         <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
59   [% FOREACH account IN accounts %]
60
61    <tr>
62    <td><span title="[% account.date | html %]">[% account.date |$KohaDates %]</span></td>
63       <td>
64         [% INCLUDE 'accounttype.inc' accountline => account %]
65         [%- IF account.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
66         [%- IF account.description %], [% account.description | html %][% END %]
67         &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | html %]&amp;itemnumber=[% account.itemnumber | html %]">[% account.item.biblio.title | html %]</a>[% END %]</td>
68       <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
69       <td>[% account.note | html_line_break %]</td>
70       [% IF ( account.amountcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price | html %]</td>
71       [% IF ( account.amountoutstandingcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price | html %]</td>
72       <td class="actions">
73         [% IF ( account.payment ) %]
74           <a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id | html %]&amp;borrowernumber=[% account.borrowernumber | html %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
75         [% ELSE %]
76           <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id | html %]&amp;borrowernumber=[% account.borrowernumber | html %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
77         [% END %]
78         <a href="accountline-details.pl?accountlines_id=[% account.accountlines_id | html %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>
79         [% IF ( reverse_col) %]
80           [% IF ( account.payment || account.amount < 0 ) %]
81                 [% IF account.payment %]
82                     <a href="boraccount.pl?action=reverse&amp;accountlines_id=[% account.accountlines_id | html %]&amp;borrowernumber=[% account.borrowernumber | html %]" class="btn btn-default btn-xs"><i class="fa fa-undo"></i> Reverse</a>
83                 [% END %]
84                 [% IF account.amount < 0 %]
85                     <a href="boraccount.pl?action=void&amp;accountlines_id=[% account.accountlines_id | html %]&amp;borrowernumber=[% account.borrowernumber | html %]" class="btn btn-default btn-xs void"><i class="fa fa-ban"></i> Void</a>
86                 [% END %]
87           [% ELSE %]
88             &nbsp;
89           [% END %]
90         [% END %]
91       </td>
92     </tr>
93
94   [% END %]
95 <tfoot>
96   <tr>
97     <td colspan="5">Total due</td>
98     [% IF ( totalcredit ) %]
99         <td class="credit" style="text-align: right;">[% total | $Price | html %]</td>
100     [% ELSE %]
101        <td class="debit"style="text-align: right;">[% total | $Price | html %]</td>
102     [% END %]
103     <td></td>
104   </tr>
105   </tfoot>
106 </table>
107 </div></div>
108
109 </div>
110 </div>
111
112 <div class="yui-b">
113 [% INCLUDE 'circ-menu.inc' %]
114 </div>
115 </div>
116
117 [% MACRO jsinclude BLOCK %]
118     [% INCLUDE 'datatables.inc' %]
119     [% INCLUDE 'columns_settings.inc' %]
120     [% INCLUDE 'str/members-menu.inc' %]
121     [% Asset.js("js/members-menu.js") | $raw %]
122     <script type="text/javascript">
123         $(document).ready(function() {
124             var txtActivefilter = _("Filter paid transactions");
125             var txtInactivefilter = _("Show all transactions");
126             var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json').raw %];
127             var table_account_fines = KohaTable("table_account_fines", {
128                 "sPaginationType": "four_button",
129                 'aaSorting': [[0, 'desc']],
130                 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
131                 "aoColumnDefs": [
132                     { "sType": "title-string", "aTargets" : [ "title-string" ] },
133                     { "bSortable": false, "bSearchable": false, "aTargets": [-1] }
134                 ]
135             }, columns_settings);
136             $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
137             $('#filter_transacs').click(function(e) {
138                 e.preventDefault();
139                 if ($(this).hasClass('filtered')) {
140                     var filteredValue = '';
141                     $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
142                 } else { //Not filtered. Let's do it!
143                     var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
144                     $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
145                 }
146                 table_account_fines.fnFilter(filteredValue, 4, true, false);
147                 $(this).toggleClass('filtered');
148             });
149
150             $(".void").on("click",function(e){
151                 if( confirm( _("Are you sure you want to void this credit?") ) ) {
152                     return true;
153                 } else {
154                     e.preventDefault();
155                 }
156             });
157         });
158     </script>
159 [% END %]
160
161 [% INCLUDE 'intranet-bottom.inc' %]