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

<f:layout name="Module"/>

<f:section name="Content">

    <f:be.pageRenderer
        includeJavaScriptModules="{
            0: '@typo3/backend/context-menu.js',
            1: '@typo3/backend/element/immediate-action-element.js',
            2: '@typo3/tstemplate/information-module.js'
        }"
    />

    <f:variable name="args" value="{0: 'web', 1: pageUid}" />
    <typo3-immediate-action action="TYPO3.Backend.Storage.ModuleStateStorage.update" args="{args -> f:format.json() -> f:format.htmlspecialchars()}"></typo3-immediate-action>

    <h1><f:translate key="LLL:EXT:tstemplate/Resources/Private/Language/locallang.xml:moduleTitle" /></h1>
    <h3>
        <a
            href="#"
            data-contextmenu-trigger="click"
            data-contextmenu-table="sys_template"
            data-contextmenu-uid="{templateRecord.uid}"
        >
            <core:iconForRecord table="sys_template" row="{templateRecord}"/>
        </a> {templateRecord.title}
    </h3>

    <f:if condition="{manyTemplatesMenu}">
        <div>
            <f:format.raw>{manyTemplatesMenu}</f:format.raw>
        </div>
    </f:if>

    <table class="table table-striped table-hover">
        <tbody>
        <tr>
            <td class="text-nowrap">
                <be:link.editRecord
                    table="sys_template"
                    uid="{templateRecord.uid}"
                    fields="title"
                    class="btn d-block text-start btn-default"
                >
                    <core:icon identifier="actions-open" /> <f:translate key="LLL:EXT:tstemplate/Resources/Private/Language/locallang_info.xlf:title" />
                </be:link.editRecord>
            </td>
            <td width="90%">{templateRecord.title}</td>
        </tr>
        <tr>
            <td class="text-nowrap">
                <be:link.editRecord
                    table="sys_template"
                    uid="{templateRecord.uid}"
                    fields="description"
                    class="btn d-block text-start btn-default"
                >
                    <core:icon identifier="actions-open" /> <f:translate key="LLL:EXT:tstemplate/Resources/Private/Language/locallang_info.xlf:description" />
                </be:link.editRecord>
            </td>
            <td width="90%">{templateRecord.description}</td>
        </tr>
        <tr>
            <td class="text-nowrap">
                <be:link.editRecord
                    table="sys_template"
                    uid="{templateRecord.uid}"
                    fields="constants"
                    class="btn d-block text-start btn-default"
                >
                    <core:icon identifier="actions-open" /> <f:translate key="LLL:EXT:tstemplate/Resources/Private/Language/locallang_info.xlf:constants" />
                </be:link.editRecord>
            </td>
            <td width="90%"><f:translate key="LLL:EXT:tstemplate/Resources/Private/Language/locallang_info.xlf:editToView" arguments="{0: numberOfConstantsLines}" /></td>
        </tr>
        <tr>
            <td class="text-nowrap">
                <be:link.editRecord
                    table="sys_template"
                    uid="{templateRecord.uid}"
                    fields="config"
                    class="btn d-block text-start btn-default"
                >
                    <core:icon identifier="actions-open" /> <f:translate key="LLL:EXT:tstemplate/Resources/Private/Language/locallang_info.xlf:setup" />
                </be:link.editRecord>
            </td>
            <td width="90%"><f:translate key="LLL:EXT:tstemplate/Resources/Private/Language/locallang_info.xlf:editToView" arguments="{0: numberOfSetupLines}" /></td>
        </tr>
        </tbody>
    </table>

    <be:link.editRecord
        table="sys_template"
        uid="{templateRecord.uid}"
        class="btn btn-default mb-2"
    >
        <core:icon identifier="actions-document-open" />
        <f:translate key="LLL:EXT:tstemplate/Resources/Private/Language/locallang_info.xlf:editTemplateRecord"/>
    </be:link.editRecord>

</f:section>

</html>
