-
Notifications
You must be signed in to change notification settings - Fork 1
/
client_pay_multiple_invoices.pdt
66 lines (64 loc) · 4.13 KB
/
client_pay_multiple_invoices.pdt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
// Create input field for each invoice
if ((isset($invoices) ? $invoices : false) && ($num_invoices = count($invoices)) > 0) {
?>
<div class="float-right mb-2">
<a id="edit_amounts" class="btn btn-light" href="#"><i class="fas fa-edit"></i> <?php $this->_('ClientPay.multipleinvoices.text_edit_amounts');?></a>
</div>
<div class="clearfix"></div>
<div class="table-responsive">
<table class="table table-curved table-striped">
<thead>
<tr>
<th><?php $this->Form->fieldCheckbox('invoice_id[]', 'all', in_array('all', (isset($vars->invoice_id) ? $vars->invoice_id : [])));?></th>
<th class="edit_amounts" style="display:none;"><?php $this->_('ClientPay.multipleinvoices.text_amount');?></th>
<th><?php $this->_('ClientPay.multipleinvoices.text_due');?></th>
<th><?php $this->_('ClientPay.multipleinvoices.text_invoice');?></th>
<th><?php $this->_('ClientPay.multipleinvoices.text_datedue');?></th>
</tr>
</thead>
<tbody>
<?php
// Display each invoice
for ($i = 0; $i < $num_invoices; $i++) {
?>
<tr>
<td><?php $this->Form->fieldCheckbox('invoice_id[]', (isset($invoices[$i]->id) ? $invoices[$i]->id : null), in_array($invoices[$i]->id, (isset($vars->invoice_id) ? $vars->invoice_id : [])));?></td>
<td class="edit_amounts" style="display:none;"><?php $this->Form->fieldText('applyamount[' . (isset($invoices[$i]->id) ? $invoices[$i]->id : null) . ']', (isset($vars->applyamount[$invoices[$i]->id]) ? $vars->applyamount[$invoices[$i]->id] : $this->CurrencyFormat->format((isset($vars->applyamount[$invoices[$i]->id]) ? $vars->applyamount[$invoices[$i]->id] : $invoices[$i]->due), $invoices[$i]->currency, ['prefix' => false,'suffix' => false,'with_separator' => false,'code' => false])), ['id' => 'invoice-' . (isset($invoices[$i]->id) ? $invoices[$i]->id : null)]);?></td>
<td><?php echo $this->CurrencyFormat->format((isset($invoices[$i]->due) ? $this->Html->safe($invoices[$i]->due) : null), (isset($invoices[$i]->currency) ? $this->Html->safe($invoices[$i]->currency) : null), ['html_code' => true]);?></td>
<td><a href="<?php echo $this->Html->safe($this->base_uri . 'invoices/view/' . $invoices[$i]->id . '/');?>" target="_blank"><?php (print (isset($invoices[$i]->id_code) ? $this->Html->safe($invoices[$i]->id_code) : null));?></a></td>
<td><?php echo $this->Date->cast((isset($invoices[$i]->date_due) ? $invoices[$i]->date_due : null));?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
} else {
?>
<div class="alert alert-info">
<p><?php $this->_('ClientPay.multipleinvoices.no_results');?></p>
</div>
<?php
}
?>
<?php
// Show amounts if amounts to pay differ from total
if (!(isset($toggle_amounts) ? $toggle_amounts : true)) {
$this->Javascript->setInline("
$(document).ready(function() {
$('.edit_amounts').toggle();
});
");
}
$this->Javascript->setInline("
$(document).ready(function() {
$('#edit_amounts').click(function() {
$('.edit_amounts').toggle();
return false;
});
});
");
?>