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