08350abe2b4ea31ec583886518ec68701c6769c5
[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 class="NoSort">Payment note</th>
50     <th>Account type</th>
51     <th>Amount</th>
52     <th>Amount outstanding</th>
53 </tr>
54 </thead>
55
56 <tbody>
57 [% FOREACH line IN accounts %]
58 <tr>
59     <td>
60     [% IF ( line.amountoutstanding > 0 ) %]
61         <input class="cb" type="checkbox" checked="checked" name="incl_par_[% line.accountlines_id | html %]" />
62     [% END %]
63     </td>
64     <td class="actions">
65     [% IF ( line.amountoutstanding > 0 ) %]
66         <button type="submit" class="btn btn-default btn-xs" name="pay_indiv_[% line.accountlines_id | html %]" value="Pay">Pay</button>
67         [% IF CAN_user_updatecharges_writeoff %]
68             <button type="submit" class="btn btn-default btn-xs" name="wo_indiv_[% line.accountlines_id | html %]" value="Write off">Write off</button>
69         [% END %]
70     [% END %]
71     <input type="hidden" name="itemnumber[% line.accountlines_id | html %]" value="[% line.itemnumber | html %]" />
72     <input type="hidden" name="description[% line.accountlines_id | html %]" value="[% line.description | html %]" />
73     <input type="hidden" name="accounttype[% line.accountlines_id | html %]" value="[% line.accounttype | html %]" />
74     <input type="hidden" name="amount[% line.accountlines_id | html %]" value="[% line.amount | html %]" />
75     <input type="hidden" name="accountlines_id[% line.accountlines_id | html %]" value="[% line.accountlines_id | html %]" />
76     <input type="hidden" name="amountoutstanding[% line.accountlines_id | html %]" value="[% line.amountoutstanding | html %]" />
77     <input type="hidden" name="borrowernumber[% line.accountlines_id | html %]" value="[% line.borrowernumber | html %]" />
78     </td>
79     <td>
80         [% SWITCH line.accounttype %]
81           [% CASE 'Pay' %]Payment, thanks
82           [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
83           [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
84           [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
85           [% CASE 'N' %]New card
86           [% CASE 'F' %]Fine
87           [% CASE 'A' %]Account management fee
88           [% CASE 'M' %]Sundry
89           [% CASE 'L' %]Lost item
90           [% CASE 'W' %]Writeoff
91           [% CASE 'FU' %]Accruing fine
92           [% CASE 'HE' %]Hold waiting too long
93           [% CASE 'Rent' %]Rental fee
94           [% CASE 'FOR' %]Forgiven
95           [% CASE 'LR' %]Lost item fee refund
96           [% CASE 'PF' %]Processing fee
97           [% CASE 'PAY' %]Payment
98           [% CASE 'WO' %]Writeoff
99           [% CASE 'C' %]Credit
100           [% CASE 'CR' %]Credit
101           [% CASE %][% line.accounttype | html %]
102         [%- END -%]
103         [%- IF line.description %], [% line.description | html %][% END %]
104         [% IF line.title %]([% line.title | html %])[% END %]
105     </td>
106     <td>
107         <span title="[% line.date | html %]">[% line.date | $KohaDates %]</span>
108     </td>
109     <td class="actions">
110         <a href="#" class="add-note" data-accountlines_id="[% line.accountlines_id | html %]"><i class="fa fa-plus"></i> Add note</a>
111         <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>
112     </td>
113     <td>[% line.accounttype | html %]</td>
114     <td class="debit" style="text-align: right;">[% line.amount | $Price %]</td>
115     <td class="debit" style="text-align: right;">[% line.amountoutstanding | $Price %]</td>
116 </tr>
117 [% END %]
118 </tbody>
119
120 <tfoot>
121     [% IF outstanding_credits.total_outstanding < 0 %]
122         <tr>
123             <td class="total" colspan="7">Outstanding credits could be applied: </td>
124             <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>
125         </tr>
126     [% END %]
127     [% IF ( account_grp.total ) %]
128         <tr>
129             <td class="total" colspan="7" style="text-align: right;">Sub total:</td>
130             <td style="text-align: right;">[% account_grp.total | $Price %]</td>
131         </tr>
132     [% END %]
133     <tr>
134         <td class="total" colspan="7">Total due:</td>
135         [% IF outstanding_credits.total_outstanding < 0 %]
136             <td style="text-align: right;">[% total + outstanding_credits.total_outstanding | $Price %]</td>
137         [% ELSE %]
138             <td style="text-align: right;">[% total | $Price %]</td>
139         [% END %]
140     </tr>
141 </tfoot>
142
143 </table>
144 <fieldset class="action">
145 <input type="submit" id="paycollect" name="paycollect"  value="Pay amount" class="submit" />
146 [% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="woall"  id="woall" value="Write off all" class="submit" />[% END %]
147 <input type="submit" id="payselected" name="payselected"  value="Pay selected" class="submit" />
148 <input type="submit" id="writeoff-selected" name="writeoff_selected"  value="Write off selected" class="submit" />
149 <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
150 </fieldset>
151 </form>
152 [% ELSE %]
153     <p>[% patron.firstname | html %] [% patron.surname | html %] has no outstanding fines.</p>
154 [% END %]
155 </div></div>
156
157             </main>
158         </div> <!-- /.col-sm-10.col-sm-push-2 -->
159
160         <div class="col-sm-2 col-sm-pull-10">
161             <aside>
162                 [% INCLUDE 'circ-menu.inc' %]
163             </aside>
164         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
165      </div> <!-- /.row -->
166
167 [% MACRO jsinclude BLOCK %]
168     [% INCLUDE 'str/members-menu.inc' %]
169     [% Asset.js("js/members-menu.js") | $raw %]
170     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
171     [% INCLUDE 'datatables.inc' %]
172     [% INCLUDE 'columns_settings.inc' %]
173     <script>
174         function enableCheckboxActions(){
175             // Enable/disable controls if checkboxes are checked
176             var checkedBoxes = $("input.cb:checked");
177             if ($(checkedBoxes).size()) {
178               $("#payselected, #writeoff-selected").prop("disabled",false);
179             } else {
180               $("#payselected, #writeoff-selected").prop("disabled",true);
181             }
182         }
183         $(document).ready(function(){
184         $('#pay-fines-form').preventDoubleFormSubmit();
185             $("#woall").click(function(event){
186                 var msg = _("Are you sure you want to write off %s in outstanding fines? This cannot be undone!").format( "[% total | $Price %]" );
187                 var answer = confirm(msg);
188                     if (!answer){
189                         event.preventDefault();
190                     }
191             });
192             $('#CheckAll').click(function(e){
193                 e.preventDefault();
194                 $("#finest").checkCheckboxes();
195                 enableCheckboxActions();
196                 return false;
197             });
198             $('#CheckNone').click(function(e){
199                 e.preventDefault();
200                 $("#finest").unCheckCheckboxes();
201                 enableCheckboxActions();
202                 return false;
203             });
204             $(".cb").change(function(){
205                 enableCheckboxActions();
206             });
207             enableCheckboxActions();
208             $(".add-note").on("click", function(e){
209                 e.preventDefault();
210                 $(this).hide();
211                 var accountlines_id = $(this).data("accountlines_id");
212                 $("#payment_note_" + accountlines_id ).show().find("input").focus();
213             });
214             $(".cancel-note").on("click", function(e){
215                 e.preventDefault();
216                 $(".payment_note").hide().find("input").val("");
217                 $(".add-note").show();
218             });
219
220             var columns_settings = [% ColumnsSettings.GetColumns('members', 'pay', 'pay-fines-table', 'json') | $raw %];
221             KohaTable("finest", {
222                 "columnDefs": [
223                     { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
224                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
225                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
226                 ],
227                 "paging": false,
228                 'sorting': [[ 3, "asc" ]],
229                 "autoWidth": false
230             }, columns_settings );
231         });
232     </script>
233 [% END %]
234
235 [% INCLUDE 'intranet-bottom.inc' %]