149 lines
6.7 KiB
Plaintext
Executable File
149 lines
6.7 KiB
Plaintext
Executable File
.center.white.show-need
|
|
.top-left-info
|
|
-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é
|
|
.content
|
|
%h1= @need.title.upcase
|
|
|
|
-if @need.author
|
|
%p.info
|
|
=i(:"clock-o") + " Proposé par "
|
|
%strong=@need.author.anonyme_nick
|
|
="il y a #{time_ago_in_words(@need.created_at)}"
|
|
-else
|
|
%p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(@need.created_at)}"
|
|
|
|
|
|
-if @need.category
|
|
%p.info=i(:"tag") + " " + @need.category_path
|
|
-else
|
|
%p.info=i(:"tag") + " Non catégorisé"
|
|
|
|
%p.description= @need.description
|
|
|
|
-if @need.verified?
|
|
-if @need.customers.include?(current_customer)
|
|
.alert.alert-success
|
|
%h3= i(:"check") + ' Vous êtes intéressé par ce besoin'
|
|
%p Marquer votre interêt pour un besoin vous permettra d'accéder à des propositions intéressantes si nous décidons par la suite de négocier ce besoin auprès de nos fournisseurs.
|
|
-else
|
|
.alert.alert-info
|
|
%h3 Vous avez aussi ce besoin ? signalez-le nous !
|
|
%p Vous pouvez marquer votre interêt pour ce besoin en cliquant sur le bouton <strong>Ça m'intéresse !</strong>
|
|
%p Si il y a un nombre suffisant de personnes avec ce même besoin, une négociation sera entamée auprès de nos fournisseurs afin de vous faire une proposition au meilleur prix.
|
|
%p Vous ensuite libre d'accepter ou non la proposition
|
|
|
|
-elsif @need.negociating?
|
|
-if @need.customers.include?(current_customer)
|
|
.alert.alert-warning
|
|
%h3 Négociation en cours...
|
|
%p Ce besoin a suscité un interêt suffisant pour que nous engagions une négociation afin de vous proposer cet article au meilleur prix.
|
|
%p Vous avez marqué votre interêt pour ce besoin et vous serez donc prevenu dès que la négociation sera terminée.
|
|
%p Une ou plusieurs propositions vous seront faites et vous serez libre de les accepter ou non.
|
|
%p <strong>Attention, accepter la proposition vous engage à payer.</strong>
|
|
-else
|
|
.alert.alert-warning
|
|
%h3 Négociation en cours...
|
|
%p Ce besoin a suscité un interêt suffisant pour que nous engagions une négociation afin de vous proposer cet article au meilleur prix.
|
|
.alert.alert-danger
|
|
%p Malheureusement vous n'avez pas marqué votre interêt pour ce besoin pendant la période de sondage, vous ne pourrez donc pas profiter de cette négociation.
|
|
-elsif @need.negociated?
|
|
-if @need.customers.include?(current_customer)
|
|
.alert.alert-success
|
|
%h3 Négociation terminée
|
|
%p= "Nous avons négocié ce besoin à partir de #{number_to_currency(offers.first.price, locale: :fr)}"
|
|
%p Vous avez maintenant le choix d'accepter ou refuser la proposition.
|
|
%p <strong>Attention, accepter la proposition vous engage à payer.</strong>
|
|
-else
|
|
.alert.alert-success
|
|
%h3 Négociation terminée
|
|
%p= "Nous avons négocié ce besoin à partir de #{number_to_currency(offers.first.price, locale: :fr)}"
|
|
.alert.alert-danger
|
|
%p= "Malheureusement, vous n'avez pas marqué votre interêt pour ce besoin pendant la période de sondage, vous ne pouvez donc pas profiter de cette négociation."
|
|
-elsif @need.failed?
|
|
.alert.alert-danger
|
|
%h3 Négociation échouée
|
|
%p= "Désolé, nous n'avons pas été en mesure de négocier un prix acceptable pour ce besoin."
|
|
.clear
|
|
.counters
|
|
-if(@need.wishes.length > 0)
|
|
.item=i(:"hand-paper-o") + " " + " #{pluralize(@need.wishes.length, 'utilisateur')} #{"intéressé".pluralize(@need.wishes.length)} par ce besoin"
|
|
-else
|
|
.item=i(:"hand-paper-o") + " Aucun utilisateur n'est intéressé par ce besoin"
|
|
|
|
-if @need.verified?
|
|
-if(@need.customers.include?(current_customer))
|
|
=link_to i(:"check") + " Intéressé", wish_public_need_path(@need) , :class => "btn btn-square btn-lg btn-success pull-right"
|
|
-else
|
|
=link_to i(:"hand-paper-o") + " Ça m'intéresse !", wish_public_need_path(@need) , :class => "btn btn-square btn-lg btn-primary pull-right"
|
|
-elsif @need.negociating?
|
|
|
|
-elsif @need.negociated?
|
|
-if @need.offers.length > 0
|
|
%h2= i(:"gift") + " Les propositions négociées"
|
|
-@need.offers.each do |offer|
|
|
.offer
|
|
|
|
.price
|
|
=number_to_currency(offer.price, locale: :fr)
|
|
|
|
-if offer.need.customers.include?(current_customer)
|
|
-if !offer.customers.include?(current_customer)
|
|
.accept-offer
|
|
=link_to i(:"check") + " Accepter la proposition", accept_public_need_offer_path(@need, offer), data: {confirm: "Voulez-vous vraiment accepter cette proposition ? Attention, cette action vous engage à payer la somme proposée."}, class: "btn btn-lg btn-success "
|
|
-else
|
|
.offer-accepted
|
|
=i(:"check") + " Propositions Acceptée"
|
|
|
|
.my-account-link
|
|
Consulter vos propositions acceptées depuis la rubrique
|
|
=link_to "Mon compte", public_my_account_path
|
|
-else
|
|
.offer-not-aceptable
|
|
Vous n'êtes pas intéressé
|
|
|
|
|
|
.clear
|
|
|
|
%hr
|
|
%h2= i(:"comments") + " Fil de discussion"
|
|
= semantic_form_for [:public, @need, @comment ], :html => {id: :message_form, :method => :post } do |f|
|
|
|
|
|
|
-if(@need.customers.include?(current_customer))
|
|
%h4 Écrire un nouveau message
|
|
= f.inputs do
|
|
= f.input :content, as: :text, label: false, rows: 5, :input_html => {:style => "height:100px;"}
|
|
|
|
=f.submit "Envoyer", :class => "btn btn-square btn-primary pull-right"
|
|
-else
|
|
.alert.alert-danger
|
|
%p= "L'envoi de message est ouvert seulement aux personnes intéressés par le besoin"
|
|
.clear
|
|
|
|
|
|
|
|
%h4= " #{pluralize(@need.messages.count, 'Message')} actuellement"
|
|
|
|
=render collection: @comments, partial: 'message'
|
|
|
|
.pagination= paginate @comments
|