Merge branch 'sorecop' into pre-prod
This commit is contained in:
commit
19200678bd
@ -13,7 +13,7 @@ class Admin::PSpecValuesController < ApplicationController
|
|||||||
def index
|
def index
|
||||||
@p_spec_values = PSpecValue.all
|
@p_spec_values = PSpecValue.all
|
||||||
|
|
||||||
@p_spec_values = sort_by_sorting(@p_spec_values, "id DESC")
|
@p_spec_values = sort_by_sorting(@p_spec_values, "value + 0 ASC")
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html{
|
format.html{
|
||||||
|
|
||||||
|
76
app/controllers/admin/sorecop_cats_controller.rb
Normal file
76
app/controllers/admin/sorecop_cats_controller.rb
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# -*- encoding : utf-8 -*-
|
||||||
|
|
||||||
|
class Admin::SorecopCatsController < ApplicationController
|
||||||
|
layout "admin"
|
||||||
|
before_action :auth_admin
|
||||||
|
|
||||||
|
before_action :admin_space
|
||||||
|
|
||||||
|
def admin_space
|
||||||
|
@admin_space = "default"
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@sorecop_cats = SorecopCat.all
|
||||||
|
|
||||||
|
@sorecop_cats = sort_by_sorting(@sorecop_cats, "id DESC")
|
||||||
|
respond_to do |format|
|
||||||
|
format.html{
|
||||||
|
|
||||||
|
params[:search][:per_page] = params[:search][:per_page] || 100
|
||||||
|
per_page = params[:search][:per_page]
|
||||||
|
page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||||
|
@sorecop_cats = @sorecop_cats.page(page).per(per_page)
|
||||||
|
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@sorecop_cat = SorecopCat.find(params[:id])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@sorecop_cat = SorecopCat.new
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@sorecop_cat = SorecopCat.find(params[:id])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@sorecop_cat = SorecopCat.new(params.require(:sorecop_cat).permit!)
|
||||||
|
|
||||||
|
if @sorecop_cat.save
|
||||||
|
|
||||||
|
else
|
||||||
|
render action: "new"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def update
|
||||||
|
@sorecop_cat = SorecopCat.find(params[:id])
|
||||||
|
|
||||||
|
|
||||||
|
if @sorecop_cat.update_attributes(params.require(:sorecop_cat).permit!)
|
||||||
|
|
||||||
|
else
|
||||||
|
render action: "edit"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@sorecop_cat = SorecopCat.find(params[:id])
|
||||||
|
@sorecop_cat.destroy
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
76
app/controllers/admin/sorecop_taxes_controller.rb
Normal file
76
app/controllers/admin/sorecop_taxes_controller.rb
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# -*- encoding : utf-8 -*-
|
||||||
|
|
||||||
|
class Admin::SorecopTaxesController < ApplicationController
|
||||||
|
layout "admin"
|
||||||
|
before_action :auth_admin
|
||||||
|
|
||||||
|
before_action :admin_space
|
||||||
|
|
||||||
|
def admin_space
|
||||||
|
@admin_space = "default"
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@sorecop_taxes = SorecopTax.all
|
||||||
|
|
||||||
|
@sorecop_taxes = sort_by_sorting(@sorecop_taxes, "id DESC")
|
||||||
|
respond_to do |format|
|
||||||
|
format.html{
|
||||||
|
|
||||||
|
params[:search][:per_page] = params[:search][:per_page] || 100
|
||||||
|
per_page = params[:search][:per_page]
|
||||||
|
page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||||
|
@sorecop_taxes = @sorecop_taxes.page(page).per(per_page)
|
||||||
|
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@sorecop_tax = SorecopTax.find(params[:id])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@sorecop_tax = SorecopTax.new
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@sorecop_tax = SorecopTax.find(params[:id])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@sorecop_tax = SorecopTax.new(params.require(:sorecop_tax).permit!)
|
||||||
|
|
||||||
|
if @sorecop_tax.save
|
||||||
|
|
||||||
|
else
|
||||||
|
render action: "new"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def update
|
||||||
|
@sorecop_tax = SorecopTax.find(params[:id])
|
||||||
|
|
||||||
|
|
||||||
|
if @sorecop_tax.update_attributes(params.require(:sorecop_tax).permit!)
|
||||||
|
|
||||||
|
else
|
||||||
|
render action: "edit"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@sorecop_tax = SorecopTax.find(params[:id])
|
||||||
|
@sorecop_tax.destroy
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
@ -126,6 +126,8 @@ class ApplicationController < ActionController::Base
|
|||||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_grades, "Grades" if PGrade::ACTIVATED
|
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_grades, "Grades" if PGrade::ACTIVATED
|
||||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_powers, "Types de chargeurs"
|
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_powers, "Types de chargeurs"
|
||||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_zones, "Zones produits"
|
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_zones, "Zones produits"
|
||||||
|
set_sub_sub_menu :stocks, :p_preferences_products_menu, :sorecop_cats, "Catégories SORECOP"
|
||||||
|
set_sub_sub_menu :stocks, :p_preferences_products_menu, :sorecop_taxes, "taxe SORECOP"
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -28,7 +28,7 @@ class PProduct < ApplicationRecord
|
|||||||
has_many :p_product_images
|
has_many :p_product_images
|
||||||
|
|
||||||
belongs_to :p_customer
|
belongs_to :p_customer
|
||||||
|
belongs_to :sorecop_cat
|
||||||
|
|
||||||
belongs_to :p_product_cat
|
belongs_to :p_product_cat
|
||||||
belongs_to :s_brand
|
belongs_to :s_brand
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
class PProductRef < ApplicationRecord
|
class PProductRef < ApplicationRecord
|
||||||
belongs_to :p_product
|
belongs_to :p_product
|
||||||
|
belongs_to :sorecop_cat
|
||||||
|
has_many :sorecop_taxes, through: :sorecop_cat
|
||||||
has_many :p_customer_cats, :through => :p_product
|
has_many :p_customer_cats, :through => :p_product
|
||||||
|
|
||||||
has_many :p_product_features
|
has_many :p_product_features
|
||||||
@ -44,9 +45,9 @@ class PProductRef < ApplicationRecord
|
|||||||
:ct_sub_name => {:name => "Nom référence"},
|
:ct_sub_name => {:name => "Nom référence"},
|
||||||
:ct_price_ht => {:name => "Prix de vente", :as => :currency},
|
:ct_price_ht => {:name => "Prix de vente", :as => :currency},
|
||||||
:ean => {:name => "EAN"},
|
:ean => {:name => "EAN"},
|
||||||
:ca_deee => {:name => "DEEE", :as => :currency},
|
:deee => {:name => "DEEE", :as => :currency},
|
||||||
:ca_sorecop => {:name => "Sorecop", :as => :currency},
|
:sorecop => {:name => "Sorecop", :as => :currency},
|
||||||
:sorecop_comment => {:name => "Type de Sorecop"},
|
:sorecop_comment => {:name => "Commentaire Sorecop"},
|
||||||
:actions => {:name => "Actions", :reorder => false}
|
:actions => {:name => "Actions", :reorder => false}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,11 +88,11 @@ class PProductRef < ApplicationRecord
|
|||||||
self.p_product.p_product_cat_id
|
self.p_product.p_product_cat_id
|
||||||
end
|
end
|
||||||
|
|
||||||
QI_DYNAMICS = %w(name code p_product_cat_id sub_cat_names cat_name)
|
# QI_DYNAMICS = %w(name code p_product_cat_id sub_cat_names cat_name)
|
||||||
|
|
||||||
eval(QI_DYNAMICS_CORE)
|
# eval(QI_DYNAMICS_CORE)
|
||||||
|
|
||||||
before_validation :qi_dynamics_cache
|
# before_validation :qi_dynamics_cache
|
||||||
|
|
||||||
def get_price(options)
|
def get_price(options)
|
||||||
p_customer = PCustomer.find(options[:p_customer_id]) if options[:p_customer_id]
|
p_customer = PCustomer.find(options[:p_customer_id]) if options[:p_customer_id]
|
||||||
@ -154,18 +155,42 @@ class PProductRef < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def ca_sorecop
|
def ca_sorecop
|
||||||
|
return ct_sorecop if ct_sorecop
|
||||||
|
return "Pas de catégorie Sorecop" if self.p_product.sorecop_cat.blank?
|
||||||
|
|
||||||
if self.cc_sorecop
|
if self.cc_sorecop
|
||||||
return self.cc_sorecop
|
return self.cc_sorecop
|
||||||
else
|
else
|
||||||
"TODO Calcul sorecop"
|
find_sorecop_tax
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_sorecop_tax
|
||||||
|
p_product_ref_spec = self.p_product_ref_specs.where(p_spec_type: PSpecType.find_by_name("Stockage")).first
|
||||||
|
return "Pas de stockage" if p_product_ref_spec.blank?
|
||||||
|
|
||||||
|
storage_capacity = p_product_ref_spec.p_spec_value.value.to_f
|
||||||
|
if p_product_ref_spec.p_spec_value.unit.casecmp?("Go")
|
||||||
|
tax = self.p_product.sorecop_cat.sorecop_taxes.where('critere_min < ? AND critere_max >= ?', storage_capacity, storage_capacity).first
|
||||||
|
elsif p_product_ref_spec.p_spec_value.unit.casecmp?("To")
|
||||||
|
tax = self.p_product.sorecop_cat.sorecop_taxes.where('critere_min < ? AND critere_max >= ?', storage_capacity * 1000, storage_capacity * 1000).first
|
||||||
|
end
|
||||||
|
|
||||||
|
if tax.fixed_price
|
||||||
|
tax.price
|
||||||
|
else
|
||||||
|
tax.price * storage_capacity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def ca_deee
|
def ca_deee
|
||||||
|
if ct_deee
|
||||||
|
return ct_deee
|
||||||
|
end
|
||||||
if self.cc_deee
|
if self.cc_deee
|
||||||
return self.cc_deee
|
return self.cc_deee
|
||||||
else
|
else
|
||||||
"TODO Calcul DEEE"
|
"DEEE à renseigner"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
10
app/models/sorecop_cat.rb
Normal file
10
app/models/sorecop_cat.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class SorecopCat < ApplicationRecord
|
||||||
|
has_many :p_products
|
||||||
|
has_many :sorecop_taxes, dependent: :destroy
|
||||||
|
|
||||||
|
acts_as_sorting :fields => {
|
||||||
|
:id => {:name => "ID"},
|
||||||
|
:name => {:name => "Catégorie", :reorder => true},
|
||||||
|
:actions => {:name => "Actions", :reorder => true}
|
||||||
|
}
|
||||||
|
end
|
15
app/models/sorecop_tax.rb
Normal file
15
app/models/sorecop_tax.rb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
class SorecopTax < ApplicationRecord
|
||||||
|
belongs_to :sorecop_cat
|
||||||
|
|
||||||
|
|
||||||
|
acts_as_sorting :fields => {
|
||||||
|
:id => {:name => "ID"},
|
||||||
|
:title => {:name => "Désignation", :reorder => true},
|
||||||
|
:critere_min => {:name => "Critère mini (Go)", :reorder => true},
|
||||||
|
:critere_max => {:name => "Critère maxi (Go)", :reorder => true},
|
||||||
|
:fixed_price => {:name => "Prix forfaitaire", :reorder => true, :format => :boolean},
|
||||||
|
:sorecop_cat => {:name => "Catégorie SORECOP",member_label: :name, :reorder => false},
|
||||||
|
:price => {:name => "Prix", :reorder => false, as: :currency},
|
||||||
|
:actions => {:name => "Actions", :reorder => true}
|
||||||
|
}
|
||||||
|
end
|
@ -20,14 +20,15 @@
|
|||||||
|
|
||||||
%td
|
%td
|
||||||
=form.input :p_product_color_id, :label => "Couleur :", :collection => PProductColor.all, :as => :select, :include_blank => true
|
=form.input :p_product_color_id, :label => "Couleur :", :collection => PProductColor.all, :as => :select, :include_blank => true
|
||||||
|
%td
|
||||||
|
=form.input :ean
|
||||||
|
%tr
|
||||||
%td
|
%td
|
||||||
=form.input :ct_sorecop, :label => "Sorecop personalisée :"
|
=form.input :ct_sorecop, :label => "Sorecop personalisée :"
|
||||||
%td
|
%td
|
||||||
=form.input :sorecop_comment, :label => "Type de Sorecop :"
|
=form.input :sorecop_comment, :label => "Commentaire de Sorecop :"
|
||||||
%td
|
%td
|
||||||
=form.input :ct_deee, :label => "DEEE personalisée :"
|
=form.input :ct_deee, :label => "DEEE personalisée :"
|
||||||
%td
|
|
||||||
=form.input :ean
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
=# f.input :stocked, :label => "Suivi de stock ?"
|
=# f.input :stocked, :label => "Suivi de stock ?"
|
||||||
|
|
||||||
|
.col-sm-2
|
||||||
|
=f.input :sorecop_cat, label: "Catgorie Sorecop :", :collection => SorecopCat.all, :as => :select, :include_blank => true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
12
app/views/admin/sorecop_cats/_form.html.haml
Normal file
12
app/views/admin/sorecop_cats/_form.html.haml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
=semantic_form_for [:admin, @sorecop_cat], :remote => true do |f|
|
||||||
|
|
||||||
|
.content
|
||||||
|
=f.inputs do
|
||||||
|
= f.input :name, :label => f.object.label_for(:name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||||
|
|
16
app/views/admin/sorecop_cats/_sorecop_cat.html.haml
Normal file
16
app/views/admin/sorecop_cats/_sorecop_cat.html.haml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
%tr#sorecop_cat_row{:id => sorecop_cat.id}
|
||||||
|
-tr = {}
|
||||||
|
|
||||||
|
-tr[:actions] = capture do
|
||||||
|
%td.actions
|
||||||
|
= link_to i(:"trash-o"), [:admin, sorecop_cat], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||||
|
= link_to i(:pencil), edit_admin_sorecop_cat_path(sorecop_cat), :remote => true
|
||||||
|
= link_to i(:eye), admin_sorecop_cat_path(sorecop_cat), :remote => true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => sorecop_cat}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
2
app/views/admin/sorecop_cats/create.js.erb
Normal file
2
app/views/admin/sorecop_cats/create.js.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$('#sorecop_cats_rows').prepend("<%= escape_javascript(render(@sorecop_cat))%>");
|
||||||
|
close_pane_hover();
|
1
app/views/admin/sorecop_cats/destroy.js.erb
Normal file
1
app/views/admin/sorecop_cats/destroy.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
$('#sorecop_cat_row_<%= @sorecop_cat.id %>').remove();
|
1
app/views/admin/sorecop_cats/edit.js.erb
Normal file
1
app/views/admin/sorecop_cats/edit.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
16
app/views/admin/sorecop_cats/index.html.haml
Normal file
16
app/views/admin/sorecop_cats/index.html.haml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
.qi_header
|
||||||
|
.right= link_to ic(:plus)+' Ajouter', new_admin_sorecop_cat_path(), :class => "btn btn-primary btn-ap-add", :remote => true
|
||||||
|
%h1
|
||||||
|
=SorecopCat.human rescue ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.qi_search_row
|
||||||
|
=form_tag "", :method => "get", :onsubmit => "" do
|
||||||
|
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @sorecop_cats}
|
||||||
|
|
||||||
|
|
||||||
|
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @sorecop_cats}
|
||||||
|
|
||||||
|
|
||||||
|
|
1
app/views/admin/sorecop_cats/new.js.erb
Normal file
1
app/views/admin/sorecop_cats/new.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
10
app/views/admin/sorecop_cats/show.html.haml
Normal file
10
app/views/admin/sorecop_cats/show.html.haml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
.qi_header
|
||||||
|
%h1
|
||||||
|
|
||||||
|
%span
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.qi_row
|
||||||
|
.qi_pannel.qi_plain.padding
|
||||||
|
=debug @sorecop_cat
|
2
app/views/admin/sorecop_cats/update.js.erb
Normal file
2
app/views/admin/sorecop_cats/update.js.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$('#sorecop_cat_row_<%= @sorecop_cat.id %>').replaceWith("<%= escape_javascript(render(@sorecop_cat))%>");
|
||||||
|
close_pane_hover();
|
18
app/views/admin/sorecop_taxes/_form.html.haml
Normal file
18
app/views/admin/sorecop_taxes/_form.html.haml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
=semantic_form_for [:admin, @sorecop_tax], :remote => true do |f|
|
||||||
|
|
||||||
|
.content
|
||||||
|
=f.inputs do
|
||||||
|
= f.input :sorecop_cat_id, as: :select, collection: SorecopCat.pluck(:name, :id) ,:label => f.object.label_for(:sorecop_cat)
|
||||||
|
= f.input :title, :label => f.object.label_for(:title)
|
||||||
|
= f.input :critere_min, :label => f.object.label_for(:critere_min)
|
||||||
|
= f.input :critere_max, :label => f.object.label_for(:critere_max)
|
||||||
|
= f.input :price, :label => f.object.label_for(:price)
|
||||||
|
= f.input :fixed_price, :label => f.object.label_for(:fixed_price)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||||
|
|
35
app/views/admin/sorecop_taxes/_sorecop_tax.html.haml
Normal file
35
app/views/admin/sorecop_taxes/_sorecop_tax.html.haml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
%tr#sorecop_tax_row{:id => sorecop_tax.id}
|
||||||
|
-tr = {}
|
||||||
|
|
||||||
|
-tr[:critere_min] = capture do
|
||||||
|
%td
|
||||||
|
= sorecop_tax.critere_min
|
||||||
|
Go
|
||||||
|
|
||||||
|
-tr[:critere_max] = capture do
|
||||||
|
%td
|
||||||
|
= sorecop_tax.critere_max
|
||||||
|
Go
|
||||||
|
|
||||||
|
-tr[:fixed_price] = capture do
|
||||||
|
%td.text-center
|
||||||
|
-if sorecop_tax.fixed_price
|
||||||
|
=ic("check-square-o")
|
||||||
|
-else
|
||||||
|
=ic("square-o")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-tr[:actions] = capture do
|
||||||
|
%td.actions
|
||||||
|
= link_to i(:"trash-o"), [:admin, sorecop_tax], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||||
|
= link_to i(:pencil), edit_admin_sorecop_tax_path(sorecop_tax), :remote => true
|
||||||
|
= link_to i(:eye), admin_sorecop_tax_path(sorecop_tax), :remote => true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => sorecop_tax}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
2
app/views/admin/sorecop_taxes/create.js.erb
Normal file
2
app/views/admin/sorecop_taxes/create.js.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$('#sorecop_taxes_rows').prepend("<%= escape_javascript(render(@sorecop_tax))%>");
|
||||||
|
close_pane_hover();
|
1
app/views/admin/sorecop_taxes/destroy.js.erb
Normal file
1
app/views/admin/sorecop_taxes/destroy.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
$('#sorecop_tax_row_<%= @sorecop_tax.id %>').remove();
|
1
app/views/admin/sorecop_taxes/edit.js.erb
Normal file
1
app/views/admin/sorecop_taxes/edit.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
16
app/views/admin/sorecop_taxes/index.html.haml
Normal file
16
app/views/admin/sorecop_taxes/index.html.haml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
.qi_header
|
||||||
|
.right= link_to ic(:plus)+' Ajouter', new_admin_sorecop_tax_path(), :class => "btn btn-primary btn-ap-add", :remote => true
|
||||||
|
%h1
|
||||||
|
=SorecopTax.human rescue ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.qi_search_row
|
||||||
|
=form_tag "", :method => "get", :onsubmit => "" do
|
||||||
|
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @sorecop_taxes}
|
||||||
|
|
||||||
|
|
||||||
|
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @sorecop_taxes}
|
||||||
|
|
||||||
|
|
||||||
|
|
1
app/views/admin/sorecop_taxes/new.js.erb
Normal file
1
app/views/admin/sorecop_taxes/new.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
10
app/views/admin/sorecop_taxes/show.html.haml
Normal file
10
app/views/admin/sorecop_taxes/show.html.haml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
.qi_header
|
||||||
|
%h1
|
||||||
|
|
||||||
|
%span
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.qi_row
|
||||||
|
.qi_pannel.qi_plain.padding
|
||||||
|
=debug @sorecop_tax
|
2
app/views/admin/sorecop_taxes/update.js.erb
Normal file
2
app/views/admin/sorecop_taxes/update.js.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$('#sorecop_tax_row_<%= @sorecop_tax.id %>').replaceWith("<%= escape_javascript(render(@sorecop_tax))%>");
|
||||||
|
close_pane_hover();
|
@ -1,5 +1,27 @@
|
|||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
namespace :admin do
|
||||||
|
resources :sorecop_taxes do
|
||||||
|
member do
|
||||||
|
|
||||||
|
end
|
||||||
|
collection do
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace :admin do
|
||||||
|
resources :sorecop_cats do
|
||||||
|
member do
|
||||||
|
|
||||||
|
end
|
||||||
|
collection do
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
resources :price_line_resp_selects do
|
resources :price_line_resp_selects do
|
||||||
member do
|
member do
|
||||||
|
9
db/migrate/20210923161914_create_sorecop_cats.rb
Normal file
9
db/migrate/20210923161914_create_sorecop_cats.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
class CreateSorecopCats < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
create_table :sorecop_cats do |t|
|
||||||
|
t.string :name
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
14
db/migrate/20210923165046_create_sorecop_taxes.rb
Normal file
14
db/migrate/20210923165046_create_sorecop_taxes.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
class CreateSorecopTaxes < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
create_table :sorecop_taxes do |t|
|
||||||
|
t.decimal :critere_min, precision: 10, scale: 2
|
||||||
|
t.decimal :critere_max, precision: 10, scale: 2
|
||||||
|
t.string :title
|
||||||
|
t.boolean :fixed_price, default: true
|
||||||
|
t.decimal :price, precision: 10, scale: 2
|
||||||
|
t.references :sorecop_cat, foreign_key: true
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddSorecopCatIdToPProducts < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
add_column :p_products, :sorecop_cat_id, :integer
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,6 @@
|
|||||||
|
class RenameCaToAcForProductRefs < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
rename_column :p_product_refs, :ca_deee, :ac_deee
|
||||||
|
rename_column :p_product_refs, :ca_sorecop, :ac_sorecop
|
||||||
|
end
|
||||||
|
end
|
26
db/schema.rb
26
db/schema.rb
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2021_09_17_124338) do
|
ActiveRecord::Schema.define(version: 2021_09_24_153716) do
|
||||||
|
|
||||||
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
@ -1793,10 +1793,10 @@ ActiveRecord::Schema.define(version: 2021_09_17_124338) do
|
|||||||
t.boolean "stocked", default: true
|
t.boolean "stocked", default: true
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.integer "p_product_color_id"
|
t.integer "p_product_color_id"
|
||||||
t.decimal "ca_sorecop", precision: 10, scale: 2
|
t.decimal "ac_sorecop", precision: 10, scale: 2
|
||||||
t.decimal "cc_sorecop", precision: 10, scale: 2
|
t.decimal "cc_sorecop", precision: 10, scale: 2
|
||||||
t.decimal "ct_sorecop", precision: 10, scale: 2
|
t.decimal "ct_sorecop", precision: 10, scale: 2
|
||||||
t.decimal "ca_deee", precision: 10, scale: 2
|
t.decimal "ac_deee", precision: 10, scale: 2
|
||||||
t.decimal "cc_deee", precision: 10, scale: 2
|
t.decimal "cc_deee", precision: 10, scale: 2
|
||||||
t.decimal "ct_deee", precision: 10, scale: 2
|
t.decimal "ct_deee", precision: 10, scale: 2
|
||||||
t.string "ean"
|
t.string "ean"
|
||||||
@ -1890,6 +1890,7 @@ ActiveRecord::Schema.define(version: 2021_09_17_124338) do
|
|||||||
t.decimal "finesse_max", precision: 6, scale: 2
|
t.decimal "finesse_max", precision: 6, scale: 2
|
||||||
t.boolean "conserve_proportion", default: false
|
t.boolean "conserve_proportion", default: false
|
||||||
t.boolean "frontpage", default: true
|
t.boolean "frontpage", default: true
|
||||||
|
t.integer "sorecop_cat_id"
|
||||||
t.index ["p_product_cat_id"], name: "index_p_products_on_p_product_cat_id"
|
t.index ["p_product_cat_id"], name: "index_p_products_on_p_product_cat_id"
|
||||||
t.index ["s_brand_id"], name: "index_p_products_on_s_brand_id"
|
t.index ["s_brand_id"], name: "index_p_products_on_s_brand_id"
|
||||||
end
|
end
|
||||||
@ -2754,6 +2755,24 @@ ActiveRecord::Schema.define(version: 2021_09_17_124338) do
|
|||||||
t.decimal "ac_remise", precision: 14, scale: 2
|
t.decimal "ac_remise", precision: 14, scale: 2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "sorecop_cats", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.datetime "created_at", precision: 6, null: false
|
||||||
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "sorecop_taxes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||||
|
t.decimal "critere_min", precision: 10, scale: 2
|
||||||
|
t.decimal "critere_max", precision: 10, scale: 2
|
||||||
|
t.string "title"
|
||||||
|
t.boolean "fixed_price", default: true
|
||||||
|
t.decimal "price", precision: 10, scale: 2
|
||||||
|
t.bigint "sorecop_cat_id"
|
||||||
|
t.datetime "created_at", precision: 6, null: false
|
||||||
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
t.index ["sorecop_cat_id"], name: "index_sorecop_taxes_on_sorecop_cat_id"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "specific_preferences", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
create_table "specific_preferences", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||||
t.string "key"
|
t.string "key"
|
||||||
t.string "value"
|
t.string "value"
|
||||||
@ -3176,6 +3195,7 @@ ActiveRecord::Schema.define(version: 2021_09_17_124338) do
|
|||||||
add_foreign_key "partition_lines", "partitions"
|
add_foreign_key "partition_lines", "partitions"
|
||||||
add_foreign_key "partitions", "admins"
|
add_foreign_key "partitions", "admins"
|
||||||
add_foreign_key "s_modules", "s_modules_states"
|
add_foreign_key "s_modules", "s_modules_states"
|
||||||
|
add_foreign_key "sorecop_taxes", "sorecop_cats"
|
||||||
add_foreign_key "stat_lines", "p_commercials"
|
add_foreign_key "stat_lines", "p_commercials"
|
||||||
add_foreign_key "stat_lines", "p_customers"
|
add_foreign_key "stat_lines", "p_customers"
|
||||||
add_foreign_key "stat_lines", "p_product_refs"
|
add_foreign_key "stat_lines", "p_product_refs"
|
||||||
|
7
test/fixtures/sorecop_cats.yml
vendored
Normal file
7
test/fixtures/sorecop_cats.yml
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
name: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
name: MyString
|
15
test/fixtures/sorecop_taxes.yml
vendored
Normal file
15
test/fixtures/sorecop_taxes.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
critere_min: 9.99
|
||||||
|
critere_max: 9.99
|
||||||
|
title: MyString
|
||||||
|
fixed_price: false
|
||||||
|
sorecop_cat_id: one
|
||||||
|
|
||||||
|
two:
|
||||||
|
critere_min: 9.99
|
||||||
|
critere_max: 9.99
|
||||||
|
title: MyString
|
||||||
|
fixed_price: false
|
||||||
|
sorecop_cat_id: two
|
7
test/models/sorecop_cat_test.rb
Normal file
7
test/models/sorecop_cat_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class SorecopCatTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
7
test/models/sorecop_tax_test.rb
Normal file
7
test/models/sorecop_tax_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class SorecopTaxTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Reference in New Issue
Block a user