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