-
Notifications
You must be signed in to change notification settings - Fork 1
/
client_transactions.pdt
100 lines (96 loc) · 8.22 KB
/
client_transactions.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
// Don't show this container when only rendering the widget section
if (!(isset($render_section) ? $render_section : null) && !(isset($is_ajax) ? $is_ajax : null)) {
?>
<div class="col-md-12">
<?php
}
$links = [
['name' => $this->_('ClientTransactions.index.category_approved', true) . ' <span class="badge">' . (isset($status_count['approved']) ? $this->Html->safe($status_count['approved']) : null) . '</span>', 'current' => ((isset($status) ? $status : null) == 'approved' ? true : false), 'attributes' => ['href' => $this->base_uri . 'transactions/index/approved/', 'class' => 'ajax']],
['name' => $this->_('ClientTransactions.index.category_pending', true) . ' <span class="badge">' . (isset($status_count['pending']) ? $this->Html->safe($status_count['pending']) : null) . '</span>', 'current' => ((isset($status) ? $status : null) == 'pending' ? true : false), 'attributes' => ['href' => $this->base_uri . 'transactions/index/pending/', 'class' => 'ajax']],
['name' => $this->_('ClientTransactions.index.category_declined', true) . ' <span class="badge">' . (isset($status_count['declined']) ? $this->Html->safe($status_count['declined']) : null) . '</span>', 'current' => ((isset($status) ? $status : null) == 'declined' ? true : false), 'attributes' => ['href' => $this->base_uri . 'transactions/index/declined/', 'class' => 'ajax']]
];
$this->WidgetClient->clear();
$this->WidgetClient->setLinks($links);
$this->WidgetClient->setFilters((isset($filters) ? $filters : null), $this->Html->safe($this->base_uri . 'transactions/index/' . (isset($status) ? $this->Html->safe($status) : null)), !empty($filter_vars));
$this->WidgetClient->setAjaxFiltering();
$this->WidgetClient->create($this->_('ClientTransactions.index.boxtitle_transactions', true), ['id' => 'client_transactions'], (isset($render_section) ? $render_section : null));
$this->WidgetClient->startBody();
$this->WidgetClient->buildFilters();
if ((isset($transactions) ? $transactions : false) && ($num_transactions = count($transactions)) > 0) {
?>
<div class="table-responsive">
<table class="table table-curved table-striped-alt table-hover" id="transactions">
<thead>
<tr>
<th><a href="<?php echo $this->Html->safe($this->base_uri . 'transactions/index/' . (isset($status) ? $status : null) . '/?sort=type&order=' . ($sort == 'type' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'type' ? ' ' . $order : '');?>"><?php $this->_('ClientTransactions.index.heading_type');?></a></th>
<th><a href="<?php echo $this->Html->safe($this->base_uri . 'transactions/index/' . (isset($status) ? $status : null) . '/?sort=amount&order=' . ($sort == 'amount' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'amount' ? ' ' . $order : '');?>"><?php $this->_('ClientTransactions.index.heading_amount');?></a></th>
<th><?php $this->_('ClientTransactions.index.heading_credited');?></th>
<th><a href="<?php echo $this->Html->safe($this->base_uri . 'transactions/index/' . (isset($status) ? $status : null) . '/?sort=applied_amount&order=' . ($sort == 'applied_amount' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'applied_amount' ? ' ' . $order : '');?>"><?php $this->_('ClientTransactions.index.heading_applied');?></a></th>
<th><a href="<?php echo $this->Html->safe($this->base_uri . 'transactions/index/' . (isset($status) ? $status : null) . '/?sort=transaction_id&order=' . ($sort == 'transaction_id' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'transaction_id' ? ' ' . $order : '');?>"><?php $this->_('ClientTransactions.index.heading_number');?></a></th>
<th><a href="<?php echo $this->Html->safe($this->base_uri . 'transactions/index/' . (isset($status) ? $status : null) . '/?sort=date_added&order=' . ($sort == 'date_added' ? $negate_order : $order));?>" class="ajax<?php echo $this->Html->safe($sort == 'date_added' ? ' ' . $order : '');?>"><?php $this->_('ClientTransactions.index.heading_date');?></a></th>
</tr>
</thead>
<tbody>
<?php
// Display all transactions
for ($i = 0; $i < $num_transactions; $i++) {
if ((isset($transactions[$i]->type) ? $transactions[$i]->type : null) == 'other' && (isset($transactions[$i]->gateway_type) ? $transactions[$i]->gateway_type : null) == 'nonmerchant') {
$trans_type = $transactions[$i]->gateway_name;
} else {
$trans_type = (isset($transaction_types[($transactions[$i]->type_name != '' ? $transactions[$i]->type_name : $transactions[$i]->type)]) ? $transaction_types[($transactions[$i]->type_name != '' ? $transactions[$i]->type_name : $transactions[$i]->type)] : null);
}
?>
<tr class="expand transaction_applied">
<td><?php (print (isset($trans_type) ? $this->Html->safe($trans_type) : null));?></td>
<td><?php echo $this->CurrencyFormat->format((isset($transactions[$i]->amount) ? $this->Html->safe($transactions[$i]->amount) : null), (isset($transactions[$i]->currency) ? $this->Html->safe($transactions[$i]->currency) : null), ['html_code' => true]);?></td>
<td><?php echo $this->CurrencyFormat->format((isset($transactions[$i]->credited_amount) ? $this->Html->safe($transactions[$i]->credited_amount) : null), (isset($transactions[$i]->currency) ? $this->Html->safe($transactions[$i]->currency) : null), ['html_code' => true]);?></td>
<td><?php echo $this->CurrencyFormat->format((isset($transactions[$i]->applied_amount) ? $this->Html->safe($transactions[$i]->applied_amount) : null), (isset($transactions[$i]->currency) ? $this->Html->safe($transactions[$i]->currency) : null), ['html_code' => true]);?></td>
<td><?php (print (isset($transactions[$i]->transaction_id) ? $this->Html->safe($transactions[$i]->transaction_id) : null));?></td>
<td><?php echo $this->Date->cast((isset($transactions[$i]->date_added) ? $this->Html->safe($transactions[$i]->date_added) : null), 'date');?></td>
</tr>
<tr class="expand_details" id="transactions_<?php (print (isset($transactions[$i]->id) ? $this->Html->safe($transactions[$i]->id) : null));?>">
<td colspan="8" class="subtable">
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
} else {
?>
<div class="alert alert-info">
<p>
<?php
$section_language = $this->_('ClientTransactions.index.category_' . (isset($status) ? $status : null), true);
$this->_('ClientTransactions.index.no_results', false, $section_language);
?>
</p>
</div>
<?php
}
$this->WidgetClient->endBody();
if ($this->Pagination->hasPages()) {
$this->WidgetClient->startFooter();
$this->Pagination->build();
$this->WidgetClient->endFooter();
}
$this->Widget->end();
// Don't show this container when only rendering the widget section
if (!(isset($render_section) ? $render_section : null) && !(isset($is_ajax) ? $is_ajax : null)) {
?>
</div>
<?php
}
?>
<script type="text/javascript">
$(document).ready(function() {
// Fetch all invoices the given transaction has been applied to
$(".transaction_applied").click(function() {
$(this).blestaUpdateRow("<?php echo $this->Html->safe((isset($this->base_uri) ? $this->Html->safe($this->base_uri) : null) . 'transactions/applied/');?>" + $(this).next("tr").attr("id").split("_")[1], ".subtable");
});
});
</script>