-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hooks for refund payments on order
- Loading branch information
Showing
11 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/templates/order/admin/content/sections/payments/header/title.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="card-title"> | ||
{{ 'sylius_refund.ui.refund_payments'|trans }} | ||
</div> |
5 changes: 5 additions & 0 deletions
5
src/templates/order/admin/content/sections/payments/item/actions.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<td class="w-1"> | ||
<div class="d-flex gap-1 justify-content-end"> | ||
{% hook 'actions' %} | ||
</div> | ||
</td> |
9 changes: 9 additions & 0 deletions
9
src/templates/order/admin/content/sections/payments/item/actions/complete.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% set refund_payment = hookable_metadata.context.refund_payment %} | ||
|
||
{% if sylius_sm_can(refund_payment, constant('Sylius\\RefundPlugin\\StateResolver\\RefundPaymentTransitions::GRAPH'), constant('Sylius\\RefundPlugin\\StateResolver\\RefundPaymentTransitions::TRANSITION_COMPLETE')) %} | ||
<form action="{{ path('sylius_refund_complete_refund_payment', {'orderNumber': refund_payment.order.number, 'id': refund_payment.id}) }}" method="POST" {{ sylius_test_html_attribute('refund-complete-button') }}> | ||
<button type="submit" class="btn"> | ||
{{ ux_icon('tabler:check') }} {{ 'sylius.ui.complete'|trans }} | ||
</button> | ||
</form> | ||
{% endif %} |
7 changes: 7 additions & 0 deletions
7
src/templates/order/admin/content/sections/payments/item/amount.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% import '@SyliusAdmin/shared/helper/money.html.twig' as money %} | ||
|
||
{% set refund_payment = hookable_metadata.context.refund_payment %} | ||
|
||
<td class="py-2 text-end" {{ sylius_test_html_attribute('refund-payment-amount') }}> | ||
<strong>{{ money.format(refund_payment.amount, refund_payment.currencyCode) }}</strong> | ||
</td> |
5 changes: 5 additions & 0 deletions
5
src/templates/order/admin/content/sections/payments/item/name.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% set refund_payment = hookable_metadata.context.refund_payment %} | ||
|
||
<td class="py-2"> | ||
<strong {{ sylius_test_html_attribute('refundd-payment-method') }}>{{ refund_payment.paymentMethod }}</strong> | ||
</td> |
7 changes: 7 additions & 0 deletions
7
src/templates/order/admin/content/sections/payments/item/state.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% from '@SyliusAdmin/order/macro/order_payment_state_label.html.twig' import label %} | ||
|
||
{% set refund_payment = hookable_metadata.context.refund_payment %} | ||
|
||
<td class="w-1" {{ sylius_test_html_attribute('refund-state') }}> | ||
{{ label(refund_payment.state) }} | ||
</td> |
3 changes: 3 additions & 0 deletions
3
src/templates/order/admin/content/sections/payments/refund_header.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="card-header"> | ||
{% hook 'refund_header' %} | ||
</div> |
20 changes: 20 additions & 0 deletions
20
src/templates/order/admin/content/sections/payments/refund_items.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% set order = hookable_metadata.context.resource %} | ||
{% set refund_payments = get_all_refund_payments_by_order(order) %} | ||
|
||
<div class="py-3"> | ||
{% if order.hasPayments %} | ||
<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 } %} | ||
</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> |
9 changes: 8 additions & 1 deletion
9
...emplates/order/admin/refund/content/sections/form/table/body/item/refund_button.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
{% set unit = hookable_metadata.context.unit %} | ||
|
||
<td class="aligned collapsing"> | ||
<button data-refund="{{ unit_refund_left(unit.id, constant('Sylius\\RefundPlugin\\Model\\RefundType::ORDER_ITEM_UNIT'), unit.total) }}" type="button" class="ui button primary" {% if not can_unit_be_refunded(unit.id, constant('Sylius\\RefundPlugin\\Model\\RefundType::ORDER_ITEM_UNIT')) %}disabled{% endif %}> | ||
<button | ||
data-refund="{{ unit_refund_left(unit.id, constant('Sylius\\RefundPlugin\\Model\\RefundType::ORDER_ITEM_UNIT'), unit.total) }}" | ||
type="button" | ||
class="btn" | ||
{% if not can_unit_be_refunded(unit.id, constant('Sylius\\RefundPlugin\\Model\\RefundType::ORDER_ITEM_UNIT')) %}disabled{% endif %} | ||
{{ sylius_test_html_attribute('refund-item-button') }} | ||
> | ||
{{ ux_icon('tabler:truck') }} | ||
{{ 'sylius_refund.ui.refund'|trans }} | ||
</button> | ||
</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters