suite
This commit is contained in:
parent
e7d937077c
commit
1f86c03556
@ -3,16 +3,20 @@ class ApplicationController < ActionController::Base
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
|
||||
before_filter :get_reseaux
|
||||
before_filter :set_order
|
||||
|
||||
|
||||
|
||||
|
||||
def get_reseaux
|
||||
if session[:reseaux_id] and current_customer
|
||||
if session[:reseaux_id] and current_customer and !params[:no_reseaux]
|
||||
@reseaux = current_customer.reseauxes.find(session[:reseaux_id])
|
||||
@reseaux_layout = true
|
||||
elsif !params[:no_reseaux]
|
||||
session[:reseaux_id] = nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -63,12 +67,12 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def current_abo
|
||||
if current_customer
|
||||
abo = current_customer.abonnements.where(:paid => true).where("start_at <= ? and end_at >= ?", Time.now, Time.now).first
|
||||
abo = current_customer.abonnements.where(:paid => true, :reseaux_id => session[:reseaux_id]).where("start_at <= ? and end_at >= ?", Time.now, Time.now).first
|
||||
end
|
||||
end
|
||||
|
||||
def require_negos_abo
|
||||
if !current_abo
|
||||
if !current_abo and (!session[:reseaux_id] or (@reseaux and @reseaux.abo_needed))
|
||||
redirect_to new_public_abonnement_path
|
||||
end
|
||||
end
|
||||
|
@ -6,12 +6,20 @@ class Public::AbonnementsController < ApplicationController
|
||||
layout "public"
|
||||
|
||||
def new
|
||||
|
||||
|
||||
@abonnement = current_customer.abonnements.new(:price => 300.0, :start_at => Time.now, :end_at => (Time.now+14.months).end_of_day, :slug => "negos-principal")
|
||||
if @reseaux and @reseaux.abo_needed
|
||||
@abonnement.price = @reseaux.abo_price
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@abonnement = current_customer.abonnements.new(:price => 300.0, :start_at => Time.now, :end_at => (Time.now+14.months).end_of_day, :slug => "negos-principal")
|
||||
|
||||
if @reseaux and @reseaux.abo_needed
|
||||
@abonnement.price = @reseaux.abo_price
|
||||
@abonnement.reseaux_id = @reseaux.id
|
||||
end
|
||||
if @abonnement.save
|
||||
session[:abonnement_id] = @abonnement
|
||||
|
||||
|
@ -10,9 +10,14 @@ class Public::NeedsController < ApplicationController
|
||||
before_filter :check_owner, only: [:destroy,:edit,:update]
|
||||
|
||||
def index
|
||||
|
||||
session[:reseaux_id] = nil if params[:no_reseaux]
|
||||
# Get only public needs
|
||||
@needs = Need.shared
|
||||
if session[:reseaux_id].to_i > 0
|
||||
@needs = @needs.where(:reseaux_id => session[:reseaux_id])
|
||||
else
|
||||
@needs = @needs.where(:reseaux_id => nil)
|
||||
end
|
||||
@needs = @needs.domain_in(current_customer.domain_ids)
|
||||
|
||||
# filters default value
|
||||
@ -117,6 +122,7 @@ class Public::NeedsController < ApplicationController
|
||||
|
||||
def create
|
||||
@need = Need.new(need_params)
|
||||
@need.reseaux_id = session[:reseaux_id]
|
||||
@need.author = current_customer
|
||||
|
||||
if !@need.devis? && !@need.note?
|
||||
|
@ -2,6 +2,7 @@
|
||||
class Need < ActiveRecord::Base
|
||||
include Workflow
|
||||
|
||||
belongs_to :reseaux
|
||||
|
||||
belongs_to :referent_technique, :class_name => "Customer"
|
||||
belongs_to :referent_negos, :class_name => "Customer"
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
|
||||
=f.inputs do
|
||||
=f.input :reseaux_id, :label => "Réseau :", :collection => Reseaux.where(:parent_id => nil).all, :as => :select, :include_blank => false
|
||||
|
||||
=f.input :title, :label => "Titre : "
|
||||
=f.input :category, include_blank: "Toute catégorie", :as => :select, :collection => @tree.map{|c| [(c.level > 0 ? (' ' * (c.level - 1)) + "|- ": "").html_safe + c.name, c.id]}, label: "Catégorie de besoin"
|
||||
=f.input :description, :label => "Description : ", :rows => 5, :input_html => {:style => "height:100px;"}
|
||||
|
@ -2,6 +2,8 @@
|
||||
-css_class = "danger" if need.failed?
|
||||
-css_class = "success" if need.negociated?
|
||||
%tr{:id => need.id, class: css_class}
|
||||
%td
|
||||
= need.reseaux.name if need.reseaux
|
||||
%td
|
||||
=link_to need.title, edit_admin_need_path(need)
|
||||
%td
|
||||
|
@ -16,6 +16,7 @@
|
||||
%thead.rows_header
|
||||
|
||||
%tr
|
||||
%th Réseaux
|
||||
%th
|
||||
Titre
|
||||
%th
|
||||
@ -45,6 +46,7 @@
|
||||
%thead.rows_header
|
||||
|
||||
%tr
|
||||
%th Réseaux
|
||||
%th
|
||||
Titre
|
||||
%th
|
||||
|
@ -18,6 +18,11 @@
|
||||
=f.input :logo_image_file_id, :label => "Logo :", :as => :qi_image_select
|
||||
=f.input :background_image_file_id, :label => "Image de fond :", :as => :qi_image_select
|
||||
|
||||
=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 ?"
|
||||
|
||||
|
||||
.actions= f.submit "Sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
|
@ -11,8 +11,16 @@
|
||||
%p Par ailleurs, celle-ci vous sera expédiée dès que nous aurons reçu votre règlement.
|
||||
|
||||
%p
|
||||
Pour cela, vous pouvez contacter LA VOUISIENNE au 04 76 55 30 94 ou par mail:
|
||||
=link_to "contact@lavouisienne.fr.", "mailto:contact@lavouisienne.fr"
|
||||
Pour cela, vous pouvez régler directement le montant de la commande par virement au RIB suivant :
|
||||
%p
|
||||
Bic :
|
||||
%strong AGRIFRPP878
|
||||
%p
|
||||
IBAN :
|
||||
%strong FR76 1780 6002 3404 1182 1505 832
|
||||
%p
|
||||
Adresse :
|
||||
%strong SAS Negos, 15 Chemin du Goulet, 38140 Apprieu
|
||||
|
||||
%p Vous trouverez ci-dessous le récapitulatif de votre commande :
|
||||
|
||||
|
@ -13,7 +13,13 @@
|
||||
|
||||
.center
|
||||
|
||||
%p{:style => "text-align:center;font-weight:bold;font-size:18px"} Pour profiter des fonctions de Négos, vous pouvez dès à présent souscrire à un abonnement annuel de 300€ HT (360€ TTC)
|
||||
%p{:style => "text-align:center;font-weight:bold;font-size:18px"}
|
||||
Pour profiter des fonctions de Négos, vous pouvez dès à présent souscrire à un abonnement annuel de
|
||||
=number_to_currency @abonnement.price
|
||||
HT
|
||||
(
|
||||
=number_to_currency (@abonnement.price.to_f*1.2)
|
||||
TTC)
|
||||
|
||||
%center
|
||||
%p=submit_tag "Souscrire maintenant >", :class => "btn btn-primary"
|
||||
|
@ -12,7 +12,7 @@
|
||||
%br
|
||||
Choissisez le réseaux sur lequel vous souhaitez vous connecter :
|
||||
.reseauxes_home
|
||||
=link_to public_needs_path, :class => "reseauxes" do
|
||||
=link_to public_needs_path(:no_reseaux => true), :class => "reseauxes" do
|
||||
.arrow
|
||||
=ic :"angle-right"
|
||||
Plateforme Négos
|
||||
|
5
db/migrate/20180827132748_add_reseaux_id_to_reseauxes.rb
Normal file
5
db/migrate/20180827132748_add_reseaux_id_to_reseauxes.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddReseauxIdToReseauxes < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :needs, :reseaux_id, :integer
|
||||
end
|
||||
end
|
8
db/migrate/20180827152648_add_abo_price_to_reseauxes.rb
Normal file
8
db/migrate/20180827152648_add_abo_price_to_reseauxes.rb
Normal file
@ -0,0 +1,8 @@
|
||||
class AddAboPriceToReseauxes < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :reseauxes, :abo_price, :decimal, precision: 10, scale: 2
|
||||
add_column :reseauxes, :abo_needed, :boolean, :default => false
|
||||
add_column :reseauxes, :offres_enabled, :boolean, :default => false
|
||||
add_column :reseauxes, :needs_enabled, :boolean, :default => false
|
||||
end
|
||||
end
|
5
db/migrate/20180827155325_add_reseaux_to_abonnements.rb
Normal file
5
db/migrate/20180827155325_add_reseaux_to_abonnements.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddReseauxToAbonnements < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :abonnements, :reseaux_id, :integer
|
||||
end
|
||||
end
|
12
db/schema.rb
12
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: 20180816172810) do
|
||||
ActiveRecord::Schema.define(version: 20180827155325) do
|
||||
|
||||
create_table "abonnements", force: :cascade do |t|
|
||||
t.integer "abonnement_type_id", limit: 4
|
||||
@ -24,6 +24,7 @@ ActiveRecord::Schema.define(version: 20180816172810) do
|
||||
t.integer "customer_id", limit: 4
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "reseaux_id", limit: 4
|
||||
end
|
||||
|
||||
create_table "accepted_offers", force: :cascade do |t|
|
||||
@ -567,6 +568,7 @@ ActiveRecord::Schema.define(version: 20180816172810) do
|
||||
t.text "note", limit: 65535
|
||||
t.integer "referent_negos_id", limit: 4
|
||||
t.integer "referent_technique_id", limit: 4
|
||||
t.integer "reseaux_id", limit: 4
|
||||
end
|
||||
|
||||
add_index "needs", ["author_id"], name: "index_needs_on_author_id", using: :btree
|
||||
@ -1021,8 +1023,8 @@ ActiveRecord::Schema.define(version: 20180816172810) do
|
||||
t.string "name", limit: 255
|
||||
t.text "description", limit: 65535
|
||||
t.integer "chef_reseau_id", limit: 4
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "token", limit: 255
|
||||
t.integer "parent_id", limit: 4
|
||||
t.integer "logo_image_file_id", limit: 4
|
||||
@ -1030,6 +1032,10 @@ ActiveRecord::Schema.define(version: 20180816172810) do
|
||||
t.string "title", limit: 255
|
||||
t.string "baseline", limit: 255
|
||||
t.string "sub_domain", limit: 255
|
||||
t.decimal "abo_price", precision: 10
|
||||
t.boolean "abo_needed", default: false
|
||||
t.boolean "offres_enabled", default: false
|
||||
t.boolean "needs_enabled", default: false
|
||||
end
|
||||
|
||||
create_table "sessions", force: :cascade do |t|
|
||||
|
Loading…
x
Reference in New Issue
Block a user