{% extends 'user.twig' %}

{% set title %}{{ 'ScheduledReports_PersonalEmailReports'|translate }}{% endset %}

{% block topcontrols %}
    {% include "@CoreHome/_siteSelectHeader.twig" %}
    {% include "@CoreHome/_periodSelect.twig" %}
{% endblock %}

{% block content %}

<div class="emailReports">
    <h2 piwik-enriched-headline help-url="http://piwik.org/docs/email-reports/">{{ title }}</h2>

    <span id="reportSentSuccess"></span>
    <span id="reportUpdatedSuccess"></span>

    <div class="entityContainer">
        {% import 'ajaxMacros.twig' as ajax %}
        {{ ajax.errorDiv() }}
        {{ ajax.loadingDiv() }}
        {% include "@ScheduledReports/_listReports.twig" %}
        {% include "@ScheduledReports/_addReport.twig" %}
        <a id='bottom'></a>
    </div>
</div>

<div class="ui-confirm" id="confirm">
    <h2>{{ 'ScheduledReports_AreYouSureDeleteReport'|translate }}</h2>
    <input role="yes" type="button" value="{{ 'General_Yes'|translate }}"/>
    <input role="no" type="button" value="{{ 'General_No'|translate }}"/>
</div>

<script type="text/javascript">
    var ReportPlugin = {};
    ReportPlugin.defaultPeriod = '{{ defaultPeriod }}';
    ReportPlugin.defaultHour = '{{ defaultHour }}';
    ReportPlugin.defaultReportType = '{{ defaultReportType }}';
    ReportPlugin.defaultReportFormat = '{{ defaultReportFormat }}';
    ReportPlugin.reportList = {{ reportsJSON | raw }};
    ReportPlugin.createReportString = "{{ 'ScheduledReports_CreateReport'|translate }}";
    ReportPlugin.updateReportString = "{{ 'ScheduledReports_UpdateReport'|translate }}";
    $(function () {
        initManagePdf();
    });
</script>
<style type="text/css">
    .reportCategory {
        font-weight: bold;
        margin-bottom: 5px;
    }

    .entityAddContainer {
        position:relative;
    }

    .emailReports .top_controls {
        padding-bottom: 18px;
    }

</style>
{% endblock %}
