Bug 31743: Change condition for messaging tab
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / includes / account-table.inc
1 [% PROCESS 'accounts.inc' %]
2 <form method="post" action="opac-account-pay.pl" class="form-horizontal">
3     [% IF ( ACCOUNT_LINES ) %]
4         <table class="table table-bordered table-striped" id="finestable">
5             <caption class="sr-only">Your charges</caption>
6             <thead>
7                 <tr>
8                     [% IF ENABLE_OPAC_PAYMENTS %]<th>&nbsp;</th>[% END %]
9                     <th>Created</th>
10                     <th>Updated</th>
11                     <th>Type</th>
12                     <th>Description</th>
13                     <th>Amount</th>
14                     <th>Amount outstanding</th>
15                 </tr>
16             </thead>
17
18             <tbody>
19                 [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %]
20                     [% IF ACCOUNT_LINE.amountoutstanding > 0 || ACCOUNT_LINE.amountoutstanding < 0 %]<tr class="outstanding">[% ELSE %]<tr>[% END%]
21                         [% IF ENABLE_OPAC_PAYMENTS %]
22                             <td>
23                                 [% IF ACCOUNT_LINE.amountoutstanding > 0 %]
24                                     [% SET DISPLAY_PAYMENT_BLOCK = 1 %]
25                                     <input class="checkbox-pay pay-online hidden" name="accountline" type="checkbox" id="checkbox-pay-[% ACCOUNT_LINE.accountlines_id | html %]" value="[% ACCOUNT_LINE.accountlines_id | html %]">
26                                     <input type="hidden" id="amount-[% ACCOUNT_LINE.accountlines_id | html %]" value="[% ACCOUNT_LINE.amountoutstanding | html %]" />
27                                 [% END %]
28                             </td>
29                         [% END %]
30                         <td data-order="[% ACCOUNT_LINE.date | html %]">[% ACCOUNT_LINE.date | $KohaDates %]</td>
31                         <td data-order="[% ACCOUNT_LINE.timestamp | html %]">[% ACCOUNT_LINE.timestamp | $KohaDates with_hours = 1 %]</td>
32                         <td>
33                             [% PROCESS account_type_description account=ACCOUNT_LINE %]
34                         </td>
35                         <td>
36                             [%- IF ACCOUNT_LINE.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %]
37                             [%- IF ACCOUNT_LINE.description %][% ACCOUNT_LINE.description | html %][% END %]
38                             [% IF ACCOUNT_LINE.itemnumber %]([% ACCOUNT_LINE.item.biblio.title | html %])[% END %]
39                         </td>
40                         [% IF ( ACCOUNT_LINE.is_credit ) %]<td class="credit">[% ACCOUNT_LINE.amount * -1 | $Price %][% ELSE %]<td class="debit">[% ACCOUNT_LINE.amount | $Price %][% END %]</td>
41                         [% IF ( ACCOUNT_LINE.is_credit ) %]<td class="credit">[% ACCOUNT_LINE.amountoutstanding * -1 | $Price %][% ELSE %]<td class="debit">[% ACCOUNT_LINE.amountoutstanding | $Price %][% END %]</td>
42                     </tr>
43                 [% END %]
44             </tbody>
45
46             <tfoot>
47                 <tr>
48                     [%- IF ENABLE_OPAC_PAYMENTS -%]
49                         [%- SET COLSPAN = 6 -%]
50                     [%- ELSE -%]
51                         [%- SET COLSPAN = 5 -%]
52                     [%- END -%]
53                     <th class="sum" colspan="[% COLSPAN | html %]">Total due</th>
54                     <td class="sum">[% total | $Price %]</td>
55                 </tr>
56                 [% IF outstanding_credits.total_outstanding < 0 %]
57                 [% FOREACH outstanding_credit IN outstanding_credits %]
58                     [% IF outstanding_credit.amountoutstanding < 0 %]<tr class="outstanding">[% ELSE %]<tr>[% END%]
59                         [% IF ENABLE_OPAC_PAYMENTS %]<td></td>[% END %]
60                         <td><span title="[% outstanding_credit.date | html %]">[% outstanding_credit.date | $KohaDates %]</span></td>
61                         <td><span title="[% outstanding_credit.timestamp | html %]">[% outstanding_credit.date | $KohaDates with_hours = 1 %]</span></td>
62                         <td>
63                             [% PROCESS account_type_description account=outstanding_credit %]
64                         </td>
65                         <td>
66                             [%- IF outstanding_credit.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', outstanding_credit.payment_type, 1) | html %][% END %]
67                             [%- IF outstanding_credit.description %][% outstanding_credit.description | html %][% END %]
68                             [% IF outstanding_credit.itemnumber %]([% outstanding_credit.item.biblio.title | html %])[% END %]
69                         </td>
70                         <td class="credit">[% outstanding_credit.amount * -1 | $Price %]</td>
71                         <td class="credit">[% outstanding_credit.amountoutstanding * -1 | $Price %]</td>
72                     </tr>
73                 [% END %]
74                 <tr>
75                     <th class="sum" colspan="[% COLSPAN | html %]">Total due if credit(s) applied:</th>
76                     <td class="sum">[% total + outstanding_credits.total_outstanding | $Price %]</td>
77                 </tr>
78                 [% END %]
79             </tfoot>
80
81         </table>
82
83
84     [% ELSE %]
85         <h3>You have no fines or charges</h3>
86     [% END # /IF ( ACCOUNT_LINES )  %]
87
88     [% FOREACH r IN relatives %]
89         <h3 id="g[% r.patron.id | html %]">[% r.patron.firstname | html %] [% r.patron.surname | html %]'s fines and charges</h3>
90
91         <table class="table table-bordered table-striped" id="finestable-[% r.id | html %]">
92             <thead>
93                 <tr>
94                     [% IF ENABLE_OPAC_PAYMENTS %]<th>&nbsp;</th>[% END %]
95                     <th>Created</th>
96                     <th>Updated</th>
97                     <th>Description</th>
98                     <th>Fine amount</th>
99                     <th>Amount outstanding</th>
100                 </tr>
101             </thead>
102
103             <tbody>
104                 [% SET account_sum = 0 %]
105                 [% FOREACH a IN r.accountlines %]
106                     [% SET account_sum = account_sum + a.amountoutstanding %]
107                     <tr>
108                         [% IF ENABLE_OPAC_PAYMENTS %]
109                             <td>
110                                 [% IF a.amountoutstanding > 0 %]
111                                     [% SET DISPLAY_PAYMENT_BLOCK = 1 %]
112                                     <input class="checkbox-pay pay-online hidden" name="accountline" type="checkbox" id="checkbox-pay-[% a.accountlines_id | html %]" value="[% a.accountlines_id | html %]">
113                                     <input type="hidden" id="amount-[% a.accountlines_id | html %]" value="[% a.amountoutstanding | html %]" />
114                                 [% END %]
115                             </td>
116                         [% END %]
117                         <td data-order="[% a.date | html %]">[% a.date | $KohaDates %]</td>
118                         <td data-order="[% a.timestamp | html %]">[% a.timestamp | $KohaDates with_hours = 1 %]</td>
119                         <td>
120                             [% PROCESS account_type_description account=a %]
121                             [%- IF a.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', a.payment_type, 1) | html %][% END %]
122                             [%- IF a.description %], [% a.description | html %][% END %]
123                             [% IF a.itemnumber %]([% a.item.biblio.title | html %])[% END %]
124                         </td>
125                         [% IF ( a.amount < 0 ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% a.amount | $Price %]</td>
126                         [% IF ( a.amountoutstanding < 0 ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% a.amountoutstanding | $Price %]</td>
127                     </tr>
128                 [% END %]
129             </tbody>
130
131             <tfoot>
132                 <tr>
133                     <th class="sum" colspan="4">Total due</th>
134                     <td class="sum">[% account_sum | $Price %]</td>
135                 </tr>
136             </tfoot>
137         </table>
138     [% END # /FOREACH r %]
139
140     [% IF ENABLE_OPAC_PAYMENTS && DISPLAY_PAYMENT_BLOCK %]
141         <fieldset class="pay-online hidden">
142             <legend>Pay selected fines and charges</legend>
143             <span class="help-block"><h2>Payment method</h2></span>
144
145             [% FOREACH p IN plugins %]
146                 <div class="control-group">
147                     <label class="radio">
148                         <input type="radio" data-threshold="[% p.opac_online_payment_threshold | html %]" name="payment_method" id="payment_method-[% p.class | html %]" value="[% p.class | html %]" checked="checked" />
149                         [% p.get_metadata.name | html %]
150                     </label>
151                     <small class="help-block text-muted"></small>
152                 </div>
153             [% END %]
154
155             <div class="control-group">
156                 <input type="hidden" id="payment-amount" name="payment_amount" value="0" />
157                 <button id="submit-pay" type="submit" class="btn btn-primary" disabled="disabled">Make payment</button>
158                 <span id="amount-to-pay-label">
159                     Amount to pay: <span id="amount-to-pay">0.00</span>
160                 </span>
161             </div>
162         </fieldset>
163     [% END # /IF ENABLE_OPAC_PAYMENTS && DISPLAY_PAYMENT_BLOCK %]
164 </form>