Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,15 @@ jobs:
-
name: Run Behat
run: |
echo "➡️ Running PDF-specific scenarios"
if [ "${{ matrix.wkhtmltopdf }}" != "false" ]; then
vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_disabled" || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun;
vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags='@pdf_enabled' || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags='@pdf_enabled' --rerun
else
vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags="~@pdf_enabled" || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun;
vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags='@pdf_disabled' || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags='@pdf_disabled' --rerun
fi

echo "➡️ Running all remaining scenarios (excluding PDF-specific)"
vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags='~@pdf_enabled&&~@pdf_disabled' || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --tags='~@pdf_enabled&&~@pdf_disabled' --rerun

-
name: Upload Behat logs
Expand Down
5 changes: 5 additions & 0 deletions UPGRADE-2.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# UPGRADE FROM 2.0 TO 2.1

### Twig hooks
- `'sylius_admin.invoice.show.content.header.title_block.title.subtitle'`- hook has been deprecated and disabled. Content of this hook has been moved to `'sylius_admin.invoice.show.content.sections.details'`section
- `'sylius_admin.invoice.show.content.sections.card'`- hook has been deprecated and disabled. Content of this hook has been moved to `'sylius_admin.invoice.show.content.sections.details'`section
51 changes: 51 additions & 0 deletions config/twig_hooks/admin/invoice/show.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sylius_twig_hooks:
subtitle:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/header/title_block/title/subtitle.html.twig'
priority: 0
enabled: false

'sylius_admin.invoice.show.content.header.title_block.actions':
back_to_index:
Expand All @@ -34,6 +35,9 @@ sylius_twig_hooks:
priority: 0

'sylius_admin.invoice.show.content.sections':
details:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details.html.twig'
priority: 300
buyer:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/buyer.html.twig'
priority: 200
Expand All @@ -44,6 +48,52 @@ sylius_twig_hooks:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/card.html.twig'
priority: 0

'sylius_admin.invoice.show.content.sections.details':
date:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/date.html.twig'
priority: 300
order:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/order.html.twig'
priority: 200
channel:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/channel.html.twig'
priority: 100
paid:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/paid.html.twig'
priority: 0

'sylius_admin.invoice.show.content.sections.details.date':
label:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/date/label.html.twig'
priority: 100
value:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/date/value.html.twig'
priority: 0

'sylius_admin.invoice.show.content.sections.details.order':
label:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/order/label.html.twig'
priority: 100
value:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/order/value.html.twig'
priority: 0

'sylius_admin.invoice.show.content.sections.details.channel':
label:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/channel/label.html.twig'
priority: 100
value:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/channel/value.html.twig'
priority: 0

'sylius_admin.invoice.show.content.sections.details.paid':
label:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/paid/label.html.twig'
priority: 100
value:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/details/paid/value.html.twig'
priority: 0

'sylius_admin.invoice.show.content.sections.buyer':
first_name:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/buyer/first_name.html.twig'
Expand Down Expand Up @@ -94,6 +144,7 @@ sylius_twig_hooks:
footer:
template: '@SyliusInvoicingPlugin/admin/invoice/show/content/sections/card/footer.html.twig'
priority: 0
enabled: false

'sylius_admin.invoice.show.content.sections.card.body':
table:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Feature: Sending invoice when order is paid
@ui
Scenario: Receiving an email containing invoice when the order is paid
When the order "#00000666" has just been paid
Then an email containing invoice generated for order "#00000666" should be sent to "sylius@example.com"
Then an email containing invoice generated for order "#00000666" should be sent to "shop@example.com"

@ui
Scenario: Not receiving an email containing invoice when the order is not paid
When the order "#00000667" was cancelled
Then an email containing invoice generated for order "#00000667" should not be sent to "sylius@example.com"
Then an email containing invoice generated for order "#00000667" should not be sent to "shop@example.com"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<a {{ sylius_test_html_attribute('back') }} href="{{ path('sylius_invoicing_admin_invoice_index') }}" class="btn">
<a {{ sylius_test_html_attribute('back') }} href="{{ path('sylius_invoicing_admin_invoice_index') }}" class="btn btn-icon">
{{ ux_icon('tabler:arrow-left', {'class': 'icon'}) }}
</a>
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% deprecated 'The "subtitle.html.twig" template is deprecated. Content has been moved to details section.' %}

{% set invoice = hookable_metadata.context.resource %}

<div class="mt-1">
Expand Down
4 changes: 2 additions & 2 deletions templates/admin/invoice/show/content/sections/buyer.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="col">
<div class="card mb-3">
<div class="col-12 col-md-4 mb-3">
<div class="card h-full">
<div class="card-header">
<div class="card-title">
{{ 'sylius_invoicing.ui.buyer'|trans }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% set billing_data = hookable_metadata.context.resource.billingData %}

