Skip to content

Commit

Permalink
refactor #187 Use Sylius UI instead of Sonata event (Prometee)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.0-dev branch.

Discussion
----------



Commits
-------

32dfc0f Remove sonata event and add sylius_ui config
65d4f2a Use format_date filter
  • Loading branch information
GSadee authored Oct 22, 2020
2 parents b1dd092 + 65d4f2a commit b9f05de
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
13 changes: 13 additions & 0 deletions src/Resources/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,16 @@ sylius_grid:
route: sylius_invoicing_plugin_admin_invoice_resend
parameters:
id: resource.id

sylius_ui:
events:
sylius.admin.order.show.summary:
blocks:
sylius_invoicing_plugin:
template: '@SyliusInvoicingPlugin/Order/Admin/fetchInvoices.html.twig'
priority: 15
sylius.shop.account.order.show.subcontent:
blocks:
sylius_invoicing_plugin:
template: '@SyliusInvoicingPlugin/Order/Shop/fetchInvoices.html.twig'
priority: 15
10 changes: 0 additions & 10 deletions src/Resources/config/services/ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@
<tag name="kernel.event_listener" event="sylius.menu.admin.main" method="__invoke" />
</service>

<service id="sylius_invoicing_plugin.block_event_listener.account.order_show" class="Sylius\Bundle\UiBundle\Block\BlockEventListener">
<argument>@SyliusInvoicingPlugin/Order/Shop/fetchInvoices.html.twig</argument>
<tag name="kernel.event_listener" event="sonata.block.event.sylius.shop.account.order.show.after_summary" method="onBlockEvent" />
</service>

<service id="sylius_invoicing_plugin.block_event_listener.order_show" class="Sylius\Bundle\UiBundle\Block\BlockEventListener">
<argument>@SyliusInvoicingPlugin/Order/Admin/fetchInvoices.html.twig</argument>
<tag name="kernel.event_listener" event="sonata.block.event.sylius.admin.order.show.after_summary" method="onBlockEvent" />
</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" />
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/Invoice/Download/pdf.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<td>
Invoice #{{ invoice.number }}<br>
Issued at: {{ invoice.issuedAt|date('Y-m-d H:i:s') }}<br>
Issued at: {{ invoice.issuedAt|format_datetime }}<br>
</td>
</tr>
</table>
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/Order/Admin/_invoices.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</td>
<td>{{ invoice.channel.name }}</td>
<td>
{{ invoice.issuedAt|date('d-m-Y') }}
{{ invoice.issuedAt|format_date }}
</td>
<td>
{% set path = path('sylius_invoicing_plugin_admin_invoice_download', { 'id': invoice.id }) %}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/Order/Admin/fetchInvoices.html.twig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ render(url('sylius_invoicing_plugin_admin_order_invoices_partial', {'orderNumber': block.settings.resource.number, 'template': '@SyliusInvoicingPlugin/Order/Admin/_invoices.html.twig'})) }}
{{ render(url('sylius_invoicing_plugin_admin_order_invoices_partial', {'orderNumber': order.number, 'template': '@SyliusInvoicingPlugin/Order/Admin/_invoices.html.twig'})) }}
2 changes: 1 addition & 1 deletion src/Resources/views/Order/Shop/_invoices.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{{ invoice.number }}
</td>
<td>
{{ invoice.issuedAt|date('d-m-Y') }}
{{ invoice.issuedAt|format_date }}
</td>
<td>
{% set path = path('sylius_invoicing_plugin_shop_invoice_download', { 'id': invoice.id }) %}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/Order/Shop/fetchInvoices.html.twig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ render(url('sylius_invoicing_plugin_shop_order_invoices_partial', {'orderNumber': block.settings.order.number, 'template': '@SyliusInvoicingPlugin/Order/Shop/_invoices.html.twig'})) }}
{{ render(url('sylius_invoicing_plugin_shop_order_invoices_partial', {'orderNumber': order.number, 'template': '@SyliusInvoicingPlugin/Order/Shop/_invoices.html.twig'})) }}

0 comments on commit b9f05de

Please sign in to comment.