Bug 34188: (QA follow-up) Fix different versions of system preference name: Force...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / pos / register.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE AuthorisedValues %]
6 [% USE Price %]
7 [% PROCESS 'i18n.inc' %]
8 [% SET footerjs = 1 %]
9 [% PROCESS 'accounts.inc' %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>[% FILTER collapse %]
12     [% tx("Transaction history for {register}", { register = register.name }) | html %] &rsaquo;
13     [% t("Koha") | html %]
14 [% END %]</title>
15 [% INCLUDE 'doc-head-close.inc' %]
16 [% Asset.css("lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css") | $raw %]
17 </head>
18
19 <body id="register" class="pos">
20 [% WRAPPER 'header.inc' %]
21     [% INCLUDE 'circ-search.inc' %]
22 [% END %]
23
24 [% WRAPPER 'sub-header.inc' %]
25     [% WRAPPER breadcrumbs %]
26         [% WRAPPER breadcrumb_item bc_active= 1 %]
27             <span>Transaction history for [% register.name | html %]</span>
28         [% END %]
29     [% END #/ WRAPPER breadcrumbs %]
30 [% END #/ WRAPPER sub-header.inc %]
31
32 <div class="main container-fluid">
33     <div class="row">
34         <div class="col-sm-10 col-sm-push-2">
35
36             [% IF ( error_registers ) %]
37                 <div id="error_message" class="dialog message">
38                     <p>
39                         You must have at least one cash register associated with the library before you can record payments.
40                     </p>
41                     [% IF ( CAN_user_parameters_manage_cash_registers ) %]
42                         <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
43                             <input type="hidden" name="op" value="add_form" />
44                             <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
45                         </form>
46                     [% END %]
47                 </div>
48             [% ELSE %]
49
50             [% IF ( error_cashup_permission ) %]
51             <div id="error_message" class="dialog alert">
52                 You do not have permission to perform cashup actions.
53             </div>
54             [% END %]
55
56             [% IF ( error_refund_permission ) %]
57             <div id="error_message" class="dialog alert">
58                 You do not have permission to perform refund actions.
59             </div>
60             [% END %]
61
62             [% IF ( CAN_user_cash_management_cashup ) %]
63             <div id="toolbar" class="btn-toolbar">
64                 <button id="pos_cashup" type="button" class="btn btn-default" data-toggle="modal" data-target="#confirmCashupModal" ><i class="fa-solid fa-money-bill-1"></i> Record cashup</button>
65             </div>
66             [% END %]
67
68             <h1>Transaction history for [% register.name | html %]</h1>
69
70             <h2>Summary</h2>
71             <ul>
72                 [% IF register.last_cashup %]
73                 <li>Last cashup: [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %] (<a data-toggle="modal" data-cashup="[% register.last_cashup.id | html %]" data-register="[% register.description | html %]" href="#cashupSummaryModal" class="button">Summary</a>)</li>
74                 [% END %]
75                 <li>Float: [% register.starting_float | $Price %]</li>
76                 <li>Total income (cash): [% accountlines.credits_total * -1 | $Price %] ([% accountlines.credits_total(payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %])</li>
77                 <li>Total outgoing (cash): [% accountlines.debits_total * -1 | $Price %] ([% accountlines.debits_total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %])</li>
78                 <li>Total bankable: [% accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %]</li>
79             </ul>
80
81             [% IF register.last_cashup %]
82             <h2>Transactions since [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %]</h2>
83             [% ELSE %]
84             <h2>Transactions to date</h2>
85             [% END %]
86             <div class="page-section">
87                 <table id="sales" class="table_sales">
88                     <thead>
89                         <tr>
90                             <th>ID</th>
91                             <th>DATA</th>
92                             <th>Transaction</th>
93                             <th>Description</th>
94                             <th>Price</th>
95                             <th>Total</th>
96                             <th class="noExport">Actions</th>
97                         </tr>
98                     </thead>
99                     <tbody>
100                         [% FOREACH accountline IN accountlines %]
101                             [% IF accountline.is_credit %]
102                             [% IF accountline.credit_offsets.count == 1 %]
103                                 <tr class="credit dtrg-group dtrg-start dtrg-level-0">
104                                     <td></td>
105                                     <td>{}</td>
106                                     <td>[% accountline.timestamp | $KohaDates with_hours => 1 %] ([% IF accountline.credit_number %][%- accountline.credit_number | html -%][% ELSE %][% accountline.accountlines_id | html %][% END %])</td>
107                                     <td>[%- PROCESS account_type_description account=accountline -%] ([% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %])</td>
108                                     <td></td>
109                                     <td>[% accountline.amount * -1 | $Price %]</td>
110                                     <td><button class="printReceipt btn btn-default btn-xs" data-accountline="[% accountline.accountlines_id | uri %]"><i class="fa fa-print"></i> Print receipt</button></td>
111                                 </tr>
112                                 [% ELSE %]
113                                 [% FOREACH credit IN accountline.credit_offsets %]
114                                 [% IF credit.debit %]
115                                 <tr>
116                                     <td>[% accountline.accountlines_id | html %]</td>
117                                     <td>{ "type": "credit", "identifier": "[%- accountline.credit_number | html -%]", "description": "[%- PROCESS account_type_description account=accountline -%] ([% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %])", "amount": "[% accountline.amount * -1 | $Price %]", "timestamp": "[% accountline.timestamp | $KohaDates with_hours => 1 %]" }</td>
118                                     <td></td>
119                                     <td>
120                                         [%- PROCESS account_type_description account=credit.debit -%]
121                                         [%- IF credit.debit.description -%] ([% credit.debit.description | html %])[%- END -%]
122                                         [%- IF ( credit.debit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% credit.debit.item.biblionumber | uri %]&amp;itemnumber=[% credit.debit.itemnumber | uri %]">[% credit.debit.item.biblio.title | html %]</a>)[%- END -%]
123                                     </td>
124                                     <td>[% credit.debit.amount | $Price %]</td>
125                                     <td></td>
126                                     <td>
127                                         [% IF CAN_user_cash_management_anonymous_refund && !(credit.debit.status == 'REFUNDED') && !(credit.debit.debit_type_code == 'PAYOUT') %]
128                                         <button type="button" class="btn btn-default btn-xs pos_refund" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" data-member="[% credit.debit.borrowernumber | html %]"><i class="fa-solid fa-money-bill-1"></i> Issue refund</button>
129                                         [% ELSIF CAN_user_updatecharges_refund && !(credit.debit.status == 'REFUNDED') && credit.debit.borrowernumber && !(credit.debit.debit_type_code == 'PAYOUT') %]
130                                         <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" data-member="[% credit.debit.borrowernumber | html %]"><i class="fa-solid fa-money-bill-1"></i> Issue refund</button>
131                                         [% END %]
132                                     </td>
133                                 </tr>
134                                 [% END %]
135                                 [% END %]
136                                 [% END %]
137                             [% ELSE %]
138                                 [% FOREACH debit IN accountline.debit_offsets %]
139                                 [% IF debit.credit %]
140                                 <tr>
141                                     <td>[% accountline.accountlines_id | html %]</td>
142                                     <td>{ "type": "debit", "identifier": "[%- accountline.credit_number | html -%]", "description": "[%- PROCESS account_type_description account=accountline -%] ([% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %])", "amount": "[% accountline.amount * -1 | $Price %]", "timestamp": "[% accountline.timestamp | $KohaDates with_hours => 1 %]" }</td>
143                                     <td></td>
144                                     <td>
145                                         [%- PROCESS account_type_description account=debit.credit -%]
146                                         [%- IF debit.credit.description %][% debit.credit.description | html %][%- END -%]
147                                         [%- IF ( debit.credit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% debit.credit.item.biblionumber | uri %]&amp;itemnumber=[% debit.credit.itemnumber | uri %]">[% debit.credit.item.biblio.title | html %]</a>)[%- END -%]
148                                     </td>
149                                     <td>[% debit.credit.amount | $Price %]</td>
150                                     <td></td>
151                                     <td>
152                                         [%- IF debit.credit.credit_type_code == 'REFUND' -%]<a href="/cgi-bin/koha/members/accountline-details.pl?accountlines_id=[% debit.credit.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>[%- END -%]
153                                     </td>
154                                 </tr>
155                                 [% END %]
156                                 [% END %]
157                             [% END %]
158                         [% END %]
159                     </tbody>
160                     <tfoot>
161                         <tr>
162                             <td colspan="5">Total income: </td>
163                             <td>[% accountlines.total * -1 | $Price %]</td>
164                             <td></td>
165                         </tr>
166                     </tfoot>
167                 </table>
168             </div>
169             [% END %]
170
171             [% IF register.cashups %]
172             <h2>Older transactions</h2>
173             <form method="GET" action="/cgi-bin/koha/pos/register.pl">
174                 <fieldset class="rows">
175                     Please select a date range to display transactions for:
176                     <ol>
177                         <li>
178                             <label for="trange_f">From: </label>
179                             <input type="text" size="10" id="from" class="flatpickr" data-date_to="to" name="trange_f" value="[% trange_f | html %]"/>
180                             <label class="inline" for="trange_t">To: </label>
181                             <input type="text" size="10" id="to" class="flatpickr" name="trange_t" value="[% trange_t | html %]" />
182                             <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
183                         </li>
184                     </ol>
185                 </fieldset>
186
187                 <fieldset class="action">
188                     <input type="hidden" name="registerid" value="[% register.id | html %]">
189                     <input type="submit" class="btn btn-primary" value="Display" />
190                 </fieldset>
191             </form>
192
193             [% IF trange_f %]
194                 <div class="page-section">
195                     <table id="past_sales" class="past_sales_table">
196                         <thead>
197                             <th>ID</th>
198                             <th>DATA</th>
199                             <th>Transaction</th>
200                             <th>Description</th>
201                             <th>Price</th>
202                             <th>Total</th>
203                             <th class="noExport">Actions</th>
204                         </thead>
205                         <tbody>
206                             [% FOREACH accountline IN past_accountlines %]
207                                 [% IF accountline.is_credit %]
208                                     [% FOREACH credit IN accountline.credit_offsets %]
209                                     [% IF credit.debit %]
210                                     <tr>
211                                         <td>[% accountline.accountlines_id | html %]</td>
212                                         <td>{ "type": "credit", "identifier": "[%- accountline.credit_number | html -%]", "description": "[%- PROCESS account_type_description account=accountline -%] ([% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %])", "amount": "[% accountline.amount * -1 | $Price %]", "timestamp": "[% accountline.timestamp | $KohaDates with_hours => 1 %]" }</td>
213                                         <td></td>
214                                         <td>
215                                             [%- PROCESS account_type_description account=credit.debit -%]
216                                             [%- IF credit.debit.description -%] ([% credit.debit.description | html %])[%- END -%]
217                                             [%- IF ( credit.debit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% credit.debit.item.biblionumber | uri %]&amp;itemnumber=[% credit.debit.itemnumber | uri %]">[% credit.debit.item.biblio.title | html %]</a>)[%- END -%]
218                                         </td>
219                                         <td>[% credit.debit.amount | $Price %]</td>
220                                         <td></td>
221                                         <td>
222                                             [% IF CAN_user_cash_management_anonymous_refund && !(credit.debit.status == 'REFUNDED') && !(credit.debit.debit_type_code == 'PAYOUT') %]
223                                             <button type="button" class="btn btn-default btn-xs pos_refund" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" data-member="[% credit.debit.borrowernumber | html %]"><i class="fa-solid fa-money-bill-1"></i> Issue refund</button>
224                                             [% ELSIF CAN_user_updatecharges_refund && !(credit.debit.status == 'REFUNDED') && credit.debit.borrowernumber && !(credit.debit.debit_type_code == 'PAYOUT') %]
225                                             <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" data-member="[% credit.debit.borrowernumber | html %]"><i class="fa-solid fa-money-bill-1"></i> Issue refund</button>
226                                             [% END %]
227                                         </td>
228                                     </tr>
229                                     [% END %]
230                                     [% END %]
231                                 [% ELSE %]
232                                     [% FOREACH debit IN accountline.debit_offsets %]
233                                     [% IF debit.credit %]
234                                     <tr>
235                                         <td>[% accountline.accountlines_id | html %]</td>
236                                         <td>{ "type": "debit", "identifier": "[%- accountline.credit_number | html -%]", "description": "[%- PROCESS account_type_description account=accountline -%] ([% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %])", "amount": "[% accountline.amount * -1 | $Price %]", "timestamp": "[% accountline.timestamp | $KohaDates with_hours => 1 %]" }</td>
237                                         <td></td>
238                                         <td>
239                                             [%- PROCESS account_type_description account=debit.credit -%]
240                                             [%- IF debit.credit.description %][% debit.credit.description | html %][%- END -%]
241                                             [%- IF ( debit.credit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% debit.credit.item.biblionumber | uri %]&amp;itemnumber=[% debit.credit.itemnumber | uri %]">[% debit.credit.item.biblio.title | html %]</a>)[%- END -%]
242                                         </td>
243                                         <td>[% debit.credit.amount | $Price %]</td>
244                                         <td></td>
245                                         <td>
246                                             [%- IF debit.credit.credit_type_code == 'REFUND' -%]<a href="/cgi-bin/koha/members/accountline-details.pl?accountlines_id=[% debit.credit.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>[%- END -%]
247                                         </td>
248                                     </tr>
249                                     [% END %]
250                                     [% END %]
251                                 [% END %]
252                             [% END %]
253                         </tbody>
254                         <tfoot>
255                             <tr>
256                                 <td colspan="5">Total income: </td>
257                                 <td>[% past_accountlines.total * -1 | $Price %]</td>
258                                 <td></td>
259                             </tr>
260                         </tfoot>
261                     </table>
262                 </div> <!-- /.page-section -->
263             [% END %]
264
265             <hr/>
266             <h2>Cashup history</h2>
267             <div class="page-section">
268                 <table id="table_cashups">
269                     <thead>
270                         <tr>
271                             <th>Date</th>
272                             <th>Cashier</th>
273                             <th>Amount</th>
274                             <th data-class-name="actions">Actions</th>
275                         </tr>
276                     </thead>
277                 </table>
278             </div>
279             [% END %]
280         </div>
281
282         <div class="col-sm-2 col-sm-pull-10">
283             <aside>
284                 [% INCLUDE 'pos-menu.inc' %]
285             </aside>
286         </div>
287     </div><!-- /.row -->
288
289     <!-- Confirm cashup modal -->
290     <div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
291         <div class="modal-dialog" role="document">
292             <div class="modal-content">
293                 <div class="modal-header">
294                     <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
295                     <h4 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em>[% register.description | html %]</em></h4>
296                 </div>
297                 <div class="modal-body">
298                     Please confirm that you have removed [% accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %] from the cash register and left a float of [% register.starting_float | $Price %].
299                 </div> <!-- /.modal-body -->
300                 <div class="modal-footer">
301                     <a href="/cgi-bin/koha/pos/register.pl?op=cashup" class="btn btn-default" id="pos_cashup_confirm">Confirm</a>
302                     <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
303                 </div> <!-- /.modal-footer -->
304             </div> <!-- /.modal-content -->
305         </div> <!-- /.modal-dialog -->
306     </div> <!-- /#confirmCashupModal -->
307
308     <!-- Issue refund modal -->
309     <div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
310         <form id="refund_form" method="post" enctype="multipart/form-data" class="validated">
311             <input type="hidden" name="accountline" value="" id="refundline">
312             <div class="modal-dialog" role="document">
313                 <div class="modal-content">
314                     <div class="modal-header">
315                         <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
316                         <h4 class="modal-title" id="issueRefundLabel">Issue refund from <em>[% register.description | html %]</em></h4>
317                     </div>
318                     <div class="modal-body">
319                         <fieldset class="rows">
320                             <ol>
321                                 <li>
322                                     <span id="item" class="label">Item: </span><span></span>
323                                 </li>
324                                 <li>
325                                     <span id="paid" class="label">Amount paid: </span><span></span>
326                                 </li>
327                                 <li>
328                                     <label class="required" for="amount">Returned to patron: </label>
329                                     <input type="text" inputmode="decimal" pattern="^\d+(\.\d{2})?$" id="returned" name="amount" required="required">
330                                     <span class="required">Required</span>
331                                 </li>
332                                 [% INCLUDE 'transaction_types.inc' type="refund" %]
333                             </ol>
334                         </fieldset> <!-- /.rows -->
335                     </div> <!-- /.modal-body -->
336                     <div class="modal-footer">
337                         <input type="hidden" name="registerid" value="[% register.id | html %]">
338                         <input type="hidden" name="op" value="refund">
339                         <button type="submit" class="btn btn-default" id="pos_refund_confirm">Confirm</button>
340                         <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
341                     </div> <!-- /.modal-footer -->
342                 </div> <!-- /.modal-content -->
343             </div> <!-- /.modal-dialog -->
344         </form> <!-- /#refund_form -->
345     </div> <!-- /#issueRefundModal -->
346
347     [% INCLUDE 'modals/cashup_summary.inc' %]
348
349     [% MACRO jsinclude BLOCK %]
350     [% INCLUDE 'datatables.inc' %]
351     [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
352     [% INCLUDE 'format_price.inc' %]
353     [% INCLUDE 'js-date-format.inc' %]
354     [% Asset.js("js/cashup_modal.js") | $raw %]
355     [% Asset.js("js/modal_printer.js") | $raw %]
356     [% INCLUDE 'calendar.inc' %]
357     <script>
358         var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, {
359             orderFixed: [ 0, 'asc'],
360             columnDefs: [ {
361                 targets: [ 0, 1 ],
362                 visible: false
363             }],
364             rowGroup: {
365                 dataSrc: 0,
366                 startRender: function ( rows, group ) {
367                     if ( group ) {
368                     var details = JSON.parse(rows.data().pluck(1).pop());
369                     var identifier = details.identifier || group;
370                     return $('<tr class="'+details.type+'"/>')
371                         .append( '<td>'+details.timestamp+' ('+identifier+')</td>' )
372                         .append( '<td colspan="2">'+details.description+'</td>' )
373                         .append( '<td>'+details.amount+'</td>' )
374                         .append( '<td><button class="printReceipt btn btn-default btn-xs" data-accountline="'+group+'"><i class="fa fa-print"></i> ' + _("Print receipt") + '</button></td>');
375                     }
376                 },
377                 endRender: null,
378             },
379             initComplete: function() {
380                 $("#sales").show();
381             }
382         }));
383
384         var past_sales_table = $("#past_sales").dataTable($.extend(true, {}, dataTablesDefaults, {
385             orderFixed: [ 0, 'asc'],
386             columnDefs: [ {
387                 targets: [ 0, 1 ],
388                 visible: false
389             }],
390             rowGroup: {
391                 dataSrc: 0,
392                 startRender: function ( rows, group ) {
393                     var details = JSON.parse(rows.data().pluck(1).pop());
394                     var identifier = details.identifier || group;
395                     return $('<tr class="'+details.type+'"/>')
396                         .append( '<td>'+details.timestamp+' ('+identifier+')</td>' )
397                         .append( '<td colspan="2">'+details.description+'</td>' )
398                         .append( '<td>'+details.amount+'</td>' )
399                         .append( '<td><button class="printReceipt btn btn-default btn-xs" data-accountline="'+group+'"><i class="fa fa-print"></i> Print receipt</button></td>');
400                 },
401                 endRender: null,
402             }
403         }));
404
405         $("#issueRefundModal").on("shown.bs.modal", function(e){
406            var button = $(e.relatedTarget);
407            var item = button.data('item');
408            $("#item + span").replaceWith(item);
409            var accountline = button.data('accountline');
410            $('#refundline').val(accountline);
411            var amount = button.data('amount');
412            var amountoutstanding = button.data('amountoutstanding') || 0;
413            var paid = amount - amountoutstanding;
414            $("#paid + span").replaceWith(paid);
415            $("#returned").attr({ "value": paid, "max": paid });
416            var member = button.data('member');
417            if ( member === '' ) {
418                $("#refund_type option[value='AC']").remove();
419            } else if ( $("#refund_type option[value='AC']").length == 0 ) {
420                $("#refund_type").prepend('<option value="AC" selected="selected">Account credit</option>');
421            }
422            $("#returned, #refund_type").focus();
423         });
424
425         $("body").on('click', ".printReceipt", function() {
426             var accountlines_id = $(this).data('accountline');
427             var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=' + accountlines_id, '_blank');
428             win.focus();
429         });
430
431         var cashups_table_url = "/api/v1/cash_registers/[% register.id | html %]/cashups?";
432         var cashups_table = $("#table_cashups").kohaTable({
433             "ajax": {
434                 "url": cashups_table_url
435             },
436             "embed": [
437                "manager"
438             ],
439             "order": [[ 0, "desc" ]],
440             "columns": [
441                 {
442                     "data": "timestamp",
443                     "searchable": true,
444                     "orderable": true,
445                     "render": function(data, type, row, meta) {
446                         return $datetime(row.timestamp);
447                     }
448                 },
449                 {
450                     "data": "manager.firstname:manager.surname",
451                     "searchable": true,
452                     "orderable": true,
453                     "render": function(data, type, row, meta) {
454                         var fullname;
455                         if ( row.manager.firstname == null ) {
456                             fullname = row.manager.surname;
457                         }
458                         else {
459                             fullname = row.manager.firstname + " " + row.manager.surname;
460                         }
461                         return escape_str(fullname);
462                     }
463                 },
464                 {
465                     "data": "amount",
466                     "searchable": true,
467                     "orderable": true,
468                     "render": function(data, type, row, meta) {
469                         var amt = row.amount * -1;
470                         return escape_price(amt);
471                     }
472                 },
473                 {
474                     "data": function( row, type, val, meta ) {
475                         var result = '<a class="btn btn-default btn-xs" role="button" data-toggle="modal" data-cashup="'+encodeURIComponent(row.cashup_id)+'" data-register="[% register.description | html %]" href="#cashupSummaryModal"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Summary")+'</a>\n';
476                         return result;
477                     },
478                     "searchable": false,
479                     "orderable": false
480                 }
481             ]
482         }, null, 1);
483     </script>
484 [% END %]
485
486 [% INCLUDE 'intranet-bottom.inc' %]