.container
  .row
    - if @need_response.any?
      .col-md-12
        .panel.panel-default
          .panel-heading
            = t 'activities.state.need_response'

          .panel-body
            %table.table.table-bordered
              %thead
                %tr
                  %th
                    = t 'activities.attrs.name'
                  %th
                    = t 'activities.attrs.group'
                  %th
                    = t 'activities.attrs.when'
                  %th
                    = t 'activities.attrs.where'
                  %th
                    = t 'activities.attrs.actions'

              %tbody
                - @need_response.each do |p|
                  - e = p.activity
                  %tr{class: p.row_class, data: {activity_id: e.id, person_id: current_person.id}}
                    %td
                      = link_to group_activity_path(e.group, e) do
                        = e.name
                    %td
                      = e.group.name
                    %td
                      = e.start
                    %td
                      = e.location
                    %td
                      = render partial: "activities/presence_buttons", locals: {activity: e, person: current_person, state: p.attending}
  .row
    .col-md-6
      .panel.panel-default
        .panel-heading
          = t 'groups.plural'

        .panel-body
          %table.table.table-bordered
            %tbody
              - current_person.groups.each do |group|
                %tr
                  %td
                    = link_to group do
                      = group.name

    .col-md-6
      .panel.panel-default
        .panel-heading
          = t 'dashboard.organized_you'

        .panel-body
          %table.table.table-striped.table-bordered
            %tbody
              - @user_organized.each do |p|
                - a = p.activity
                %tr
                  %td
                    = link_to group_activity_url(a.group, a) do
                      = a.name
                      = render partial: "activities/state_counts", locals: {counts: a.state_counts}

  .row
    .col-md-12
      .panel.panel-default
        .panel-heading
          = t 'dashboard.participant_you'

        .panel-body
          %table.table.table-striped
            %tbody
              - @upcoming.each do |p|
                - e = p.activity
                %tr{class: p.row_class, data: {activity_id: e.id, person_id: current_person.id}}
                  %td
                    = link_to group_activity_path(e.group, e) do
                      = e.name
                  %td
                    = render partial: "activities/presence_buttons", locals: {activity: e, person: current_person, state: p.attending}
                  %td
                    = editable p, :notes, url: presence_group_activity_path(e.group, e, person_id: current_person.id), title: t('activities.participant.notes'), value: p.notes, emptytext: t('activities.participant.add_notes')