<strong>{{ billing_data.firstName }} {{ billing_data.lastName }}</strong>
<div>
<strong>{{ billing_data.firstName }} {{ billing_data.lastName }}</strong>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set invoice = hookable_metadata.context.resource %}

<div class="card mb-3 mb-2">
<div class="col-12">
{% hook 'card' %}
</div>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="card-body">
<div class="card">
{% hook 'body' %}
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="table-responsive">
<table class="table table-bordered table-striped table-sm">
<table class="table" {{ sylius_test_html_attribute('invoice-items') }}>
{% hook 'table' %}
</table>
</div>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<td>{{ hookable_metadata.context.resource.currencyCode }}</td>
<td class="text-center">{{ hookable_metadata.context.resource.currencyCode }}</td>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<td>{{ hookable_metadata.context.loop.index }}</td>
<td class="text-center">{{ hookable_metadata.context.loop.index }}</td>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th class="sylius-table-column-total" scope="col">{{ 'sylius.ui.currency'|trans }}</th>
<th class="sylius-table-column-total text-center text-wrap" scope="col">{{ 'sylius.ui.currency'|trans }}</th>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th class="sylius-table-column-discounted-unit-net-price" scope="col">{{ 'sylius_invoicing.ui.discounted_unit_net_price'|trans }}</th>
<th class="sylius-table-column-discounted-unit-net-price text-end text-wrap" scope="col">{{ 'sylius_invoicing.ui.discounted_unit_net_price'|trans }}</th>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th class="sylius-table-column-total" scope="col">{{ 'sylius_invoicing.ui.gross_value'|trans }}</th>
<th class="sylius-table-column-total text-end text-wrap" scope="col">{{ 'sylius_invoicing.ui.gross_value'|trans }}</th>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th class="sylius-table-column-name" scope="col">{{ 'sylius.ui.name'|trans }}</th>
<th class="sylius-table-column-name text-wrap" scope="col">{{ 'sylius.ui.name'|trans }}</th>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th class="sylius-table-column-subtotal" scope="col">{{ 'sylius_invoicing.ui.net_value'|trans }}</th>
<th class="sylius-table-column-subtotal text-end text-wrap" scope="col">{{ 'sylius_invoicing.ui.net_value'|trans }}</th>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th class="sylius-table-column-number" scope="col">{{ 'sylius_invoicing.ui.no'|trans }}</th>
<th class="sylius-table-column-number text-center text-wrap" scope="col">{{ 'sylius_invoicing.ui.no'|trans }}</th>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th class="sylius-table-column-quantity" scope="col">{{ 'sylius.ui.quantity'|trans }}</th>
<th class="sylius-table-column-quantity text-end text-wrap" scope="col">{{ 'sylius.ui.quantity'|trans }}</th>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th class="sylius-table-column-tax_total" scope="col">{{ 'sylius_invoicing.ui.tax_amount'|trans }}</th>
<th class="sylius-table-column-tax_total text-end text-wrap" scope="col">{{ 'sylius_invoicing.ui.tax_amount'|trans }}</th>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th class="sylius-table-column-tax-rate" scope="col">{{ 'sylius_invoicing.ui.tax_rate'|trans }}</th>
<th class="sylius-table-column-tax-rate text-end text-wrap" scope="col">{{ 'sylius_invoicing.ui.tax_rate'|trans }}</th>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th class="sylius-table-column-unit-net-price" scope="col">{{ 'sylius_invoicing.ui.unit_net_price'|trans }}</th>
<th class="sylius-table-column-unit-net-price text-end text-wrap" scope="col">{{ 'sylius_invoicing.ui.unit_net_price'|trans }}</th>
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% deprecated 'The "footer.html.twig" template is deprecated. Content has been moved to details section.' %}

<div class="card-footer text-end">
<div class="d-inline-block" {{ sylius_test_html_attribute('invoice-is-paid') }}>
<strong>{{ 'sylius_invoicing.ui.payment.paid'|trans }}: </strong>
Expand Down
14 changes: 14 additions & 0 deletions templates/admin/invoice/show/content/sections/details.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="col-12 col-md-4 mb-3">
<div class="card h-full">
<div class="card-header">
<div class="card-title">
{{ 'sylius.ui.details'|trans }}
</div>
</div>
<div class="card-body">
<table class="table table-sm table-borderless">
{% hook 'details' %}
</table>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<tr>
{% hook 'channel' %}
</tr>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<td><strong>{{ 'sylius_invoicing.ui.issued_from'|trans }}:</strong></td>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% set invoice = hookable_metadata.context.resource %}

