{% extends 'base.html.twig' %}
{% set menu = 'dashboard' %}

{% block body %}

<h1 class="display-4 fw-lighter">{{ "title.dashboard"|trans }}</h1>

<div class="row">
  <div class="col-md">
    <h3 class="mb-3 mt-4 capabilities">{{ "dashboard.capabilities"|trans }}</h3>

    <ul class="list-group">
      {% if calDAVEnabled %}
      <li class="list-group-item d-flex justify-content-between align-items-center list-group-item-success">CalDAV
        <span class="badge bg-success rounded-pill">{{ "enabled"|trans }}</span></li>
      {% else %}
      <li class="list-group-item d-flex justify-content-between align-items-center list-group-item-danger">CalDAV
        <span class="badge bg-danger rounded-pill">{{ "disabled"|trans }}</span></li>
      {% endif %}

      {% if cardDAVEnabled %}
      <li class="list-group-item d-flex justify-content-between align-items-center list-group-item-success">CardDAV
        <span class="badge bg-success rounded-pill">{{ "enabled"|trans }}</span></li>
      {% else %}
      <li class="list-group-item d-flex justify-content-between align-items-center list-group-item-danger">CardDAV
        <span class="badge bg-danger rounded-pill">{{ "disabled"|trans }}</span></li>
      {% endif %}

      {% if webDAVEnabled %}
      <li class="list-group-item d-flex justify-content-between align-items-center list-group-item-success">WebDAV
        <span class="badge bg-success rounded-pill">{{ "enabled"|trans }}</span></li>
      {% else %}
      <li class="list-group-item d-flex justify-content-between align-items-center list-group-item-danger">WebDAV
        <span class="badge bg-danger rounded-pill">{{ "disabled"|trans }}</span></li>
      {% endif %}
    </ul>

    <h3 class="mb-3 mt-4 environment">{{ "dashboard.env"|trans }}</h3>

    <ul class="list-group">
      <li class="list-group-item list-group-item-primary">{{ "dashboard.version"|trans }} : <code>{{ version }}</code> (SabreDAV <code>{{ sabredav_version }}</code>)</li>
      <li class="list-group-item list-group-item-secondary">{{ "dashboard.auth"|trans }} : <code>{{ authMethod }}</code> ({{ "dashboard.auth_realm"|trans }}: <code>{{ authRealm }}</code>)</li>
      <li class="list-group-item list-group-item-secondary">{{ "dashboard.invite_from_address"|trans }} : <code>{{ invite_from_address|default('Not set') }}</code></li>
      <li class="list-group-item list-group-item-secondary d-flex justify-content-between align-items-center ">
        <span>{{ "dashboard.server_timezone"|trans }} : <code>{{ timezone.actual_default }}</code></span>
        {% if timezone.not_set_in_app %}<span class="badge bg-secondary rounded-pill">{{ "dashboard.no_timezone_configuration"|trans }}</span>{% endif %}
        {% if timezone.bad_value %}<span class="badge bg-danger rounded-pill">{{ "dashboard.bad_timezone_configuration"|trans }}</span>{% endif %}
      </li>
    </ul>
  </div>

  <div class="col-md">
    <h3 class="mb-3 mt-4 objects">{{ "dashboard.objects"|trans }}</h3>

    <ul class="list-group mb-5">
      <li class="list-group-item d-flex justify-content-between align-items-center">
        {{ "dashboard.users"|trans }} <span class="badge bg-primary rounded-pill">{{ users|length }}</span>
      </li>
      <li class="list-group-item d-flex justify-content-between align-items-center">
        <div>{{ "dashboard.calendars"|trans }}&nbsp;<span class="small text-muted ms-1 me-auto">{{ "dashboard.calendars.help"|trans }}</span></div> <span class="badge bg-primary rounded-pill">{{ calendars|length }}</span>
      </li>
      <li class="list-group-item d-flex justify-content-between align-items-center">
        ↳ {{ "dashboard.events"|trans }} <span class="badge bg-secondary rounded-pill">{{ events|length }}</span>
      </li>
      <li class="list-group-item d-flex justify-content-between align-items-center">
        {{ "dashboard.address_books"|trans }} <span class="badge bg-primary rounded-pill">{{ addressbooks|length }}</span>
      </li>
      <li class="list-group-item d-flex justify-content-between align-items-center">
        ↳ {{ "dashboard.contacts"|trans }} <span class="badge bg-secondary rounded-pill">{{ contacts|length }}</span>
      </li>
    </ul>
  </div>
</div>

{% endblock %}