2017-05-18 01:21:04 +02:00

87 lines
2.1 KiB
Plaintext

-@read_only = true
.center.row
%h1
Mon réseau :
=@reseaux.name
%h3 Membres du réseau
%div{:style => "position:relative"}
%table.table.table-hover.table-striped.customer_table
%thead#customer_rows_header.rows_header
%tr
%th
Société
%th
Nom
%th
Téléphone
%th
Ville
%th
Email
%th
CA
%th
Gains
%th Dernière activité
%th{:style => "width:100px;text-align:right;"}
 
%tbody#customer_rows.rows
-gain = 0.0
-@reseaux.customers.each do |customer|
-css_class = ""
-css_class "danger" if customer.lock
%tr#customer_row{:id => customer.id, :class => css_class}
%td
=customer.organisation
%td
=customer.name
=customer.firstname
%td
-if customer.phone?
= i("phone") + " #{customer.phone}"
%td
=customer.city
%td
=link_to customer.email, "mailto:#{customer.email}"
%td
=number_to_currency customer.accepted_offers.joins(:offer).where(:state => "documents_completed").sum("offers.price * accepted_offers.qte").to_f
%td
-g = customer.accepted_offers.joins(:offer).where(:state => "documents_completed").sum("offers.gain * accepted_offers.qte").to_f
=number_to_currency g
-gain += g
%td=time_ago_in_words(customer.last_activity) if customer.last_activity
%td.actions{:style => "width:150px;text-align:right;"}
=link_to i(:eye), public_customer_path(customer)
=link_to i(:envelope), mail_public_customer_path(customer)
%div{:style => "position:absolute;top:-30px;right:10px;"}
Gains :
=number_to_currency gain
%h3 Les besoins de mon réseau
=render collection: @reseaux.needs, partial: 'public/needs/need_item', as: :need