cardinity_order_ajax.tpl
3.17 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php if ($payment) { ?>
<table class="table table-bordered">
<tr>
<td><?php echo $column_refund_history; ?></td>
<td>
<table class="table table-bordered">
<thead>
<tr>
<td class="text-left"><?php echo $column_date; ?></td>
<td class="text-left"><?php echo $column_amount; ?></td>
<td class="text-left"><?php echo $column_status; ?></td>
<td class="text-left"><?php echo $column_description; ?></td>
</tr>
</thead>
<tbody>
<?php if ($refunds) { ?>
<?php foreach ($refunds as $refund) { ?>
<tr>
<td><?php echo $refund['date_added']; ?></td>
<td><?php echo $refund['amount']; ?></td>
<td><?php echo $refund['status']; ?></td>
<td><?php echo $refund['description']; ?></td>
</tr>
<?php } ?>
<?php } else { ?>
<tr>
<td class="text-center" colspan="3"><?php echo $text_no_refund; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</td>
</tr>
<tr>
<td><?php echo $column_action; ?></td>
<td>
<table class="table table-bordered">
<thead>
<tr>
<td class="text-left"><?php echo $column_refund; ?></td>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php if ($refund_action) { ?>
<label class="control-label">Amount:</label>
<input id="refund-amount" text="text" name="refund_amount" value="<?php echo $max_refund_amount; ?>" />
<label class="control-label">Description:</label>
<input id="refund-description" text="text" name="refund_description" value="" />
<a class="btn btn-primary button-command" data-type="refund"><?php echo $button_refund; ?></a>
<?php } else { ?>
<?php echo $text_na; ?>
<?php } ?>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
<?php } else { ?>
Unable to find transaction for this order.
<?php } ?>
<script type="text/javascript"><!--
$('.button-command').on('click', function() {
var confirm_text = '';
<?php if ($symbol_left) { ?>
confirm_text = '<?php echo $text_confirm_refund; ?> ' + '<?php echo $symbol_left; ?>' + $('#refund-amount').val();
<?php } elseif($symbol_right) { ?>
confirm_text = '<?php echo $text_confirm_refund; ?> ' + $('#refund-amount').val() + '<?php echo $symbol_right; ?>';
<?php } ?>
if (confirm(confirm_text)) {
$.ajax({
url: 'index.php?route=payment/cardinity/refund&token=<?php echo $token; ?>',
type: 'post',
data: {
payment_id: '<?php echo $payment_id; ?>',
amount: $('#refund-amount').val(),
description: $('#refund-description').val()
},
dataType: 'json',
beforeSend: function() {
$('#button-settle').button('loading');
$('.alert').hide();
$('.alert').removeClass('alert-success alert-danger');
},
complete: function() {
$('#button-settle').button('reset');
},
success: function(json) {
if (json.error) {
$('.alert').show();
$('.alert').addClass('alert-danger');
$('.alert').html('<i class="fa fa-check-circle"></i> ' + json.error);
}
if (json.success) {
$('.alert').show();
$('.alert').addClass('alert-success');
$('.alert').html('<i class="fa fa-exclamation-circle"></i> ' + json.success);
}
getPayment('<?php echo $payment_id; ?>');
}
});
}
});
//--></script>