Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
<label for="payment-methods">{{ 'sylius.ui.payment_method'|trans }}</label>
<select id="payment-methods" name="sylius_refund_payment_method" class="ui fluid selection dropdown">
{% for payment_method in payment_methods %}
<option value="{{ payment_method.id }}" {{ (payment_method.code == original_payment_method.code) ? 'selected="selected"' : '' }}>
{% set selected = original_payment_method is not null and payment_method.code == original_payment_method.code %}
<option value="{{ payment_method.id }}" {{ selected ? 'selected="selected"' : '' }}>
{{ payment_method.name }}
</option>
{% endfor %}
</select>
<small id="original-payment-method">{{ 'sylius.ui.original_payment_method'|trans }}: <strong>{{ original_payment_method }}</strong></small>
{% if original_payment_method is not null %}
<small id="original-payment-method">{{ 'sylius.ui.original_payment_method'|trans }}: <strong>{{ original_payment_method }}</strong></small>
{% endif %}
</div>
</div>
24 changes: 15 additions & 9 deletions src/Resources/views/_paymentMethod.html.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
{% if order.payments.first() %}
{% set completed = constant('Sylius\\Component\\Core\\Model\\PaymentInterface::STATE_COMPLETED') %}
{% set original_payment_method = order.lastPayment(completed).method %}
<div class="ui hidden divider"></div>
{% set completed = constant('Sylius\\Component\\Core\\Model\\PaymentInterface::STATE_COMPLETED') %}
{% set last_completed_payment = order.lastPayment(completed) %}
{% set lat_payment = order.lastPayment %}
{% if last_completed_payment is not null %}
{% set original_payment_method = last_completed_payment.method %}
{% elseif last_payment is not null %}
{% set original_payment_method = last_payment.method %}
{% else %}
{% set original_payment_method = null %}
{% endif %}

<div class="ui stackable grid">
<div class="two column row">
{{ sylius_template_event('sylius_refund.admin.order.refund.form.payment_method', _context) }}
</div>
<div class="ui hidden divider"></div>
<div class="ui stackable grid">
<div class="two column row">
{{ sylius_template_event('sylius_refund.admin.order.refund.form.payment_method', _context) }}
</div>
{% endif %}
</div>