<html
    xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
    data-namespace-typo3-fluid="true"
>

<f:layout name="Module"/>

<f:section name="Before">
    <f:asset.module identifier="@typo3/backend/context-menu.js"/>
    <f:asset.module identifier="@typo3/backend/element/immediate-action-element.js"/>
    <f:variable name="args" value="{0: 'web', 1: id}" />
    <typo3-immediate-action
        action="TYPO3.Backend.Storage.ModuleStateStorage.update"
        args="{args -> f:format.json() -> f:format.htmlspecialchars()}"
    ></typo3-immediate-action>
</f:section>

<f:section name="Content">

    <h1>
        <f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_pagetsconfig.xlf:module.pagetsconfig_pages.headline" />
    </h1>
    <p><f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_pagetsconfig.xlf:module.pagetsconfig_pages.description" /></p>

    <f:if condition="!{accessContent}">
        <f:then>
            <f:be.infobox state="{f:constant(name: 'TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::INFO')}" message="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pagetsconfig.xlf:module.pagetsconfig.noAccess')}" />
        </f:then>
        <f:else>
            <f:if condition="!{overviewOfPagesUsingTSConfig}">
                <f:then>
                    <f:be.infobox state="{f:constant(name: 'TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::INFO')}" message="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_pagetsconfig.xlf:module.pagetsconfig_pages.noRecords')}" />
                </f:then>
                <f:else>
                    <div class="table-fit">
                        <table class="table table-striped table-hover">
                            <thead>
                                <tr>
                                    <th><f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_pagetsconfig.xlf:module.pagetsconfig_pages.pagetitle" /></th>
                                    <th><f:translate key="LLL:EXT:backend/Resources/Private/Language/locallang_pagetsconfig.xlf:module.pagetsconfig_pages.written_tsconfig_lines" /></th>
                                </tr>
                            </thead>
                            <tbody>
                                <f:for each="{overviewOfPagesUsingTSConfig}" as="line">
                                    <tr>
                                        <td class="align-top nowrap"><f:spaceless>
                                            <span style="margin-left: {line.padding}px">
                                                <button
                                                    type="button"
                                                    class="btn btn-link"
                                                    data-contextmenu-trigger="click"
                                                    data-contextmenu-table="pages"
                                                    data-contextmenu-uid="{line.title}"
                                                    aria-label="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.contextMenu.open')}"
                                                >
                                                    <span title="id={line.title}">
                                                        <f:format.raw>{line.icon}</f:format.raw>
                                                    </span>
                                                </button>
                                                <f:format.raw>{line.pageTitle}</f:format.raw>
                                            </span>
                                        </f:spaceless></td>
                                        <td>{line.lines}</td>
                                    </tr>
                                </f:for>
                            </tbody>
                        </table>
                    </div>
                </f:else>
            </f:if>
        </f:else>
    </f:if>

</f:section>

</html>
