.container
  .row
    .col-md-12
      .page-header
        %h1
          Registration for
          = @conference.title
        %p.text-muted
          -if @conference.venue
            at
            %strong
              = "#{@conference.venue_name},"
            = "#{@conference.venue_street},"
            = "#{@conference.city} / #{@conference.country_name}."
          %small
            = date_string(@conference.start_date, @conference.end_date)
  - unless @conference.code_of_conduct.blank?
    .row
      .col-md-12
        %h4= fa_stacked_icon 'handshake-o', base: 'square-o', text: 'Code of Conduct'
        %ul.fa-ul
          - if @registration.accepted_code_of_conduct
            %li.text-info
              = fa_icon('check li')
              You have accepted the
              = link_to 'Code of Conduct', '#',
                data: { toggle: 'modal', target: '#modal-code-of-conduct'}
          - else
            %li.text-warning
              = fa_icon('exclamation-circle li')
              You need to accept the
              = link_to 'Code of Conduct', '#',
                data: { toggle: 'modal', target: '#modal-code-of-conduct'}
          = render 'conferences/code_of_conduct',
            organization: @conference.organization
  - if @conference.surveys.for_registration.any?
    .row
      .col-md-12
        %h4
          %span.fa-stack
            %i.fa.fa-square-o.fa-stack-2x
            %i.fa.fa-info.fa-stack-1x
          Surveys

        %ul
          = render partial: 'surveys/list', locals: { surveys: @conference.surveys.for_registration, conference: @conference }
  - if @registration.events.any?
    .row
      .col-md-12
        %h4
          %span.fa-stack
            %i.fa.fa-square-o.fa-stack-2x
            %i.fa.fa-check.fa-stack-1x
          Registered to the following event(s)
        %ul
          - @registration.events.each do |event|
            %li
              = link_to event.title, conference_program_proposal_path(@conference.short_title, event.id)
              = '(' + registered_text(event) + ')'

  - if @registration.conference.program.events.remaining_for_registration(@registration).any?
    .row
      .col-md-12
        %h4
          %span.fa-stack
            %i.fa.fa-square-o.fa-stack-2x
            %i.fa.fa-question.fa-stack-1x
          Events that require registration
        %ul
          - @registration.conference.program.events.remaining_for_registration(@registration).each do |event|
            %li
              = link_to event.title, conference_program_proposal_path(@conference.short_title, event.id)
              = '(' + registered_text(event) + ')'

  - if @conference.tickets.any?
    .row
      .col-md-12
        %h4
          %span.fa-stack
            %i.fa.fa-square-o.fa-stack-2x
            %i.fa.fa-ticket.fa-stack-1x
          Tickets
        - if @tickets.any?
          Total Purchased:
          = "(#{@tickets.first.price.symbol}#{humanized_money @total_price})"
          %ul
            .col-md-12
              - @ticket_payments.each_pair do |ticket_id, tickets|
                %li
                  = @total_quantity[ticket_id]
                  = tickets.first.title
                  = word_pluralize(@total_quantity[ticket_id], 'Ticket')
                  for
                  = tickets.first.price.symbol
                  = humanized_money @total_price_per_ticket[ticket_id]
              %br
          .btn-group{ role: 'group' }
            = link_to 'View all tickets',
              conference_physical_tickets_path(@conference.short_title),
              class: 'btn btn-success'
            = link_to 'Get more tickets',
              conference_tickets_path(@conference.short_title),
              class: 'btn btn-default'
        - else
          %p
            You haven't bought any tickets.
            = link_to 'Please get some tickets to support us!', conference_tickets_path(@conference.short_title)
          - if @conference.tickets.for_registration.any?
            %p
              %em
                Your participation won't be valid without getting a
                registration ticket.
          = link_to 'Get tickets',
            conference_tickets_path(@conference.short_title),
            class: 'btn btn-default'

  .row
    .col-md-12
      - if @registration
        .btn-group-vertical.pull-right
          = link_to 'Edit your Registration', edit_conference_conference_registration_path(@conference.short_title), class: 'btn btn-success', disabled: @conference.end_date < Date.today
          - if @tickets.any?
            = link_to 'Unregister', conference_conference_registration_path(@conference.short_title), method: :delete, class: 'btn btn-danger btn-xs',
              data: { confirm: "Your ticket purchases won't be refunded. Are you sure you want to unregister?" }, disabled: @conference.end_date < Date.today
          - else
            = link_to 'Unregister', conference_conference_registration_path(@conference.short_title), method: :delete, class: 'btn btn-danger btn-xs',
              data: { confirm: "You haven't purchased any ticket. Are you sure you want to unregister?" }, disabled: @conference.end_date < Date.today
      - else
        = link_to 'Register', new_conference_conference_registration_path(@conference.short_title), class: 'btn btn-success btn-lg pull-right'

  .row
    .col-md-12
      .page-header
        %h1
          %small
            Meet the people of
            = @conference.short_title
    .col-md-4
      - if @conference.participants.any?
        %h4
          %span.fa-stack
            %i.fa.fa-square-o.fa-stack-2x
            %i.fa.fa-group.fa-stack-1x
          = @conference.participants.count
          Registered
          = word_pluralize(@conference.participants.count, 'Attendee')
        - @conference.participants.each do |participant|
          = link_to image_tag(participant.gravatar_url(size: '25'), title: "#{participant.name}!", class: 'img-circle'), user_path(participant)
    .col-md-4.col-md-offset-2
      - if @conference.program.speakers.confirmed.any?
        %h4
          %span.fa-stack
            %i.fa.fa-square-o.fa-stack-2x
            %i.fa.fa-microphone.fa-stack-1x
          = @conference.program.speakers.confirmed.count
          Confirmed
          = word_pluralize(@conference.program.speakers.confirmed.count, 'Speaker')
        - @conference.program.speakers.confirmed.each do |speaker|
          = link_to image_tag(speaker.gravatar_url(size: '25'), title: "#{speaker.name}!", class: 'img-circle'), user_path(speaker)
