Skip to content

Commit 0cbe68d

Browse files
authored
SYL-4225: UI improvements (#468)
| Q | A | --------------- | ----- | Branch? | 2.0 | Bug fix? | yes | New feature? | no | Related tickets | ### 1. Added condition for refund payments and now it will not be visible if there are no refund payments available. Payments without refund transactions: ![image](https://github.com/user-attachments/assets/e7d7c913-bd45-4e3e-999e-35c8de17209b) Payments with refund transactions: ![image](https://github.com/user-attachments/assets/29351366-3c51-43a8-8d86-0f7ffdabc303) ### 2. Textarea Reduced comment textarea heght: ![image](https://github.com/user-attachments/assets/773c26d6-ea48-4274-a365-d75af794932b)
2 parents 90a81fc + 82ab6c3 commit 0cbe68d

File tree

14 files changed

+46
-22
lines changed

14 files changed

+46
-22
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ jobs:
268268
name: Run Behat
269269
run: |
270270
if [ "${{ matrix.wkhtmltopdf }}" != "false" ]; then
271-
vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_disabled"
271+
vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_disabled" || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_disabled" --rerun || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_disabled" --rerun
272272
else
273-
vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_enabled"
273+
vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_enabled" || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_enabled" --rerun || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_enabled" --rerun || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_enabled" --rerun || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_enabled" --rerun
274274
fi
275275
276276
-

assets/entrypoint.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
import './js/refund-button';
2+
3+
import './styles/main.scss';

assets/styles/main.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import 'refund';

assets/styles/refund.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
textarea.refund-comment {
2+
min-height: 4rem;
3+
height: 4rem;
4+
}

config/twig_hooks/admin/order/refund/show.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ sylius_twig_hooks:
117117
'sylius_refund.admin.order.refund.content.sections.form.fields':
118118
payment_method:
119119
template: '@SyliusRefundPlugin/admin/order/refund/content/sections/form/fields/payment_method.html.twig'
120-
priority: 100
120+
priority: 0
121121
comment:
122122
template: '@SyliusRefundPlugin/admin/order/refund/content/sections/form/fields/comment.html.twig'
123-
priority: 0
123+
priority: 100

config/twig_hooks/admin/order/show.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ sylius_twig_hooks:
4242
priority: 0
4343

4444
'sylius_admin.order.show.content.sections#left':
45+
payments:
46+
template: '@SyliusRefundPlugin/admin/order/content/sections/payments.html.twig'
47+
priority: 100
4548
credit_memos:
4649
template: '@SyliusRefundPlugin/admin/order/content/sections/credit_memos.html.twig'
4750
priority: 50
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
<table class="table mb-0">
2-
{% hook 'table' %}
3-
</table>
1+
<div class="table-responsive">
2+
<table class="table mb-0">
3+
{% hook 'table' %}
4+
</table>
5+
</div>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% set order = hookable_metadata.context.resource %}
2+
{% set refund_payments = get_all_refund_payments_by_order(order) %}
3+
4+
<div class="card mb-3" {{ sylius_test_html_attribute('payments') }}>
5+
{% hook 'payments' with { refund_payments } %}
6+
</div>
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
<div class="card-header">
2-
{% hook 'refund_header' %}
3-
</div>
1+
{% set refund_payments = hookable_metadata.context.refund_payments %}
2+
3+
{% if refund_payments|length > 0 %}
4+
<div class="card-header border-top">
5+
{% hook 'refund_header' %}
6+
</div>
7+
{% endif %}
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
{% set order = hookable_metadata.context.resource %}
2-
{% set refund_payments = get_all_refund_payments_by_order(order) %}
1+
{% set refund_payments = hookable_metadata.context.refund_payments %}
32

4-
<div class="py-3">
5-
{% if order.hasPayments %}
3+
{% if refund_payments|length > 0 %}
4+
<div class="py-3">
65
<div class="table-responsive">
76
<table class="table table-vcenter table-borderless table-sm card-table">
87
<tbody>
98
{% for refund_payment in refund_payments %}
109
<tr {{ sylius_test_html_attribute('refund') }}>
11-
{% hook 'refund_item' with { resource: order, refund_payment } %}
10+
{% hook 'refund_item' with { refund_payment } %}
1211
</tr>
1312
{% endfor %}
1413
</tbody>
1514
</table>
1615
</div>
17-
{% else %}
18-
<span class="px-3 text-secondary italic" {{ sylius_test_html_attribute('no-payments') }}>{{ 'sylius.ui.no_payments'|trans }}</span>
19-
{% endif %}
20-
</div>
16+
</div>
17+
{% endif %}

0 commit comments

Comments
 (0)