%h2
  %em.fa.fa-signal
  = title t '.title'

%dl
  %dt= t '.allEvents'
  %dd.quantity= number_with_delimiter @events_count

  %dt= t '.awaitingModeration'
  %dd.quantity= number_with_delimiter @events_um_count

  %dt= t '.allOrgas'
  %dd.quantity= number_with_delimiter @orgas_count

  %dt= t '.awaitingModeration'
  %dd.quantity= number_with_delimiter @orgas_um_count

%h3
  %em.fa.fa-calendar
  = t '.dates'

%table.list.dates
  %thead
    %tr
      %th/
      - @years.each do |year|
        %th= year[0]
      %th/
  %tbody
    - (1..12).each do |m|
      %tr
        %th.month= I18n.t('date.month_names')[m]
        - @years.each do |year|
          - line = @months.find do |l|
            - l[0][0] == year[0] && l[0][1].try(:to_i) == m
          %td.quantity
            = link_to root_path(start_date: "#{year[0]}-#{m}-01") do
              = number_with_delimiter line[1] if line
        %td.sparkline/

  %tfoot
    %tr
      %th= t '.total'
      - @years.each do |year|
        %th.quantity= number_with_delimiter year[1]

    %tr
      %th/
      %td.sparkline{ colspan: @years.size }

%h3
  %em.fa.fa-shield-alt
  = t '.regional'

%table.list.dates
  %thead
    %tr
      %th/
      - @years.each do |year|
        %th= year[0]
      %th= t '.total'
      %th/
  %tbody
    - @regions.each do |region|
      %tr
        %th.region= t(region.code.presence ? region.code : region.name,
                      scope: :countries, default: region.name)
        - total = 0
        - @years.each do |year|
          %td.quantity
            - total += @region_events[[region.id, year[0]]] || 0
            = link_to root_path(year: year[0].to_s, region: region.id) do
              = number_with_delimiter @region_events[[region.id, year[0]]]
        %th.quantity.total= number_with_delimiter total
        %td.sparkline/

%h3
  %em.fa.fa-building
  = t '.city'

%p= t '.city_conditions'

%dl
  - @city_events.each do |city|
    %dt.item= city[0]
    %dd.quantity= number_with_delimiter city[1]