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