{namespace v=FluidTYPO3\Vhs\ViewHelpers}
{namespace ot=Opentalent\OtTemplating\ViewHelpers}

<f:layout name="Backend/Default" />

<f:section name="content">
    <div class="ot-be-module ot-stats">
        <h1><f:translate key="stats"/></h1>

        <div id="matomoFilters">
            <span><f:translate key="period"/>: </span>
            <f:form action="index">
                <f:form.select class="form-control"
                               name="period"
                               options="{week: '{f:translate(key: \'last_week\')}',
                                         month: '{f:translate(key: \'last_month\')}',
                                         year: '{f:translate(key: \'last_year\')}'}"
                               value="{period}">
                </f:form.select>

                <f:comment><!--
                Important: if the cache is not disabled,
                 then the results won't be updated even after submitting this form
                 --></f:comment>
                <input type="hidden"
                       name="no_cache"
                       value="1">

                <f:form.button type="submit" class="ot-btn">
                    <f:translate key="refresh"/>
                </f:form.button>
            </f:form>
        </div>

        <div id="matomoReport">

            <div class="reportSection">

                <f:comment><!-- Real time visits--></f:comment>
                <f:render partial="ReportCard"
                          arguments="{title: '{f:translate(key: \'real_time_visits\')}', id: 'realTimeVisits',
                                      module: 'Live', action: 'widget',
                                      matomoSiteId: matomoSiteId, matomoToken: matomoToken, period: period}"/>

                <div class="reportSubSection">
                    <f:comment><!-- Last visits graph--></f:comment>
                    <f:render partial="ReportCard"
                              arguments="{title: '{f:translate(key: \'last_visits_graph\')}', id: 'lastVisitsGraph',
                                          module: 'VisitsSummary', action: 'getEvolutionGraph',
                                          matomoSiteId: matomoSiteId, matomoToken: matomoToken, period: period}"/>

                    <f:comment><!-- Visits Summary --></f:comment>
                    <f:render partial="ReportCard"
                              arguments="{title: '{f:translate(key: \'visits_summary\')}', id: 'visitsSummary',
                                          module: 'VisitsSummary', action: 'get',
                                          matomoSiteId: matomoSiteId, matomoToken: matomoToken, period: period}"/>
                </div>
            </div>

            <div class="reportSection">

                <f:comment><!-- By weekday --></f:comment>
                <f:render partial="ReportCard"
                          arguments="{title: '{f:translate(key: \'visits_by_weekday\')}', id: 'visitsByWeekday',
                                      module: 'VisitTime', action: 'getByDayOfWeek',
                                      matomoSiteId: matomoSiteId, matomoToken: matomoToken, period: period}"/>

                <f:comment><!-- By local hour --></f:comment>
                <f:render partial="ReportCard"
                          arguments="{title: '{f:translate(key: \'visits_by_hour\')}', id: 'visitsByHour',
                                      module: 'VisitTime', action: 'getVisitInformationPerLocalTime',
                                      matomoSiteId: matomoSiteId, matomoToken: matomoToken, period: period}"/>

                <f:comment><!-- Map --></f:comment>
                <f:render partial="ReportCard"
                          arguments="{title: '{f:translate(key: \'visits_map\')}', id: 'visitsMap',
                                      module: 'UserCountryMap', action: 'visitorMap',
                                      matomoSiteId: matomoSiteId, matomoToken: matomoToken, period: period}"/>
            </div>

            <div class="reportSection">

                <f:comment><!-- Refferers --></f:comment>
                <f:render partial="ReportCard"
                          arguments="{title: '{f:translate(key: \'visits_referrers\')}', id: 'visitsRefferers',
                                      module: 'Referrers', action: 'getAll',
                                      matomoSiteId: matomoSiteId, matomoToken: matomoToken, period: period}"/>

                <f:comment><!-- By web-browsers   --></f:comment>
                <f:render partial="ReportCard"
                          arguments="{title: '{f:translate(key: \'get_browsers\')}', id: 'getBrowsers',
                                      module: 'Referrers', action: 'getAll',
                                      matomoSiteId: matomoSiteId, matomoToken: matomoToken, period: period}"/>

            </div>

            <div class="reportSection">

                <f:comment><!-- By page   --></f:comment>
                <f:render partial="ReportCard"
                          arguments="{title: '{f:translate(key: \'visits_by_page\')}', id: 'visitsByPage',
                                      module: 'Actions', action: 'getPageUrls', width: '1028',
                                      matomoSiteId: matomoSiteId, matomoToken: matomoToken, period: period}"/>
            </div>

            <div class="reportSection">

                <f:comment><!-- By entry page --></f:comment>
                <f:render partial="ReportCard"
                          arguments="{title: '{f:translate(key: \'visitors_entry_points\')}', id: 'visitorsEntryPoints',
                                      module: 'Actions', action: 'getEntryPageUrls',
                                      matomoSiteId: matomoSiteId, matomoToken: matomoToken, period: period}"/>

                <f:comment><!-- By visits duration   --></f:comment>
                <f:render partial="ReportCard"
                          arguments="{title: '{f:translate(key: \'visits_by_duration\')}', id: 'visitsByDuration',
                                      module: 'VisitorInterest', action: 'getNumberOfVisitsPerVisitDuration',
                                      matomoSiteId: matomoSiteId, matomoToken: matomoToken, period: period}"/>
            </div>

            <div class="reportFooter">
                <f:link.action
                        action="askForDeactivationConfirmation"
                        title="select"
                        id="disableLink"
                        class="warning"
                >
                    <f:translate key="disable_monitoring"/>
                </f:link.action>
            </div>

        </div>
    </div>
</f:section>
