diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b51c7f37..99ad644f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -268,9 +268,9 @@ jobs: name: Run Behat run: | if [ "${{ matrix.wkhtmltopdf }}" != "false" ]; then - 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" || 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 else - 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" || 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 fi - diff --git a/assets/entrypoint.js b/assets/entrypoint.js index c5e8cf09..866791ec 100644 --- a/assets/entrypoint.js +++ b/assets/entrypoint.js @@ -1 +1,3 @@ import './js/refund-button'; + +import './styles/main.scss'; diff --git a/assets/styles/main.scss b/assets/styles/main.scss new file mode 100644 index 00000000..86d0c649 --- /dev/null +++ b/assets/styles/main.scss @@ -0,0 +1 @@ +@import 'refund'; diff --git a/assets/styles/refund.scss b/assets/styles/refund.scss new file mode 100644 index 00000000..bba7f4b1 --- /dev/null +++ b/assets/styles/refund.scss @@ -0,0 +1,4 @@ +textarea.refund-comment { + min-height: 4rem; + height: 4rem; +} diff --git a/config/twig_hooks/admin/order/refund/show.yaml b/config/twig_hooks/admin/order/refund/show.yaml index 51a83fc8..190ae2d6 100644 --- a/config/twig_hooks/admin/order/refund/show.yaml +++ b/config/twig_hooks/admin/order/refund/show.yaml @@ -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 diff --git a/config/twig_hooks/admin/order/show.yaml b/config/twig_hooks/admin/order/show.yaml index d5256e70..572b2ff5 100644 --- a/config/twig_hooks/admin/order/show.yaml +++ b/config/twig_hooks/admin/order/show.yaml @@ -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 diff --git a/templates/admin/credit_memo/show/content/sections/memo_details/table.html.twig b/templates/admin/credit_memo/show/content/sections/memo_details/table.html.twig index 33dc94ad..6eb21cca 100644 --- a/templates/admin/credit_memo/show/content/sections/memo_details/table.html.twig +++ b/templates/admin/credit_memo/show/content/sections/memo_details/table.html.twig @@ -1,3 +1,5 @@ - - {% hook 'table' %} -
+
+ + {% hook 'table' %} +
+
diff --git a/templates/admin/order/content/sections/payments.html.twig b/templates/admin/order/content/sections/payments.html.twig new file mode 100644 index 00000000..35a6d608 --- /dev/null +++ b/templates/admin/order/content/sections/payments.html.twig @@ -0,0 +1,6 @@ +{% set order = hookable_metadata.context.resource %} +{% set refund_payments = get_all_refund_payments_by_order(order) %} + +
+ {% hook 'payments' with { refund_payments } %} +
diff --git a/templates/admin/order/content/sections/payments/refund_header.html.twig b/templates/admin/order/content/sections/payments/refund_header.html.twig index 64239f4f..cb67e3a3 100644 --- a/templates/admin/order/content/sections/payments/refund_header.html.twig +++ b/templates/admin/order/content/sections/payments/refund_header.html.twig @@ -1,3 +1,7 @@ -
- {% hook 'refund_header' %} -
+{% set refund_payments = hookable_metadata.context.refund_payments %} + +{% if refund_payments|length > 0 %} +
+ {% hook 'refund_header' %} +
+{% endif %} diff --git a/templates/admin/order/content/sections/payments/refund_items.html.twig b/templates/admin/order/content/sections/payments/refund_items.html.twig index e6d79785..2bd0c0ee 100644 --- a/templates/admin/order/content/sections/payments/refund_items.html.twig +++ b/templates/admin/order/content/sections/payments/refund_items.html.twig @@ -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 %} -
- {% if order.hasPayments %} +{% if refund_payments|length > 0 %} +
{% for refund_payment in refund_payments %} - {% hook 'refund_item' with { resource: order, refund_payment } %} + {% hook 'refund_item' with { refund_payment } %} {% endfor %}
- {% else %} - {{ 'sylius.ui.no_payments'|trans }} - {% endif %} -
+
+{% endif %} diff --git a/templates/admin/order/refund/content/sections/form/fields/comment.html.twig b/templates/admin/order/refund/content/sections/form/fields/comment.html.twig index 87eebf58..327bbba0 100644 --- a/templates/admin/order/refund/content/sections/form/fields/comment.html.twig +++ b/templates/admin/order/refund/content/sections/form/fields/comment.html.twig @@ -1,6 +1,6 @@ -
+
- +
diff --git a/templates/admin/order/refund/content/sections/form/fields/payment_method.html.twig b/templates/admin/order/refund/content/sections/form/fields/payment_method.html.twig index fa229325..452cff0d 100644 --- a/templates/admin/order/refund/content/sections/form/fields/payment_method.html.twig +++ b/templates/admin/order/refund/content/sections/form/fields/payment_method.html.twig @@ -3,7 +3,7 @@ {% set payment_methods = hookable_metadata.context.payment_methods %} {% set original_payment_method = order.lastPayment(completed).method %} -
+