diff --git a/app/assets/stylesheets/public.scss b/app/assets/stylesheets/public.scss index a29ec2c..dbf3bab 100755 --- a/app/assets/stylesheets/public.scss +++ b/app/assets/stylesheets/public.scss @@ -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; diff --git a/app/controllers/public/customers_controller.rb b/app/controllers/public/customers_controller.rb index bf2a78a..2c0fc9b 100755 --- a/app/controllers/public/customers_controller.rb +++ b/app/controllers/public/customers_controller.rb @@ -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 diff --git a/app/controllers/public/product_orders_controller.rb b/app/controllers/public/product_orders_controller.rb index 642abed..4761644 100755 --- a/app/controllers/public/product_orders_controller.rb +++ b/app/controllers/public/product_orders_controller.rb @@ -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 diff --git a/app/controllers/public/reseauxes_controller.rb b/app/controllers/public/reseauxes_controller.rb index 9be7913..fef3398 100755 --- a/app/controllers/public/reseauxes_controller.rb +++ b/app/controllers/public/reseauxes_controller.rb @@ -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 diff --git a/app/models/reseaux.rb b/app/models/reseaux.rb index ee0449a..fe49e7d 100644 --- a/app/models/reseaux.rb +++ b/app/models/reseaux.rb @@ -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 diff --git a/app/views/public/customers/index.haml b/app/views/public/customers/index.haml index c0065d0..1e512d2 100755 --- a/app/views/public/customers/index.haml +++ b/app/views/public/customers/index.haml @@ -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;"} +   + + + + + %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 diff --git a/app/views/public/product_orders/_product_order.html.haml b/app/views/public/product_orders/_product_order.html.haml new file mode 100644 index 0000000..148c5e9 --- /dev/null +++ b/app/views/public/product_orders/_product_order.html.haml @@ -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} + + + + + diff --git a/app/views/public/product_orders/index.html.haml b/app/views/public/product_orders/index.html.haml new file mode 100644 index 0000000..43c5429 --- /dev/null +++ b/app/views/public/product_orders/index.html.haml @@ -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 + \ No newline at end of file diff --git a/app/views/public/reseauxes/show.html.haml b/app/views/public/reseauxes/show.html.haml index a8c4d51..444e218 100644 --- a/app/views/public/reseauxes/show.html.haml +++ b/app/views/public/reseauxes/show.html.haml @@ -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;"} -   - - - - - %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 diff --git a/app/views/public/shared/_sub_menu.html.haml b/app/views/public/shared/_sub_menu.html.haml index b76c145..d2df122 100644 --- a/app/views/public/shared/_sub_menu.html.haml +++ b/app/views/public/shared/_sub_menu.html.haml @@ -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 \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index af3afe7..c45e7d1 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -254,6 +254,11 @@ Rails.application.routes.draw do resources :reseauxes do resources :products + resources :product_orders + resources :customers do + + + end end resources :virements