%h1 Startseite

#start_nav
  = render :partial => 'start_nav'

.right_column{:style => "width:70%"}
  - unless @unaccepted_tasks.empty? && @next_tasks.empty? && @unassigned_tasks_number == 0
    .box_title 
      %h2 Aufgaben
    .column_content
      -unless @next_tasks.empty?
        %div{:style => "float:left, margin-bottom:2em"}
          %h3 Deine Aufgaben für die nächste Woche:
          %table{:style => "width:25em"}
            -for task in @next_tasks
              %tr
                %td= format_date task.due_date
                %td
                  %b= task.name
          
      - unless @unaccepted_tasks.empty?
        %h3 Aufgaben übernehmen
        Du bis für Aufgaben verantwortlich.
        = link_to "Aufgaben übernehmen/ablehnen", my_tasks_path
      - unless @unassigned_tasks_number == 0
        %h3 Offene Aufgaben
        = "Es gibt #{@unassigned_tasks_number} #{link_to 'offene Aufgabe(n)', :controller => 'tasks'}"
      %p{:style => "clear:both"}= link_to "Meine Aufgaben", my_tasks_path

  - if @ordergroup
    // Current orders
    = render :partial => 'shared/open_orders'

  // Stats
  - if @ordergroup
    .box_title
      %h2 Engagement Deiner Bestellgruppe
    .column_content
      = render "stats"

  - unless @messages.empty?
    .box_title
      %h2 Neuste Nachrichten
    .column_content
      = render :partial => 'messages/messages', :locals => { :subject_length => 70 }
      %br/
      = link_to "Alle Nachrichten einsehen", messages_path

  - if @ordergroup
    // Ordergroup overview
    .box_title
      %h2 Meine Bestellgruppe
    .column_content
      %p
        %b= @ordergroup.name
        |
        Verfügbares Guthaben:
        = number_to_currency(@ordergroup.get_available_funds())
        %span.description
          (Letzte Aktualisierung ist
          = distance_of_time_in_words(Time.now, @ordergroup.account_updated) + " her)"
        %h3 Letzte Transaktionen
        %table
          %tr
            %th Wann
            %th Wer
            %th Notiz
            %th Betrag
          - for ft in @ordergroup.financial_transactions.all(:limit => 5)
            %tr{:class => cycle('even','odd')}
              %td= format_time(ft.created_on)
              %td= h(ft.user.nil? ? '?' : ft.user.nick)
              %td= h(ft.note)
              - color = ft.amount < 0 ? 'red' : 'black'
              %td{:style => "color:#{color}; width:5em", :class => "currency"}= number_to_currency(ft.amount)
        %br/
        = link_to _("mehr ..."), my_ordergroup_path