parameters:
    sylius_invoicing.invoice_save_path: "%kernel.project_dir%/private/invoices/"
    sylius_invoicing.filesystem_adapter.invoice: "sylius_invoicing_invoice"

sylius_invoicing:
    pdf_generator:
        allowed_files:
            - '%env(default:default_logo_file:resolve:SYLIUS_INVOICING_LOGO_FILE)%'

sylius_mailer:
    emails:
        invoice_generated:
            subject: sylius.emails.invoice_generated.subject
            template: "@SyliusInvoicingPlugin/Invoice/Email/invoiceGenerated.html.twig"

knp_snappy:
    pdf:
        enabled: true

winzou_state_machine:
    sylius_payment:
        callbacks:
            after:
                sylius_invoicing_plugin_payment_complete_producer:
                    on: ['complete']
                    do: ['@sylius_invoicing_plugin.event_producer.order_payment_paid', '__invoke']
                    args: ['object']

sylius_grid:
    templates:
        filter:
            invoice_channel: '@SyliusInvoicingPlugin/Grid/Filter/channel.html.twig'
    grids:
        sylius_invoicing_plugin_invoice:
            driver:
                name: doctrine/orm
                options:
                    class: '%sylius_invoicing_plugin.model.invoice.class%'
            sorting:
                issuedAt: desc
            fields:
                number:
                    type: string
                    label: sylius_invoicing_plugin.ui.invoice_number
                    sortable: true
                orderNumber:
                    type: twig
                    label: sylius.ui.order
                    options:
                        template: '@SyliusInvoicingPlugin/Invoice/Grid/Field/orderNumber.html.twig'
                    sortable: order.number
                channel:
                    type: twig
                    label: sylius.ui.channel
                    options:
                        template: "@SyliusInvoicingPlugin/Invoice/Grid/Field/channel.html.twig"
                total:
                    type: twig
                    label: sylius.ui.total
                    path: .
                    sortable: total
                    options:
                        template: "@SyliusAdmin/Order/Grid/Field/total.html.twig"
                issuedAt:
                    type: datetime
                    label: sylius_invoicing_plugin.ui.issued_at
                    options:
                        format: 'Y-m-d H:i:s'
                    sortable: true
            filters:
                orderNumber:
                    type: string
                    label: sylius_invoicing_plugin.ui.order_number
                    options:
                        fields: [order.number]
                number:
                    type: string
                    label: sylius_invoicing_plugin.ui.invoice_number
                issuedAt:
                    type: date
                    label: sylius_invoicing_plugin.ui.issued_at
                channel:
                    type: invoice_channel
                    label: sylius.ui.channel
            actions:
                item:
                    show:
                        type: show
                    download:
                        type: default
                        label: sylius_invoicing_plugin.ui.download_invoice
                        enabled: '%sylius_invoicing.pdf_generator.enabled%'
                        icon: download
                        options:
                            link:
                                route: sylius_invoicing_plugin_admin_invoice_download
                                parameters:
                                    id: resource.id
                    resend:
                        type: default
                        label: sylius_invoicing_plugin.ui.resend_invoice
                        icon: send
                        options:
                            link:
                                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

        sylius_invoicing.admin.invoice.buttons:
            blocks:
                back_button:
                    template: '@SyliusInvoicingPlugin/Invoice/Show/_backButton.html.twig'
                    priority: 30
                download_button:
                    template: '@SyliusInvoicingPlugin/Invoice/Admin/_downloadButton.html.twig'
                    enabled: '%sylius_invoicing.pdf_generator.enabled%'
                    priority: 20
                resend_button:
                    template: '@SyliusInvoicingPlugin/Invoice/Admin/_resendButton.html.twig'
                    priority: 10

        sylius_invoicing.admin.order.invoices.list.actions.buttons:
            blocks:
                download_button:
                    template: '@SyliusInvoicingPlugin/Invoice/Admin/_downloadButton.html.twig'
                    enabled: '%sylius_invoicing.pdf_generator.enabled%'
                    priority: 20
                resend_button:
                    template: '@SyliusInvoicingPlugin/Invoice/Admin/_resendButton.html.twig'
                    priority: 10

        sylius_invoicing.shop.order.invoices.list.actions:
            blocks:
                download_button:
                    template: '@SyliusInvoicingPlugin/Order/Shop/_downloadButton.html.twig'
                    enabled: '%sylius_invoicing.pdf_generator.enabled%'
                    priority: 10

framework:
    messenger:
        buses:
            sylius.event_bus:
                default_middleware: allow_no_handlers
            sylius.command_bus:
                middleware:
                    - 'validation'
                    - 'doctrine_transaction'

knp_gaufrette:
    adapters:
        sylius_invoicing_invoice:
            local:
                directory: "%sylius_invoicing.invoice_save_path%"
                create: true
    filesystems:
        sylius_invoicing_invoice:
            adapter: "%sylius_invoicing.filesystem_adapter.invoice%"

sylius_fixtures:
    suites:
        default:
            listeners:
                invoices_purger: ~
