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 14, 2020
1 parent 63842d4 commit 00c6a35
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 78 deletions.
4 changes: 2 additions & 2 deletions migrations/Version20191230121402.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class Version20191230121402 extends AbstractMigration
{
public function up(Schema $schema) : void
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

Expand All @@ -29,7 +29,7 @@ public function up(Schema $schema) : void
$this->addSql('CREATE INDEX IDX_5C4F33318D9F6D38 ON sylius_refund_credit_memo (order_id)');
}

public function down(Schema $schema) : void
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

Expand Down
2 changes: 1 addition & 1 deletion spec/Entity/CreditMemoSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function it_has_number(): void
$this->getNumber()->shouldReturn('2018/07/00003333');
}

function it_has_order(OrderInterface $order): void
function it_has_an_order(OrderInterface $order): void
{
$this->getOrder()->shouldReturn($order);
}
Expand Down
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
3 changes: 1 addition & 2 deletions src/Resources/config/app/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ sylius_grid:
type: string
label: sylius.ui.number
sortable: ~
orderNumber:
order:
type: twig
label: sylius.ui.order
path: order.number
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.id}) }}">#{{ data.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
1 change: 0 additions & 1 deletion tests/Behat/Resources/suites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ default:
- sylius.behat.context.transform.lexical
- sylius.behat.context.transform.order
- sylius.behat.context.transform.payment
- sylius.behat.context.transform.payment
- sylius.behat.context.transform.product
- sylius.behat.context.transform.promotion
- sylius.behat.context.transform.shared_storage
Expand Down

0 comments on commit 00c6a35

Please sign in to comment.