Files
hutko/views/templates/admin/order_payment_refund.tpl
2025-06-02 11:24:18 +03:00

128 lines
8.5 KiB
Smarty

{*
* Hutko PrestaShop Module
*
* This template is used to display the Hutko payment refund tab content
* on the PrestaShop admin order details page.
* It lists all Hutko payments for the order and provides a refund button
* which opens a modal for amount and comment input.
*}
{if $hutkoPayments->count()}
<div class="panel">
<div class="panel-heading">
<i class="icon-dollar"></i> {l s='Hutko Payments & Refunds' d='Modules.Hutko.Admin'}
</div>
<div class="panel-body">
<div id="hutko_payments_list">
{* {if !empty($hutkoOrderPaymentStatus)}
<div class="alert alert-info" role="alert">
<p class="alert-text">
{$hutkoOrderPaymentStatus|nofilter}
</p>
</div>
{/if} *}
<div class="table-responsive">
<table class="table" id="hutko_payments_table">
<thead>
<tr>
<th>{l s='Transaction ID' d='Modules.Hutko.Admin'}</th>
<th>{l s='Amount' d='Modules.Hutko.Admin'}</th>
<th>{l s='Payment Date' d='Modules.Hutko.Admin'}</th>
<th>{l s='Actions' d='Modules.Hutko.Admin'}</th>
</tr>
</thead>
<tbody>
{foreach from=$hutkoPayments item='payment'}
<tr data-payment-id="{$payment->id}" data-payment-amount="{$payment->amount}">
<td>{$payment->transaction_id}</td>
<td>{displayPrice price=Tools::ps_round($payment->amount, 2) currency=$currency->id}
</td>
<td>{$payment->date_add|date_format:'%Y-%m-%d %H:%M:%S'}</td>
<td>
{if $payment->amount > 0}
<button type="button" class="btn btn-default btn-sm hutko-refund-btn"
data-toggle="modal" data-target="#hutkoRefundModal-{$payment->id}"
data-payment-id="{$payment->id}" data-payment-amount="{$payment->amount}">
<i class="icon-undo"></i> {l s='Refund' d='Modules.Hutko.Admin'}
</button>
{/if}
<form method="post" id="hutkoStatusForm-{$payment->id|intval}"></form>
<button type="submit" class="btn btn-default btn-sm hutko-status-btn"
form="hutkoStatusForm-{$payment->id|intval}"
{* data-toggle="modal" data-target="#hutkoStatusModal-{$payment->id}" *}
name="hutkoOrderStatus" value="{$payment->transaction_id|escape:'htmlall':'UTF-8'}"
data-hutkoOrderPaymentStatus="{$payment->id}">
<i class="icon-info"></i> {l s='Status' d='Modules.Hutko.Admin'}
</button>
<div class="modal fade" id="hutkoRefundModal-{$payment->id}" tabindex="-1" role="dialog"
aria-labelledby="hutkoRefundModalLabel-{$payment->id}" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="hutkoRefundForm-{$payment->id}" method="post">
<input type="hidden" name="id_order" value="{$id_order}">
<input type="hidden" name="action" value="process_refund">
<input type="hidden" name="orderPaymentId" value="{$payment->id}">
<div class="form-group">
<label
for="refund_amount">{l s='Refund Amount' d='Modules.Hutko.Admin'}
({$currency->sign})</label>
<div class="input-group">
<input type="number" value="{$payment->amount}" step="0.01"
min="0.01" max="{$payment->amount}" class="form-control"
id="refund_amount" name="refund_amount" required>
<span class="input-group-addon"
id="max_refund_amount_display"></span>
</div>
<small
class="form-text text-muted">{l s='Enter the amount to refund for this payment.' d='Modules.Hutko.Admin'}</small>
</div>
<div class="form-group">
<label
for="refund_comment">{l s='Refund Reason/Comment' d='Modules.Hutko.Admin'}</label>
<textarea class="form-control" id="refund_comment"
maxlength="1024" name="comment" rows="3"></textarea>
<small
class="form-text text-muted">{l s='Optional: A brief reason for the refund.' d='Modules.Hutko.Admin'}</small>
</div>
</form>
<div id="hutko_refund_message" class="alert hidden" role="alert"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{l s='Cancel' d='Modules.Hutko.Admin'}</button>
<button class="btn btn-primary" name="hutkoRefundsubmit"
form="hutkoRefundForm-{$payment->id}"
type="submit">{l s='Process Refund' d='Modules.Hutko.Admin'}</button>
</div>
</div>
</div>
</div>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
</div>
{/if}