Bug 34094: Use DefaultPatronSearchMethod consistently
[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 TablesSettings %]
8 [% USE KohaDates %]
9 [% SET footerjs = 1 %]
10 [% PROCESS 'accounts.inc' %]
11 [% INCLUDE 'doc-head-open.inc' %]
12 <title>Make a payment for [% INCLUDE 'patron-title.inc' no_html = 1 %] &rsaquo; Patrons &rsaquo; Koha</title>
13 [% INCLUDE 'doc-head-close.inc' %]
14 </head>
15
16 <body id="pat_pay" class="pat">
17 [% WRAPPER 'header.inc' %]
18     [% INCLUDE 'patron-search-header.inc' %]
19 [% END %]
20
21 [% WRAPPER 'sub-header.inc' %]
22     [% WRAPPER breadcrumbs %]
23         [% WRAPPER breadcrumb_item %]
24             <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
25         [% END %]
26         [% WRAPPER breadcrumb_item %]
27             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">
28                 [% INCLUDE 'patron-title.inc' %]
29             </a>
30         [% END %]
31         [% WRAPPER breadcrumb_item bc_active= 1 %]
32             <span>Make a payment</span>
33         [% END %]
34     [% END #/ WRAPPER breadcrumbs %]
35 [% END #/ WRAPPER sub-header.inc %]
36
37 <div class="main container-fluid">
38     <div class="row">
39         <div class="col-sm-10 col-sm-push-2">
40             <main>
41
42 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
43
44 <h1>Make a payment</h1>
45
46 <!-- The manual invoice and credit buttons -->
47 <div class="toptabs">
48     <ul class="nav nav-tabs" role="tablist">
49         <li role="presentation" class="transactions">
50             <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Transactions</a>
51         </li>
52         <li role="presentation" class="makepayment active">
53             <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Make a payment</a>
54         </li>
55         [% IF CAN_user_updatecharges_manual_invoice %]
56             <li role="presentation" class="manualinvoice">
57                 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual invoice</a>
58             </li>
59         [% END %]
60         [% IF CAN_user_updatecharges_manual_credit %]
61             <li role="presentation" class="manualcredit">
62                 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual credit</a>
63             </li>
64         [% END %]
65     </ul> <!-- /.nav.nav-tabs -->
66     <div class="tab-content">
67         <div role="tabpanel" class="tab-pane active">
68
69 [% INCLUDE 'renew_results.inc' renew_results=renew_results %]
70 [% IF ( accounts ) %]
71     <form action="/cgi-bin/koha/members/pay.pl" method="post" id="pay-fines-form">
72     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
73 <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>
74 <table id="finest">
75 <thead>
76 <tr>
77     <th class="NoSort">&nbsp;</th>
78     <th class="NoSort noExport">Actions</th>
79     <th>Account type</th>
80     <th>Description</th>
81     <th>Date</th>
82     <th>Barcode</th>
83     <th>Call number</th>
84     <th>Due date</th>
85     <th>Checkin date</th>
86     <th>Checkout date</th>
87     <th class="checked_out_from">Checked out from</th>
88     <th>Home library</th>
89     <th class="NoSort">Payment note</th>
90     <th>Amount</th>
91     <th>Amount outstanding</th>
92 </tr>
93 </thead>
94
95 <tbody>
96 [% FOREACH line IN accounts %]
97 <tr>
98     <td>
99     [% IF ( line.amountoutstanding > 0 ) %]
100         <input class="cb" type="checkbox" checked="checked" name="incl_par_[% line.accountlines_id | html %]" />
101     [% END %]
102     </td>
103     <td class="actions">
104     [% IF ( line.amountoutstanding > 0 ) %]
105         <button type="submit" class="btn btn-default btn-xs" name="pay_indiv_[% line.accountlines_id | html %]" value="Pay">Pay</button>
106         [% IF CAN_user_updatecharges_writeoff %]
107             <button type="submit" class="btn btn-default btn-xs" name="wo_indiv_[% line.accountlines_id | html %]" value="Write off">Write off</button>
108         [% END %]
109     [% END %]
110     <input type="hidden" name="itemnumber[% line.accountlines_id | html %]" value="[% line.itemnumber | html %]" />
111     <input type="hidden" name="description[% line.accountlines_id | html %]" value="[% line.description | html %]" />
112     <input type="hidden" name="debit_type_code[% line.accountlines_id | html %]" value="[% line.debit_type_code | html %]" />
113     <input type="hidden" name="amount[% line.accountlines_id | html %]" value="[% line.amount | html %]" />
114     <input type="hidden" name="accountlines_id[% line.accountlines_id | html %]" value="[% line.accountlines_id | html %]" />
115     <input type="hidden" name="amountoutstanding[% line.accountlines_id | html %]" value="[% line.amountoutstanding | html %]" />
116     <input type="hidden" name="borrowernumber[% line.accountlines_id | html %]" value="[% line.borrowernumber | html %]" />
117     </td>
118     <td>
119         [% PROCESS account_type_description account=line %]
120     </td>
121     <td>
122         [%- IF line.description %][% line.description | html %][% END %]
123         [% IF line.itemnumber %]([% line.item.biblio.title | html %])[% END %]
124     </td>
125     <td data-order="[% line.date | html %]">
126         [% line.date | $KohaDates %]
127     </td>
128     <td>
129         [% IF line.itemnumber %]
130             <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>
131         [% END %]
132     </td>
133     <td>
134         [% IF line.itemnumber %]
135             [% line.item.itemcallnumber | html %]
136         [% END %]
137     </td>
138     <td>
139         [% IF line.issue_id %]
140             [% line.checkout.date_due | $KohaDates as_due_date => 1 %]
141         [% END %]
142     </td>
143     <td>
144         [% IF line.issue_id %]
145             [% line.checkout.returndate | $KohaDates with_hours => 1 %]
146         [% END %]
147     </td>
148     <td>
149         [% IF line.issue_id %]
150             [% line.checkout.issuedate | $KohaDates %]
151         [% END %]
152     </td>
153     <td class="checked_out_from">
154         [% IF line.issue_id && line.checkout.library %]
155             [% line.checkout.library.branchname | html %]
156         [% END %]
157     </td>
158     <td>
159         [% IF line.itemnumber %]
160             [% Branches.GetName( line.item.homebranch ) | html %]
161         [% END %]
162     </td>
163     <td class="actions">
164         <a href="#" class="add-note" data-accountlines_id="[% line.accountlines_id | html %]"><i class="fa fa-plus"></i> Add note</a>
165         <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>
166     </td>
167     <td class="debit" style="text-align: right;">[% line.amount | $Price %]</td>
168     <td class="debit" style="text-align: right;">[% line.amountoutstanding | $Price %]</td>
169 </tr>
170 [% END %]
171 </tbody>
172
173 <tfoot>
174     <tr>
175         <td class="total" colspan="12">Total due:</td>
176         <td style="text-align: right;">[% total | $Price %]</td>
177     </tr>
178     [% IF outstanding_credits.total_outstanding < 0 %]
179         <tr>
180             <td class="total" colspan="12">Outstanding credits could be applied: </td>
181             <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>
182         </tr>
183         <tr>
184             <td class="total" colspan="12">Total due if credit applied:</td>
185             <td style="text-align: right;">[% total + outstanding_credits.total_outstanding | $Price %]</td>
186         </tr>
187     [% END %]
188 </tfoot>
189
190 </table>
191 <fieldset class="action">
192 <input type="submit" id="paycollect" name="paycollect"  value="Pay amount" class="submit" />
193 <input type="submit" id="payselected" name="payselected"  value="Pay selected" class="submit" />
194 [% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="woall"  id="woall" value="Write off all" class="submit" />
195 <input type="submit" id="writeoff-selected" name="writeoff_selected"  value="Write off selected" class="submit" />[% END %]
196 <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
197 </fieldset>
198 </form>
199 [% ELSE %]
200     <p>[% INCLUDE 'patron-title.inc' %] has no outstanding charges.</p>
201 [% END %]
202         </div> <!-- /.tab-pane -->
203     </div> <!-- /.tab-content -->
204 </div> <!-- /.toptabs -->
205
206             </main>
207         </div> <!-- /.col-sm-10.col-sm-push-2 -->
208
209         <div class="col-sm-2 col-sm-pull-10">
210             <aside>
211                 [% INCLUDE 'circ-menu.inc' %]
212             </aside>
213         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
214      </div> <!-- /.row -->
215
216 [% MACRO jsinclude BLOCK %]
217     [% INCLUDE 'str/members-menu.inc' %]
218     [% Asset.js("js/members-menu.js") | $raw %]
219     [% INCLUDE 'datatables.inc' %]
220     [% INCLUDE 'columns_settings.inc' %]
221     <script>
222         function enableCheckboxActions(){
223             // Enable/disable controls if checkboxes are checked
224             var checkedBoxes = $("input.cb:checked");
225             if ($(checkedBoxes).size()) {
226               $("#payselected, #writeoff-selected").prop("disabled",false);
227             } else {
228               $("#payselected, #writeoff-selected").prop("disabled",true);
229             }
230         }
231         $(document).ready(function(){
232             [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
233                 window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id | html %]&change_given=[% change_given | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
234             [% END %]
235
236             $('#pay-fines-form').preventDoubleFormSubmit();
237             $("#woall").click(function(event){
238                 var msg = _("Are you sure you want to write off %s in outstanding charges? This cannot be undone!").format( "[% total | $Price %]" );
239                 var answer = confirm(msg);
240                     if (!answer){
241                         event.preventDefault();
242                     }
243             });
244             $('#CheckAll').click(function(e){
245                 e.preventDefault();
246                 $(".cb").each(function(){
247                     $(this).prop("checked", true );
248                 });
249                 enableCheckboxActions();
250             });
251             $('#CheckNone').click(function(e){
252                 e.preventDefault();
253                 $(".cb").each(function(){
254                     $(this).prop("checked", false );
255                 });
256                 enableCheckboxActions();
257             });
258             $(".cb").change(function(){
259                 enableCheckboxActions();
260             });
261             enableCheckboxActions();
262             $(".add-note").on("click", function(e){
263                 e.preventDefault();
264                 $(this).hide();
265                 var accountlines_id = $(this).data("accountlines_id");
266                 $("#payment_note_" + accountlines_id ).show().find("input").focus();
267             });
268             $(".cancel-note").on("click", function(e){
269                 e.preventDefault();
270                 $(".payment_note").hide().find("input").val("");
271                 $(".add-note").show();
272             });
273
274             var table_settings = [% TablesSettings.GetTableSettings('members', 'pay', 'pay-fines-table', 'json') | $raw %];
275             KohaTable("finest", {
276                 "paging": false,
277                 "autoWidth": false
278             }, table_settings );
279         });
280     </script>
281 [% END %]
282
283 [% INCLUDE 'intranet-bottom.inc' %]