Bug 20226: Centralize update child code (CATCODE_MULTI)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / pay.tt
1 [% USE Asset %]
2 [% USE Koha %]
3 [% USE AuthorisedValues %]
4 [% USE Branches %]
5 [% USE Price %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% patron.firstname |html %] [% patron.surname |html %]</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="pat_pay" class="pat">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'patron-search.inc' %]
15
16 <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; Pay fines for [% patron.firstname |html %] [% patron.surname |html %]</div>
17
18 <div id="doc3" class="yui-t2">
19    
20    <div id="bd">
21         <div id="yui-main">
22         <div class="yui-b">
23 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
24
25 <!-- The manual invoice and credit buttons -->
26 <div class="statictabs">
27 <ul>
28     <li><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Account</a></li>
29     <li class="active"><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]" >Pay fines</a></li>
30     <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual invoice</a></li>
31     <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual credit</a></li>
32 </ul>
33 <div class="tabs-container">
34
35 [% IF ( accounts ) %]
36     <form action="/cgi-bin/koha/members/pay.pl" method="post" id="pay-fines-form">
37     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" />
38 <p><span class="checkall"><a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a></span> | <span class="clearall"><a id="CheckNone" href="#"><i class="fa fa-remove"></i> Clear all</a></span></p>
39 <table id="finest">
40 <thead>
41 <tr>
42     <th>&nbsp;</th>
43     <th>Fines &amp; charges</th>
44     <th>Description</th>
45     <th>Payment note</th>
46     <th>Account type</th>
47     <th>Amount</th>
48     <th>Amount outstanding</th>
49 </tr>
50 </thead>
51 <tfoot>
52 <tr>
53     <td class="total" colspan="6">Total due:</td>
54     <td style="text-align: right;">[% total | $Price %]</td>
55 </tr>
56 </tfoot>
57 <tbody>
58 [% FOREACH line IN accounts %]
59 <tr>
60     <td>
61     [% IF ( line.amountoutstanding > 0 ) %]
62         <input class="cb" type="checkbox" checked="checked" name="incl_par_[% line.accountlines_id %]" />
63     [% END %]
64     </td>
65     <td>
66     [% IF ( line.amountoutstanding > 0 ) %]
67         <input type="submit" name="pay_indiv_[% line.accountlines_id %]" value="Pay" />
68         [% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="wo_indiv_[% line.accountlines_id %]" value="Write off" />[% END %]
69     [% END %]
70     <input type="hidden" name="itemnumber[% line.accountlines_id %]" value="[% line.itemnumber %]" />
71     <input type="hidden" name="description[% line.accountlines_id %]" value="[% line.description %]" />
72     <input type="hidden" name="accounttype[% line.accountlines_id %]" value="[% line.accounttype %]" />
73     <input type="hidden" name="amount[% line.accountlines_id %]" value="[% line.amount %]" />
74     <input type="hidden" name="accountlines_id[% line.accountlines_id %]" value="[% line.accountlines_id %]" />
75     <input type="hidden" name="amountoutstanding[% line.accountlines_id %]" value="[% line.amountoutstanding %]" />
76     <input type="hidden" name="borrowernumber[% line.accountlines_id %]" value="[% line.borrowernumber %]" />
77     </td>
78     <td>
79         [% SWITCH line.accounttype %]
80           [% CASE 'Pay' %]Payment, thanks
81           [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
82           [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
83           [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
84           [% CASE 'N' %]New card
85           [% CASE 'F' %]Fine
86           [% CASE 'A' %]Account management fee
87           [% CASE 'M' %]Sundry
88           [% CASE 'L' %]Lost item
89           [% CASE 'W' %]Writeoff
90           [% CASE 'FU' %]Accruing fine
91           [% CASE 'HE' %]Hold waiting too long
92           [% CASE 'Rent' %]Rental fee
93           [% CASE 'FOR' %]Forgiven
94           [% CASE 'LR' %]Lost item fee refund
95           [% CASE 'PF' %]Processing fee
96           [% CASE 'PAY' %]Payment
97           [% CASE 'WO' %]Writeoff
98           [% CASE 'C' %]Credit
99           [% CASE 'CR' %]Credit
100           [% CASE %][% line.accounttype %]
101         [%- END -%]
102         [%- IF line.description %], [% line.description %][% END %]
103         [% IF line.title %]([% line.title %])[% END %]
104     </td>
105     <td><input type="text" name="payment_note_[% line.accountlines_id %]" /></td>
106     <td>[% line.accounttype %]</td>
107     <td class="debit" style="text-align: right;">[% line.amount | $Price %]</td>
108     <td class="debit" style="text-align: right;">[% line.amountoutstanding | $Price %]</td>
109 </tr>
110 [% END %]
111 [% IF ( account_grp.total ) %]
112 <tr>
113
114     <td class="total" colspan="8" style="text-align: right;">Sub total:</td>
115     <td style="text-align: right;">[% account_grp.total | $Price %]</td>
116 </tr>
117 [% END %]
118 </tbody>
119 </table>
120 <fieldset class="action">
121 <input type="submit" id="paycollect" name="paycollect"  value="Pay amount" class="submit" />
122 [% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="woall"  id="woall" value="Write off all" class="submit" />[% END %]
123 <input type="submit" id="payselected" name="payselected"  value="Pay selected" class="submit" />
124 <input type="submit" id="writeoff-selected" name="writeoff_selected"  value="Write off selected" class="submit" />
125 <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a>
126 </fieldset>
127 </form>
128 [% ELSE %]
129     <p>[% patron.firstname |html %] [% patron.surname |html %] has no outstanding fines.</p>
130 [% END %]
131 </div></div>
132
133 </div>
134 </div>
135 <div class="yui-b">
136 [% INCLUDE 'circ-menu.inc' %]
137 </div>
138 </div>
139
140 [% MACRO jsinclude BLOCK %]
141     [% INCLUDE 'str/members-menu.inc' %]
142     [% Asset.js("js/members-menu.js") %]
143     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
144     <script type= "text/javascript">
145         function enableCheckboxActions(){
146             // Enable/disable controls if checkboxes are checked
147             var checkedBoxes = $("input.cb:checked");
148             if ($(checkedBoxes).size()) {
149               $("#payselected").prop("disabled",false);
150             } else {
151               $("#payselected").prop("disabled",true);
152             }
153         }
154         $(document).ready(function(){
155         $('#pay-fines-form').preventDoubleFormSubmit();
156             $("#woall").click(function(event){
157                 var msg = _("Are you sure you want to write off %s in outstanding fines? This cannot be undone!").format( "[% total | $Price %]" );
158                 var answer = confirm(msg);
159                     if (!answer){
160                         event.preventDefault();
161                     }
162             });
163             $('#CheckAll').click(function(){
164                 $("#finest").checkCheckboxes();
165                 enableCheckboxActions();
166                 return false;
167             });
168             $('#CheckNone').click(function(){
169                 $("#finest").unCheckCheckboxes();
170                 enableCheckboxActions();
171                 return false;
172             });
173             $(".cb").change(function(){
174                 enableCheckboxActions();
175             });
176             enableCheckboxActions();
177         });
178
179     </script>
180 [% END %]
181
182 [% INCLUDE 'intranet-bottom.inc' %]