Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions assets/entrypoint.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
import './js/refund-button';

import './styles/main.scss';
1 change: 1 addition & 0 deletions assets/styles/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'refund';
4 changes: 4 additions & 0 deletions assets/styles/refund.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
textarea.refund-comment {
min-height: 4rem;
height: 4rem;
}
4 changes: 2 additions & 2 deletions config/twig_hooks/admin/order/refund/show.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ sylius_twig_hooks:
'sylius_refund.admin.order.refund.content.sections.form.fields':
payment_method:
template: '@SyliusRefundPlugin/admin/order/refund/content/sections/form/fields/payment_method.html.twig'
priority: 100
priority: 0
comment:
template: '@SyliusRefundPlugin/admin/order/refund/content/sections/form/fields/comment.html.twig'
priority: 0
priority: 100
3 changes: 3 additions & 0 deletions config/twig_hooks/admin/order/show.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ sylius_twig_hooks:
priority: 0

'sylius_admin.order.show.content.sections#left':
payments:
template: '@SyliusRefundPlugin/admin/order/content/sections/payments.html.twig'
priority: 100
credit_memos:
template: '@SyliusRefundPlugin/admin/order/content/sections/credit_memos.html.twig'
priority: 50
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<table class="table mb-0">
{% hook 'table' %}
</table>
<div class="table-responsive">
<table class="table mb-0">
{% hook 'table' %}
</table>
</div>
6 changes: 6 additions & 0 deletions templates/admin/order/content/sections/payments.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% set order = hookable_metadata.context.resource %}
{% set refund_payments = get_all_refund_payments_by_order(order) %}

<div class="card mb-3" {{ sylius_test_html_attribute('payments') }}>
{% hook 'payments' with { refund_payments } %}
</div>
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<div class="card-header">
{% hook 'refund_header' %}
</div>
{% set refund_payments = hookable_metadata.context.refund_payments %}

{% if refund_payments|length > 0 %}
<div class="card-header border-top">
{% hook 'refund_header' %}
</div>
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
{% set order = hookable_metadata.context.resource %}
{% set refund_payments = get_all_refund_payments_by_order(order) %}
{% set refund_payments = hookable_metadata.context.refund_payments %}

<div class="py-3">
{% if order.hasPayments %}
{% if refund_payments|length > 0 %}
<div class="py-3">
<div class="table-responsive">
<table class="table table-vcenter table-borderless table-sm card-table">
<tbody>
{% for refund_payment in refund_payments %}
<tr {{ sylius_test_html_attribute('refund') }}>
{% hook 'refund_item' with { resource: order, refund_payment } %}
{% hook 'refund_item' with { refund_payment } %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<span class="px-3 text-secondary italic" {{ sylius_test_html_attribute('no-payments') }}>{{ 'sylius.ui.no_payments'|trans }}</span>
{% endif %}
</div>
</div>
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="col-12 col-md-6">
<div class="col-12 col-md-6 mb-3 mb-md-0">
<div class="field">
<label for="sylius-refund-comment" class="form-label">{{ 'sylius.ui.comment'|trans }}</label>
<textarea rows="3" name="sylius_refund_comment" id="sylius-refund-comment" class="form-control" style="height: 8rem;"></textarea>
<textarea rows="3" name="sylius_refund_comment" id="sylius-refund-comment" class="form-control refund-comment"></textarea>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% set payment_methods = hookable_metadata.context.payment_methods %}
{% set original_payment_method = order.lastPayment(completed).method %}

<div class="col-12 col-md-6 mb-3">
<div class="col-12 col-md-6">
<div class="field">
<label for="payment-methods" class="form-label">{{ 'sylius.ui.payment_method'|trans }}</label>
<select id="payment-methods" name="sylius_refund_payment_method" class="form-select mb-1">
Expand Down
4 changes: 4 additions & 0 deletions tests/Application/config/packages/_sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ sylius_twig_hooks:
'sylius_admin.base#javascripts':
app_javascripts:
template: 'admin/javascripts.html.twig'

'sylius_admin.base#stylesheets':
app_stylesheets:
template: 'admin/stylesheets.html.twig'
1 change: 1 addition & 0 deletions tests/Application/templates/admin/stylesheets.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ encore_entry_link_tags('app-admin-entry', null, 'app.admin') }}
Loading