sadem_app/app/views/admin/p_customers/_p_customer.html.haml
Nicolas Bally 0d5aeb443e suite
2020-03-01 23:33:47 +01:00

67 lines
2.0 KiB
Plaintext

%tr#p_customer{:id => p_customer.id}
-tr = {}
-tr[:enabled] = capture do
%td
-if p_customer.enabled
Actif
-else
%span.red
=ic :lock
=p_customer.disabled_raison
-tr[:p_commercial] = capture do
%td
= p_customer.p_commercial.long_name if p_customer.p_commercial
-tr[:p_customer_cat] = capture do
%td= p_customer.p_customer_cat.name if p_customer.p_customer_cat
-tr[:particular] = capture do
%td
-if p_customer.particular
= p_customer.particular.cp
= p_customer.particular.city
= p_customer.particular.country
-tr[:market_discount] = capture do
%td
-if p_customer.market_discount
=p_customer.market_discount.percent
="%"
-if !@qi_table_orders
=render :partial => "qi/qi_ordered_table_head", :locals => {:qi_ordered_table_name => p_product.class.to_s.tableize, :qi_ordered_table_model => p_product.class}
-@qi_table_orders[:p_customers].each do |key,value|
-if tr[:"#{key}"]
=raw tr[:"#{key}"]
-elsif (p_customer.respond_to?(key))
%td
=p_customer.send(key.to_s)
%td.actions
-if params[:offre].to_s == "true"
-if p_customer.enabled
=link_to ic(:"arrow-right")+" Demande de commande", new_admin_p_customer_sheet_path(:p_customer_id => p_customer.id), :class => "btn btn-primary btn-ap-add"
-else
.badge.badge-danger
=ic :lock
=p_customer.disabled_raison
-else
-if current_admin.has_permission?("customers-d")
= link_to i(:"trash-o"), [:admin, p_customer], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer ce client ? ' } , :remote => true if p_customer.can_destroy?
-if current_admin.has_permission?("customers-d")
= link_to i(:pencil), edit_admin_p_customer_path(p_customer), :remote => false
-if current_admin.has_permission?("customers-s")
= link_to i(:eye), admin_p_customer_path(p_customer)