menu & forms

This commit is contained in:
Barnabé 2021-09-23 19:56:51 +02:00
parent 7a5e27685c
commit 0246cf966e
6 changed files with 41 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -1,2 +1,10 @@
class SorecopCat < ApplicationRecord class SorecopCat < ApplicationRecord
has_many :p_product_refs
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 end

View File

@ -1,3 +1,15 @@
class SorecopTax < ApplicationRecord class SorecopTax < ApplicationRecord
belongs_to :sorecop_cat_id 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", :reorder => false},
:price => {:name => "Prix", :reorder => false},
:actions => {:name => "Actions", :reorder => true}
}
end end

View File

@ -2,11 +2,13 @@
.content .content
=f.inputs do =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_min, :label => f.object.label_for(:critere_min)
= f.input :critere_max, :label => f.object.label_for(:critere_max) = f.input :critere_max, :label => f.object.label_for(:critere_max)
= f.input :title, :label => f.object.label_for(:title) = f.input :price, :label => f.object.label_for(:price)
= f.input :fixed_price, :label => f.object.label_for(:fixed_price) = f.input :fixed_price, :label => f.object.label_for(:fixed_price)
= f.input :sorecop_cat_id, :label => f.object.label_for(:sorecop_cat_id)

View File

@ -1,6 +1,11 @@
%tr#sorecop_tax_row{:id => sorecop_tax.id} %tr#sorecop_tax_row{:id => sorecop_tax.id}
-tr = {} -tr = {}
-tr[:sorecop_cat] = capture do
%td
= sorecop_tax.sorecop_cat.name
-tr[:actions] = capture do -tr[:actions] = capture do
%td.actions %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(:"trash-o"), [:admin, sorecop_tax], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true