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