-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_pay_multiple_invoices.pdt
66 lines (64 loc) · 3.85 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 ($this->Html->ifSet($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', $this->Html->ifSet($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[]', $this->Html->ifSet($invoices[$i]->id), in_array($invoices[$i]->id, $this->Html->ifSet($vars->invoice_id, [])));?></td>
<td class="edit_amounts" style="display:none;"><?php $this->Form->fieldText('applyamount[' . $this->Html->ifSet($invoices[$i]->id) . ']', $this->Html->ifSet($vars->applyamount[$invoices[$i]->id], $this->CurrencyFormat->format($this->Html->ifSet($vars->applyamount[$invoices[$i]->id], $invoices[$i]->due), $invoices[$i]->currency, ['prefix' => false,'suffix' => false,'with_separator' => false,'code' => false])), ['id' => 'invoice-' . $this->Html->ifSet($invoices[$i]->id)]);?></td>
<td><?php echo $this->CurrencyFormat->format($this->Html->_($invoices[$i]->due, true), $this->Html->_($invoices[$i]->currency, true), ['html_code' => true]);?></td>
<td><a href="<?php echo $this->Html->safe($this->base_uri . 'invoices/view/' . $invoices[$i]->id . '/');?>" target="_blank"><?php $this->Html->_($invoices[$i]->id_code);?></a></td>
<td><?php echo $this->Date->cast($this->Html->ifSet($invoices[$i]->date_due));?></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 (!$this->Html->ifSet($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;
});
});
");
?>