Update admin/view/template/payment/hutko_order_info_panel.twig
This commit is contained in:
@@ -3,6 +3,12 @@
|
|||||||
<i class="fa-solid fa-credit-card"></i> {{ text_payment_information }} (Hutko)
|
<i class="fa-solid fa-credit-card"></i> {{ text_payment_information }} (Hutko)
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<div class="mb-3 text-end border-bottom pb-3">
|
||||||
|
<span class="text-muted me-2 small">{{ text_create_link_info }}</span>
|
||||||
|
<button type="button" id="button-create-link" class="btn btn-primary"><i class="fa-solid fa-plus-circle"></i> {{ button_create_link }}</button>
|
||||||
|
<div id="create-link-response" class="mt-2 text-start"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if transactions %}
|
{% if transactions %}
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-bordered table-hover">
|
<table class="table table-bordered table-hover">
|
||||||
@@ -33,11 +39,11 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ t.amount }}</td>
|
<td>{{ t.amount }}</td>
|
||||||
<td class="text-end">
|
<td class="text-end">
|
||||||
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="collapse" data-bs-target="#payload-{{ loop.index }}"><i class="fa-solid fa-code"></i></button>
|
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="collapse" data-bs-target="#payload-{{ loop.index }}" title="Show Payload"><i class="fa-solid fa-code"></i></button>
|
||||||
{% if t.can_refund %}
|
{% if t.can_refund %}
|
||||||
<button type="button" class="btn btn-warning btn-sm btn-refund-modal" data-ref="{{ t.ref }}" data-amount="{{ t.amount }}"><i class="fa-solid fa-undo"></i></button>
|
<button type="button" class="btn btn-warning btn-sm btn-refund-modal" data-ref="{{ t.ref }}" data-amount="{{ t.amount }}" title="{{ button_hutko_refund }}"><i class="fa-solid fa-undo"></i></button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<button type="button" class="btn btn-primary btn-sm btn-check-status" data-ref="{{ t.ref }}"><i class="fa-solid fa-sync"></i></button>
|
<button type="button" class="btn btn-primary btn-sm btn-check-status" data-ref="{{ t.ref }}" title="{{ button_hutko_status_check }}"><i class="fa-solid fa-sync"></i></button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="payload-{{ loop.index }}" class="collapse">
|
<tr id="payload-{{ loop.index }}" class="collapse">
|
||||||
@@ -50,7 +56,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Refund Form Section (Hidden by default, shown when Refund clicked) -->
|
<!-- Refund Form Section -->
|
||||||
<div id="refund-section" class="border p-3 bg-light mt-3" style="display:none;">
|
<div id="refund-section" class="border p-3 bg-light mt-3" style="display:none;">
|
||||||
<h5>{{ text_hutko_refund_title }} <span id="refund-ref-display" class="badge bg-dark"></span></h5>
|
<h5>{{ text_hutko_refund_title }} <span id="refund-ref-display" class="badge bg-dark"></span></h5>
|
||||||
<div class="row g-2 align-items-center">
|
<div class="row g-2 align-items-center">
|
||||||
@@ -78,13 +84,49 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
// CREATE NEW LINK
|
||||||
|
$('#button-create-link').on('click', function() {
|
||||||
|
var btn = $(this);
|
||||||
|
$.ajax({
|
||||||
|
url: '{{ create_link_url|raw }}',
|
||||||
|
type: 'post',
|
||||||
|
dataType: 'json',
|
||||||
|
beforeSend: function () {
|
||||||
|
btn.prop('disabled', true).html('<i class="fa-solid fa-spinner fa-spin"></i> {{ text_loading }}');
|
||||||
|
$('#create-link-response').html('');
|
||||||
|
},
|
||||||
|
complete: function () {
|
||||||
|
btn.prop('disabled', false).html('<i class="fa-solid fa-plus-circle"></i> {{ button_create_link }}');
|
||||||
|
},
|
||||||
|
success: function (json) {
|
||||||
|
if (json['error']) {
|
||||||
|
$('#create-link-response').html('<div class="alert alert-danger">' + json['error'] + '</div>');
|
||||||
|
}
|
||||||
|
if (json['success']) {
|
||||||
|
var html = '<div class="alert alert-success">';
|
||||||
|
html += json['success'] + '<br>';
|
||||||
|
html += '<strong>URL:</strong> <a href="' + json['url'] + '" target="_blank">' + json['url'] + '</a>';
|
||||||
|
html += ' <button class="btn btn-sm btn-light ms-2" onclick="navigator.clipboard.writeText(\'' + json['url'] + '\')"><i class="fa-solid fa-copy"></i> Copy</button>';
|
||||||
|
html += '</div>';
|
||||||
|
$('#create-link-response').html(html);
|
||||||
|
|
||||||
|
// Optional: reload page to see it in the table list after a delay
|
||||||
|
setTimeout(function(){ location.reload(); }, 3000);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, ajaxOptions, thrownError) {
|
||||||
|
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Show Refund Section
|
// Show Refund Section
|
||||||
$('.btn-refund-modal').on('click', function() {
|
$('.btn-refund-modal').on('click', function() {
|
||||||
var ref = $(this).data('ref');
|
var ref = $(this).data('ref');
|
||||||
var amt = parseFloat($(this).data('amount')); // simplistic parsing
|
var amt = parseFloat($(this).data('amount'));
|
||||||
$('#refund-ref-display').text(ref);
|
$('#refund-ref-display').text(ref);
|
||||||
$('#input-refund-ref').val(ref);
|
$('#input-refund-ref').val(ref);
|
||||||
$('#input-refund-amount').val(amt); // Pre-fill amount
|
$('#input-refund-amount').val(amt);
|
||||||
$('#refund-section').slideDown();
|
$('#refund-section').slideDown();
|
||||||
$('#hutko-refund-response').html('');
|
$('#hutko-refund-response').html('');
|
||||||
});
|
});
|
||||||
@@ -92,7 +134,6 @@ $('.btn-refund-modal').on('click', function() {
|
|||||||
// Execute Refund
|
// Execute Refund
|
||||||
$('#button-execute-refund').on('click', function () {
|
$('#button-execute-refund').on('click', function () {
|
||||||
if (!confirm('{{ text_confirm_refund }}')) return;
|
if (!confirm('{{ text_confirm_refund }}')) return;
|
||||||
|
|
||||||
var btn = $(this);
|
var btn = $(this);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ refund_url|raw }}',
|
url: '{{ refund_url|raw }}',
|
||||||
@@ -130,7 +171,6 @@ $('#button-execute-refund').on('click', function () {
|
|||||||
$('.btn-check-status').on('click', function () {
|
$('.btn-check-status').on('click', function () {
|
||||||
var btn = $(this);
|
var btn = $(this);
|
||||||
var ref = $(this).data('ref');
|
var ref = $(this).data('ref');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ status_url|raw }}',
|
url: '{{ status_url|raw }}',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
|
|||||||
Reference in New Issue
Block a user