Bug 32061: Remove spans from page titles for adding/editing Z39.50/SRU servers
[koha-ffzg.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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
23     <ol>
24         <li>
25             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
26         </li>
27         <li>
28             <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
29         </li>
30         <li>
31             <a href="#" aria-current="page">
32                 Make a payment for [% INCLUDE 'patron-title.inc' %]
33             </a>
34         </li>
35     </ol>
36 </nav>
37 [% END %]
38
39 <div class="main container-fluid">
40     <div class="row">
41         <div class="col-sm-10 col-sm-push-2">
42             <main>
43
44 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
45
46 <h1>Make a payment</h1>
47
48 <!-- The manual invoice and credit buttons -->
49 <div class="toptabs">
50     <ul class="nav nav-tabs" role="tablist">
51         <li role="presentation" class="transactions">
52             <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Transactions</a>
53         </li>
54         <li role="presentation" class="makepayment active">
55             <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Make a payment</a>
56         </li>
57         [% IF CAN_user_updatecharges_manual_invoice %]
58             <li role="presentation" class="manualinvoice">
59                 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual invoice</a>
60             </li>
61         [% END %]
62         [% IF CAN_user_updatecharges_manual_credit %]
63             <li role="presentation" class="manualcredit">
64                 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual credit</a>
65             </li>
66         [% END %]
67     </ul> <!-- /.nav.nav-tabs -->
68     <div class="tab-content">
69         <div role="tabpanel" class="tab-pane active">
70
71 [% INCLUDE 'renew_results.inc' renew_results=renew_results %]
72 [% IF ( accounts ) %]
73     <form action="/cgi-bin/koha/members/pay.pl" method="post" id="pay-fines-form">
74     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
75 <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>
76 <table id="finest">
77 <thead>
78 <tr>
79     <th class="NoSort">&nbsp;</th>
80     <th class="NoSort noExport">Actions</th>
81     <th>Account type</th>
82     <th>Description</th>
83     <th>Date</th>
84     <th>Barcode</th>
85     <th>Due date</th>
86     <th>Checkin date</th>
87     <th>Checkout date</th>
88     <th class="checked_out_from">Checked out from</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.issue_id %]
135             [% line.checkout.date_due | $KohaDates as_due_date => 1 %]
136         [% END %]
137     </td>
138     <td>
139         [% IF line.issue_id %]
140             [% line.checkout.returndate | $KohaDates with_hours => 1 %]
141         [% END %]
142     </td>
143     <td>
144         [% IF line.issue_id %]
145             [% line.checkout.issuedate | $KohaDates %]
146         [% END %]
147     </td>
148     <td class="checked_out_from">
149         [% IF line.issue_id && line.checkout.library %]
150             [% line.checkout.library.branchname | html %]
151         [% END %]
152     </td>
153     <td class="actions">
154         <a href="#" class="add-note" data-accountlines_id="[% line.accountlines_id | html %]"><i class="fa fa-plus"></i> Add note</a>
155         <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>
156     </td>
157     <td class="debit" style="text-align: right;">[% line.amount | $Price %]</td>
158     <td class="debit" style="text-align: right;">[% line.amountoutstanding | $Price %]</td>
159 </tr>
160 [% END %]
161 </tbody>
162
163 <tfoot>
164     <tr>
165         <td class="total" colspan="12">Total due:</td>
166         <td style="text-align: right;">[% total | $Price %]</td>
167     </tr>
168     [% IF outstanding_credits.total_outstanding < 0 %]
169         <tr>
170             <td class="total" colspan="12">Outstanding credits could be applied: </td>
171             <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>
172         </tr>
173         <tr>
174             <td class="total" colspan="12">Total due if credit applied:</td>
175             <td style="text-align: right;">[% total + outstanding_credits.total_outstanding | $Price %]</td>
176         </tr>
177     [% END %]
178 </tfoot>
179
180 </table>
181 <fieldset class="action">
182 <input type="submit" id="paycollect" name="paycollect"  value="Pay amount" class="submit" />
183 <input type="submit" id="payselected" name="payselected"  value="Pay selected" class="submit" />
184 [% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="woall"  id="woall" value="Write off all" class="submit" />
185 <input type="submit" id="writeoff-selected" name="writeoff_selected"  value="Write off selected" class="submit" />[% END %]
186 <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
187 </fieldset>
188 </form>
189 [% ELSE %]
190     <p>[% INCLUDE 'patron-title.inc' %] has no outstanding fines.</p>
191 [% END %]
192         </div> <!-- /.tab-pane -->
193     </div> <!-- /.tab-content -->
194 </div> <!-- /.toptabs -->
195
196             </main>
197         </div> <!-- /.col-sm-10.col-sm-push-2 -->
198
199         <div class="col-sm-2 col-sm-pull-10">
200             <aside>
201                 [% INCLUDE 'circ-menu.inc' %]
202             </aside>
203         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
204      </div> <!-- /.row -->
205
206 [% MACRO jsinclude BLOCK %]
207     [% INCLUDE 'str/members-menu.inc' %]
208     [% Asset.js("js/members-menu.js") | $raw %]
209     [% INCLUDE 'datatables.inc' %]
210     [% INCLUDE 'columns_settings.inc' %]
211     <script>
212         function enableCheckboxActions(){
213             // Enable/disable controls if checkboxes are checked
214             var checkedBoxes = $("input.cb:checked");
215             if ($(checkedBoxes).size()) {
216               $("#payselected, #writeoff-selected").prop("disabled",false);
217             } else {
218               $("#payselected, #writeoff-selected").prop("disabled",true);
219             }
220         }
221         $(document).ready(function(){
222             [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
223                 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');
224             [% END %]
225
226             $('#pay-fines-form').preventDoubleFormSubmit();
227             $("#woall").click(function(event){
228                 var msg = _("Are you sure you want to write off %s in outstanding fines? This cannot be undone!").format( "[% total | $Price %]" );
229                 var answer = confirm(msg);
230                     if (!answer){
231                         event.preventDefault();
232                     }
233             });
234             $('#CheckAll').click(function(e){
235                 e.preventDefault();
236                 $(".cb").each(function(){
237                     $(this).prop("checked", true );
238                 });
239                 enableCheckboxActions();
240             });
241             $('#CheckNone').click(function(e){
242                 e.preventDefault();
243                 $(".cb").each(function(){
244                     $(this).prop("checked", false );
245                 });
246                 enableCheckboxActions();
247             });
248             $(".cb").change(function(){
249                 enableCheckboxActions();
250             });
251             enableCheckboxActions();
252             $(".add-note").on("click", function(e){
253                 e.preventDefault();
254                 $(this).hide();
255                 var accountlines_id = $(this).data("accountlines_id");
256                 $("#payment_note_" + accountlines_id ).show().find("input").focus();
257             });
258             $(".cancel-note").on("click", function(e){
259                 e.preventDefault();
260                 $(".payment_note").hide().find("input").val("");
261                 $(".add-note").show();
262             });
263
264             var table_settings = [% TablesSettings.GetTableSettings('members', 'pay', 'pay-fines-table', 'json') | $raw %];
265             KohaTable("finest", {
266                 "paging": false,
267                 "autoWidth": false
268             }, table_settings );
269         });
270     </script>
271 [% END %]
272
273 [% INCLUDE 'intranet-bottom.inc' %]