diff --git a/app/views/admin/reseauxes/_form.html.haml b/app/views/admin/reseauxes/_form.html.haml
index 7e07873..fd4237f 100755
--- a/app/views/admin/reseauxes/_form.html.haml
+++ b/app/views/admin/reseauxes/_form.html.haml
@@ -20,8 +20,14 @@
=f.input :abo_needed, :label => "Abonnement nécessaire ?"
=f.input :abo_price, :label => "Prix de l'abonnement ?"
- =f.input :offres_enabled, :label => "Besoins activés ?"
- =f.input :needs_enabled, :label => "Offres activées ?"
+
+
+ =f.input :needs_enabled, :label => "Besoins spécifiques activées ?"
+ =f.input :centrale_enabled, :label => "Centrale d'achats activées ?"
+ =f.input :offres_enabled, :label => "Offres exclusives activés ?"
+
+
+ =f.input :default_part, :label => "Partie par défaut :", :collection => [["Besoins spécifiques", 1],["Centrale d'achats", 2],["Offres exclusives", 3]], :as => :select
.actions= f.submit "Sauvegarder", :class => "btn btn-primary"
diff --git a/app/views/public/my_account/my_reseauxes.html.haml b/app/views/public/my_account/my_reseauxes.html.haml
index 3b261e8..9f6aa78 100644
--- a/app/views/public/my_account/my_reseauxes.html.haml
+++ b/app/views/public/my_account/my_reseauxes.html.haml
@@ -20,7 +20,16 @@
%span
Vous choisissez, nous négocions !
-current_customer.reseauxes.where(:parent_id => nil).each do |reseaux|
- =link_to public_reseaux_products_path(:reseaux_id => reseaux.id), :class => "reseauxes" do
+
+ -if reseaux.default_part == 3
+ -reseaux_path = public_reseaux_products_path(:reseaux_id => reseaux.id)
+ -elsif reseaux.default_part == 2
+ -reseaux_path = public_needs_path(:type => 2, :reseaux_id => reseaux.id)
+ -else
+ -reseaux_path = public_needs_path(:type => 1, :reseaux_id => reseaux.id)
+
+
+ =link_to reseaux_path, :class => "reseauxes" do
.arrow
=ic :"angle-right"
=reseaux.name
diff --git a/app/views/public/shared/_sub_menu.html.haml b/app/views/public/shared/_sub_menu.html.haml
index 0e79a79..6dfd7fe 100644
--- a/app/views/public/shared/_sub_menu.html.haml
+++ b/app/views/public/shared/_sub_menu.html.haml
@@ -3,11 +3,14 @@
.center
-if current_customer.account_validated?
- =link_to "Besoins spécifiques", public_needs_path(:type => 1), :class => ("active" if @needs and params[:type].to_i == 1)
- =link_to "Centrale d'achats", public_needs_path(:type => 2), :class => ("active" if @needs and params[:type].to_i == 2)
+ -if @reseaux and @reseaux.needs_enabled
+ =link_to "Besoins spécifiques", public_needs_path(:type => 1), :class => ("active" if @needs and params[:type].to_i == 1)
+ -if @reseaux and @reseaux.centrale_enabled
+ =link_to "Centrale d'achats", public_needs_path(:type => 2), :class => ("active" if @needs and params[:type].to_i == 2)
-if session[:reseaux_id].to_i > 0
- =link_to "Offres exclusives", public_reseaux_products_path(:reseaux_id => session[:reseaux_id].to_i), :class => ("active" if @products or @product)
+ -if @reseaux and @reseaux.offres_enabled
+ =link_to "Offres exclusives", public_reseaux_products_path(:reseaux_id => session[:reseaux_id].to_i), :class => ("active" if @products or @product)
.clear
diff --git a/db/migrate/20181017211545_add_centrale_to_reseauxes.rb b/db/migrate/20181017211545_add_centrale_to_reseauxes.rb
new file mode 100644
index 0000000..47f4871
--- /dev/null
+++ b/db/migrate/20181017211545_add_centrale_to_reseauxes.rb
@@ -0,0 +1,6 @@
+class AddCentraleToReseauxes < ActiveRecord::Migration
+ def change
+ add_column :reseauxes, :centrale_enabled, :boolean, :default => false
+ add_column :reseauxes, :default_part, :integer, :default => 1
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 7cf1936..53568de 100755
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20181016180809) do
+ActiveRecord::Schema.define(version: 20181017211545) do
create_table "abonnements", force: :cascade do |t|
t.integer "abonnement_type_id", limit: 4
@@ -1047,6 +1047,8 @@ ActiveRecord::Schema.define(version: 20181016180809) do
t.boolean "abo_needed", default: false
t.boolean "offres_enabled", default: false
t.boolean "needs_enabled", default: false
+ t.boolean "centrale_enabled", default: false
+ t.integer "default_part", limit: 4, default: 1
end
create_table "sessions", force: :cascade do |t|