.col-md-12
  .padding.need-item

    %h4
      =link_to need.title.upcase, public_need_path(need)

    -if need.image_file
      %div.need-image{style: "background-image: url('#{need.image_file.file.url}')"}
    -else
      %div.need-image

    -# -if need.author
    -#   %p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(need.created_at)} par #{need.author.anonyme_nick}"
    -# -else
    -#   %p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(need.created_at)}"

    .top-left-info
      -if need.category
        =i(:"tag") + " " + need.category.name
      -else
        Non catégorisé
      -if need.verified?
        %span.state.state-info.pull-right
          =need.human_state
      -elsif need.negociating?
        %span.state.state-warning.pull-right
          =need.human_state
      -elsif need.failed?
        %span.state.state-danger.pull-right
          =need.human_state
      -elsif need.negociated?
        %span.state.state-success.pull-right
          -offers = need.offers.order(price: :asc)
          -if offers.size > 1
            Négocié à partir de
            %strong="#{number_to_currency(offers.first.price, locale: :fr)}"
          -elsif offers.size == 1
            Négocié à
            %strong="#{number_to_currency(offers.first.price, locale: :fr)}"
          -else
            Négocié





    %p.description=need.description

    .counters
      .item=i(:"hand-paper-o") + " " + need.wishes.length.to_s
      .item=i(:"comment-o") + " " + need.messages.length.to_s
    -if !@read_only
      -if(need.verified?)
        - @wish =  need.wishes.where(need_id: need.id, customer_id: current_customer.id).first
        -if(@wish)
          =link_to i(:"check") + " Intéressé", edit_public_need_wish_path(need, @wish) , :class => "btn btn-square btn-lg btn-success pull-right"
        -else
          =link_to i(:"hand-paper-o") + " Ça m'intéresse !", new_public_need_wish_path(need) , :class => "btn btn-square btn-lg btn-primary pull-right"
      -elsif(need.negociating?)
        -if(need.customers.include?(current_customer))
          =link_to "Négociation en cours...", public_need_path(need), class: "btn btn-warning pull-right"
        -else
          =link_to  i(:"times-circle") + " Négociation en cours...", public_need_path(need) , class: "btn btn-warning pull-right"

      -elsif(need.negociated?)
        -if(need.customers.include?(current_customer))
          =link_to i(:"download") +" Voir les offres", public_need_path(need), class: "btn btn-success pull-right"
        -else
          =link_to  i(:"times-circle") + " Négociation terminée", public_need_path(need) , class: "btn btn-danger pull-right"



        .clear
