This commit is contained in:
Nicolas Bally 2018-05-15 17:25:48 +02:00
parent d55cc5c33b
commit 698ef3ca31
11 changed files with 258 additions and 104 deletions

View File

@ -18,17 +18,50 @@ $blue:#428bca;
@import "vendor/flipclock";
.sub_menu_boutique{
padding:5px 5px;
.domain_select{
a{
color:white;
color:black;
display:inline-block;
padding:4px 10px;
margin:0 3px;
border-radius:30px;
background:#a39f9f;
border:1px solid black;
//background:#a39f9f;
&:hover, &.active{
text-decoration:none;
color:white;
background: $blue !important;
border:1px solid $blue;
}
}
}
.sub_menu_boutique{
text-align:left;
padding:0;
background:white;
white-space: nowrap;
.center{
border-left:1px solid rgba(0,0,0,0.5) ;
white-space: nowrap;
text-align:left;
}
a{
color:rgba(0,0,0,0.5);
display:block;
float:left;
padding:10px 15px;
margin:0;
border-right:1px solid rgba(0,0,0,0.5) ;
&:hover, &.active{
text-decoration:none;
@ -42,12 +75,12 @@ $blue:#428bca;
ul{
margin:0;
padding:2px 10px;
padding:0px;
li{
padding:0;
margin:0;
display:inline;
display:inline-block;

View File

@ -12,12 +12,26 @@ class Public::CustomersController < ApplicationController
def index
@customers = Customer.all
if params[:reseaux_id]
@reseaux_layout = true
@reseaux = current_customer.own_reseauxes.find(params[:reseaux_id])
@customers = @reseaux.customers
if params[:domain_id] and params[:domain_id].to_s != ""
@customers = @customers.joins(:domains).where(:domains => {:id => params[:domain_id]})
end
@reseaux_chief_layout = true
end
end
def show
@customer = current_customer.own_customers.find(params[:id])
if params[:reseaux_id]
@reseaux_layout = true
@reseaux = current_customer.own_reseauxes.find(params[:reseaux_id])
@reseaux_chief_layout = true
end
end

View File

@ -8,6 +8,18 @@ class Public::ProductOrdersController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:payplug_ipn]
def index
if params[:reseaux_id]
@reseaux_layout = true
@reseaux = current_customer.own_reseauxes.find(params[:reseaux_id])
@reseaux_chief_layout = true
end
@product_orders = @reseaux.product_orders.where(:completed_finish => true).order("created_at DESC")
end
def get_reseaux
if session[:reseaux_id]
@reseaux = current_customer.reseauxes.find(session[:reseaux_id])
@ -497,5 +509,6 @@ class Public::ProductOrdersController < ApplicationController
end
end

View File

@ -10,8 +10,9 @@ class Public::ReseauxesController < ApplicationController
end
def show
@reseaux_layout = true
@reseaux = current_customer.own_reseauxes.find(params[:id])
@reseaux_chief_layout = true
#@reseaux = Reseaux.find(params[:id])
end

View File

@ -6,7 +6,7 @@ class Reseaux < ActiveRecord::Base
has_many :reseaux_customers
has_many :customers, :through => :reseaux_customers
has_many :domains, :through => :customers
has_many :needs, :through => :customers
has_many :offer_reseauxes
@ -17,6 +17,8 @@ class Reseaux < ActiveRecord::Base
has_many :conversations, :through => :thing_conversations
has_many :product_orders
acts_as_tree

View File

@ -1,13 +1,86 @@
=link_to "nouvel utilisateur", new_forum_forum_user_path, :class => "btn btn-primary", :style => "margin:1em 0em;float:right" if moderator?
.center
%h3 Membres du réseau
.domain_select
Domaines :
=link_to "Tous", public_reseaux_customers_path(:resaux_id => @reseaux, :domain_id => ""), :class => ("active" if params[:domain_id].to_s == "")
-@reseaux.domains.uniq.each do |domain|
=link_to domain.name, public_reseaux_customers_path(:resaux_id => @reseaux, :domain_id => domain.id), :class => ("active" if params[:domain_id].to_s == domain.id.to_s)
%div{:style => "position:relative"}
%table.table.table-hover.table-striped.customer_table
%thead#customer_rows_header.rows_header
%h1 Liste des utilisateurs
%tr
%th Domaine
%th
Nom
%th
%th
Email
-if !@vouistar
%th
CA
%th
Gains
%th Dernière activité
%th{:style => "width:100px;text-align:right;"}
&nbsp;
%tbody#customer_rows.rows
-gain = 0.0
-@customers.each do |customer|
-css_class = ""
-css_class "danger" if customer.lock
%tr#customer_row{:id => customer.id, :class => css_class}
%td
=customer.domains.all.map{ |d| d.name}.join(", ")
%td
-if customer.organisation?
=customer.organisation
%br
=customer.name
=customer.firstname
%td
=customer.city
-if customer.phone?
%br
= i("phone") + " #{customer.phone}"
%td
=link_to customer.email, "mailto:#{customer.email}"
-if !@vouistar
%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_reseaux_customer_path(@reseaux, customer)
=link_to i(:envelope), new_public_customer_message_path(:thing_type => "Customer", :thing_id => customer.id)
%table.table.table-hover.table-striped
%tr
%th{:style => "width:50px;"}
%th Nom
%th Topics
%th Messages
-if moderator?
%th Actions
=render @users

View File

@ -0,0 +1,48 @@
%tr#product_order_row.product_order_row{:id => product_order.id, :class => ("success" if product_order)}
%td
=product_order.id
%td
=l product_order.created_at
%td
-if product_order.particular_bill
=product_order.particular_bill.name
=product_order.particular_bill.firstname
%td
=product_order.particular_send.country
%td
-if product_order.product_order_payment_type_ok_id == 3
CB
-elsif product_order.product_order_payment_type_ok_id == 1
Chèque
%td
="oui" if product_order.paid
%td
=number_to_currency product_order.archived_total_ttc
%td
-if product_order.paid
=link_to product_order.bill_number, bill_admin_product_order_path(product_order), :target => "_blank"
=#%td.actions
=# link_to i(:"trash-o"), [:admin, product_order], :data =>{:remote => true, :confirm => 'Voulez-vous vraiment supprimer cet élément de menu ?'}, :method => :delete #, if current_admin.super_admin? || !product_order.super_admin
=# link_to i(:eye), [:admin, product_order]
=# link_to i(:pencil), edit_admin_product_order_path(product_order), :data => {:remote => true}

View File

@ -0,0 +1,22 @@
.center
%h1 Liste des commandes
%table.table#product_orders
%tr
%th ID
%th Date
%th
Nom
%th Pays d'exp.
%th
Paiement
%th
Payé ?
%th
Total
=#%th
=# Numéro facture
=#%th
=render @product_orders

View File

@ -1,5 +1,7 @@
-@read_only = true
-@vouistar = true if @reseaux.id == 2 or @reseaux.parent_id == 2
.center.row
.right
@ -10,6 +12,10 @@
=@reseaux.name
%div{:style => "text-align:center;width:120px;background:white; margin:20px 0;padding:10px;font-weight:bold;"}
%center{:style => "padding-top:5px;font-size:60px;line-height:40px;text-align:center;"}
=@reseaux.customers.count
%div{:style => "padding-top:5px;"} inscrits
%h3 Sous réseaux
@ -29,83 +35,7 @@
=render @reseaux.children
%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
-if !@vouistar
%th
CA
%th
Gains
%th Dernière activité
%th{:style => "width:100px;text-align:right;"}
&nbsp;
%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}"
-if !@vouistar
%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), new_public_customer_message_path(:thing_type => "Customer", :thing_id => customer.id)
%div{:style => "position:absolute;top:-30px;right:10px;"}
Gains :
=number_to_currency gain
-if @reseaux.id != 2 and @reseaux.parent_id != 2
%h3 Les besoins de mon réseau

View File

@ -1,10 +1,23 @@
-if @needs or @products or @product
.sub_menu_boutique
.center
%ul
-if current_customer.account_validated?
%li=link_to "Besoins", public_needs_path, :class => ("active" if @needs)
-if session[:reseaux_id].to_i > 0
%li=link_to "Offres", public_reseaux_products_path(:reseaux_id => session[:reseaux_id].to_i), :class => ("active" if @products or @product)
-if current_customer.account_validated?
=link_to "Besoins", public_needs_path, :class => ("active" if @needs)
-if session[:reseaux_id].to_i > 0
=link_to "Offres", public_reseaux_products_path(:reseaux_id => session[:reseaux_id].to_i), :class => ("active" if @products or @product)
.clear
-if @reseaux_chief_layout
.sub_menu_boutique
.center
=link_to "Vue de mon réseau", public_reseaux_path(@reseaux) #, :class => ("active" if @needs)
=link_to "Membres", public_reseaux_customers_path(@reseaux)
=#link_to "Besoins", public_reseaux_path(@reseaux)
=link_to "Commandes", public_reseaux_product_orders_path(@reseaux)
.clear

View File

@ -254,6 +254,11 @@ Rails.application.routes.draw do
resources :reseauxes do
resources :products
resources :product_orders
resources :customers do
end
end
resources :virements