first commit
This commit is contained in:
151
admin/view/template/payment/hutko.twig
Normal file
151
admin/view/template/payment/hutko.twig
Normal file
@@ -0,0 +1,151 @@
|
||||
{{ header }}{{ column_left }}
|
||||
<div id="content">
|
||||
<div class="page-header">
|
||||
<div class="container-fluid">
|
||||
<div class="float-end">
|
||||
<button type="submit" form="form-payment" data-bs-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary">
|
||||
<i class="fa-solid fa-save"></i>
|
||||
</button>
|
||||
<a href="{{ back }}" data-bs-toggle="tooltip" title="{{ button_back }}" class="btn btn-light">
|
||||
<i class="fa-solid fa-reply"></i>
|
||||
</a>
|
||||
</div>
|
||||
<h1>{{ heading_title }}</h1>
|
||||
<ol class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
{{ text_edit }}</div>
|
||||
<div class="card-body">
|
||||
<form id="form-payment" action="{{ save }}" method="post" data-oc-toggle="ajax">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a href="#tab-general" data-bs-toggle="tab" class="nav-link active">{{ tab_general }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#tab-status" data-bs-toggle="tab" class="nav-link">{{ tab_order_statuses }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#tab-advanced" data-bs-toggle="tab" class="nav-link">{{ tab_advanced }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#tab-logs" data-bs-toggle="tab" class="nav-link">{{ tab_logs }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="tab-general" class="tab-pane active">
|
||||
<div class="row mb-3 required">
|
||||
<label for="input-merchant-id" class="col-sm-2 col-form-label">{{ entry_merchant_id }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="payment_hutko_merchant_id" value="{{ payment_hutko_merchant_id }}" placeholder="{{ entry_merchant_id }}" id="input-payment-hutko-merchant-id" class="form-control"/>
|
||||
<div id="error-payment-hutko-merchant-id" class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3 required">
|
||||
<label for="input-secret-key" class="col-sm-2 col-form-label">{{ entry_secret_key }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="payment_hutko_secret_key" value="{{ payment_hutko_secret_key }}" placeholder="{{ entry_secret_key }}" id="input-payment-hutko-secret-key" class="form-control"/>
|
||||
<div id="error-payment-hutko-secret-key" class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="input-status" class="col-sm-2 col-form-label">{{ entry_status }}</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check form-switch form-switch-lg">
|
||||
<input type="hidden" name="payment_hutko_status" value="0"/>
|
||||
<input type="checkbox" name="payment_hutko_status" value="1" id="input-status" class="form-check-input" {% if payment_hutko_status %} checked {% endif %}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="input-sort-order" class="col-sm-2 col-form-label">{{ entry_sort_order }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="payment_hutko_sort_order" value="{{ payment_hutko_sort_order }}" id="input-sort-order" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label">{{ entry_geo_zone }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="payment_hutko_geo_zone_id" id="input-geo-zone" class="form-select">
|
||||
<option value="0">{{ text_all_zones }}</option>
|
||||
{% for geo_zone in geo_zones %}
|
||||
<option value="{{ geo_zone.geo_zone_id }}" {% if geo_zone.geo_zone_id == payment_hutko_geo_zone_id %} selected {% endif %}>{{ geo_zone.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label">{{ entry_total }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="payment_hutko_total" value="{{ payment_hutko_total }}" placeholder="{{ entry_total }}" id="input-total" class="form-control"/>
|
||||
<div class="form-text">{{ help_total }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tab-status" class="tab-pane">
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label">{{ entry_new_order_status }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="payment_hutko_new_order_status_id" class="form-select">
|
||||
{% for status in order_statuses %}
|
||||
<option value="{{ status.order_status_id }}" {% if status.order_status_id == payment_hutko_new_order_status_id %} selected {% endif %}>{{ status.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Repeat logic for other statuses -->
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label">{{ entry_success_status }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="payment_hutko_success_status_id" class="form-select">
|
||||
{% for status in order_statuses %}
|
||||
<option value="{{ status.order_status_id }}" {% if status.order_status_id == payment_hutko_success_status_id %} selected {% endif %}>{{ status.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tab-advanced" class="tab-pane">
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label">{{ entry_shipping_include }}</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check form-switch">
|
||||
<input type="hidden" name="payment_hutko_shipping_include" value="0"/>
|
||||
<input type="checkbox" name="payment_hutko_shipping_include" value="1" class="form-check-input" {% if payment_hutko_shipping_include %} checked {% endif %}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label">{{ entry_save_logs }}</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check form-switch">
|
||||
<input type="hidden" name="payment_hutko_save_logs" value="0"/>
|
||||
<input type="checkbox" name="payment_hutko_save_logs" value="1" class="form-check-input" {% if payment_hutko_save_logs %} checked {% endif %}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tab-logs" class="tab-pane">
|
||||
<pre class="bg-light p-3 border">{{ log_content }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ footer }}
|
||||
101
admin/view/template/payment/hutko_order_info_panel.twig
Normal file
101
admin/view/template/payment/hutko_order_info_panel.twig
Normal file
@@ -0,0 +1,101 @@
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<i class="fa-solid fa-credit-card"></i> {{ text_payment_information }} (Hutko)
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<td>{{ text_hutko_transaction_ref_label }}</td>
|
||||
<td>{{ hutko_transaction_ref_display }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{% if hutko_transaction_ref_display != text_not_available %}
|
||||
<hr>
|
||||
<h5>{{ text_hutko_refund_title }}</h5>
|
||||
<div class="row g-3 align-items-center mb-3">
|
||||
<div class="col-auto">
|
||||
<input type="text" id="input-refund-amount" class="form-control" placeholder="{{ entry_refund_amount }}">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<input type="text" id="input-refund-comment" class="form-control" placeholder="{{ entry_refund_comment }}">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button type="button" id="button-hutko-refund" class="btn btn-warning">{{ button_hutko_refund }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="hutko-refund-response"></div>
|
||||
|
||||
<hr>
|
||||
<h5>{{ text_hutko_status_title }}</h5>
|
||||
<button type="button" id="button-hutko-status" class="btn btn-info text-white">{{ button_hutko_status_check }}</button>
|
||||
<div id="hutko-status-response" class="mt-2"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#button-hutko-refund').on('click', function () {
|
||||
if (!confirm('{{ text_confirm_refund }}')) return;
|
||||
|
||||
var btn = $(this);
|
||||
$.ajax({
|
||||
url: '{{ hutko_refund_action_url|raw }}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'refund_amount': $('#input-refund-amount').val(),
|
||||
'refund_comment': $('#input-refund-comment').val(),
|
||||
'order_id': {{ order_id }}
|
||||
},
|
||||
beforeSend: function () {
|
||||
btn.prop('disabled', true);
|
||||
$('#hutko-refund-response').html('');
|
||||
},
|
||||
complete: function () {
|
||||
btn.prop('disabled', false);
|
||||
},
|
||||
success: function (json) {
|
||||
if (json['error']) {
|
||||
$('#hutko-refund-response').html('<div class="alert alert-danger">' + json['error'] + '</div>');
|
||||
}
|
||||
if (json['success']) {
|
||||
$('#hutko-refund-response').html('<div class="alert alert-success">' + json['success'] + '</div>');
|
||||
setTimeout(function(){ location.reload(); }, 2000);
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#button-hutko-status').on('click', function () {
|
||||
var btn = $(this);
|
||||
$.ajax({
|
||||
url: '{{ hutko_status_action_url|raw }}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {'hutko_transaction_ref': '{{ hutko_transaction_ref_display }}'},
|
||||
beforeSend: function () {
|
||||
btn.prop('disabled', true);
|
||||
$('#hutko-status-response').html('');
|
||||
},
|
||||
complete: function () {
|
||||
btn.prop('disabled', false);
|
||||
},
|
||||
success: function (json) {
|
||||
if (json['error']) {
|
||||
$('#hutko-status-response').html('<div class="alert alert-danger">' + json['error'] + '</div>');
|
||||
}
|
||||
if (json['success']) {
|
||||
let data = json['data'] ? JSON.stringify(json['data'], null, 2) : '';
|
||||
$('#hutko-status-response').html('<div class="alert alert-success">' + json['success'] + '<pre class="mt-2 bg-light p-2">' + data + '</pre></div>');
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user