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