diff --git a/.sass-cache/d6dc4d64a1af1ff4c7903858d908aeb1a0a8c2c1/(__TEMPLATE__)c b/.sass-cache/d6dc4d64a1af1ff4c7903858d908aeb1a0a8c2c1/(__TEMPLATE__)c new file mode 100644 index 0000000..2aaa243 Binary files /dev/null and b/.sass-cache/d6dc4d64a1af1ff4c7903858d908aeb1a0a8c2c1/(__TEMPLATE__)c differ diff --git a/app/controllers/admin/p_article_serial_nums_controller.rb b/app/controllers/admin/p_article_serial_nums_controller.rb new file mode 100644 index 0000000..d7ecbf7 --- /dev/null +++ b/app/controllers/admin/p_article_serial_nums_controller.rb @@ -0,0 +1,89 @@ +# -*- encoding : utf-8 -*- + +class Admin::PArticleSerialNumsController < ApplicationController + layout "admin" + before_action :auth_admin + + before_action :admin_space + + def admin_space + @admin_space = "default" + end + + def index + @p_article_serial_nums = PArticleSerialNum.all + + if params[:search][:p_serial_num_type_name].present? + @p_article_serial_nums = @p_article_serial_nums.where(p_serial_num_type_id: params[:search][:p_serial_num_type_name]) + + end + + if params[:search][:p_product_ref_cc_name] + @p_article_serial_nums = @p_article_serial_nums.joins(:p_article, :p_product_ref).where("cc_name LIKE ?","#{params[:search][:p_product_ref_cc_name]}%") + end + + if params[:search][:value] + @p_article_serial_nums = @p_article_serial_nums.where("value LIKE ?","#{params[:search][:value]}%") + end + + @p_article_serial_nums = sort_by_sorting(@p_article_serial_nums, "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 + @p_article_serial_nums = @p_article_serial_nums.page(page).per(per_page) + + } + end + end + + def show + @p_article_serial_num = PArticleSerialNum.find(params[:id]) + + end + + def new + @p_article_serial_num = PArticleSerialNum.new + # @p_article_serial_num.build_p_serial_num_value + end + + def edit + @p_article_serial_num = PArticleSerialNum.find(params[:id]) + + end + + def create + @p_article_serial_num = PArticleSerialNum.new(params.require(:p_article_serial_num).permit!) + + if @p_article_serial_num.save + + else + render action: "new" + + end + + end + + + def update + @p_article_serial_num = PArticleSerialNum.find(params[:id]) + + + if @p_article_serial_num.update_attributes(params.require(:p_article_serial_num).permit!) + + else + render action: "edit" + + end + + end + + + def destroy + @p_article_serial_num = PArticleSerialNum.find(params[:id]) + @p_article_serial_num.destroy + + end +end diff --git a/app/controllers/admin/p_articles_controller.rb b/app/controllers/admin/p_articles_controller.rb new file mode 100644 index 0000000..0e40f7a --- /dev/null +++ b/app/controllers/admin/p_articles_controller.rb @@ -0,0 +1,104 @@ +# -*- encoding : utf-8 -*- + +class Admin::PArticlesController < ApplicationController + layout "admin" + before_action :auth_admin + + before_action :admin_space + + def admin_space + @admin_space = "default" + end + + def index + @p_articles = PArticle.all + + if params[:search][:p_product_color].to_s != "" + if params[:search][:p_product_color].to_s == "null" + @p_articles = @p_articles.joins(:p_product_ref).where("p_product_color_id = ?", nil) + else + @p_articles = @p_articles.joins(:p_product_ref).where("p_product_color_id = ?", params[:search][:p_product_color]) + end + end + + if params[:search][:p_product_ref_cc_name] + @p_articles = @p_articles.joins(:p_product_ref).where("cc_name LIKE ?", "#{params[:search][:p_product_ref_cc_name]}%") + end + + if params[:search][:p_grade_id] + @p_articles = @p_articles.where("p_grade_id LIKE ?", "#{params[:search][:p_grade_id]}%") + end + + if params[:search][:p_product_ref_cc_code] + @p_articles = @p_articles.joins(:p_product_ref).where("cc_code LIKE ?", "#{params[:search][:p_product_ref_cc_code]}%") + end + + if params[:search][:p_article_serial_num] + @p_articles = @p_articles.joins(:p_article_serial_nums).where("value LIKE ?", "#{params[:search][:p_article_serial_num]}%") + end + + + @p_articles = sort_by_sorting(@p_articles, "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 + @p_articles = @p_articles.page(page).per(per_page) + + } + end + end + + def show + @p_article = PArticle.find(params[:id]) + + end + + def new + @p_article = PArticle.new + @p_article_serial_nums = @p_article.p_article_serial_nums.build + + @p_serial_num_type = @p_article_serial_nums.build_p_serial_num_type + # @p_serial_num_value = @p_article_serial_nums.build_p_serial_num_value + end + + def edit + @p_article = PArticle.find(params[:id]) + + end + + def create + @p_article = PArticle.new(params.require(:p_article).permit!) + + if @p_article.save + + else + render action: "new" + + end + + end + + + def update + @p_article = PArticle.find(params[:id]) + + + if @p_article.update_attributes(params.require(:p_article).permit!) + + else + render action: "edit" + + end + + end + + + def destroy + @p_article = PArticle.find(params[:id]) + @p_article.destroy + + end +end diff --git a/app/controllers/admin/p_grades_controller.rb b/app/controllers/admin/p_grades_controller.rb new file mode 100644 index 0000000..7a77712 --- /dev/null +++ b/app/controllers/admin/p_grades_controller.rb @@ -0,0 +1,76 @@ +# -*- encoding : utf-8 -*- + +class Admin::PGradesController < ApplicationController + layout "admin" + before_action :auth_admin + + before_action :admin_space + + def admin_space + @admin_space = "default" + end + + def index + @p_grades = PGrade.all + + @p_grades = sort_by_sorting(@p_grades, "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 + @p_grades = @p_grades.page(page).per(per_page) + + } + end + end + + def show + @p_grade = PGrade.find(params[:id]) + + end + + def new + @p_grade = PGrade.new + + end + + def edit + @p_grade = PGrade.find(params[:id]) + + end + + def create + @p_grade = PGrade.new(params.require(:p_grade).permit!) + + if @p_grade.save + + else + render action: "new" + + end + + end + + + def update + @p_grade = PGrade.find(params[:id]) + + + if @p_grade.update_attributes(params.require(:p_grade).permit!) + + else + render action: "edit" + + end + + end + + + def destroy + @p_grade = PGrade.find(params[:id]) + @p_grade.destroy + + end +end diff --git a/app/controllers/admin/p_product_ref_specs_controller.rb b/app/controllers/admin/p_product_ref_specs_controller.rb new file mode 100644 index 0000000..9935030 --- /dev/null +++ b/app/controllers/admin/p_product_ref_specs_controller.rb @@ -0,0 +1,78 @@ +# -*- encoding : utf-8 -*- + +class Admin::PProductRefSpecsController < ApplicationController + layout "admin" + before_action :auth_admin + + before_action :admin_space + + def admin_space + @admin_space = "default" + end + + def index + @p_product_ref_specs = PProductRefSpec.all + + @p_product_ref_specs = sort_by_sorting(@p_product_ref_specs, "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 + @p_product_ref_specs = @p_product_ref_specs.page(page).per(per_page) + + } + end + end + + def show + @p_product_ref_spec = PProductRefSpec.find(params[:id]) + + end + + def new + @p_product_ref_spec = PProductRefSpec.new + @p_product_ref_spec.build_p_spec_type + @p_product_ref_spec.build_p_spec_value + + end + + def edit + @p_product_ref_spec = PProductRefSpec.find(params[:id]) + + end + + def create + @p_product_ref_spec = PProductRefSpec.new(params.require(:p_product_ref_spec).permit!) + + if @p_product_ref_spec.save + + else + render action: "new" + + end + + end + + + def update + @p_product_ref_spec = PProductRefSpec.find(params[:id]) + + + if @p_product_ref_spec.update_attributes(params.require(:p_product_ref_spec).permit!) + + else + render action: "edit" + + end + + end + + + def destroy + @p_product_ref_spec = PProductRefSpec.find(params[:id]) + @p_product_ref_spec.destroy + + end +end diff --git a/app/controllers/admin/p_products_controller.rb b/app/controllers/admin/p_products_controller.rb index a0ae7f9..9cb4915 100644 --- a/app/controllers/admin/p_products_controller.rb +++ b/app/controllers/admin/p_products_controller.rb @@ -73,8 +73,11 @@ class Admin::PProductsController < ApplicationController @p_product = PProduct.new #(:p_customer_cat_ids => [3]) - @p_product.p_product_refs << PProductRef.new - + # @p_product.p_product_refs << PProductRef.new + @p_product_refs = @p_product.p_product_refs.build + @p_product_ref_specs = @p_product_refs.p_product_ref_specs.build + @p_spec_type = @p_product_ref_specs.build_p_spec_type + @p_spec_value = @p_product_ref_specs.build_p_spec_value end diff --git a/app/controllers/admin/p_serial_num_types_controller.rb b/app/controllers/admin/p_serial_num_types_controller.rb new file mode 100644 index 0000000..ef1f006 --- /dev/null +++ b/app/controllers/admin/p_serial_num_types_controller.rb @@ -0,0 +1,81 @@ +# -*- encoding : utf-8 -*- + +class Admin::PSerialNumTypesController < ApplicationController + layout "admin" + before_action :auth_admin + + before_action :admin_space + + def admin_space + @admin_space = "default" + end + + def index + @p_serial_num_types = PSerialNumType.all + + if params[:search][:name] + @p_serial_num_types = @p_serial_num_types.where("id = ?","#{params[:search][:name]}%") + end + + + @p_serial_num_types = sort_by_sorting(@p_serial_num_types, "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 + @p_serial_num_types = @p_serial_num_types.page(page).per(per_page) + + } + end + end + + def show + @p_serial_num_type = PSerialNumType.find(params[:id]) + + end + + def new + @p_serial_num_type = PSerialNumType.new + + end + + def edit + @p_serial_num_type = PSerialNumType.find(params[:id]) + + end + + def create + @p_serial_num_type = PSerialNumType.new(params.require(:p_serial_num_type).permit!) + + if @p_serial_num_type.save + + else + render action: "new" + + end + + end + + + def update + @p_serial_num_type = PSerialNumType.find(params[:id]) + + + if @p_serial_num_type.update_attributes(params.require(:p_serial_num_type).permit!) + + else + render action: "edit" + + end + + end + + + def destroy + @p_serial_num_type = PSerialNumType.find(params[:id]) + @p_serial_num_type.destroy + + end +end diff --git a/app/controllers/admin/p_serial_num_values_controller.rb b/app/controllers/admin/p_serial_num_values_controller.rb new file mode 100644 index 0000000..05c3bde --- /dev/null +++ b/app/controllers/admin/p_serial_num_values_controller.rb @@ -0,0 +1,76 @@ +# -*- encoding : utf-8 -*- + +class Admin::PSerialNumValuesController < ApplicationController + layout "admin" + before_action :auth_admin + + before_action :admin_space + + def admin_space + @admin_space = "default" + end + + def index + @p_serial_num_values = PSerialNumValue.all + + @p_serial_num_values = sort_by_sorting(@p_serial_num_values, "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 + @p_serial_num_values = @p_serial_num_values.page(page).per(per_page) + + } + end + end + + def show + @p_serial_num_value = PSerialNumValue.find(params[:id]) + + end + + def new + @p_serial_num_value = PSerialNumValue.new + + end + + def edit + @p_serial_num_value = PSerialNumValue.find(params[:id]) + + end + + def create + @p_serial_num_value = PSerialNumValue.new(params.require(:p_serial_num_value).permit!) + + if @p_serial_num_value.save + + else + render action: "new" + + end + + end + + + def update + @p_serial_num_value = PSerialNumValue.find(params[:id]) + + + if @p_serial_num_value.update_attributes(params.require(:p_serial_num_value).permit!) + + else + render action: "edit" + + end + + end + + + def destroy + @p_serial_num_value = PSerialNumValue.find(params[:id]) + @p_serial_num_value.destroy + + end +end diff --git a/app/controllers/admin/p_spec_types_controller.rb b/app/controllers/admin/p_spec_types_controller.rb new file mode 100644 index 0000000..5d3ed6b --- /dev/null +++ b/app/controllers/admin/p_spec_types_controller.rb @@ -0,0 +1,76 @@ +# -*- encoding : utf-8 -*- + +class Admin::PSpecTypesController < ApplicationController + layout "admin" + before_action :auth_admin + + before_action :admin_space + + def admin_space + @admin_space = "default" + end + + def index + @p_spec_types = PSpecType.all + + @p_spec_types = sort_by_sorting(@p_spec_types, "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 + @p_spec_types = @p_spec_types.page(page).per(per_page) + + } + end + end + + def show + @p_spec_type = PSpecType.find(params[:id]) + + end + + def new + @p_spec_type = PSpecType.new + + end + + def edit + @p_spec_type = PSpecType.find(params[:id]) + + end + + def create + @p_spec_type = PSpecType.new(params.require(:p_spec_type).permit!) + + if @p_spec_type.save + + else + render action: "new" + + end + + end + + + def update + @p_spec_type = PSpecType.find(params[:id]) + + + if @p_spec_type.update_attributes(params.require(:p_spec_type).permit!) + + else + render action: "edit" + + end + + end + + + def destroy + @p_spec_type = PSpecType.find(params[:id]) + @p_spec_type.destroy + + end +end diff --git a/app/controllers/admin/p_spec_values_controller.rb b/app/controllers/admin/p_spec_values_controller.rb new file mode 100644 index 0000000..2dfd736 --- /dev/null +++ b/app/controllers/admin/p_spec_values_controller.rb @@ -0,0 +1,76 @@ +# -*- encoding : utf-8 -*- + +class Admin::PSpecValuesController < ApplicationController + layout "admin" + before_action :auth_admin + + before_action :admin_space + + def admin_space + @admin_space = "default" + end + + def index + @p_spec_values = PSpecValue.all + + @p_spec_values = sort_by_sorting(@p_spec_values, "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 + @p_spec_values = @p_spec_values.page(page).per(per_page) + + } + end + end + + def show + @p_spec_value = PSpecValue.find(params[:id]) + + end + + def new + @p_spec_value = PSpecValue.new + + end + + def edit + @p_spec_value = PSpecValue.find(params[:id]) + + end + + def create + @p_spec_value = PSpecValue.new(params.require(:p_spec_value).permit!) + + if @p_spec_value.save + + else + render action: "new" + + end + + end + + + def update + @p_spec_value = PSpecValue.find(params[:id]) + + + if @p_spec_value.update_attributes(params.require(:p_spec_value).permit!) + + else + render action: "edit" + + end + + end + + + def destroy + @p_spec_value = PSpecValue.find(params[:id]) + @p_spec_value.destroy + + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f693d7e..9ab496c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -65,13 +65,14 @@ class ApplicationController < ActionController::Base if current_admin.has_permission?("products") set_sub_menu :stocks, :p_products, "Produits", admin_p_products_path set_sub_menu :stocks, :p_product_refs, "Références", admin_p_product_refs_path - set_sub_menu :stocks, :promos_p_products, "Offres spots", promos_admin_p_products_path + set_sub_menu :stocks, :p_articles, "Articles", admin_p_articles_path + # set_sub_menu :stocks, :promos_p_products, "Offres spots", promos_admin_p_products_path end if current_admin.has_permission?("product-cats") set_sub_menu :stocks, :p_product_cats, "Catégories produits", admin_p_product_cats_path - set_sub_menu :stocks, :p_product_sub_cats, "Sous catégories produits", admin_p_product_sub_cats_path + # set_sub_menu :stocks, :p_product_sub_cats, "Sous catégories produits", admin_p_product_sub_cats_path end @@ -97,6 +98,11 @@ class ApplicationController < ActionController::Base if current_admin.has_permission?("boutique") set_sub_menu :stocks, :p_product_colors, "Couleurs" + set_sub_menu :stocks, :p_article_serial_nums, "Numeros série" + set_sub_menu :stocks, :p_serial_num_types, "Types de Numero série" + set_sub_menu :stocks, :p_product_ref_specs, "Specs" + set_sub_menu :stocks, :p_spec_values, "Valeur de specs" + set_sub_menu :stocks, :p_grades, "Grades" set_sub_menu :stocks, :p_product_powers, "Types de chargeurs" set_sub_menu :stocks, :p_product_zones, "Zones produits" diff --git a/app/models/p_article.rb b/app/models/p_article.rb new file mode 100644 index 0000000..f301d09 --- /dev/null +++ b/app/models/p_article.rb @@ -0,0 +1,28 @@ +class PArticle < ApplicationRecord + belongs_to :p_grade + belongs_to :p_product_ref + has_one :p_product, through: :p_product_ref + has_one :p_product_color, through: :p_product_ref + + has_many :p_article_serial_nums, dependent: :destroy + has_many :p_serial_num_values, through: :p_article_serial_nums + accepts_nested_attributes_for :p_article_serial_nums + + validates_presence_of :p_product_ref + # has_many :p_product_ref_specs, through: :p_product_ref + # accepts_nested_attributes_for :p_product_ref_specs + + acts_as_sorting :fields => { + :id => {:name => "id", :reorder => true}, + :p_product_ref_code => {:name => "Code ref", :reorder => true}, + :p_product_ref => {:name => "Désignation", :reorder => true}, + :p_grade => {:name => "Grade", :reorder => true}, + :color => {:name => "Couleur"}, + :p_article_serial_nums => {:name => "N° identifiants"}, + :actions => {:name => "Actions", :reorder => false}, + } + + def member_label + "#{p_product_ref.cc_name}" + end +end diff --git a/app/models/p_article_serial_num.rb b/app/models/p_article_serial_num.rb new file mode 100644 index 0000000..b17ef22 --- /dev/null +++ b/app/models/p_article_serial_num.rb @@ -0,0 +1,19 @@ +class PArticleSerialNum < ApplicationRecord + belongs_to :p_article + belongs_to :p_serial_num_type + belongs_to :p_serial_num_value, inverse_of: :p_article_serial_nums + has_one :p_product_ref, through: :p_article + # accepts_nested_attributes_for :p_serial_num_value + + acts_as_sorting :fields => { + :id => {:name => "ID"}, + :p_article => {:name => "Article", :reorder => true}, + :p_article_id => {:name => "Article ID", :reorder => true}, + :p_serial_num_type => {:name => "Type", :reorder => true}, + :value => {:name => "N°", :reorder => true}, + + :actions => {:name => "Actions", :reorder => true} + + } + +end diff --git a/app/models/p_grade.rb b/app/models/p_grade.rb new file mode 100644 index 0000000..949f5e1 --- /dev/null +++ b/app/models/p_grade.rb @@ -0,0 +1,10 @@ +class PGrade < ApplicationRecord + has_many :p_articles + + acts_as_sorting :fields => { + :id => {:name => "id", :reorder => true}, + :grade => {:name => "Grade", :reorder => true}, + :actions => {:name => "Actions", :reorder => false}, + } + +end diff --git a/app/models/p_product.rb b/app/models/p_product.rb index 1d77cd4..893a83c 100644 --- a/app/models/p_product.rb +++ b/app/models/p_product.rb @@ -5,8 +5,6 @@ class PProduct < ApplicationRecord has_many :p_product_refs, :dependent => :destroy accepts_nested_attributes_for :p_product_refs, allow_destroy: true - - has_many :p_product_ingredients, :dependent => :destroy accepts_nested_attributes_for :p_product_ingredients, allow_destroy: true @@ -17,6 +15,14 @@ class PProduct < ApplicationRecord has_many :p_product_nutris, :dependent => :destroy accepts_nested_attributes_for :p_product_nutris, allow_destroy: true + has_many :p_articles, through: :p_product_refs + + # has_many :p_product_ref_specs, through: :p_product_refs + # accepts_nested_attributes_for :p_product_ref_specs + # # has_many :p_spec_types, through: :p_product_ref_specs + # has_many :p_spec_values, through: :p_product_ref_specs + # accepts_nested_attributes_for :p_spec_types, allow_destroy: true + # accepts_nested_attributes_for :p_spec_values, allow_destroy: true has_many :p_product_images diff --git a/app/models/p_product_ref.rb b/app/models/p_product_ref.rb index ae959f6..07926e6 100644 --- a/app/models/p_product_ref.rb +++ b/app/models/p_product_ref.rb @@ -10,6 +10,13 @@ class PProductRef < ApplicationRecord belongs_to :p_product_color + has_many :p_articles + has_many :p_article_serial_nums, through: :p_articles + accepts_nested_attributes_for :p_article_serial_nums, allow_destroy: true + + has_many :p_product_ref_specs + accepts_nested_attributes_for :p_product_ref_specs, allow_destroy: true + #validates :ct_price_ht, :presence => true @@ -64,7 +71,9 @@ class PProductRef < ApplicationRecord def ca_name - self.p_product.name if self.p_product + if self.p_product + self.p_product.name + " - " + self.ct_sub_name + end end def ca_code diff --git a/app/models/p_product_ref_spec.rb b/app/models/p_product_ref_spec.rb new file mode 100644 index 0000000..a036951 --- /dev/null +++ b/app/models/p_product_ref_spec.rb @@ -0,0 +1,18 @@ +class PProductRefSpec < ApplicationRecord + belongs_to :p_product_ref + belongs_to :p_spec_type + belongs_to :p_spec_value + + accepts_nested_attributes_for :p_spec_type, :p_spec_value + + acts_as_sorting :fields => { + :id => {:name => "ID"}, + :p_product_ref => {:name => "Référence produit", :reorder => true}, + :p_product_ref_id => {:name => "ID Ref produit", :reorder => true}, + :p_spec_type => {:name => "Type", :reorder => true}, + :p_spec_value => {:name => "Valeur", :reorder => true}, + + :actions => {:name => "Actions", :reorder => true} + + } +end diff --git a/app/models/p_serial_num_type.rb b/app/models/p_serial_num_type.rb new file mode 100644 index 0000000..596d817 --- /dev/null +++ b/app/models/p_serial_num_type.rb @@ -0,0 +1,9 @@ +class PSerialNumType < ApplicationRecord + has_many :p_article_serial_nums + + acts_as_sorting :fields => { + :id => {:name => "id", :reorder => true}, + :name => {:name => "Type", :reorder => true}, + :actions => {:name => "Actions", :reorder => false}, + } +end diff --git a/app/models/p_serial_num_value.rb b/app/models/p_serial_num_value.rb new file mode 100644 index 0000000..c8a476f --- /dev/null +++ b/app/models/p_serial_num_value.rb @@ -0,0 +1,4 @@ +class PSerialNumValue < ApplicationRecord + has_many :p_article_serial_nums, inverse_of: :p_serial_num_value + has_many :p_articles, through: :p_article_serial_nums +end diff --git a/app/models/p_spec_type.rb b/app/models/p_spec_type.rb new file mode 100644 index 0000000..a656aa6 --- /dev/null +++ b/app/models/p_spec_type.rb @@ -0,0 +1,5 @@ +class PSpecType < ApplicationRecord + has_many :p_product_ref_specs + + TYPES = ["Ram", "Stockage"] +end diff --git a/app/models/p_spec_value.rb b/app/models/p_spec_value.rb new file mode 100644 index 0000000..8471de5 --- /dev/null +++ b/app/models/p_spec_value.rb @@ -0,0 +1,18 @@ +class PSpecValue < ApplicationRecord + has_many :p_product_ref_specs + + UNITS = ["Go", "Mo"] + + def member_label + "#{value} #{unit}" + end + + acts_as_sorting :fields => { + :id => {:name => "ID"}, + :value => {:name => "Valeur", :reorder => true}, + :unit => {:name => "Unité", :reorder => true}, + :actions => {:name => "Actions", :reorder => true} + } + + +end diff --git a/app/views/admin/p_article_serial_nums/_form.html.haml b/app/views/admin/p_article_serial_nums/_form.html.haml new file mode 100644 index 0000000..545dbdf --- /dev/null +++ b/app/views/admin/p_article_serial_nums/_form.html.haml @@ -0,0 +1,19 @@ +- if params[:controller] == "admin/p_article_serial_nums" + =semantic_form_for [:admin, @p_article_serial_num], :remote => true do |f| + + .content + =f.inputs do + = f.input :p_article, as: :select, collection: PArticle.all ,:label => f.object.label_for(:p_article_id), member_label: :member_label + = f.input :p_serial_num_type_id, :label => "type", as: :select, collection: PSerialNumType.pluck(:name, :id) + + = f.input :value + + + .actions=f.submit "sauvegarder", :class => "btn btn-primary" + +- else + .p_article_serial_nums_form.field + =form.inputs do + = form.input :p_serial_num_type_id, :label => "type", as: :select, collection: PSerialNumType.pluck(:name, :id) + = form.input :value + diff --git a/app/views/admin/p_article_serial_nums/_p_article_serial_num.html.haml b/app/views/admin/p_article_serial_nums/_p_article_serial_num.html.haml new file mode 100644 index 0000000..08acd41 --- /dev/null +++ b/app/views/admin/p_article_serial_nums/_p_article_serial_num.html.haml @@ -0,0 +1,38 @@ +%tr#p_article_serial_num_row{:id => p_article_serial_num.id} + -tr = {} + + -tr[:p_article_id] = capture do + %td + = p_article_serial_num.p_article.id + + -tr[:p_article] = capture do + %td + = p_article_serial_num.p_article.p_product.name + \- + = p_article_serial_num.p_article.p_product_ref.ct_sub_name + \- + = p_article_serial_num.p_article.p_product_ref.p_product_color.name + + + -tr[:p_serial_num_type] = capture do + %td + = p_article_serial_num.p_serial_num_type.name + + -tr[:value] = capture do + %td + = p_article_serial_num.value + + + -tr[:actions] = capture do + %td.actions + = link_to i(:"trash-o"), [:admin, p_article_serial_num], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true + = link_to i(:pencil), edit_admin_p_article_serial_num_path(p_article_serial_num), :remote => true + = link_to i(:eye), admin_p_article_serial_num_path(p_article_serial_num), :remote => true + + + + =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_article_serial_num} + + + + diff --git a/app/views/admin/p_article_serial_nums/create.js.erb b/app/views/admin/p_article_serial_nums/create.js.erb new file mode 100644 index 0000000..0f45d7b --- /dev/null +++ b/app/views/admin/p_article_serial_nums/create.js.erb @@ -0,0 +1,2 @@ +$('#p_article_serial_nums_rows').prepend("<%= escape_javascript(render(@p_article_serial_num))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_article_serial_nums/destroy.js.erb b/app/views/admin/p_article_serial_nums/destroy.js.erb new file mode 100644 index 0000000..bfed426 --- /dev/null +++ b/app/views/admin/p_article_serial_nums/destroy.js.erb @@ -0,0 +1 @@ +$('#p_article_serial_num_row_<%= @p_article_serial_num.id %>').remove(); \ No newline at end of file diff --git a/app/views/admin/p_article_serial_nums/edit.js.erb b/app/views/admin/p_article_serial_nums/edit.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_article_serial_nums/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_article_serial_nums/index.html.haml b/app/views/admin/p_article_serial_nums/index.html.haml new file mode 100644 index 0000000..0c3ea96 --- /dev/null +++ b/app/views/admin/p_article_serial_nums/index.html.haml @@ -0,0 +1,30 @@ +.qi_header + .right= link_to ic(:plus)+' Ajouter', new_admin_p_article_serial_num_path(), :class => "btn btn-primary btn-ap-add", :remote => true + %h1 + =PArticleSerialNum.human rescue "" + + + +.qi_search_row + =form_tag "", :method => "get", :onsubmit => "" do + =hidden_field_tag :column, params[:column] + =hidden_field_tag :direction, params[:direction] + + %table + %tr + %td Type : + %td=select_tag "search[p_serial_num_type_name]", options_for_select([["",""],["Aucune","null"]]+PSerialNumType.pluck(:name, :id), params[:search][:p_serial_num_type_name]), class: "custom-select" + + %td=text_field_tag "search[p_product_ref_cc_name]", params[:search][:p_product_ref_cc_name],:class => "form-control", :placeholder => "Article" + + %td=text_field_tag "search[value]", params[:search][:value],:class => "form-control", :placeholder => "N° de serie" + + + + =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_article_serial_nums} + + +=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_article_serial_nums} + + + diff --git a/app/views/admin/p_article_serial_nums/new.js.erb b/app/views/admin/p_article_serial_nums/new.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_article_serial_nums/new.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_article_serial_nums/show.html.haml b/app/views/admin/p_article_serial_nums/show.html.haml new file mode 100644 index 0000000..b32815c --- /dev/null +++ b/app/views/admin/p_article_serial_nums/show.html.haml @@ -0,0 +1,10 @@ +.qi_header + %h1 + + %span + + + +.qi_row + .qi_pannel.qi_plain.padding + =debug @p_article_serial_num \ No newline at end of file diff --git a/app/views/admin/p_article_serial_nums/update.js.erb b/app/views/admin/p_article_serial_nums/update.js.erb new file mode 100644 index 0000000..2a1b65c --- /dev/null +++ b/app/views/admin/p_article_serial_nums/update.js.erb @@ -0,0 +1,2 @@ +$('#p_article_serial_num_row_<%= @p_article_serial_num.id %>').replaceWith("<%= escape_javascript(render(@p_article_serial_num))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_articles/_form.html.haml b/app/views/admin/p_articles/_form.html.haml new file mode 100644 index 0000000..3bec92b --- /dev/null +++ b/app/views/admin/p_articles/_form.html.haml @@ -0,0 +1,19 @@ +=semantic_form_for [:admin, @p_article], :remote => true do |f| + + .content + =f.inputs do + = f.input :p_product_ref, as: :select, collection: PProductRef.all.distinct, :label => f.object.label_for(:p_product_ref) + = f.input :p_grade, as: :select, collection: PGrade.pluck(:grade, :id), :label => "Grade" + %h4 Numero de série : + .p_article_serial_nums_form + = f.semantic_fields_for :p_article_serial_nums do |form| + =render :partial => "admin/p_article_serial_nums/form", :locals => {:form => form} + %p= link_to_add_fields "Ajouter un numéro de série", f, :p_article_serial_nums, {:class => "btn btn-primary"} + + + + + + + .actions=f.submit "sauvegarder", :class => "btn btn-primary" + diff --git a/app/views/admin/p_articles/_p_article.html.haml b/app/views/admin/p_articles/_p_article.html.haml new file mode 100644 index 0000000..8d4a1ed --- /dev/null +++ b/app/views/admin/p_articles/_p_article.html.haml @@ -0,0 +1,43 @@ +%tr#p_article_row{:id => p_article.id} + -tr = {} + + -tr[:p_product_ref_code] = capture do + %td + = p_article.p_product_ref.code + + -tr[:p_grade] = capture do + %td + = p_article.p_grade.grade + + -tr[:color] = capture do + %td + = p_article.p_product_ref.p_product_color.color + + -tr[:p_product_ref] = capture do + %td + = p_article.p_product_ref.p_product.name + \- + = p_article.p_product_ref.ct_sub_name + \- + = p_article.p_product_ref.p_product_color.name + + -tr[:p_article_serial_nums] = capture do + %td + - p_article.p_article_serial_nums.each do |sn| + = sn.p_serial_num_type.name + " : " + sn.value + %br + + + -tr[:actions] = capture do + %td.actions + = link_to i(:"trash-o"), [:admin, p_article], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true + = link_to i(:pencil), edit_admin_p_article_path(p_article), :remote => true + = link_to i(:eye), admin_p_article_path(p_article), :remote => true + + + + =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_article} + + + + diff --git a/app/views/admin/p_articles/create.js.erb b/app/views/admin/p_articles/create.js.erb new file mode 100644 index 0000000..4638f5f --- /dev/null +++ b/app/views/admin/p_articles/create.js.erb @@ -0,0 +1,2 @@ +$('#p_articles_rows').prepend("<%= escape_javascript(render(@p_article))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_articles/destroy.js.erb b/app/views/admin/p_articles/destroy.js.erb new file mode 100644 index 0000000..267d137 --- /dev/null +++ b/app/views/admin/p_articles/destroy.js.erb @@ -0,0 +1 @@ +$('#p_article_row_<%= @p_article.id %>').remove(); \ No newline at end of file diff --git a/app/views/admin/p_articles/edit.js.erb b/app/views/admin/p_articles/edit.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_articles/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_articles/index.html.haml b/app/views/admin/p_articles/index.html.haml new file mode 100644 index 0000000..0064c5c --- /dev/null +++ b/app/views/admin/p_articles/index.html.haml @@ -0,0 +1,35 @@ +.qi_header + .right= link_to ic(:plus)+' Ajouter', new_admin_p_article_path(), :class => "btn btn-primary btn-ap-add", :remote => true + %h1 + =PArticle.human rescue "" + + + +.qi_search_row + =form_tag "", :method => "get", :onsubmit => "" do + =hidden_field_tag :column, params[:column] + =hidden_field_tag :direction, params[:direction] + + %table + %tr + %td=text_field_tag "search[p_product_ref_cc_code]", params[:search][:p_product_ref_cc_code],:class => "form-control", :placeholder => "Code" + + %td=text_field_tag "search[p_product_ref_cc_name]", params[:search][:p_product_ref_cc_name],:class => "form-control", :placeholder => "Article" + + %td=text_field_tag "search[p_article_serial_num]", params[:search][:p_article_serial_num],:class => "form-control", :placeholder => "N° de serie" + + %td.pl-2 Grade : + %td=select_tag "search[p_grade_id]", options_for_select([["",""],["Aucune","null"]]+PGrade.pluck(:grade, :id), params[:search][:p_grade_id]), class: "custom-select" + + %td.pl-2 Couleur : + %td + =select_tag "search[p_product_color]", options_for_select([["",""],["Aucune","null"]]+PProductColor.pluck(:color, :id), params[:search][:p_product_color]),class: "custom-select" + + + =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_articles} + + +=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_articles} + + + diff --git a/app/views/admin/p_articles/new.js.erb b/app/views/admin/p_articles/new.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_articles/new.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_articles/show.html.haml b/app/views/admin/p_articles/show.html.haml new file mode 100644 index 0000000..63cfc6a --- /dev/null +++ b/app/views/admin/p_articles/show.html.haml @@ -0,0 +1,10 @@ +.qi_header + %h1 + + %span + + + +.qi_row + .qi_pannel.qi_plain.padding + =debug @p_article \ No newline at end of file diff --git a/app/views/admin/p_articles/update.js.erb b/app/views/admin/p_articles/update.js.erb new file mode 100644 index 0000000..54d637a --- /dev/null +++ b/app/views/admin/p_articles/update.js.erb @@ -0,0 +1,2 @@ +$('#p_article_row_<%= @p_article.id %>').replaceWith("<%= escape_javascript(render(@p_article))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_grades/_form.html.haml b/app/views/admin/p_grades/_form.html.haml new file mode 100644 index 0000000..00d2fa0 --- /dev/null +++ b/app/views/admin/p_grades/_form.html.haml @@ -0,0 +1,12 @@ +=semantic_form_for [:admin, @p_grade], :remote => true do |f| + + .content + =f.inputs do + = f.input :grade, :label => f.object.label_for(:grade) + + + + + + .actions=f.submit "sauvegarder", :class => "btn btn-primary" + \ No newline at end of file diff --git a/app/views/admin/p_grades/_p_grade.html.haml b/app/views/admin/p_grades/_p_grade.html.haml new file mode 100644 index 0000000..9608e54 --- /dev/null +++ b/app/views/admin/p_grades/_p_grade.html.haml @@ -0,0 +1,16 @@ +%tr#p_grade_row{:id => p_grade.id} + -tr = {} + + -tr[:actions] = capture do + %td.actions + = link_to i(:"trash-o"), [:admin, p_grade], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true + = link_to i(:pencil), edit_admin_p_grade_path(p_grade), :remote => true + = link_to i(:eye), admin_p_grade_path(p_grade), :remote => true + + + + =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_grade} + + + + \ No newline at end of file diff --git a/app/views/admin/p_grades/create.js.erb b/app/views/admin/p_grades/create.js.erb new file mode 100644 index 0000000..d562c04 --- /dev/null +++ b/app/views/admin/p_grades/create.js.erb @@ -0,0 +1,2 @@ +$('#p_grades_rows').prepend("<%= escape_javascript(render(@p_grade))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_grades/destroy.js.erb b/app/views/admin/p_grades/destroy.js.erb new file mode 100644 index 0000000..7e6a917 --- /dev/null +++ b/app/views/admin/p_grades/destroy.js.erb @@ -0,0 +1 @@ +$('#p_grade_row_<%= @p_grade.id %>').remove(); \ No newline at end of file diff --git a/app/views/admin/p_grades/edit.js.erb b/app/views/admin/p_grades/edit.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_grades/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_grades/index.html.haml b/app/views/admin/p_grades/index.html.haml new file mode 100644 index 0000000..4dbb173 --- /dev/null +++ b/app/views/admin/p_grades/index.html.haml @@ -0,0 +1,16 @@ +.qi_header + .right= link_to ic(:plus)+' Ajouter', new_admin_p_grade_path(), :class => "btn btn-primary btn-ap-add", :remote => true + %h1 + =PGrade.human rescue "" + + + +.qi_search_row + =form_tag "", :method => "get", :onsubmit => "" do + =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_grades} + + +=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_grades} + + + diff --git a/app/views/admin/p_grades/new.js.erb b/app/views/admin/p_grades/new.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_grades/new.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_grades/show.html.haml b/app/views/admin/p_grades/show.html.haml new file mode 100644 index 0000000..e63e6fc --- /dev/null +++ b/app/views/admin/p_grades/show.html.haml @@ -0,0 +1,10 @@ +.qi_header + %h1 + + %span + + + +.qi_row + .qi_pannel.qi_plain.padding + =debug @p_grade \ No newline at end of file diff --git a/app/views/admin/p_grades/update.js.erb b/app/views/admin/p_grades/update.js.erb new file mode 100644 index 0000000..0371e07 --- /dev/null +++ b/app/views/admin/p_grades/update.js.erb @@ -0,0 +1,2 @@ +$('#p_grade_row_<%= @p_grade.id %>').replaceWith("<%= escape_javascript(render(@p_grade))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_product_ref_specs/_form.html.haml b/app/views/admin/p_product_ref_specs/_form.html.haml new file mode 100644 index 0000000..ffde9d3 --- /dev/null +++ b/app/views/admin/p_product_ref_specs/_form.html.haml @@ -0,0 +1,36 @@ +- if params[:controller] == "admin/p_product_ref_specs" + =semantic_form_for [:admin, @p_product_ref_spec], :remote => true do |f| + .content + =f.inputs do + = f.input :p_product_ref, as: :select, collection: PProductRef.pluck(:cc_name, :id) ,:label => f.object.label_for(:p_product_ref) + = f.semantic_fields_for :p_spec_type do | form | + =render :partial => "admin/p_spec_types/form", :locals => {:f => form} + = f.semantic_fields_for :p_spec_value do | form | + =render :partial => "admin/p_spec_values/form", :locals => {:f => form} + + .actions=f.submit "sauvegarder", :class => "btn btn-primary" + +- else + .p_product_ref_spec_form.field + %table + %tr + %td + %h4 spec : + + %td + -#form.object.p_spec_type = PSpecType.new if !form.object.p_spec_type + -#form.object.p_spec_value = PSpecValue.new if !form.object.p_spec_value + + = form.input :p_spec_type_id, :label => "Type", as: :select, collection: PSpecType.all, :include_blank => false + %td + = form.input :p_spec_value_id, :label => "Valeur", as: :select, collection: PSpecValue.all, :include_blank => false, :member_label => :member_label + + + =#form.inputs do + =# form.semantic_fields_for :p_spec_type do | f | + =#render :partial => "admin/p_spec_types/form", :locals => {:f => f} + =# form.semantic_fields_for :p_spec_value do | f | + =# render :partial => "admin/p_spec_values/form", :locals => {:f => f} + %tr + %td + = link_to_remove_fields ic(:"trash-o"), form diff --git a/app/views/admin/p_product_ref_specs/_p_product_ref_spec.html.haml b/app/views/admin/p_product_ref_specs/_p_product_ref_spec.html.haml new file mode 100644 index 0000000..b696059 --- /dev/null +++ b/app/views/admin/p_product_ref_specs/_p_product_ref_spec.html.haml @@ -0,0 +1,31 @@ +%tr#p_product_ref_spec_row{:id => p_product_ref_spec.id} + -tr = {} + -tr[:p_product_ref] = capture do + %td + = p_product_ref_spec.p_product_ref.cc_name + + -tr[:p_product_ref_id] = capture do + %td + = p_product_ref_spec.p_product_ref.id + + -tr[:p_spec_type] = capture do + %td + = p_product_ref_spec.p_spec_type.name + -tr[:p_spec_value] = capture do + %td + = p_product_ref_spec.p_spec_value.value + = p_product_ref_spec.p_spec_value.unit + + -tr[:actions] = capture do + %td.actions + = link_to i(:"trash-o"), [:admin, p_product_ref_spec], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true + = link_to i(:pencil), edit_admin_p_product_ref_spec_path(p_product_ref_spec), :remote => true + = link_to i(:eye), admin_p_product_ref_spec_path(p_product_ref_spec), :remote => true + + + + =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_product_ref_spec} + + + + diff --git a/app/views/admin/p_product_ref_specs/create.js.erb b/app/views/admin/p_product_ref_specs/create.js.erb new file mode 100644 index 0000000..d7a17bc --- /dev/null +++ b/app/views/admin/p_product_ref_specs/create.js.erb @@ -0,0 +1,2 @@ +$('#p_product_ref_specs_rows').prepend("<%= escape_javascript(render(@p_product_ref_spec))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_product_ref_specs/destroy.js.erb b/app/views/admin/p_product_ref_specs/destroy.js.erb new file mode 100644 index 0000000..5e87c5d --- /dev/null +++ b/app/views/admin/p_product_ref_specs/destroy.js.erb @@ -0,0 +1 @@ +$('#p_product_ref_spec_row_<%= @p_product_ref_spec.id %>').remove(); \ No newline at end of file diff --git a/app/views/admin/p_product_ref_specs/edit.js.erb b/app/views/admin/p_product_ref_specs/edit.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_product_ref_specs/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_product_ref_specs/index.html.haml b/app/views/admin/p_product_ref_specs/index.html.haml new file mode 100644 index 0000000..f486839 --- /dev/null +++ b/app/views/admin/p_product_ref_specs/index.html.haml @@ -0,0 +1,16 @@ +.qi_header + .right= link_to ic(:plus)+' Ajouter', new_admin_p_product_ref_spec_path(), :class => "btn btn-primary btn-ap-add", :remote => true + %h1 + =PProductRefSpec.human rescue "" + + + +.qi_search_row + =form_tag "", :method => "get", :onsubmit => "" do + =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_product_ref_specs} + + +=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_product_ref_specs} + + + diff --git a/app/views/admin/p_product_ref_specs/new.js.erb b/app/views/admin/p_product_ref_specs/new.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_product_ref_specs/new.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_product_ref_specs/show.html.haml b/app/views/admin/p_product_ref_specs/show.html.haml new file mode 100644 index 0000000..e56e759 --- /dev/null +++ b/app/views/admin/p_product_ref_specs/show.html.haml @@ -0,0 +1,10 @@ +.qi_header + %h1 + + %span + + + +.qi_row + .qi_pannel.qi_plain.padding + =debug @p_product_ref_spec \ No newline at end of file diff --git a/app/views/admin/p_product_ref_specs/update.js.erb b/app/views/admin/p_product_ref_specs/update.js.erb new file mode 100644 index 0000000..ccaba69 --- /dev/null +++ b/app/views/admin/p_product_ref_specs/update.js.erb @@ -0,0 +1,2 @@ +$('#p_product_ref_spec_row_<%= @p_product_ref_spec.id %>').replaceWith("<%= escape_javascript(render(@p_product_ref_spec))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_product_refs/_form.html.haml b/app/views/admin/p_product_refs/_form.html.haml index bc9ca3b..b7ff800 100644 --- a/app/views/admin/p_product_refs/_form.html.haml +++ b/app/views/admin/p_product_refs/_form.html.haml @@ -4,10 +4,8 @@ %table.form-table %tr - %td - =# form.input :enabled, :label => "Actif ?" - %td - =# form.input :assembled, :label => "Assemblé ?", :input_html => {:onchange => 'if ($(this).is(":checked")) {$(this).closest(".field").find(".p_product_assembleds_part").show();}else{$(this).closest(".field").find(".p_product_assembleds_part").hide();}'} + =# form.input :enabled, :label => "Actif ?" + =# form.input :assembled, :label => "Assemblé ?", :input_html => {:onchange => 'if ($(this).is(":checked")) {$(this).closest(".field").find(".p_product_assembleds_part").show();}else{$(this).closest(".field").find(".p_product_assembleds_part").hide();}'} %td = form.input :ref, :label => "Réf int. :" @@ -21,8 +19,16 @@ %td =form.input :p_product_color_id, :label => "Couleur :", :collection => PProductColor.all, :as => :select, :include_blank => true - - =# form.input :s_brand_id, :label => "Marque :", :collection => SBrand.all, :as => :select, :include_blank => true + + + + %tr + %td{:colspan => 4} + .p_product_ref_specs_form + = form.semantic_fields_for :p_product_ref_specs do |f| + =render :partial => "admin/p_product_ref_specs/form", :locals => {:form => f} + %p= link_to_add_fields "Ajouter une spec", form, :p_product_ref_specs + %tr @@ -42,4 +48,4 @@ %p= link_to_add_fields "Ajouter une référence fournisseur", form, :fournisseur_product_refs - \ No newline at end of file + diff --git a/app/views/admin/p_serial_num_types/_form.html.haml b/app/views/admin/p_serial_num_types/_form.html.haml new file mode 100644 index 0000000..99f609b --- /dev/null +++ b/app/views/admin/p_serial_num_types/_form.html.haml @@ -0,0 +1,12 @@ +=semantic_form_for [:admin, @p_serial_num_type], :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" + diff --git a/app/views/admin/p_serial_num_types/_p_serial_num_type.html.haml b/app/views/admin/p_serial_num_types/_p_serial_num_type.html.haml new file mode 100644 index 0000000..db6e57b --- /dev/null +++ b/app/views/admin/p_serial_num_types/_p_serial_num_type.html.haml @@ -0,0 +1,16 @@ +%tr#p_serial_num_type_row{:id => p_serial_num_type.id} + -tr = {} + + -tr[:actions] = capture do + %td.actions + = link_to i(:"trash-o"), [:admin, p_serial_num_type], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true + = link_to i(:pencil), edit_admin_p_serial_num_type_path(p_serial_num_type), :remote => true + = link_to i(:eye), admin_p_serial_num_type_path(p_serial_num_type), :remote => true + + + + =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_serial_num_type} + + + + \ No newline at end of file diff --git a/app/views/admin/p_serial_num_types/create.js.erb b/app/views/admin/p_serial_num_types/create.js.erb new file mode 100644 index 0000000..1bcfb90 --- /dev/null +++ b/app/views/admin/p_serial_num_types/create.js.erb @@ -0,0 +1,2 @@ +$('#p_serial_num_types_rows').prepend("<%= escape_javascript(render(@p_serial_num_type))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_serial_num_types/destroy.js.erb b/app/views/admin/p_serial_num_types/destroy.js.erb new file mode 100644 index 0000000..25bf828 --- /dev/null +++ b/app/views/admin/p_serial_num_types/destroy.js.erb @@ -0,0 +1 @@ +$('#p_serial_num_type_row_<%= @p_serial_num_type.id %>').remove(); \ No newline at end of file diff --git a/app/views/admin/p_serial_num_types/edit.js.erb b/app/views/admin/p_serial_num_types/edit.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_serial_num_types/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_serial_num_types/index.html.haml b/app/views/admin/p_serial_num_types/index.html.haml new file mode 100644 index 0000000..80034b4 --- /dev/null +++ b/app/views/admin/p_serial_num_types/index.html.haml @@ -0,0 +1,24 @@ +.qi_header + .right= link_to ic(:plus)+' Ajouter', new_admin_p_serial_num_type_path(), :class => "btn btn-primary btn-ap-add", :remote => true + %h1 + =PSerialNumType.human rescue "" + + + +.qi_search_row + =form_tag "", :method => "get", :onsubmit => "" do + =hidden_field_tag :column, params[:column] + =hidden_field_tag :direction, params[:direction] + + %table + %tr + %td Type : + %td=select_tag "search[name]", options_for_select([["",""],["Aucune","null"]]+PSerialNumType.pluck(:name, :id), params[:search][:name]), class: "custom-select" + + =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_serial_num_types} + + +=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_serial_num_types} + + + diff --git a/app/views/admin/p_serial_num_types/new.js.erb b/app/views/admin/p_serial_num_types/new.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_serial_num_types/new.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_serial_num_types/show.html.haml b/app/views/admin/p_serial_num_types/show.html.haml new file mode 100644 index 0000000..6ab5cdf --- /dev/null +++ b/app/views/admin/p_serial_num_types/show.html.haml @@ -0,0 +1,10 @@ +.qi_header + %h1 + + %span + + + +.qi_row + .qi_pannel.qi_plain.padding + =debug @p_serial_num_type \ No newline at end of file diff --git a/app/views/admin/p_serial_num_types/update.js.erb b/app/views/admin/p_serial_num_types/update.js.erb new file mode 100644 index 0000000..beac1d8 --- /dev/null +++ b/app/views/admin/p_serial_num_types/update.js.erb @@ -0,0 +1,2 @@ +$('#p_serial_num_type_row_<%= @p_serial_num_type.id %>').replaceWith("<%= escape_javascript(render(@p_serial_num_type))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_serial_num_values/_form.html.haml b/app/views/admin/p_serial_num_values/_form.html.haml new file mode 100644 index 0000000..1872e5e --- /dev/null +++ b/app/views/admin/p_serial_num_values/_form.html.haml @@ -0,0 +1,12 @@ +/ =semantic_form_for [:admin, @p_serial_num_value], :remote => true do |f| + + +=f.inputs do + = f.input :value, :label => "Numéro" + + + + + + / .actions=f.submit "sauvegarder", :class => "btn btn-primary" + diff --git a/app/views/admin/p_serial_num_values/_p_serial_num_value.html.haml b/app/views/admin/p_serial_num_values/_p_serial_num_value.html.haml new file mode 100644 index 0000000..52d6eee --- /dev/null +++ b/app/views/admin/p_serial_num_values/_p_serial_num_value.html.haml @@ -0,0 +1,16 @@ +%tr#p_serial_num_value_row{:id => p_serial_num_value.id} + -tr = {} + + -tr[:actions] = capture do + %td.actions + = link_to i(:"trash-o"), [:admin, p_serial_num_value], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true + = link_to i(:pencil), edit_admin_p_serial_num_value_path(p_serial_num_value), :remote => true + = link_to i(:eye), admin_p_serial_num_value_path(p_serial_num_value), :remote => true + + + + =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_serial_num_value} + + + + \ No newline at end of file diff --git a/app/views/admin/p_serial_num_values/create.js.erb b/app/views/admin/p_serial_num_values/create.js.erb new file mode 100644 index 0000000..f53ff23 --- /dev/null +++ b/app/views/admin/p_serial_num_values/create.js.erb @@ -0,0 +1,2 @@ +$('#p_serial_num_values_rows').prepend("<%= escape_javascript(render(@p_serial_num_value))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_serial_num_values/destroy.js.erb b/app/views/admin/p_serial_num_values/destroy.js.erb new file mode 100644 index 0000000..1622e2d --- /dev/null +++ b/app/views/admin/p_serial_num_values/destroy.js.erb @@ -0,0 +1 @@ +$('#p_serial_num_value_row_<%= @p_serial_num_value.id %>').remove(); \ No newline at end of file diff --git a/app/views/admin/p_serial_num_values/edit.js.erb b/app/views/admin/p_serial_num_values/edit.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_serial_num_values/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_serial_num_values/index.html.haml b/app/views/admin/p_serial_num_values/index.html.haml new file mode 100644 index 0000000..7e600fc --- /dev/null +++ b/app/views/admin/p_serial_num_values/index.html.haml @@ -0,0 +1,16 @@ +.qi_header + .right= link_to ic(:plus)+' Ajouter', new_admin_p_serial_num_value_path(), :class => "btn btn-primary btn-ap-add", :remote => true + %h1 + =PSerialNumValue.human rescue "" + + + +.qi_search_row + =form_tag "", :method => "get", :onsubmit => "" do + =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_serial_num_values} + + +=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_serial_num_values} + + + diff --git a/app/views/admin/p_serial_num_values/new.js.erb b/app/views/admin/p_serial_num_values/new.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_serial_num_values/new.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_serial_num_values/show.html.haml b/app/views/admin/p_serial_num_values/show.html.haml new file mode 100644 index 0000000..e9b982d --- /dev/null +++ b/app/views/admin/p_serial_num_values/show.html.haml @@ -0,0 +1,10 @@ +.qi_header + %h1 + + %span + + + +.qi_row + .qi_pannel.qi_plain.padding + =debug @p_serial_num_value \ No newline at end of file diff --git a/app/views/admin/p_serial_num_values/update.js.erb b/app/views/admin/p_serial_num_values/update.js.erb new file mode 100644 index 0000000..d272f5f --- /dev/null +++ b/app/views/admin/p_serial_num_values/update.js.erb @@ -0,0 +1,2 @@ +$('#p_serial_num_value_row_<%= @p_serial_num_value.id %>').replaceWith("<%= escape_javascript(render(@p_serial_num_value))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_spec_types/_form.html.haml b/app/views/admin/p_spec_types/_form.html.haml new file mode 100644 index 0000000..ab615d2 --- /dev/null +++ b/app/views/admin/p_spec_types/_form.html.haml @@ -0,0 +1,2 @@ +=f.inputs do + = f.input :name, :label => "Type", as: :select, collection: PSpecType::TYPES diff --git a/app/views/admin/p_spec_types/_p_spec_type.html.haml b/app/views/admin/p_spec_types/_p_spec_type.html.haml new file mode 100644 index 0000000..fd475e3 --- /dev/null +++ b/app/views/admin/p_spec_types/_p_spec_type.html.haml @@ -0,0 +1,16 @@ +%tr#p_spec_type_row{:id => p_spec_type.id} + -tr = {} + + -tr[:actions] = capture do + %td.actions + = link_to i(:"trash-o"), [:admin, p_spec_type], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true + = link_to i(:pencil), edit_admin_p_spec_type_path(p_spec_type), :remote => true + = link_to i(:eye), admin_p_spec_type_path(p_spec_type), :remote => true + + + + =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_spec_type} + + + + \ No newline at end of file diff --git a/app/views/admin/p_spec_types/create.js.erb b/app/views/admin/p_spec_types/create.js.erb new file mode 100644 index 0000000..e9f7774 --- /dev/null +++ b/app/views/admin/p_spec_types/create.js.erb @@ -0,0 +1,2 @@ +$('#p_spec_types_rows').prepend("<%= escape_javascript(render(@p_spec_type))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_spec_types/destroy.js.erb b/app/views/admin/p_spec_types/destroy.js.erb new file mode 100644 index 0000000..e97e73c --- /dev/null +++ b/app/views/admin/p_spec_types/destroy.js.erb @@ -0,0 +1 @@ +$('#p_spec_type_row_<%= @p_spec_type.id %>').remove(); \ No newline at end of file diff --git a/app/views/admin/p_spec_types/edit.js.erb b/app/views/admin/p_spec_types/edit.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_spec_types/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_spec_types/index.html.haml b/app/views/admin/p_spec_types/index.html.haml new file mode 100644 index 0000000..46d02ec --- /dev/null +++ b/app/views/admin/p_spec_types/index.html.haml @@ -0,0 +1,16 @@ +.qi_header + .right= link_to ic(:plus)+' Ajouter', new_admin_p_spec_type_path(), :class => "btn btn-primary btn-ap-add", :remote => true + %h1 + =PSpecType.human rescue "" + + + +.qi_search_row + =form_tag "", :method => "get", :onsubmit => "" do + =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_spec_types} + + +=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_spec_types} + + + diff --git a/app/views/admin/p_spec_types/new.js.erb b/app/views/admin/p_spec_types/new.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_spec_types/new.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_spec_types/show.html.haml b/app/views/admin/p_spec_types/show.html.haml new file mode 100644 index 0000000..6005a84 --- /dev/null +++ b/app/views/admin/p_spec_types/show.html.haml @@ -0,0 +1,10 @@ +.qi_header + %h1 + + %span + + + +.qi_row + .qi_pannel.qi_plain.padding + =debug @p_spec_type \ No newline at end of file diff --git a/app/views/admin/p_spec_types/update.js.erb b/app/views/admin/p_spec_types/update.js.erb new file mode 100644 index 0000000..2f952cc --- /dev/null +++ b/app/views/admin/p_spec_types/update.js.erb @@ -0,0 +1,2 @@ +$('#p_spec_type_row_<%= @p_spec_type.id %>').replaceWith("<%= escape_javascript(render(@p_spec_type))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_spec_values/_form.html.haml b/app/views/admin/p_spec_values/_form.html.haml new file mode 100644 index 0000000..509bf70 --- /dev/null +++ b/app/views/admin/p_spec_values/_form.html.haml @@ -0,0 +1,18 @@ +- if params[:controller] == "admin/p_spec_values" + =semantic_form_for [:admin, @p_spec_value], :remote => true do |f| + + .content + =f.inputs do + %td + = f.input :value, :label => "Valeur" + %td + = f.input :unit, :label => "Unité", as: :select, collection: PSpecValue::UNITS + + .actions=f.submit "sauvegarder", :class => "btn btn-primary" + +- else + =f.inputs do + %td + = f.input :value, :label => "Valeur" + %td + = f.input :unit, :label => "Unité", as: :select, collection: PSpecValue::UNITS diff --git a/app/views/admin/p_spec_values/_p_spec_value.html.haml b/app/views/admin/p_spec_values/_p_spec_value.html.haml new file mode 100644 index 0000000..64de749 --- /dev/null +++ b/app/views/admin/p_spec_values/_p_spec_value.html.haml @@ -0,0 +1,16 @@ +%tr#p_spec_value_row{:id => p_spec_value.id} + -tr = {} + + -tr[:actions] = capture do + %td.actions + = link_to i(:"trash-o"), [:admin, p_spec_value], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true + = link_to i(:pencil), edit_admin_p_spec_value_path(p_spec_value), :remote => true + = link_to i(:eye), admin_p_spec_value_path(p_spec_value), :remote => true + + + + =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_spec_value} + + + + \ No newline at end of file diff --git a/app/views/admin/p_spec_values/create.js.erb b/app/views/admin/p_spec_values/create.js.erb new file mode 100644 index 0000000..8aef8dd --- /dev/null +++ b/app/views/admin/p_spec_values/create.js.erb @@ -0,0 +1,2 @@ +$('#p_spec_values_rows').prepend("<%= escape_javascript(render(@p_spec_value))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/p_spec_values/destroy.js.erb b/app/views/admin/p_spec_values/destroy.js.erb new file mode 100644 index 0000000..643c933 --- /dev/null +++ b/app/views/admin/p_spec_values/destroy.js.erb @@ -0,0 +1 @@ +$('#p_spec_value_row_<%= @p_spec_value.id %>').remove(); \ No newline at end of file diff --git a/app/views/admin/p_spec_values/edit.js.erb b/app/views/admin/p_spec_values/edit.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_spec_values/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_spec_values/index.html.haml b/app/views/admin/p_spec_values/index.html.haml new file mode 100644 index 0000000..8f34bd1 --- /dev/null +++ b/app/views/admin/p_spec_values/index.html.haml @@ -0,0 +1,16 @@ +.qi_header + .right= link_to ic(:plus)+' Ajouter', new_admin_p_spec_value_path(), :class => "btn btn-primary btn-ap-add", :remote => true + %h1 + =PSpecValue.human rescue "" + + + +.qi_search_row + =form_tag "", :method => "get", :onsubmit => "" do + =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_spec_values} + + +=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_spec_values} + + + diff --git a/app/views/admin/p_spec_values/new.js.erb b/app/views/admin/p_spec_values/new.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/p_spec_values/new.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/p_spec_values/show.html.haml b/app/views/admin/p_spec_values/show.html.haml new file mode 100644 index 0000000..6414fbc --- /dev/null +++ b/app/views/admin/p_spec_values/show.html.haml @@ -0,0 +1,10 @@ +.qi_header + %h1 + + %span + + + +.qi_row + .qi_pannel.qi_plain.padding + =debug @p_spec_value \ No newline at end of file diff --git a/app/views/admin/p_spec_values/update.js.erb b/app/views/admin/p_spec_values/update.js.erb new file mode 100644 index 0000000..b7e6986 --- /dev/null +++ b/app/views/admin/p_spec_values/update.js.erb @@ -0,0 +1,2 @@ +$('#p_spec_value_row_<%= @p_spec_value.id %>').replaceWith("<%= escape_javascript(render(@p_spec_value))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 226c9c5..cdc0dc1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,93 @@ Rails.application.routes.draw do + namespace :admin do + resources :p_grades do + member do + + end + collection do + + end + end + end + + namespace :admin do + resources :p_product_ref_specs do + member do + + end + collection do + + end + end + end + + namespace :admin do + resources :p_spec_values do + member do + + end + collection do + + end + end + end + + namespace :admin do + resources :p_spec_types do + member do + + end + collection do + + end + end + end + + namespace :admin do + resources :p_article_serial_nums do + member do + + end + collection do + + end + end + end + + namespace :admin do + resources :p_serial_num_values do + member do + + end + collection do + + end + end + end + + namespace :admin do + resources :p_serial_num_types do + member do + + end + collection do + + end + end + end + + namespace :admin do + resources :p_articles do + member do + + end + collection do + + end + end + end + namespace :admin do resources :buy_lists do member do diff --git a/db/migrate/20210826135742_create_p_articles.rb b/db/migrate/20210826135742_create_p_articles.rb new file mode 100644 index 0000000..67ccbf1 --- /dev/null +++ b/db/migrate/20210826135742_create_p_articles.rb @@ -0,0 +1,9 @@ +class CreatePArticles < ActiveRecord::Migration[6.0] + def change + create_table :p_articles do |t| + t.references :p_product_ref, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20210826140333_create_p_serial_num_types.rb b/db/migrate/20210826140333_create_p_serial_num_types.rb new file mode 100644 index 0000000..e713124 --- /dev/null +++ b/db/migrate/20210826140333_create_p_serial_num_types.rb @@ -0,0 +1,9 @@ +class CreatePSerialNumTypes < ActiveRecord::Migration[6.0] + def change + create_table :p_serial_num_types do |t| + t.string :type + + t.timestamps + end + end +end diff --git a/db/migrate/20210826140445_create_p_serial_num_values.rb b/db/migrate/20210826140445_create_p_serial_num_values.rb new file mode 100644 index 0000000..79660b3 --- /dev/null +++ b/db/migrate/20210826140445_create_p_serial_num_values.rb @@ -0,0 +1,9 @@ +class CreatePSerialNumValues < ActiveRecord::Migration[6.0] + def change + create_table :p_serial_num_values do |t| + t.string :value + + t.timestamps + end + end +end diff --git a/db/migrate/20210826140648_create_p_article_serial_nums.rb b/db/migrate/20210826140648_create_p_article_serial_nums.rb new file mode 100644 index 0000000..a68ebe3 --- /dev/null +++ b/db/migrate/20210826140648_create_p_article_serial_nums.rb @@ -0,0 +1,11 @@ +class CreatePArticleSerialNums < ActiveRecord::Migration[6.0] + def change + create_table :p_article_serial_nums do |t| + t.references :p_article, foreign_key: true + t.references :p_serial_num_type, foreign_key: true + t.references :p_serial_num_value, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20210826145816_rename_column_type_by_name_in_p_serial_num_types.rb b/db/migrate/20210826145816_rename_column_type_by_name_in_p_serial_num_types.rb new file mode 100644 index 0000000..2fe6872 --- /dev/null +++ b/db/migrate/20210826145816_rename_column_type_by_name_in_p_serial_num_types.rb @@ -0,0 +1,5 @@ +class RenameColumnTypeByNameInPSerialNumTypes < ActiveRecord::Migration[6.0] + def change + rename_column :p_serial_num_types, :type, :name + end +end diff --git a/db/migrate/20210827074532_create_p_spec_types.rb b/db/migrate/20210827074532_create_p_spec_types.rb new file mode 100644 index 0000000..ab9699c --- /dev/null +++ b/db/migrate/20210827074532_create_p_spec_types.rb @@ -0,0 +1,9 @@ +class CreatePSpecTypes < ActiveRecord::Migration[6.0] + def change + create_table :p_spec_types do |t| + t.string :type + + t.timestamps + end + end +end diff --git a/db/migrate/20210827074615_create_p_spec_values.rb b/db/migrate/20210827074615_create_p_spec_values.rb new file mode 100644 index 0000000..442275a --- /dev/null +++ b/db/migrate/20210827074615_create_p_spec_values.rb @@ -0,0 +1,10 @@ +class CreatePSpecValues < ActiveRecord::Migration[6.0] + def change + create_table :p_spec_values do |t| + t.string :value + t.string :unit + + t.timestamps + end + end +end diff --git a/db/migrate/20210827074812_create_p_product_ref_specs.rb b/db/migrate/20210827074812_create_p_product_ref_specs.rb new file mode 100644 index 0000000..0731732 --- /dev/null +++ b/db/migrate/20210827074812_create_p_product_ref_specs.rb @@ -0,0 +1,11 @@ +class CreatePProductRefSpecs < ActiveRecord::Migration[6.0] + def change + create_table :p_product_ref_specs do |t| + t.references :p_product_ref, foreign_key: true + t.references :p_spec_type, foreign_key: true + t.references :p_spec_value, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20210827082814_rename_column_type_by_name_in_p_spec_types.rb b/db/migrate/20210827082814_rename_column_type_by_name_in_p_spec_types.rb new file mode 100644 index 0000000..4b890e8 --- /dev/null +++ b/db/migrate/20210827082814_rename_column_type_by_name_in_p_spec_types.rb @@ -0,0 +1,5 @@ +class RenameColumnTypeByNameInPSpecTypes < ActiveRecord::Migration[6.0] + def change + rename_column :p_spec_types, :type, :name + end +end diff --git a/db/migrate/20210827164230_create_p_grades.rb b/db/migrate/20210827164230_create_p_grades.rb new file mode 100644 index 0000000..3851843 --- /dev/null +++ b/db/migrate/20210827164230_create_p_grades.rb @@ -0,0 +1,9 @@ +class CreatePGrades < ActiveRecord::Migration[6.0] + def change + create_table :p_grades do |t| + t.string :grade + + t.timestamps + end + end +end diff --git a/db/migrate/20210827164533_add_p_grade_references_to_p_articles.rb b/db/migrate/20210827164533_add_p_grade_references_to_p_articles.rb new file mode 100644 index 0000000..6185877 --- /dev/null +++ b/db/migrate/20210827164533_add_p_grade_references_to_p_articles.rb @@ -0,0 +1,5 @@ +class AddPGradeReferencesToPArticles < ActiveRecord::Migration[6.0] + def change + add_reference :p_articles, :p_grade, foreign_key: true + end +end diff --git a/db/migrate/20210830091804_add_value_to_p_article_serial_nums.rb b/db/migrate/20210830091804_add_value_to_p_article_serial_nums.rb new file mode 100644 index 0000000..e80c91e --- /dev/null +++ b/db/migrate/20210830091804_add_value_to_p_article_serial_nums.rb @@ -0,0 +1,5 @@ +class AddValueToPArticleSerialNums < ActiveRecord::Migration[6.0] + def change + add_column :p_article_serial_nums, :value, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 734a9dc..e1898e3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_07_06_171352) do +ActiveRecord::Schema.define(version: 2021_08_30_091804) do create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.string "name" @@ -970,6 +970,27 @@ ActiveRecord::Schema.define(version: 2021_07_06_171352) do t.datetime "updated_at", precision: 6, null: false end + create_table "p_article_serial_nums", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + t.bigint "p_article_id" + t.bigint "p_serial_num_type_id" + t.bigint "p_serial_num_value_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.string "value" + t.index ["p_article_id"], name: "index_p_article_serial_nums_on_p_article_id" + t.index ["p_serial_num_type_id"], name: "index_p_article_serial_nums_on_p_serial_num_type_id" + t.index ["p_serial_num_value_id"], name: "index_p_article_serial_nums_on_p_serial_num_value_id" + end + + create_table "p_articles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + t.bigint "p_product_ref_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.bigint "p_grade_id" + t.index ["p_grade_id"], name: "index_p_articles_on_p_grade_id" + t.index ["p_product_ref_id"], name: "index_p_articles_on_p_product_ref_id" + end + create_table "p_bank_accounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.bigint "p_bank_id" t.string "iban" @@ -1444,6 +1465,12 @@ ActiveRecord::Schema.define(version: 2021_07_06_171352) do t.datetime "updated_at", precision: 6, null: false end + create_table "p_grades", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + t.string "grade" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + create_table "p_nutris", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.string "name" t.boolean "public", default: true @@ -1727,6 +1754,17 @@ ActiveRecord::Schema.define(version: 2021_07_06_171352) do t.index ["p_product_ref_id"], name: "index_p_product_ref_price_histories_on_p_product_ref_id" end + create_table "p_product_ref_specs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + t.bigint "p_product_ref_id" + t.bigint "p_spec_type_id" + t.bigint "p_spec_value_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["p_product_ref_id"], name: "index_p_product_ref_specs_on_p_product_ref_id" + t.index ["p_spec_type_id"], name: "index_p_product_ref_specs_on_p_spec_type_id" + t.index ["p_spec_value_id"], name: "index_p_product_ref_specs_on_p_spec_value_id" + end + create_table "p_product_refs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.string "ref" t.integer "p_product_id" @@ -1859,6 +1897,18 @@ ActiveRecord::Schema.define(version: 2021_07_06_171352) do t.index ["p_payment_type_id"], name: "index_p_remises_on_p_payment_type_id" end + create_table "p_serial_num_types", 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 "p_serial_num_values", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + t.string "value" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + create_table "p_sheet_line_stocks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.bigint "p_sheet_line_id" t.bigint "p_brut_product_id" @@ -1948,6 +1998,19 @@ ActiveRecord::Schema.define(version: 2021_07_06_171352) do t.index ["p_fournisseur_id"], name: "index_p_ship_bills_on_p_fournisseur_id" end + create_table "p_spec_types", 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 "p_spec_values", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + t.string "value" + t.string "unit" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + create_table "p_tank_stocks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.datetime "ok_at" t.boolean "enabled", default: false @@ -2336,7 +2399,6 @@ ActiveRecord::Schema.define(version: 2021_07_06_171352) do t.integer "order_hist_id" t.boolean "imported", default: false t.date "validation_date" - t.date "cc_validation_date" t.string "cc_state" t.index ["p_customer_id"], name: "index_price_line_blocks_on_p_customer_id" end @@ -3050,6 +3112,11 @@ ActiveRecord::Schema.define(version: 2021_07_06_171352) do add_foreign_key "order_hist_lines", "p_customers" add_foreign_key "order_hist_lines", "p_payment_types" add_foreign_key "order_hist_lines", "p_product_refs" + add_foreign_key "p_article_serial_nums", "p_articles" + add_foreign_key "p_article_serial_nums", "p_serial_num_types" + add_foreign_key "p_article_serial_nums", "p_serial_num_values" + add_foreign_key "p_articles", "p_grades" + add_foreign_key "p_articles", "p_product_refs" add_foreign_key "p_commercial_object_brands", "p_commercial_objectives" add_foreign_key "p_commercial_object_brands", "p_commercials" add_foreign_key "p_commercial_object_brands", "s_brands" @@ -3080,6 +3147,9 @@ ActiveRecord::Schema.define(version: 2021_07_06_171352) do add_foreign_key "p_product_prices", "p_price_cats" add_foreign_key "p_product_prices", "p_product_refs" add_foreign_key "p_product_ref_price_histories", "p_product_refs" + add_foreign_key "p_product_ref_specs", "p_product_refs" + add_foreign_key "p_product_ref_specs", "p_spec_types" + add_foreign_key "p_product_ref_specs", "p_spec_values" add_foreign_key "p_product_utilisations", "p_products" add_foreign_key "p_product_utilisations", "p_utilisations" add_foreign_key "partition_lines", "partitions" diff --git a/test/fixtures/p_article_serial_nums.yml b/test/fixtures/p_article_serial_nums.yml new file mode 100644 index 0000000..b464109 --- /dev/null +++ b/test/fixtures/p_article_serial_nums.yml @@ -0,0 +1,11 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + p_article: one + p_serial_num_type: one + p_serial_num_value: one + +two: + p_article: two + p_serial_num_type: two + p_serial_num_value: two diff --git a/test/fixtures/p_articles.yml b/test/fixtures/p_articles.yml new file mode 100644 index 0000000..28280d4 --- /dev/null +++ b/test/fixtures/p_articles.yml @@ -0,0 +1,7 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + p_product_ref: one + +two: + p_product_ref: two diff --git a/test/fixtures/p_grades.yml b/test/fixtures/p_grades.yml new file mode 100644 index 0000000..345f425 --- /dev/null +++ b/test/fixtures/p_grades.yml @@ -0,0 +1,7 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + grade: MyString + +two: + grade: MyString diff --git a/test/fixtures/p_product_ref_specs.yml b/test/fixtures/p_product_ref_specs.yml new file mode 100644 index 0000000..e22eda8 --- /dev/null +++ b/test/fixtures/p_product_ref_specs.yml @@ -0,0 +1,11 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + p_product_ref: one + p_spec_type: one + p_spec_value: one + +two: + p_product_ref: two + p_spec_type: two + p_spec_value: two diff --git a/test/fixtures/p_serial_num_types.yml b/test/fixtures/p_serial_num_types.yml new file mode 100644 index 0000000..860f9b8 --- /dev/null +++ b/test/fixtures/p_serial_num_types.yml @@ -0,0 +1,7 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + type: + +two: + type: diff --git a/test/fixtures/p_serial_num_values.yml b/test/fixtures/p_serial_num_values.yml new file mode 100644 index 0000000..ebe29a0 --- /dev/null +++ b/test/fixtures/p_serial_num_values.yml @@ -0,0 +1,7 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + value: MyString + +two: + value: MyString diff --git a/test/fixtures/p_spec_types.yml b/test/fixtures/p_spec_types.yml new file mode 100644 index 0000000..860f9b8 --- /dev/null +++ b/test/fixtures/p_spec_types.yml @@ -0,0 +1,7 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + type: + +two: + type: diff --git a/test/fixtures/p_spec_values.yml b/test/fixtures/p_spec_values.yml new file mode 100644 index 0000000..b54b2ea --- /dev/null +++ b/test/fixtures/p_spec_values.yml @@ -0,0 +1,9 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + value: MyString + unit: MyString + +two: + value: MyString + unit: MyString diff --git a/test/models/p_article_serial_num_test.rb b/test/models/p_article_serial_num_test.rb new file mode 100644 index 0000000..046c2fb --- /dev/null +++ b/test/models/p_article_serial_num_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PArticleSerialNumTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/p_article_test.rb b/test/models/p_article_test.rb new file mode 100644 index 0000000..8e6e762 --- /dev/null +++ b/test/models/p_article_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PArticleTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/p_grade_test.rb b/test/models/p_grade_test.rb new file mode 100644 index 0000000..7078651 --- /dev/null +++ b/test/models/p_grade_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PGradeTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/p_product_ref_spec_test.rb b/test/models/p_product_ref_spec_test.rb new file mode 100644 index 0000000..59dbd78 --- /dev/null +++ b/test/models/p_product_ref_spec_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PProductRefSpecTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/p_serial_num_type_test.rb b/test/models/p_serial_num_type_test.rb new file mode 100644 index 0000000..63011d9 --- /dev/null +++ b/test/models/p_serial_num_type_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PSerialNumTypeTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/p_serial_num_value_test.rb b/test/models/p_serial_num_value_test.rb new file mode 100644 index 0000000..812717c --- /dev/null +++ b/test/models/p_serial_num_value_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PSerialNumValueTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/p_spec_type_test.rb b/test/models/p_spec_type_test.rb new file mode 100644 index 0000000..97553a9 --- /dev/null +++ b/test/models/p_spec_type_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PSpecTypeTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/p_spec_value_test.rb b/test/models/p_spec_value_test.rb new file mode 100644 index 0000000..021bdc7 --- /dev/null +++ b/test/models/p_spec_value_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PSpecValueTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end