Skip to content

Commit

Permalink
Merge pull request #338 from GSadee/replace-custom-grid-invoice-chann…
Browse files Browse the repository at this point in the history
…el-filter

[Admin] Replace custom invoice_channel filter with entity filter from GridBundle
  • Loading branch information
Wojdylak authored Nov 20, 2024
2 parents 4bea6d1 + c46dd31 commit dc2ec13
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 97 deletions.
15 changes: 15 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@
- `@SyliusInvoicingPlugin/Invoice/Grid/Field/orderNumber.html.twig`
- `@SyliusInvoicingPlugin/Invoice/Grid/Field/channel.html.twig`

1. The custom `invoice_channel` filter, its `Sylius\InvoicingPlugin\Grid\Filter\ChannelFilter` class
and `Sylius\InvoicingPlugin\Form\Type\ChannelFilterType` form type have been removed and replaced by
the `entity` filter from GridBundle.

1. The invoice grid configuration has been updated accordingly to the above changes:

```diff
sylius_grid:
- templates:
- filter:
- invoice_channel: '@SyliusInvoicingPlugin/Grid/Filter/channel.html.twig'
grids:
sylius_invoicing_plugin_invoice:
# ...
Expand All @@ -52,5 +59,13 @@
options:
- template: "@SyliusInvoicingPlugin/Invoice/Grid/Field/channel.html.twig"
+ template: "@SyliusAdmin/Order/Grid/Field/channel.html.twig"
filters:
# ...
channel:
- type: invoice_channel
+ type: entity
label: sylius.ui.channel
+ form_options:
+ class: "%sylius.model.channel.class%"
# ...
```
48 changes: 0 additions & 48 deletions src/Form/Type/ChannelFilterType.php

This file was deleted.

32 changes: 0 additions & 32 deletions src/Grid/Filter/ChannelFilter.php

This file was deleted.

7 changes: 3 additions & 4 deletions src/Resources/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ winzou_state_machine:
args: ['object']

sylius_grid:
templates:
filter:
invoice_channel: '@SyliusInvoicingPlugin/Grid/Filter/channel.html.twig'
grids:
sylius_invoicing_plugin_invoice:
driver:
Expand Down Expand Up @@ -81,8 +78,10 @@ sylius_grid:
type: date
label: sylius_invoicing.ui.issued_at
channel:
type: invoice_channel
type: entity
label: sylius.ui.channel
form_options:
class: "%sylius.model.channel.class%"
actions:
item:
show:
Expand Down
9 changes: 0 additions & 9 deletions src/Resources/config/services/ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,5 @@
<service id="sylius_invoicing_plugin.ui.menu.admin_menu_listener" class="Sylius\InvoicingPlugin\Ui\Menu\AdminMenuListener">
<tag name="kernel.event_listener" event="sylius.menu.admin.main" method="__invoke" />
</service>

<service id="sylius_invoicing_plugin.form.type.channel_filter" class="Sylius\InvoicingPlugin\Form\Type\ChannelFilterType">
<argument type="service" id="sylius.repository.channel" />
<tag name="form.type" />
</service>

<service id="sylius_invoicing_plugin.grid.filter.channel" class="Sylius\InvoicingPlugin\Grid\Filter\ChannelFilter">
<tag name="sylius.grid_filter" type="invoice_channel" form_type="Sylius\InvoicingPlugin\Form\Type\ChannelFilterType" />
</service>
</services>
</container>
3 changes: 0 additions & 3 deletions src/Resources/views/Grid/Filter/channel.html.twig

This file was deleted.

2 changes: 1 addition & 1 deletion tests/Behat/Page/Admin/Invoice/IndexPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public function hasInvoiceWithChannel(int $index, string $channel): bool

public function filterByChannel(string $channelName): void
{
$this->getDocument()->find('css', '#criteria_channel_channel')->selectOption($channelName);
$this->getDocument()->find('css', '#criteria_channel')->selectOption($channelName);
}
}

0 comments on commit dc2ec13

Please sign in to comment.