FEAT: [AdminBundle] #18994 extend orders grid in admin with indicator for guest or customer orders

refactor: use custom customer template for the orders grid

[Translations] update translations

[Behat] add test case

[Translation] adjust translation keys

[Translation] adjust translation keys
This commit is contained in:
Simon Krull 2026-04-29 18:38:32 +02:00 committed by Simon Krull
parent 0a6bb24f47
commit 63ba269684
7 changed files with 60 additions and 1 deletions

View file

@ -0,0 +1,25 @@
@managing_orders
Feature: Browsing orders with guest or customer type indicator
In order to distinguish guest orders from registered customer orders
As an Administrator
I want to see an indicator in the customer column of the orders grid
Background:
Given the store operates on a single channel in "United States"
And the store has a product "Sylius T-Shirt"
And the store ships everywhere for Free
And the store allows paying with "Cash on Delivery"
And I am logged in as an administrator
@ui
Scenario: Seeing a guest order indicator for an order placed by a guest
Given the guest customer placed order with "Sylius T-Shirt" product for "guest@example.com" and "United States" based billing address with "Free" shipping method and "Cash on Delivery" payment
When I browse orders
Then the order placed by "guest@example.com" should be marked as a guest order
@ui
Scenario: Seeing a customer order indicator for an order placed by a registered customer
Given there is a customer account "customer@example.com"
And there is a customer "customer@example.com" that placed order with "Sylius T-Shirt" product to "United States" based billing address with "Free" shipping method and "Cash on Delivery" payment method
When I browse orders
Then the order placed by "customer@example.com" should be marked as a customer order

View file

@ -209,6 +209,24 @@ final readonly class ManagingOrdersContext implements Context
Assert::true($this->indexPage->isSingleResourceOnPage(['customer' => $customer->getEmail()]));
}
#[Then('the order placed by :email should be marked as a guest order')]
public function theOrderPlacedByShouldBeMarkedAsGuestOrder(string $email): void
{
Assert::true($this->indexPage->isSingleResourceWithSpecificElementOnPage(
['customer' => $email],
'[data-test-order-customer-type="guest"]',
));
}
#[Then('the order placed by :email should be marked as a customer order')]
public function theOrderPlacedByShouldBeMarkedAsCustomerOrder(string $email): void
{
Assert::true($this->indexPage->isSingleResourceWithSpecificElementOnPage(
['customer' => $email],
'[data-test-order-customer-type="customer"]',
));
}
#[Then('I should not be able to resend the shipment confirmation email')]
public function iShouldNotBeAbleToResendTheShipmentConfirmationEmail(): void
{

View file

@ -34,8 +34,9 @@ sylius_grid:
type: twig
label: sylius.ui.customer
sortable: customer.lastName
path: .
options:
template: "@SyliusAdmin/shared/grid/field/customer.html.twig"
template: "@SyliusAdmin/order/grid/field/customer.html.twig"
vars:
th_class: "w-100"
channel:

View file

@ -0,0 +1,9 @@
{% set customer = data.customer %}
{% set created_by_guest = data.createdByGuest %}
<span data-bs-toggle="tooltip" data-bs-title="{{ (created_by_guest ? 'sylius.ui.created_by_guest' : 'sylius.ui.created_by_logged_in')|trans }}" {{ sylius_test_html_attribute('order-customer-type', created_by_guest ? 'guest' : 'customer') }}>
{{ ux_icon(created_by_guest ? 'tabler:spy' : 'tabler:user-check', { class: 'icon' }) }}
</span>
<strong>{{ customer.firstName }} {{ customer.lastName }}</strong>
<div class="fs-5 text-secondary">{{ customer.email }}</div>

View file

@ -236,6 +236,8 @@ sylius:
customize_metadata: 'Metadaten anpassen'
customize_products_metadata: 'Produkt-Metadaten anpassen'
customizing_metadata: 'Metadaten anpassen'
created_by_logged_in: 'Erstellt von einem angemeldeten Benutzer'
created_by_guest: 'Erstellt von einem Gast'
dashboard: 'Dashboard'
data: 'Daten'
date: 'Datum'

View file

@ -248,6 +248,8 @@ sylius:
customize_metadata: 'Customize metadata'
customize_products_metadata: 'Customize products metadata'
customizing_metadata: 'Customizing metadata'
created_by_logged_in: 'Created by logged-in'
created_by_guest: 'Created by guest'
dashboard: 'Dashboard'
data: 'Data'
date: 'Date'

View file

@ -244,6 +244,8 @@ sylius:
customize_metadata: 'Customize metadata'
customize_products_metadata: 'Customize products metadata'
customizing_metadata: 'Customizing metadata'
created_by_logged_in: 'Created by logged-in'
created_by_guest: 'Created by guest'
dashboard: 'Dashboard'
data: 'Data'
date: 'Date'