Skip to content

Commit

Permalink
Add breadcrumb for credit memo, fix refund breadcrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKasp committed Jan 13, 2020
1 parent 63842d4 commit 7bd9ed7
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 73 deletions.
10 changes: 0 additions & 10 deletions src/Resources/config/admin_routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,3 @@ sylius_refund_admin_credit_memo_send:
methods: [GET]
defaults:
_controller: Sylius\RefundPlugin\Action\Admin\SendCreditMemoAction

sylius_refund_admin_order_show_by_number:
path: /orders/by-number/{number}
methods: [GET]
defaults:
_controller: Sylius\RefundPlugin\Ui\RedirectToOrderShowAction
_sylius:
section: admin
permission: true
alias: refund_plugin
2 changes: 1 addition & 1 deletion src/Resources/config/app/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ sylius_grid:
orderNumber:
type: twig
label: sylius.ui.order
path: order.number
path: .
sortable: ~
options:
template: "@SyliusRefundPlugin/Order/Grid/Field/number.html.twig"
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/doctrine/CreditMemo.orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<join-column name="channel_id" referenced-column-name="id" nullable="true" />
</many-to-one>

<many-to-one field="order" target-entity="Sylius\Component\Core\Model\OrderInterface">
<many-to-one field="order" target-entity="Sylius\Component\Order\Model\OrderInterface">
<join-column name="order_id" referenced-column-name="id" nullable="true" />
</many-to-one>

Expand Down
5 changes: 0 additions & 5 deletions src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@
<argument type="service" id="sylius.manager.order" />
</service>

<service id="Sylius\RefundPlugin\Ui\RedirectToOrderShowAction">
<argument type="service" id="router" />
<argument type="service" id="sylius.repository.order" />
</service>

<service id="Sylius\RefundPlugin\Checker\OrderFullyRefundedTotalChecker">
<argument type="service" id="Sylius\RefundPlugin\Provider\OrderRefundedTotalProvider" />
</service>
Expand Down
12 changes: 12 additions & 0 deletions src/Resources/views/Order/Admin/CreditMemo/_breadcrumb.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% import '@SyliusAdmin/Macro/breadcrumb.html.twig' as breadcrumb %}

{% set breadcrumbs = [
{ label: 'sylius.ui.administration'|trans, url: path('sylius_admin_dashboard') },
{ label: 'sylius.ui.orders'|trans, url: path('sylius_admin_order_index') },
{ label: '#' ~ credit_memo.order.number, url: path('sylius_admin_order_show', {'id': credit_memo.order.id}) },
{ label: 'sylius_refund.ui.credit_memo'|trans },
{ label: credit_memo.number },
]
%}

{{ breadcrumb.crumble(breadcrumbs) }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<div class="ui stackable two column grid">
<div class="eight wide column">
{% include '@SyliusRefundPlugin/Order/Admin/CreditMemo/_header.html.twig' %}
{% include '@SyliusRefundPlugin/Order/Admin/CreditMemo/_breadcrumb.html.twig' %}
</div>
<div class="eight wide right aligned column">
{{ buttons.default(
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/Order/Grid/Field/number.html.twig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a href="{{ path('sylius_refund_admin_order_show_by_number', {'number': data}) }}">#{{ data }}</a>
<a href="{{ path('sylius_admin_order_show', {'id': data.order.id}) }}">#{{ data.order.number }}</a>
11 changes: 11 additions & 0 deletions src/Resources/views/_breadcrumb.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% import '@SyliusAdmin/Macro/breadcrumb.html.twig' as breadcrumb %}

{% set breadcrumbs = [
{ label: 'sylius.ui.administration'|trans, url: path('sylius_admin_dashboard') },
{ label: 'sylius.ui.orders'|trans, url: path('sylius_admin_order_index') },
{ label: '#' ~ order.number, url: path('sylius_admin_order_show', {'id': order.id}) },
{ label: 'sylius_refund.ui.refund'|trans },
]
%}

{{ breadcrumb.crumble(breadcrumbs) }}
2 changes: 1 addition & 1 deletion src/Resources/views/orderRefunds.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{% block content %}
{% include '@SyliusRefundPlugin/_header.html.twig' %}
{% include '@SyliusAdmin/Order/Show/_breadcrumb.html.twig' %}
{% include '@SyliusRefundPlugin/_breadcrumb.html.twig' %}

<div class="ui stackable grid">
<div class="sixteen wide column">
Expand Down
51 changes: 0 additions & 51 deletions src/Ui/RedirectToOrderShowAction.php

This file was deleted.

3 changes: 0 additions & 3 deletions tests/Application/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@ doctrine:
charset: UTF8

url: '%env(resolve:DATABASE_URL)%'
orm:
resolve_target_entities:
Sylius\Component\Core\Model\OrderInterface: Sylius\Component\Core\Model\Order

0 comments on commit 7bd9ed7

Please sign in to comment.