sylius_grid:
    grids:
        sylius_admin_product_variant:
            driver:
                name: doctrine/orm
                options:
                    class: "%sylius.model.product_variant.class%"
                    repository:
                        method: createQueryBuilderByProductId
                        arguments: ["expr:service('sylius.context.locale').getLocaleCode()", $productId]
            sorting:
                position: asc
            fields:
                name:
                    type: twig
                    path: .
                    label: sylius.ui.name
                    options:
                        template: "@SyliusAdmin/product_variant/grid/field/name.html.twig"
                code:
                    type: string
                    label: sylius.ui.code
                enabled:
                    type: twig
                    label: sylius.ui.enabled
                    options:
                        template: "@SyliusAdmin/shared/grid/field/boolean.html.twig"
                        vars:
                            th_class: "text-center"
                inventory:
                    type: twig
                    path: .
                    label: sylius.ui.inventory
                    options:
                        template: "@SyliusAdmin/product_variant/grid/field/inventory.html.twig"
                        vars:
                            th_class: "text-center"
                position:
                    type: twig
                    label: sylius.ui.position
                    path: .
                    sortable: position
                    options:
                        template: "@SyliusAdmin/product_variant/grid/field/position.html.twig"
                        vars:
                            th_class: "text-center"
            filters:
                code:
                    type: string
                    label: sylius.ui.code
                name:
                    type: string
                    label: sylius.ui.name
                    options:
                        fields: [translation.name]
            actions:
                main:
                    generate:
                        type: generate_variants
                        options:
                            product: expr:service('sylius.repository.product').find($productId)
                    update_positions:
                        type: update_product_variant_positions
                    create:
                        type: create
                        options:
                            link:
                                parameters:
                                    productId: $productId
                item:
                    update:
                        type: update
                        options:
                            link:
                                parameters:
                                    id: resource.id
                                    productId: $productId
                    delete:
                        type: delete
                        options:
                            link:
                                parameters:
                                    id: resource.id
                                    productId: $productId
                bulk:
                    delete:
                        type: delete
                        options:
                            link:
                                parameters:
                                    productId: $productId
                subitem:
                    price_history:
                        type: price_history
                        label: sylius.ui.price_history
