Bug 19489: Change method name issue --> checkout
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / pay.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE AuthorisedValues %]
5 [% USE Branches %]
6 [% USE Price %]
7 [% USE ColumnsSettings %]
8 [% USE KohaDates %]
9 [% SET footerjs = 1 %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>Koha &rsaquo; Patrons &rsaquo; Make a payment for  [% patron.firstname | html %] [% patron.surname | html %]</title>
12 [% INCLUDE 'doc-head-close.inc' %]
13 </head>
14
15 <body id="pat_pay" class="pat">
16 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'patron-search.inc' %]
18
19 <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; Make a payment for [% patron.firstname | html %] [% patron.surname | html %]</div>
20
21 <div class="main container-fluid">
22     <div class="row">
23         <div class="col-sm-10 col-sm-push-2">
24             <main>
25
26 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
27
28 <!-- The manual invoice and credit buttons -->
29 <div class="statictabs">
30 <ul>
31     <li><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a></li>
32     <li class="active"><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a></li>
33     <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a></li>
34     <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a></li>
35 </ul>
36 <div class="tabs-container">
37
38 [% IF ( accounts ) %]
39     <form action="/cgi-bin/koha/members/pay.pl" method="post" id="pay-fines-form">
40     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
41 <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>
42 <table id="finest">
43 <thead>
44 <tr>
45     <th class="NoSort">&nbsp;</th>
46     <th class="NoSort">Actions</th>
47     <th>Description</th>
48     <th class="title-string">Date</th>
49     <th>Barcode</th>
50     <th>Due date</th>
51     <th>Return date</th>
52     <th class="NoSort">Payment note</th>
53     <th>Account type</th>
54     <th>Amount</th>
55     <th>Amount outstanding</th>
56 </tr>
57 </thead>
58
59 <tbody>
60 [% FOREACH line IN accounts %]
61 <tr>
62     <td>
63     [% IF ( line.amountoutstanding > 0 ) %]
64         <input class="cb" type="checkbox" checked="checked" name="incl_par_[% line.accountlines_id | html %]" />
65     [% END %]
66     </td>
67     <td class="actions">
68     [% IF ( line.amountoutstanding > 0 ) %]
69         <button type="submit" class="btn btn-default btn-xs" name="pay_indiv_[% line.accountlines_id | html %]" value="Pay">Pay</button>
70         [% IF CAN_user_updatecharges_writeoff %]
71             <button type="submit" class="btn btn-default btn-xs" name="wo_indiv_[% line.accountlines_id | html %]" value="Write off">Write off</button>
72         [% END %]
73     [% END %]
74     <input type="hidden" name="itemnumber[% line.accountlines_id | html %]" value="[% line.itemnumber | html %]" />
75     <input type="hidden" name="description[% line.accountlines_id | html %]" value="[% line.description | html %]" />
76     <input type="hidden" name="issue_id[% line.accountlines_id | html %]" value="[% line.issue_id | html %]" />
77     <input type="hidden" name="accounttype[% line.accountlines_id | html %]" value="[% line.accounttype | html %]" />
78     <input type="hidden" name="amount[% line.accountlines_id | html %]" value="[% line.amount | html %]" />
79     <input type="hidden" name="accountlines_id[% line.accountlines_id | html %]" value="[% line.accountlines_id | html %]" />
80     <input type="hidden" name="amountoutstanding[% line.accountlines_id | html %]" value="[% line.amountoutstanding | html %]" />
81     <input type="hidden" name="borrowernumber[% line.accountlines_id | html %]" value="[% line.borrowernumber | html %]" />
82     </td>
83     <td>
84         [% SWITCH line.accounttype %]
85           [% CASE 'Pay' %]Payment, thanks
86           [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
87           [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
88           [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
89           [% CASE 'N' %]New card
90           [% CASE 'F' %]Fine
91           [% CASE 'A' %]Account management fee
92           [% CASE 'M' %]Sundry
93           [% CASE 'L' %]Lost item
94           [% CASE 'W' %]Writeoff
95           [% CASE 'FU' %]Accruing fine
96           [% CASE 'HE' %]Hold waiting too long
97           [% CASE 'Rent' %]Rental fee
98           [% CASE 'FOR' %]Forgiven
99           [% CASE 'LR' %]Lost item fee refund
100           [% CASE 'PF' %]Processing fee
101           [% CASE 'PAY' %]Payment
102           [% CASE 'WO' %]Writeoff
103           [% CASE 'C' %]Credit
104           [% CASE 'CR' %]Credit
105           [% CASE %][% line.accounttype | html %]
106         [%- END -%]
107         [%- IF line.description %], [% line.description | html %][% END %]
108         [% IF line.itemnumber %]([% line.item.biblio.title | html %])[% END %]
109     </td>
110     <td>
111         <span title="[% line.date | html %]">[% line.date | $KohaDates %]</span>
112     </td>
113     <td>
114         [% IF line.itemnumber %]
115             <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% line.itemnumber | uri %]&amp;biblionumber=[% line.item.biblionumber | uri %]#item[% line.itemnumber | uri %]">[% line.item.barcode | html %]</a>
116         [% END %]
117     </td>
118     <td>
119         [% IF line.issue_id %]
120             [% line.checkout.date_due | $KohaDates as_due_date => 1 %]
121         [% END %]
122     </td>
123     <td>
124         [% IF line.issue_id %]
125             [% line.checkout.returndate | $KohaDates with_hours => 1 %]
126         [% END %]
127     </td>
128     <td class="actions">
129         <a href="#" class="add-note" data-accountlines_id="[% line.accountlines_id | html %]"><i class="fa fa-plus"></i> Add note</a>
130         <span class="payment_note" id="payment_note_[% line.accountlines_id | html %]" style="display:none"><input type="text" size="10" name="payment_note_[% line.accountlines_id | html %]" value="" /> <a href="#" class="cancel-note"><i class="fa fa-remove"></i></a></span>
131     </td>
132     <td>[% line.accounttype | html %]</td>
133     <td class="debit" style="text-align: right;">[% line.amount | $Price %]</td>
134     <td class="debit" style="text-align: right;">[% line.amountoutstanding | $Price %]</td>
135 </tr>
136 [% END %]
137 </tbody>
138
139 <tfoot>
140     [% IF outstanding_credits.total_outstanding < 0 %]
141         <tr>
142             <td class="total" colspan="10">Outstanding credits could be applied: </td>
143             <td class="credit" style="text-align: right;"><button type="submit" id="apply_credits" name="apply_credits" value="apply_credits" class="btn btn-default btn-sm">Apply <strong class="credit">[% outstanding_credits.total_outstanding | $Price %]</strong></button></td>
144         </tr>
145     [% END %]
146     [% IF ( account_grp.total ) %]
147         <tr>
148             <td class="total" colspan="10" style="text-align: right;">Sub total:</td>
149             <td style="text-align: right;">[% account_grp.total | $Price %]</td>
150         </tr>
151     [% END %]
152     <tr>
153         <td class="total" colspan="10">Total due:</td>
154         [% IF outstanding_credits.total_outstanding < 0 %]
155             <td style="text-align: right;">[% total + outstanding_credits.total_outstanding | $Price %]</td>
156         [% ELSE %]
157             <td style="text-align: right;">[% total | $Price %]</td>
158         [% END %]
159     </tr>
160 </tfoot>
161
162 </table>
163 <fieldset class="action">
164 <input type="submit" id="paycollect" name="paycollect"  value="Pay amount" class="submit" />
165 [% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="woall"  id="woall" value="Write off all" class="submit" />[% END %]
166 <input type="submit" id="payselected" name="payselected"  value="Pay selected" class="submit" />
167 <input type="submit" id="writeoff-selected" name="writeoff_selected"  value="Write off selected" class="submit" />
168 <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
169 </fieldset>
170 </form>
171 [% ELSE %]
172     <p>[% patron.firstname | html %] [% patron.surname | html %] has no outstanding fines.</p>
173 [% END %]
174 </div></div>
175
176             </main>
177         </div> <!-- /.col-sm-10.col-sm-push-2 -->
178
179         <div class="col-sm-2 col-sm-pull-10">
180             <aside>
181                 [% INCLUDE 'circ-menu.inc' %]
182             </aside>
183         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
184      </div> <!-- /.row -->
185
186 [% MACRO jsinclude BLOCK %]
187     [% INCLUDE 'str/members-menu.inc' %]
188     [% Asset.js("js/members-menu.js") | $raw %]
189     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
190     [% INCLUDE 'datatables.inc' %]
191     [% INCLUDE 'columns_settings.inc' %]
192     <script>
193         function enableCheckboxActions(){
194             // Enable/disable controls if checkboxes are checked
195             var checkedBoxes = $("input.cb:checked");
196             if ($(checkedBoxes).size()) {
197               $("#payselected, #writeoff-selected").prop("disabled",false);
198             } else {
199               $("#payselected, #writeoff-selected").prop("disabled",true);
200             }
201         }
202         $(document).ready(function(){
203         $('#pay-fines-form').preventDoubleFormSubmit();
204             $("#woall").click(function(event){
205                 var msg = _("Are you sure you want to write off %s in outstanding fines? This cannot be undone!").format( "[% total | $Price %]" );
206                 var answer = confirm(msg);
207                     if (!answer){
208                         event.preventDefault();
209                     }
210             });
211             $('#CheckAll').click(function(e){
212                 e.preventDefault();
213                 $("#finest").checkCheckboxes();
214                 enableCheckboxActions();
215                 return false;
216             });
217             $('#CheckNone').click(function(e){
218                 e.preventDefault();
219                 $("#finest").unCheckCheckboxes();
220                 enableCheckboxActions();
221                 return false;
222             });
223             $(".cb").change(function(){
224                 enableCheckboxActions();
225             });
226             enableCheckboxActions();
227             $(".add-note").on("click", function(e){
228                 e.preventDefault();
229                 $(this).hide();
230                 var accountlines_id = $(this).data("accountlines_id");
231                 $("#payment_note_" + accountlines_id ).show().find("input").focus();
232             });
233             $(".cancel-note").on("click", function(e){
234                 e.preventDefault();
235                 $(".payment_note").hide().find("input").val("");
236                 $(".add-note").show();
237             });
238
239             var columns_settings = [% ColumnsSettings.GetColumns('members', 'pay', 'pay-fines-table', 'json') | $raw %];
240             KohaTable("finest", {
241                 "columnDefs": [
242                     { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
243                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
244                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
245                 ],
246                 "paging": false,
247                 'sorting': [[ 3, "asc" ]],
248                 "autoWidth": false
249             }, columns_settings );
250         });
251     </script>
252 [% END %]
253
254 [% INCLUDE 'intranet-bottom.inc' %]