<td {{ sylius_test_html_attribute('channel') }}>
{% include '@SyliusAdmin/shared/grid/field/channel.html.twig' with {'data': invoice.channel} %}
</td>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<tr>
{% hook 'date' %}
</tr>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<td><strong>{{ 'sylius_invoicing.ui.issued_at'|trans }}:</strong></td>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% set invoice = hookable_metadata.context.resource %}

<td><span {{ sylius_test_html_attribute('issued-at') }}>{{ invoice.issuedAt|format_datetime }}</span></td>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<tr>
{% hook 'order' %}
</tr>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<td><strong>{{ 'sylius_invoicing.ui.issued_for_order'|trans }}:</strong></td>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% set invoice = hookable_metadata.context.resource %}

<td>#{{ invoice.order.number }}</td>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<tr {{ sylius_test_html_attribute('invoice-is-paid') }}>
{% hook 'paid' %}
</tr>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<td><strong>{{ 'sylius_invoicing.ui.payment.paid'|trans }}: </strong></td>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% set invoice = hookable_metadata.context.resource %}
{% set payment_state_completed = constant('Sylius\\InvoicingPlugin\\Entity\\InvoiceInterface::PAYMENT_STATE_COMPLETED') %}

<td>
{% if invoice.paymentState == payment_state_completed %}
<span class="text-success">{{ 'sylius_invoicing.ui.payment.yes'|trans }}</span>
{% else %}
<span class="text-danger">{{ 'sylius_invoicing.ui.payment.no'|trans }}</span>
{% endif %}
</td>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% set shop_billing_data = hookable_metadata.context.resource.shopBillingData %}

{% if shop_billing_data %}
<div class="col">
<div class="card mb-3">
<div class="col-12 col-md-4 mb-3">
<div class="card h-full">
<div class="card-header">
<div class="card-title">
{{ 'sylius_invoicing.ui.seller'|trans }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{% set shop_billing_data = hookable_metadata.context.resource.shopBillingData %}

{% if shop_billing_data.company %}<strong>{{ shop_billing_data.company }}</strong>{% endif %}
{% if shop_billing_data.company %}
<div>
<strong>{{ shop_billing_data.company }}</strong>
</div>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
{{ 'sylius_invoicing.ui.invoices'|trans }}
</div>
</div>
<table class="table table-borderless align-middle mb-0">
{% hook 'table' %}
</table>
<div class="table-responsive">
<table class="table table-hover table-vcenter card-table">
{% hook 'table' %}
</table>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<td>
{% hook 'actions' %}
<div class="d-flex gap-1 justify-content-end">
{% hook 'actions' %}
</div>
</td>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<td {{ sylius_test_html_attribute('issued-at') }}>
<td class="text-end" {{ sylius_test_html_attribute('issued-at') }}>
{{ hookable_metadata.context.invoice.issuedAt|format_date }}
</td>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th>{{ 'sylius.ui.actions'|trans }}</th>
<th class="text-end">{{ 'sylius.ui.actions'|trans }}</th>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<th>{{ 'sylius_invoicing.ui.issued_at'|trans }}</th>
<th class="text-end">{{ 'sylius_invoicing.ui.issued_at'|trans }}</th>
5 changes: 5 additions & 0 deletions tests/Application/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=sync://
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=sync://
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=sync://
###< symfony/messenger ###

###> lexik/jwt-authentication-bundle ###
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private-test.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public-test.pem
###< lexik/jwt-authentication-bundle ###
7 changes: 4 additions & 3 deletions tests/Behat/Page/Admin/Invoice/ShowPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function getChannel(): string

public function download(): void
{
$this->getDocument()->clickLink('Download');
$this->getElement('download_button')->click();
}

public function resend(): void
Expand All @@ -165,7 +165,7 @@ public function isPaid(): bool

public function hasDownloadButton(): bool
{
return $this->getDocument()->hasLink('Download');
return $this->hasElement('download_button');
}

protected function getDefinedElements(): array
Expand All @@ -174,6 +174,7 @@ protected function getDefinedElements(): array
'back' => '[data-test-back]',
'billing_address' => '[data-test-billing-data]',
'channel' => '[data-test-channel]',
'download_button' => '[data-test-download-button]',
'invoice_net_total' => '[data-test-invoice-net-total]',
'invoice_net_total_currency_code' => '[data-test-invoice-net-total-currency-code]',
'invoice_taxes_total' => '[data-test-invoice-taxes-total]',
Expand All @@ -183,7 +184,7 @@ protected function getDefinedElements(): array
'issued_at' => '[data-test-issued-at]',
'paid' => '[data-test-invoice-is-paid]',
'shop_billing_data' => '[data-test-shop-billing-data]',
'table' => '.table',
'table' => '[data-test-invoice-items]',
]);
}

Expand Down