Bug 24080: (QA follow-up) Remove processing for removed field
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / boraccount.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE KohaDates %]
6 [% USE ColumnsSettings %]
7 [% USE AuthorisedValues %]
8 [% USE Price %]
9 [% USE Branches %]
10 [% SET footerjs = 1 %]
11
12 [% PROCESS 'accounts.inc' %]
13
14 [% INCLUDE 'doc-head-open.inc' %]
15 <title>Koha &rsaquo; Patrons &rsaquo; Account for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
16 [% INCLUDE 'doc-head-close.inc' %]
17 </head>
18
19 <body id="pat_borraccount" class="pat">
20 [% INCLUDE 'header.inc' %]
21 [% INCLUDE 'patron-search.inc' %]
22
23 <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; Account for [% INCLUDE 'patron-title.inc' %]</div>
24
25 <div class="main container-fluid">
26     <div class="row">
27         <div class="col-sm-10 col-sm-push-2">
28             <main>
29
30 [% INCLUDE 'members-toolbar.inc' %]
31 <form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
32
33 <!-- The manual invoice and credit buttons -->
34 <div class="statictabs">
35 <ul>
36     <li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a></li>
37     <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a></li>
38     <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a></li>
39     <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a></li>
40 </ul>
41 <div class="tabs-container">
42 <!-- The table with the account items -->
43 <table id="table_account_fines">
44     <thead>
45       <tr>
46           <th class="title-string">Date</th>
47           <th>Account type</th>
48           <th>Description of charges</th>
49           <th>Barcode</th>
50           <th>Due date</th>
51           <th>Return date</th>
52           <th>Home library</th>
53           <th>Note</th>
54           <th>Amount</th>
55           <th>Outstanding</th>
56           <th>Actions</th>
57         </tr>
58     </thead>
59
60         <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
61   [% FOREACH account IN accounts %]
62
63    <tr>
64    <td><span title="[% account.date | html %]">[% account.date |$KohaDates %]</span></td>
65         <td>[% PROCESS account_type_description account=account %]</td>
66       <td>
67         [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
68         [%- IF account.description %][% account.description | html %][% END %]
69         &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&amp;itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>[% END %]</td>
70       <td>[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% account.itemnumber | uri %]&amp;biblionumber=[% account.item.biblionumber | uri %]#item[% account.itemnumber | uri %]">[% account.item.barcode | html %]</a>[% END %]</td>
71       <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
72       <td>[% IF ( account.issue_id ) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %]</td>
73       <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
74       <td>[% account.note | html_line_break %]</td>
75       [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
76       [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
77       <td class="actions">
78         [% IF ( account.is_credit ) %]
79           <a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
80         [% ELSE %]
81           <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
82         [% END %]
83         <a href="accountline-details.pl?accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>
84         [% IF account.is_credit %]
85           <a href="boraccount.pl?action=void&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs void"><i class="fa fa-ban"></i> Void</a>
86         [% END %]
87         [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
88           <button type="button" data-toggle="modal" data-target="#issuePayoutModal" data-account="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs"><i class="fa fa-money"></i> Issue payout</button>
89         [% END %]
90       </td>
91     </tr>
92
93   [% END %]
94 <tfoot>
95   <tr>
96     <td colspan="9">Total due</td>
97     [% IF ( totalcredit ) %]
98         <td class="credit" style="text-align: right;">[% total | $Price %]</td>
99     [% ELSE %]
100        <td class="debit"style="text-align: right;">[% total | $Price %]</td>
101     [% END %]
102     <td></td>
103   </tr>
104   </tfoot>
105 </table>
106 </div>
107 </div>
108
109             </main>
110         </div> <!-- /.col-sm-10.col-sm-push-2 -->
111
112         <div class="col-sm-2 col-sm-pull-10">
113             <aside>
114                 [% INCLUDE 'circ-menu.inc' %]
115             </aside>
116         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
117      </div> <!-- /.row -->
118
119     <!-- Issue payout modal -->
120     <div class="modal" id="issuePayoutModal" tabindex="-1" role="dialog" aria-labelledby="issuePayoutLabel">
121         <form  id="payout_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
122             <input type="hidden" name="accountlines_id" value="" id="payoutline">
123             <input type="hidden" name="action" value="payout">
124             <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
125             <div class="modal-dialog" role="document">
126                 <div class="modal-content">
127                     <div class="modal-header">
128                         <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
129                         <h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
130                     </div>
131                     <div class="modal-body">
132                         <fieldset class="rows">
133                             <ol>
134                                 <li>
135                                     <span id="paid" class="label">Outstanding credit: </span><span>[% payout.amount | $Price %]</span>
136                                 </li>
137                                 <li>
138                                     <label class="required" for="amount">Returned to patron: </label>
139                                     <input type="number" step="0.01" id="amount" name="amount" min="0.00" required="required">
140                                     <span class="required">Required</span>
141                                 </li>
142                                 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
143                                 [% IF payment_types %]
144                                 <li>
145                                     <label for="transaction_type">Transaction type: </label>
146                                     <select name="transaction_type" id="transaction_type">
147                                         [% FOREACH pt IN payment_types %]
148                                             <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
149                                         [% END %]
150                                     </select>
151                                 </li>
152                                 [% END %]
153
154                                 [% IF Koha.Preference('UseCashRegisters') %]
155                                 <li>
156                                     <label for="cash_register">Cash register: </label>
157                                     <select name="cash_register" id="cash_register">
158                                         [% FOREACH register IN registers %]
159                                           [% IF register.id == registerid %]
160                                         <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
161                                           [% ELSE %]
162                                         <option value="[% register.id | html %]">[% register.name | html %]</option>
163                                           [% END %]
164                                         [% END %]
165                                     </select>
166                                 </li>
167                                 [% END %]
168
169                             </ol>
170                         </fieldset> <!-- /.rows -->
171                     </div> <!-- /.modal-body -->
172                     <div class="modal-footer">
173                         <input type="hidden" name="registerid" value="[% register.id | html %]">
174                         <input type="hidden" name="op" value="payout">
175                         <button type="submit" class="btn btn-default">Confirm</button>
176                         <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
177                     </div> <!-- /.modal-footer -->
178                 </div> <!-- /.modal-content -->
179             </div> <!-- /.modal-dialog -->
180         </form> <!-- /#payout_form -->
181     </div> <!-- /#issuePayoutModal -->
182
183 [% MACRO jsinclude BLOCK %]
184     [% INCLUDE 'datatables.inc' %]
185     [% INCLUDE 'columns_settings.inc' %]
186     [% INCLUDE 'str/members-menu.inc' %]
187     [% Asset.js("js/members-menu.js") | $raw %]
188     <script>
189         $(document).ready(function() {
190             [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
191                 window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
192             [% END %]
193
194             var txtActivefilter = _("Filter paid transactions");
195             var txtInactivefilter = _("Show all transactions");
196             var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %];
197             var table_account_fines = KohaTable("table_account_fines", {
198                 "sPaginationType": "full",
199                 'aaSorting': [[0, 'desc']],
200                 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
201                 "aoColumnDefs": [
202                     { "sType": "title-string", "aTargets" : [ "title-string" ] },
203                     { "bSortable": false, "bSearchable": false, "aTargets": [-1] }
204                 ]
205             }, columns_settings);
206             $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
207             $('#filter_transacs').click(function(e) {
208                 e.preventDefault();
209                 if ($(this).hasClass('filtered')) {
210                     var filteredValue = '';
211                     $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
212                 } else { //Not filtered. Let's do it!
213                     var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
214                     $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
215                 }
216                 table_account_fines.fnFilter(filteredValue, 9, true, false);
217                 $(this).toggleClass('filtered');
218             });
219
220             $(".void").on("click",function(e){
221                 if( confirm( _("Are you sure you want to void this credit?") ) ) {
222                     return true;
223                 } else {
224                     e.preventDefault();
225                 }
226             });
227
228             $("#issuePayoutModal").on("shown.bs.modal", function(e){
229                 var button = $(e.relatedTarget);
230                 var accountline = button.data('accountline');
231                 $('#payoutline').val(accountline);
232                 var amount = button.data('amount') * -1;
233                 $("#paid + span").replaceWith(amount);
234                 $("#amount").attr({ "value": amount, "max": amount });
235                 $("#amount, #transaction_type").focus();
236             });
237         });
238     </script>
239 [% END %]
240
241 [% INCLUDE 'intranet-bottom.inc' %]