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

<f:layout name="Module" />

<f:section name="Content">
    <h1><f:translate key="administration.externalDocuments.headline" /></h1>
    <f:if condition="{pageUid}">
        <f:then>
            <f:if condition="{records}">
                <f:then>
                    <div class="table-fit">
                        <table class="table table-striped table-hover">
                            <thead>
                                <tr>
                                    <th><f:translate key="field.fileName" /></th>
                                    <th><f:translate key="field.fileSize" /></th>
                                    <th><f:translate key="field.wordCount" /></th>
                                    <th><f:translate key="field.mtime" /></th>
                                    <th><f:translate key="field.indexed" /></th>
                                    <th><f:translate key="field.updated" /></th>
                                    <th><f:translate key="field.parseTime" /></th>
                                    <th><f:translate key="field.groups" /></th>
                                    <th><f:translate key="field.sub" /></th>
                                    <th><f:translate key="field.staticPageArguments" /></th>
                                    <th><f:translate key="field.pHash" /></th>
                                    <th><f:translate key="field.path" /></th>
                                </tr>
                            </thead>
                            <tbody>
                                <f:for each="{records}" as="data">
                                    <tr>
                                        <td>
                                            <f:format.crop maxCharacters="30">{data.item_title}</f:format.crop>
                                        </td>
                                        <td>
                                            <f:format.bytes decimals="1">{data.item_size}</f:format.bytes>
                                        </td>
                                        <td>{data.numberOfWords}</td>
                                        <td>
                                            <is:format.dateTime>{data.item_mtime}</is:format.dateTime>
                                        </td>
                                        <td>
                                            <is:format.dateTime>{data.crdate}</is:format.dateTime>
                                        </td>
                                        <td>
                                            <f:if condition="{date.tstamp}=={date.crdate}">
                                                <f:then></f:then>
                                                <f:else>
                                                    <is:format.dateTime>{data.tstamp}</is:format.dateTime>
                                                </f:else>
                                            </f:if>
                                        </td>
                                        <td>{data.parsetime}</td>
                                        <td>{data.numberOfSections}/{data.grList.0.pcount}/{data.numberOfFulltext}</td>
                                        <td>{data.pcount}</td>
                                        <td>
                                            <f:if condition="{data.static_page_arguments}">
                                                <f:for each="{data.static_page_arguments}" as="value" key="key">
                                                    {key}={value}<br>
                                                </f:for>
                                            </f:if>
                                        </td>
                                        <td>{data.phash}</td>
                                        <td>
                                            <f:format.crop maxCharacters="100">{data.data_filename}</f:format.crop>
                                        </td>
                                    </tr>
                                </f:for>
                            </tbody>
                        </table>
                    </div>
                </f:then>
                <f:else>
                    <f:be.infobox
                        message="{f:translate(key:'LLL:EXT:indexed_search/Resources/Private/Language/locallang.xlf:administration.noRecords')}"
                        state="{f:constant(name: 'TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper::STATE_NOTICE')}"
                    />
                </f:else>
            </f:if>
        </f:then>
        <f:else>
            <f:be.infobox
                message="{f:translate(key:'LLL:EXT:indexed_search/Resources/Private/Language/locallang.xlf:administration.noPageSelected')}"
                state="{f:constant(name: 'TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper::STATE_INFO')}"
            />
        </f:else>
    </f:if>
</f:section>

</html>
