# This file is part of the Sylius package.
# (c) Sylius Sp. z o.o.

sylius_grid:
    grids:
        sylius_shop_account_order:
            driver:
                name: doctrine/orm
                options:
                    class: "%sylius.model.order.class%"
                    repository:
                        method: createByCustomerAndChannelIdQueryBuilder
                        arguments:
                            - "expr:service('sylius.context.customer').getCustomer().getId()"
                            - "expr:service('sylius.context.channel').getChannel().getId()"
            sorting:
                checkoutCompletedAt: desc
            fields:
                number:
                    type: twig
                    label: sylius.ui.number
                    sortable: ~
                    options:
                        template: "@SyliusShop/account/order/grid/field/number.html.twig"
                checkoutCompletedAt:
                    type: datetime
                    label: sylius.ui.date
                    sortable: ~
                    options:
                        format: m/d/Y
                shippingAddress:
                    type: twig
                    label: sylius.ui.ship_to
                    options:
                        template: "@SyliusShop/account/order/grid/field/address.html.twig"
                total:
                    type: twig
                    label: sylius.ui.total
                    path: .
                    sortable: total
                    options:
                        template: "@SyliusShop/account/order/grid/field/total.html.twig"
                state:
                    type: twig
                    label: sylius.ui.state
                    sortable: ~
                    options:
                        template: "@SyliusUi/grid/field/label.html.twig"
                        vars:
                            labels: "@SyliusShop/account/order/label/state"
            actions:
                item:
                    show:
                        type: shop_show
                        label: sylius.ui.show
                        options:
                            link:
                                route: sylius_shop_account_order_show
                                parameters:
                                    number: resource.number
                    pay:
                        type: shop_pay
                        label: sylius.ui.pay
                        options:
                            link:
                                route: sylius_shop_order_show
                                parameters:
                                    tokenValue: resource.tokenValue
