Merge branch 'pre-prod'

This commit is contained in:
Barnabé 2021-09-27 16:59:00 +02:00
commit 69efd1df5a
203 changed files with 5121 additions and 1028 deletions

View File

@ -56,6 +56,7 @@
#= require freeze-table #= require freeze-table
#= require admin/random_hexa
@ -857,5 +858,3 @@ $(document).on 'click', '.datepicker', (e) ->
return return
return return

View File

@ -0,0 +1,2 @@
const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');

View File

@ -42,7 +42,7 @@ function manager_show(url){
function manager_hide(){ function manager_hide(){
$("#manager_box_place").removeClass("manager_box_place_active"); $("#manager_box_place").removeClass("manager_box_place_active");
$('#manager_box').html("");
$("body").css("overflow", "auto"); $("body").css("overflow", "auto");
slider_enabled = null; slider_enabled = null;
@ -239,3 +239,23 @@ function select_video_from_manager(input_id){
} }
function select_product_from_manager(input_id){
manager_prompt(p_product_refs_url,function(m_return){
$('#p_product_ref_id_'+input_id).val(m_return.id);
$('#p_product_ref_name_'+input_id).val(m_return.name);
$('#p_product_ref_qte_'+input_id).focus()
});
}
function send_manager_product(product_id, product_name){
manager_send_response({id : product_id, name : product_name});
}

View File

@ -10,8 +10,10 @@
if $(link).closest("p").next("." + association + "_form").length > 0 if $(link).closest("p").next("." + association + "_form").length > 0
form_element = $(link).closest("p").next("." + association + "_form") form_element = $(link).closest("p").next("." + association + "_form")
else else if $(link).closest("p").prev("." + association + "_form").length > 0
form_element = $(link).closest("p").prev("." + association + "_form") form_element = $(link).closest("p").prev("." + association + "_form")
else
form_element = $(link).closest(".qi_field_wrapper").find("." + association + "_form")
form_element.append content_final form_element.append content_final

View File

@ -1782,4 +1782,88 @@ td{
} }
// Html5 Tooltip
.info {
color: #009bbf;
position: relative;
display: inline-block;
text-overflow: ellipsis;
.info-text-top {
visibility: hidden;
background-color: #555;
color: #fff;
text-align: center;
padding: 5px;
border-radius: 6px;
max-width: 500px;
min-width: fit-content;
white-space: normal;
/* Position the tooltip text */
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -60px;
/* Fade in tooltip */
opacity: 0;
transition: opacity 0.3s;
}
.info-text-top::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}
.info-text-bottom {
visibility: hidden;
background-color: #555;
color: #fff;
text-align: center;
padding: 5px;
border-radius: 6px;
max-width: 500px;
min-width: fit-content;
white-space: normal;
/* Position the tooltip text */
position: absolute;
z-index: 1;
top: 125%;
left: 200%;
margin-left: -60px;
/* Fade in tooltip */
opacity: 0;
transition: opacity 0.3s;
}
.info-text-bottom::after {
content: "";
position: absolute;
bottom: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent #555 transparent;
}
}
.info:hover {
.info-text-top {
visibility: visible;
opacity: 1;
}
.info-text-bottom {
visibility: visible;
opacity: 1;
}
}
// Fin // Fin

View File

@ -2,7 +2,8 @@
#manager_box_place{ #manager_box_place{
position:fixed; position:fixed;
height:0; height:0;
width:100%; left:100px;
right:30px;
z-index:1500; z-index:1500;
top:0px; top:0px;
margin:0px; margin:0px;

View File

@ -8,17 +8,89 @@ class Admin::BuyListsController < ApplicationController
@p_customer_sheets = PCustomerSheet.all @p_customer_sheets = PCustomerSheet.all
@p_customer_sheets = @p_customer_sheets.where(:state => ["AV BPA", "PAS BPA", "BPA"]) @p_customer_sheets = @p_customer_sheets.where(:state => ["brouillon", "offre", "commande"])
@price_line_blocks = PriceLineBlock.where(:price_lineable_type => "PCustomerSheet", :price_lineable_id => @p_customer_sheets.ids) @price_line_blocks = PriceLineBlock.where(:price_lineable_type => "PCustomerSheet", :price_lineable_id => @p_customer_sheets.ids)
@price_lines = PriceLine.where(:price_line_block_id => @price_line_blocks.ids) @price_lines = PriceLine.where(:price_line_block_id => @price_line_blocks.ids)
if params[:search][:s_brand].present? && params[:search][:s_brand] != ""
@price_lines = @price_lines.joins(p_product_ref: :p_product).where("s_brand_id = ?", params[:search][:s_brand])
end
if params[:search][:state].present? && params[:search][:state] != ""
@p_customer_sheets = @p_customer_sheets.where(:state => params[:search][:state])
@price_line_blocks = PriceLineBlock.where(:price_lineable_type => "PCustomerSheet", :price_lineable_id => @p_customer_sheets.ids)
@price_lines = PriceLine.where(:price_line_block_id => @price_line_blocks.ids)
end
if params[:search][:p_customer_code].present?
@p_customer_sheets = @p_customer_sheets.joins(:p_customer).where("code LIKE ?", params[:search][:p_customer_code])
@price_line_blocks = PriceLineBlock.where(:price_lineable_type => "PCustomerSheet", :price_lineable_id => @p_customer_sheets.ids)
@price_lines = PriceLine.where(:price_line_block_id => @price_line_blocks.ids)
end
date_regex = /^(0[1-9]|[12][0-9]|3[01])[\/](0[1-9]|1[012])[\/](19|20)\d\d$/i
params[:cc_creation_date_start] = Date.today.beginning_of_month.strftime('%d/%m/%Y') if !params[:cc_creation_date_start]
if params[:cc_creation_date_start] and params[:cc_creation_date_start] =~ date_regex
#fsfds = sdfsfd
@cc_creation_date_start = Date.parse(params[:cc_creation_date_start]).beginning_of_day
params[:cc_creation_date_start]= @cc_creation_date_start.strftime('%d/%m/%Y')
else
@cc_creation_date_start = nil
end
if true
params[:cc_creation_date_stop] = Date.today.end_of_month.strftime('%d/%m/%Y') if !params[:cc_creation_date_stop]
if params[:cc_creation_date_stop].to_s != "" # and params[:stop] =~ date_regex
@cc_creation_date_stop = Date.parse(params[:cc_creation_date_stop]).end_of_day
params[:cc_creation_date_stop]= @cc_creation_date_stop.strftime('%d/%m/%Y')
else
@cc_creation_date_stop = nil
end
end
@price_lines = @price_lines.where("price_lines.cc_creation_date >= ?", @cc_creation_date_start) if @cc_creation_date_start
@price_lines = @price_lines.where("price_lines.cc_creation_date <= ?", @cc_creation_date_stop.end_of_day) if @cc_creation_date_stop
params[:wish_date_start] = Date.today.beginning_of_month.strftime('%d/%m/%Y') if !params[:wish_date_start]
if params[:wish_date_start] and params[:wish_date_start] =~ date_regex
#fsfds = sdfsfd
@wish_date_start = Date.parse(params[:wish_date_start]).beginning_of_day
params[:wish_date_start]= @wish_date_start.strftime('%d/%m/%Y')
else
@wish_date_start = nil
end
if true
params[:wish_date_stop] = Date.today.end_of_month.strftime('%d/%m/%Y') if !params[:wish_date_stop]
if params[:wish_date_stop].to_s != "" # and params[:stop] =~ date_regex
@wish_date_stop = Date.parse(params[:wish_date_stop]).end_of_day
params[:wish_date_stop]= @wish_date_stop.strftime('%d/%m/%Y')
else
@wish_date_stop = nil
end
end
@price_lines = @price_lines.joins(:price_line_block).where("price_line_blocks.wish_date >= ?", @wish_date_start) if @wish_date_start
@price_lines = @price_lines.joins(:price_line_block).where("price_line_blocks.wish_date <= ?", @wish_date_stop.end_of_day) if @wish_date_stop
respond_to do |format| respond_to do |format|
format.html{ format.html{
} }
end end

View File

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

View File

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

View File

@ -174,12 +174,14 @@ class Admin::PCustomerSheetsController < ApplicationController
@p_customer_sheet.admin = current_admin @p_customer_sheet.admin = current_admin
@p_customer = @p_customer_sheet.p_customer
if @p_customer_sheet.save if @p_customer_sheet.save
@p_customer_sheets = PCustomerSheet.order(:id).all
redirect_to admin_p_customer_sheet_path(@p_customer_sheet) redirect_to admin_p_customer_sheet_path(@p_customer_sheet)
else else
@p_customer = @p_customer_sheet.price_line_block.p_customer
render action: "new" render action: "new"
end end
@ -189,12 +191,13 @@ class Admin::PCustomerSheetsController < ApplicationController
def update def update
@p_customer_sheet = PCustomerSheet.find(params[:id]) @p_customer_sheet = PCustomerSheet.find(params[:id])
@p_customer = @p_customer_sheet.p_customer
if @p_customer_sheet.update_attributes(params.require(:p_customer_sheet).permit!) if @p_customer_sheet.update_attributes(params.require(:p_customer_sheet).permit!)
@p_customer_sheets = PCustomerSheet.order(:id).all @p_customer = @p_customer_sheet.price_line_block.p_customer
redirect_to admin_p_customer_sheet_path(@p_customer_sheet) redirect_to admin_p_customer_sheet_path(@p_customer_sheet)
else else
@ -277,6 +280,89 @@ class Admin::PCustomerSheetsController < ApplicationController
end end
def export_xls
@p_customer_sheets = PCustomerSheet.all
if params[:p_customer_sheet_ids].present?
@p_customer_sheets = PCustomerSheet.where(id: params[:p_customer_sheet_ids])
end
respond_to do |format|
format.csv {
@headers = ["BUID", "DATE", "NUMERO", "CLIENT", "REFERENCE", "EAN", "DESIGNATION", "QTE", "PRIX 1", "PRIX 2", "DEEE", "SORECOP", "FOURNISSEUR", "CODE ARTICLE MAG", "NomMarque", "Code Douanier", "Type SORECOP"]
@columns = []
# PCustomerSheet.qi_table_order.each do |key, value|
# if value.instance_of? Hash
# name = value[:name]
# else
# name = value
# end
# if name != "Actions"
# @headers << name.to_s
# @columns << key
# end
# end
xlsx_package = Axlsx::Package.new
wb = xlsx_package.workbook
wb.add_worksheet(name: "BASIC extract to Chronopost") do |sheet|
sheet.add_row @headers
@p_customer_sheets.each do |p_customer_sheet|
p_customer_sheet.price_line_block.price_lines.each do |price_line|
line = []
line << price_line.id
line << p_customer_sheet.created_at.strftime("%d/%d/%Y")
line << p_customer_sheet.id
line << p_customer_sheet.p_customer.code + " - " + p_customer_sheet.p_customer.particulars.first.organisation
line << price_line.p_product_ref.cc_name
# line << price_line.p_product_ref.cc_ean
line << price_line.p_product_ref.ean
line << price_line.p_product_ref.cc_name
line << price_line.qte
line << price_line.cc_price_u_ht
line << price_line.ct_u_price_ht
line << price_line.p_product_ref.deee
line << price_line.p_product_ref.sorecop
# line << price_line.p_product_ref.referal_fournisseur
line << "Fournisseur"
line << ""
line << price_line.p_product_ref.p_product.s_brand.name
line << "Code douanier"
line << price_line.p_product_ref.sorecop_comment
sheet.add_row line, types: line.map{|t| cell_type_from_value(t)}
# puts line
end
# @columns.each do |column|
# if (p_customer_sheet.respond_to?("csv_"+column.to_s))
# line << p_customer_sheet.send("csv_"+column.to_s)
# elsif (p_customer_sheet.respond_to?(column))
# if p_customer_sheet.send(column.to_s).class.to_s == "BigDecimal"
# line << p_customer_sheet.send(column.to_s).to_s.gsub('.', ',')
# else
# line << p_customer_sheet.send(column.to_s)
# end
# else
# line << column.to_s
# end
# end
# sheet.add_row line, types: line.map{|t| cell_type_from_value(t)}
end
end
@final_file = "#{Rails.root}/private_medias/export-inscrits-#{Time.now.to_s.to_slug}.xlsx"
xlsx_package.serialize(@final_file)
send_file @final_file
}
end
end
end end

View File

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

View File

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

View File

@ -42,11 +42,19 @@ class Admin::PProductRefsController < ApplicationController
if params[:search][:s_brand_id].to_s != "" if params[:search][:s_brand_id].to_s != ""
@p_product_refs = @p_product_refs.where(:s_brand_id => params[:search][:s_brand_id]) @p_product_refs = @p_product_refs.where(:p_products => {:s_brand_id => params[:search][:s_brand_id]})
end end
@p_product_refs = sort_by_sorting(@p_product_refs, "id DESC") @p_product_refs = sort_by_sorting(@p_product_refs, "id DESC")
respond_to do |format| respond_to do |format|
format.js{
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_refs = @p_product_refs.page(page).per(per_page)
}
format.html{ format.html{
params[:search][:per_page] = params[:search][:per_page] || 100 params[:search][:per_page] = params[:search][:per_page] || 100
@ -58,6 +66,11 @@ class Admin::PProductRefsController < ApplicationController
end end
if params[:manager].to_s == "true"
@manager = true
render :layout => false
end
end end
def show def show
@ -94,7 +107,9 @@ class Admin::PProductRefsController < ApplicationController
if @p_product_ref.update_attributes(params.require(:p_product_ref).permit!) if @p_product_ref.update_attributes(params.require(:p_product_ref).permit!)
else else
render action: "edit" render action: "edit"
end end
@ -138,16 +153,18 @@ class Admin::PProductRefsController < ApplicationController
def get_infos def get_infos
@p_product_ref = PProductRef.find(params[:id]) @p_product_ref = PProductRef.find(params[:id])
if params[:type] == "price" if params[:type] == "price"
price = @p_product_ref.get_price(:p_customer_id => params[:p_customer_id], :qte => params[:qte]) price = @p_product_ref.get_price(:p_customer_id => params[:p_customer_id], :qte => params[:qte])
puts params[:p_fournisseur_id]
if params[:p_customer_id].to_s != "" if params[:p_customer_id].to_s != ""
p_customer = PCustomer.find(params[:p_customer_id]) p_customer = PCustomer.find(params[:p_customer_id])
accounting_zone_id = p_customer.accounting_zone_id accounting_zone_id = p_customer.accounting_zone_id
if p_customer.tva_rate if p_customer.tva_rate
tva_account_id = p_customer.tva_rate.id tva_account_id = p_customer.tva_rate.id
tva_account_value = p_customer.tva_rate.rate tva_account_value = p_customer.tva_rate.rate

View File

@ -73,8 +73,11 @@ class Admin::PProductsController < ApplicationController
@p_product = PProduct.new #(:p_customer_cat_ids => [3]) @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 end

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
class Admin::PriceDocumentsController < ApplicationController class Admin::PriceDocumentsController < ApplicationController
layout "admin" layout "admin"
before_action :auth_admin, :except => :print before_action :auth_admin, :except => [:print, :consult, :consult_create, :consult_edit, :consult_update]
before_action :admin_space, :except => :print before_action :admin_space, :except => :print
@ -224,7 +224,7 @@ class Admin::PriceDocumentsController < ApplicationController
def show def show
@price_document = PriceDocument.find(params[:id]) @price_document = PriceDocument.find(params[:id])
@facture_achat_childrens = PriceDocument.where(doc_ref_id: @price_document.id, price_document_type: PriceDocumentType.find_by_label("Facture achat"))
end end
def new def new
@ -235,11 +235,19 @@ class Admin::PriceDocumentsController < ApplicationController
@price_document.price_line_block = PriceLineBlock.new(:p_customer_id => params[:p_customer_id], :p_fournisseur_id => params[:p_fournisseur_id]) @price_document.price_line_block = PriceLineBlock.new(:p_customer_id => params[:p_customer_id], :p_fournisseur_id => params[:p_fournisseur_id])
if @price_document.price_document_type.label == "Demande prix" if @price_document.price_document_type.label == "Demande prix"
@ref_price_lines = PriceLine.where(:id => params[:price_line_ids]) p_product_ref_id = params[:p_product_ref_ids] - [""]
p_product_ref_qte = params[:qte].permit!.to_hash
@ref_price_lines.group(:p_product_ref_id).each do |plr| p_product_ref_id.each do |i|
@price_document.price_line_block.price_lines << PriceLine.new(:p_product_ref_id => plr.p_product_ref_id, :qte => @ref_price_lines.where(:p_product_ref_id => plr.p_product_ref_id).sum(:qte)) if p_product_ref_qte[i.to_s].to_i > 0
@price_document.price_line_block.price_lines << PriceLine.new(:p_product_ref_id => i, :qte => p_product_ref_qte[i.to_s])
end end
end
# @ref_price_lines = PriceLine.where(:id => params[:price_line_ids])
# @ref_price_lines.group(:p_product_ref_id).each do |plr|
# @price_document.price_line_block.price_lines << PriceLine.new(:p_product_ref_id => plr.p_product_ref_id, :qte => @ref_price_lines.where(:p_product_ref_id => plr.p_product_ref_id).sum(:qte))
# end
end end
@ -261,6 +269,7 @@ class Admin::PriceDocumentsController < ApplicationController
def consult def consult
@consult = true
@demande = PriceDocument.where(:f_token => params[:id]).first @demande = PriceDocument.where(:f_token => params[:id]).first
@ -272,13 +281,35 @@ class Admin::PriceDocumentsController < ApplicationController
@ref_price_lines = @demande.price_line_block.price_lines @ref_price_lines = @demande.price_line_block.price_lines
@ref_price_lines.group(:p_product_ref_id).each do |plr| @ref_price_lines.group(:p_product_ref_id).each do |plr|
@price_document.price_line_block.price_lines << PriceLine.new(:p_product_ref_id => plr.p_product_ref_id, :qte => @ref_price_lines.where(:p_product_ref_id => plr.p_product_ref_id).sum(:qte)) @price_document.price_line_block.price_lines << PriceLine.new(:price_line_ref_id => plr.id, :p_product_ref_id => plr.p_product_ref_id, :qte => @ref_price_lines.where(:p_product_ref_id => plr.p_product_ref_id).sum(:qte))
end end
end end
def consult_create
@consult = true
@price_document = PriceDocument.new(params.require(:price_document).permit!)
@price_document.date = Date.today
if @price_document.save
redirect_to consult_edit_admin_price_document_path(:id => @price_document.token)
else
render action: "consult"
end
end
def consult_edit
@consult = true
@price_document = PriceDocument.where(:token => params[:id]).first
end
def edit def edit
@price_document = PriceDocument.find(params[:id]) @price_document = PriceDocument.find(params[:id])
@ -291,7 +322,11 @@ class Admin::PriceDocumentsController < ApplicationController
@price_document.date = Date.today @price_document.date = Date.today
@avoir = true if @price_document.label == "Avoir" @avoir = true if @price_document.label == "Avoir"
if @price_document.save if @price_document.save
if @price_document.cc_label == "Demande prix"
render action: :show
else
redirect_to admin_price_documents_path(:price_document_type_id => @price_document.price_document_type_id) redirect_to admin_price_documents_path(:price_document_type_id => @price_document.price_document_type_id)
end
else else
render action: "new" render action: "new"
@ -305,18 +340,26 @@ class Admin::PriceDocumentsController < ApplicationController
@avoir = true if @price_document.label == "Avoir" @avoir = true if @price_document.label == "Avoir"
if @price_document.update_attributes(params.require(:price_document).permit!) if @price_document.update_attributes(params.require(:price_document).permit!)
if params[:public_edit].to_s == "true" if params[:public_edit].to_s == "true"
@price_document.reset_for_update @price_document.reset_for_update
#@price_document.unarchive_now #@price_document.unarchive_now
#@price_document.archive_now #@price_document.archive_now
if @price_document.ref_element if ["Facture achat", "Commande achat"].include?(@price_document.cc_label)
redirect_to [:admin, @price_document]
elsif @price_document.doc_ref_id
redirect_to [:admin, PriceDocument.find(@price_document.doc_ref_id)]
elsif @price_document.ref_element
redirect_to [:admin, @price_document.ref_element] redirect_to [:admin, @price_document.ref_element]
else else
redirect_to [:admin, @price_document] redirect_to [:admin, @price_document]
end end
elsif @price_document.doc_ref_id
redirect_to [:admin, PriceDocument.find(@price_document.doc_ref_id)]
elsif @price_document.ref_element
redirect_to [:admin, @price_document.ref_element]
else else
redirect_to [:admin, @price_document] redirect_to [:admin, @price_document]
end end
@ -566,5 +609,203 @@ class Admin::PriceDocumentsController < ApplicationController
end end
def match_p_fournisseur
@price_document = PriceDocument.find(params[:id])
end
def match_p_fournisseur_save
@price_document = PriceDocument.find(params[:id])
if @price_document.update_attributes(params.require(:price_document).permit!)
# redirect_back(fallback_location: price_documents_ptath)
else
render action: "edit"
end
end
def analyse_reponses
@price_document = PriceDocument.find(params[:id])
@price_document_responses = PriceDocument.where(:doc_ref_id => @price_document.id, :price_document_type_id => PriceDocumentType.find_by_label("Réponse fournisseur").id )
end
def analyse_reponses_save
@price_document = PriceDocument.find(params[:id])
if @price_document.update_attributes(params.require(:price_document).permit!)
redirect_to :analyse_reponses_admin_price_document
else
render :edit
end
end
def generate_final_consult
price_lines_to_add = {}
@price_document_demand = PriceDocument.find(params[:id])
@price_document_demand.price_line_block.price_lines.each do |pl_demand|
pl_demand.price_line_resps.all.each do |price_line_resp|
price_lines_to_add[price_line_resp.p_fournisseur.id] = price_lines_to_add[price_line_resp.p_fournisseur.id] || {:p_fournisseur => price_line_resp.p_fournisseur, :price_lines => [] }
price_lines_to_add[price_line_resp.p_fournisseur.id][:price_lines] << price_line_resp
end
end
price_lines_to_add.each do |k,v|
new_final_consult = PriceDocument.new(:doc_ref_id => @price_document_demand.id,:date => Date.today, :price_document_type => PriceDocumentType.find_by_label("Consultation fournisseur"))
new_final_consult.price_line_block = PriceLineBlock.new(:p_fournisseur => v[:p_fournisseur])
v[:price_lines].each do |price_line_resp|
new_final_consult.price_line_block.price_lines << PriceLine.new(:p_product_ref => price_line_resp.p_product_ref, :qte => price_line_resp.qte_available, :ct_u_price_ht => price_line_resp.price_u_ht )
end
new_final_consult.save
end
@final_consult = PriceDocument.where(price_document_type: PriceDocumentType.find_by_label("Consultation fournisseur")).last
redirect_to admin_price_document_path(@price_document_demand, anchor: "consult")
end
def buy_order_create
@final_consult = PriceDocument.find(params[:id])
price_line_block = PriceLineBlock.new(p_fournisseur: @final_consult.price_line_block.p_fournisseur)
price_lines = PriceLine.where(price_line_block: @final_consult.price_line_block)
@price_document = PriceDocument.new(date: Date.today, price_line_block: price_line_block, doc_ref_id: @final_consult.id, demande_de_prix_id: @final_consult.id ,:price_document_type => PriceDocumentType.find_by_label("Commande achat"))
price_lines.each do |pl|
@price_document.price_line_block.price_lines << PriceLine.new(p_product_ref: pl.p_product_ref, qte: pl.qte, ct_u_price_ht: pl.price_u_ht)
end
if @price_document.save!
redirect_to admin_price_document_path(@price_document)
end
end
def bon_de_reception
@past_price_document = PriceDocument.find(params[:id])
@p_customer_sheet = @past_price_document.ref_element
if @p_customer_sheet
price_document = @p_customer_sheet.price_documents.new(:price_document_type => PriceDocumentType.find_by_label("Bon de réception achat"), :demande_de_prix_id => @past_price_document.id, :date => Date.today)
else
price_document = PriceDocument.new(:price_document_type => PriceDocumentType.find_by_label("Bon de réception achat"), :date => Date.today)
end
price_document.doc_ref_id = @past_price_document.id
price_document.p_fournisseur = @past_price_document.p_fournisseur
price_document.price_line_block = @past_price_document.price_line_block.dup
if @past_price_document.cc_label == "Commande achat"
price_document.bon_de_commande_achat_id = @past_price_document.id
price_document.reliquat = true if PriceDocument.where(:bon_de_commande_achat_id => @past_price_document.id, :price_document_type => PriceDocumentType.find_by_label("Bon de réception achat")).count > 0
end
if @past_price_document.cc_label == "Facture achat"
price_document.facture_achat_id = @past_price_document.id
end
price_document.price_line_block.ac_bon_de_commande_id = nil
price_document.price_line_block.ac_bon_de_livraison_id = nil
price_document.price_line_block.ac_facture_id = nil
price_document.price_line_block.ac_block_type = nil
price_document.price_line_block.ac_reliquat = nil
@past_price_document.price_line_block.price_lines.each do |pl|
new_pl = pl.dup
new_pl.price_line_ref_id = pl.id
new_pl.ac_block_type = nil
if price_document.reliquat #and @p_customer_sheet
bls = PriceDocument.where(:bon_de_commande_achat_id => @past_price_document.id, :price_document_type => PriceDocumentType.find_by_label("Bon de réception achat"))
qte_ok = PriceLine.where(:price_line_ref_id => new_pl.price_line_ref_id).where(:price_line_block_id => PriceLineBlock.where(:price_lineable_type => "PriceDocument", :price_lineable_id => bls.ids)).sum(:qte)
new_pl.qte = new_pl.qte - qte_ok
end
price_document.price_line_block.price_lines << new_pl
end
if price_document.save
#price_document.reset_for_update
#price_document.archive_now
if @p_customer_sheet
@p_customer_sheet.state = "Bon de réception achat"
@p_customer_sheet.save
end
if price_document.doc_ref_id
redirect_to [:admin, @past_price_document]
else
redirect_to [:admin, price_document]
end
else
render :inline => price_document.errors.messages.to_s
end
end
def facture_achat
@past_price_document = PriceDocument.find(params[:id])
@p_customer_sheet = @past_price_document.ref_element
if @p_customer_sheet
price_document = @p_customer_sheet.price_documents.new(:price_document_type => PriceDocumentType.find_by_label("Facture achat"), :demande_de_prix_id => @past_price_document.id, :date => Date.today)
else
price_document = PriceDocument.new(:price_document_type => PriceDocumentType.find_by_label("Facture achat"), :date => Date.today)
end
price_document.doc_ref_id = @past_price_document.id
price_document.p_fournisseur = @past_price_document.p_fournisseur
price_document.price_line_block = @past_price_document.price_line_block.dup
price_document.price_line_block.ac_bon_de_commande_id = nil
price_document.price_line_block.ac_bon_de_livraison_id = nil
price_document.price_line_block.ac_facture_id = nil
price_document.price_line_block.ac_block_type = nil
price_document.price_line_block.ac_reliquat = nil
@past_price_document.price_line_block.price_lines.each do |pl|
new_pl = pl.dup
new_pl.price_line_ref_id = pl.id
new_pl.ac_block_type = nil
price_document.price_line_block.price_lines << new_pl
end
if price_document.save
#price_document.reset_for_update
#price_document.archive_now
if @p_customer_sheet
@p_customer_sheet.state = "Facture"
@p_customer_sheet.save
end
if price_document.doc_ref_id
redirect_to [:admin, @past_price_document]
else
redirect_to [:admin, price_document]
end
else
render :inline => price_document.errors.messages.to_s
end
end
end end

View File

@ -0,0 +1,76 @@
# -*- encoding : utf-8 -*-
class Admin::PriceLineRespSelectsController < ApplicationController
layout "admin"
before_action :auth_admin
before_action :admin_space
def admin_space
@admin_space = "default"
end
def index
@price_line_resp_selects = PriceLineRespSelect.all
@price_line_resp_selects = sort_by_sorting(@price_line_resp_selects, "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
@price_line_resp_selects = @price_line_resp_selects.page(page).per(per_page)
}
end
end
def show
@price_line_resp_select = PriceLineRespSelect.find(params[:id])
end
def new
@price_line_resp_select = PriceLineRespSelect.new
end
def edit
@price_line_resp_select = PriceLineRespSelect.find(params[:id])
end
def create
@price_line_resp_select = PriceLineRespSelect.new(params.require(:price_line_resp_select).permit!)
if @price_line_resp_select.save
else
render action: "new"
end
end
def update
@price_line_resp_select = PriceLineRespSelect.find(params[:id])
if @price_line_resp_select.update_attributes(params.require(:price_line_resp_select).permit!)
else
render action: "edit"
end
end
def destroy
@price_line_resp_select = PriceLineRespSelect.find(params[:id])
@price_line_resp_select.destroy
end
end

View File

@ -2,7 +2,7 @@
class Admin::PriceLinesController < ApplicationController class Admin::PriceLinesController < ApplicationController
layout "admin" layout "admin"
before_action :auth_admin before_action :auth_admin, :except => [:edit, :update]
before_action :admin_space before_action :admin_space

View File

@ -2,13 +2,14 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception. # Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead. # For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception protect_from_forgery with: :exception
before_action :set_current_p_customer_sheet #before_action :set_current_p_customer_sheet
before_action :init_admin_menu before_action :init_admin_menu
before_action :qi_menu before_action :qi_menu
before_action :set_navbar_dropdown
def qi_menu(sym=nil) def qi_menu(sym=nil)
@ -21,10 +22,24 @@ class ApplicationController < ActionController::Base
@qi_menu_active = sym.to_sym @qi_menu_active = sym.to_sym
else else
@qi_menus.each do |k, v| @qi_menus.each do |k, v|
if v[:elements] and v[:elements][sym.to_sym] if v[:elements] and v[:elements][sym.to_sym]
@qi_menu_active = k @qi_menu_active = k
@qi_menu_sub_menu_active = sym.to_sym @qi_menu_sub_menu_active = sym.to_sym
break break
elsif v[:elements]
v[:elements].each do |a,b|
if b[:sub_elements] and b[:sub_elements][sym.to_sym]
@qi_menu_active = k
@qi_menu_sub_menu_active = sym.to_sym
end
end
end end
@ -64,41 +79,53 @@ class ApplicationController < ActionController::Base
if current_admin.has_permission?("products") if current_admin.has_permission?("products")
set_sub_menu :stocks, :p_products, "Produits", admin_p_products_path 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, :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 end
if current_admin.has_permission?("product-cats") 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_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 end
set_sub_menu :stocks, :p_preferences_products_menu, "Préférences", admin_p_products_path
if current_admin.has_permission?("brands") if current_admin.has_permission?("brands")
set_sub_menu :stocks, :s_brands, "Marques", admin_s_brands_path set_sub_sub_menu :stocks, :p_preferences_products_menu, :s_brands, "Marques", admin_s_brands_path
end end
if current_admin.has_permission?("fournisseurs") if current_admin.has_permission?("fournisseurs")
set_sub_menu :stocks, :p_fournisseurs, "Fournisseurs", admin_p_fournisseurs_path set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_fournisseurs, "Fournisseurs", admin_p_fournisseurs_path
end end
if current_admin.has_permission?("stocks") if current_admin.has_permission?("stocks")
set_sub_menu :stocks, :stock_alias, "Stocks", admin_line_stocks_path set_sub_sub_menu :stocks, :p_preferences_products_menu, :stock_alias, "Stocks", admin_line_stocks_path
end end
if current_admin.has_permission?("boutique") if current_admin.has_permission?("boutique")
set_sub_menu :stocks, :p_product_colors, "Couleurs" set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_colors, "Couleurs"
set_sub_menu :stocks, :p_product_powers, "Types de chargeurs" set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_article_serial_nums, "Numeros série"
set_sub_menu :stocks, :p_product_zones, "Zones produits" set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_serial_num_types, "Types de Numero série"
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_ref_specs, "Specs"
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_spec_types, "Types de specs"
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_spec_values, "Valeurs de specs"
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_zones, "Zones produits"
end end
@ -138,7 +165,7 @@ class ApplicationController < ActionController::Base
end end
set_sub_menu :documents, :"p_document_type_reponse_fournisseur", "Réponses fournisseurs", admin_price_documents_path(:price_document_type_id => 2) # set_sub_menu :documents, :"p_document_type_reponse_fournisseur", "Réponses fournisseurs", admin_price_documents_path(:price_document_type_id => PriceDocumentType.find_by(label: "Réponse fournisseur").id)
@ -191,6 +218,16 @@ class ApplicationController < ActionController::Base
end end
def set_sub_sub_menu(big_menu, sub_menu, sub_sub_menu, name, link=nil)
link = eval("admin_#{sub_sub_menu}_path") if !link
@qi_menus[big_menu.to_sym][:elements][sub_menu.to_sym][:sub_elements] = @qi_menus[big_menu.to_sym][:elements][sub_menu.to_sym][:sub_elements] || {}
@qi_menus[big_menu.to_sym][:elements][sub_menu.to_sym][:sub_elements][sub_sub_menu.to_sym] = {:name => name, :link => link}
end
before_action :set_product_display before_action :set_product_display
before_action :set_locale before_action :set_locale
@ -434,6 +471,9 @@ class ApplicationController < ActionController::Base
def current_admin def current_admin
if @current_admin
return @current_admin
else
if cookies[:admin_remember_token] if cookies[:admin_remember_token]
if @current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token]) if @current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token])
@current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token]) @current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token])
@ -442,6 +482,7 @@ class ApplicationController < ActionController::Base
end end
end end
end
@ -493,7 +534,10 @@ class ApplicationController < ActionController::Base
end end
def set_navbar_dropdown
@dropdown_elements = [:p_product_cats, :s_brands, :p_product_colors, :p_article_serial_nums, :p_serial_num_types, :p_product_ref_specs, :p_spec_values, :p_grades, :p_product_powers, :p_product_zones]
@dropdown_title = "Parametrage"
end
end end

View File

@ -14,6 +14,19 @@ module ApplicationHelper
return raw(r) return raw(r)
end end
def qi_js_field_price_line_form(form, model, method, options = {})
r = ""
if options[:hidden]
r += hidden_field_tag(method, eval("form.object.#{method}"), :class => "input_#{model}_#{method} form-control",:disabled => true)
else
if options[:label]
r += label_tag(:input, options[:label], class: options[:label_class])
end
r += text_field_tag(method, (options[:value] ? options[:value] : eval("form.object.#{method}")), :class => "input_#{model}_#{method} form-control",:disabled => true)
end
return raw(r)
end
def edit_watcher(element_type, element_id, key='' ) def edit_watcher(element_type, element_id, key='' )
raw ('<script type="text/javascript">')+("edit_watcher('"+element_type+"', '"+element_id.to_s+"','"+key+"');")+("setInterval(function(){ edit_watcher('"+element_type+"', '"+element_id.to_s+"','"+key+"');}, 1000);")+('</script><div id="edit_watcher_result"></div>') raw ('<script type="text/javascript">')+("edit_watcher('"+element_type+"', '"+element_id.to_s+"','"+key+"');")+("setInterval(function(){ edit_watcher('"+element_type+"', '"+element_id.to_s+"','"+key+"');}, 1000);")+('</script><div id="edit_watcher_result"></div>')

View File

@ -28,13 +28,17 @@ module DocumentLineHelper
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
render("admin/"+association.to_s + "/essentials_form", :form => builder) render("admin/"+association.to_s + "/essentials_form", :form => builder)
end end
elsif options[:slug]
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
render("admin/"+association.to_s + "/form_#{options[:slug]}", :form => builder)
end
else else
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
render("admin/"+association.to_s + "/form", :form => builder) render("admin/"+association.to_s + "/form", :form => builder)
end end
end end
link_to name,"#", :onclick => "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\");return false;", :class => (options[:class]) link_to name,"#", :onclick => "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\");return false;", :class => (options[:class]), tabindex: options[:tabindex], style: options[:style]
end end
end end

View File

@ -32,7 +32,7 @@ module TranslationHelper
content = capture(&block) if block_given? content = capture(&block) if block_given?
r = "" r = ""
if current_admin.id == 1 if current_admin and current_admin.id == 1
r += "<span class='admin_diag'>" r += "<span class='admin_diag'>"
r += ic(:"stethoscope") if show_icon r += ic(:"stethoscope") if show_icon

View File

@ -99,7 +99,7 @@ class LineStock < ApplicationRecord
end end
def ca_price_u_kg_ht def ca_price_u_kg_ht
if self.qte_kg_per_unit != 0.0 if self.qte_kg_per_unit.to_f != 0.0
(self.price_u_ht.to_f / self.qte_kg_per_unit).round(2) (self.price_u_ht.to_f / self.qte_kg_per_unit).round(2)
else else
0.0 0.0
@ -116,7 +116,7 @@ class LineStock < ApplicationRecord
end end
def ca_qte_kg def ca_qte_kg
self.qte * self.qte_kg_per_unit self.qte.to_f * self.qte_kg_per_unit.to_f
end end

38
app/models/p_article.rb Normal file
View File

@ -0,0 +1,38 @@
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
if PGrade::ACTIVATED
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},
}
else
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},
:color => {:name => "Couleur"},
:p_article_serial_nums => {:name => "N° identifiants"},
:actions => {:name => "Actions", :reorder => false},
}
end
def member_label
"#{p_product_ref.cc_name}"
end
end

View File

@ -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 => "", :reorder => true},
:actions => {:name => "Actions", :reorder => true}
}
end

View File

@ -192,6 +192,15 @@ class PCustomer < ApplicationRecord
end end
def tva_rate
if tva = TvaRate.where(:accounting_zone_id => self.accounting_zone_id).first
return tva
else
return nil
end
end
def update_caches def update_caches

View File

@ -40,6 +40,7 @@ class PCustomerSheet < ApplicationRecord
:tot_amount_ht => {:name => "Total HT", :reorder => true, :sort_name => "cc_tot_amount_ht", :sort_name => "p_customer_sheets.cc_tot_amount_ht"}, :tot_amount_ht => {:name => "Total HT", :reorder => true, :sort_name => "cc_tot_amount_ht", :sort_name => "p_customer_sheets.cc_tot_amount_ht"},
:tot_amount_ttc => {:name => "Total TTC", :reorder => true, :sort_name => "cc_tot_amount_ttc", :sort_name => "p_customer_sheets.cc_tot_amount_ttc"}, :tot_amount_ttc => {:name => "Total TTC", :reorder => true, :sort_name => "cc_tot_amount_ttc", :sort_name => "p_customer_sheets.cc_tot_amount_ttc"},
:state => {:name => "Statut", :reorder => false, :as => :state}, :state => {:name => "Statut", :reorder => false, :as => :state},
:check_box => {:name => "Export excel #{'<i id="check-all" class="fa fa-check-square" aria-hidden="true"></i>'}", :reorder => false},
:actions => {:name => "Actions", :reorder => false}, :actions => {:name => "Actions", :reorder => false},
} }
@ -256,7 +257,7 @@ class PCustomerSheet < ApplicationRecord
after_create do after_create do
#self.state = "brouillon" if self.state != "Panier web" self.state = "brouillon" if self.state != "Panier web"
self.save self.save
end end

11
app/models/p_grade.rb Normal file
View File

@ -0,0 +1,11 @@
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},
}
ACTIVATED = false
end

View File

@ -5,8 +5,6 @@ class PProduct < ApplicationRecord
has_many :p_product_refs, :dependent => :destroy has_many :p_product_refs, :dependent => :destroy
accepts_nested_attributes_for :p_product_refs, allow_destroy: true accepts_nested_attributes_for :p_product_refs, allow_destroy: true
has_many :p_product_ingredients, :dependent => :destroy has_many :p_product_ingredients, :dependent => :destroy
accepts_nested_attributes_for :p_product_ingredients, allow_destroy: true accepts_nested_attributes_for :p_product_ingredients, allow_destroy: true
@ -17,6 +15,14 @@ class PProduct < ApplicationRecord
has_many :p_product_nutris, :dependent => :destroy has_many :p_product_nutris, :dependent => :destroy
accepts_nested_attributes_for :p_product_nutris, allow_destroy: true 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 has_many :p_product_images

View File

@ -10,8 +10,15 @@ class PProductRef < ApplicationRecord
belongs_to :p_product_color belongs_to :p_product_color
#validates :ct_price_ht, :presence => true 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
validate :ean, :is_integer
has_many :p_customer_product_prices, :dependent => :destroy has_many :p_customer_product_prices, :dependent => :destroy
accepts_nested_attributes_for :p_customer_product_prices, allow_destroy: true accepts_nested_attributes_for :p_customer_product_prices, allow_destroy: true
@ -36,11 +43,14 @@ class PProductRef < ApplicationRecord
:description => {:name => "Description"}, :description => {:name => "Description"},
: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"},
:ca_deee => {:name => "DEEE", :as => :currency},
:ca_sorecop => {:name => "Sorecop", :as => :currency},
:sorecop_comment => {:name => "Type de Sorecop"},
:actions => {:name => "Actions", :reorder => false} :actions => {:name => "Actions", :reorder => false}
} }
acts_as_caching :fields => [:sorecop, :deee]
def not_imported? def not_imported?
if !self.p_product or !self.p_product.imported if !self.p_product or !self.p_product.imported
@ -64,7 +74,9 @@ class PProductRef < ApplicationRecord
def ca_name 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 end
def ca_code def ca_code
@ -141,4 +153,26 @@ class PProductRef < ApplicationRecord
"#{self.ref} | #{self.p_product.name} - #{self.ct_sub_name} - #{self.p_product_color.name if self.p_product_color} | #{self.cat_name}" "#{self.ref} | #{self.p_product.name} - #{self.ct_sub_name} - #{self.p_product_color.name if self.p_product_color} | #{self.cat_name}"
end end
def ca_sorecop
if self.cc_sorecop
return self.cc_sorecop
else
"TODO Calcul sorecop"
end
end
def ca_deee
if self.cc_deee
return self.cc_deee
else
"TODO Calcul DEEE"
end
end
def is_integer
if ean.present? && ean.match(/\A[+-]?\d+\z/).nil?
errors.add(:ean, "ne doit être composé que de chiffres")
end
end
end end

View File

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

View File

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

View File

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

10
app/models/p_spec_type.rb Normal file
View File

@ -0,0 +1,10 @@
class PSpecType < ApplicationRecord
has_many :p_product_ref_specs
TYPES = ["Ram", "Stockage"]
acts_as_sorting :fields => {
:id => {:name => "ID"},
:name => {:name => "Type", :reorder => true},
:actions => {:name => "Actions", :reorder => true}
}
end

View File

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

View File

@ -25,8 +25,10 @@ class PriceDocument < ApplicationRecord
has_many :avoir_p_payment_documents, :dependent => :destroy, :foreign_key => :avoir_id, :class_name => "PPaymentDocument" has_many :avoir_p_payment_documents, :dependent => :destroy, :foreign_key => :avoir_id, :class_name => "PPaymentDocument"
accepts_nested_attributes_for :avoir_p_payment_documents, allow_destroy: true accepts_nested_attributes_for :avoir_p_payment_documents, allow_destroy: true
PURCHASES = ["Demande prix", "Commande achat", "Facture d'achat"] PURCHASES = ["Demande prix", "Réponse fournisseur", "Commande achat", "Facture achat", "Consultation fournisseur"]
SALES = ["Bon de commande", "Devis", "Bon de livraison", "Facture", "Avoir"] SALES = ["Bon de commande", "Devis", "Bon de livraison", "Facture", "Avoir"]
# AVANCEMENT = ["0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"]
AVANCEMENT = ["0%", "25%", "50%", "75%", "100"]
validates :public_fournisseur_name, :presence => true, :if => :public_fournisseur_name_needed? validates :public_fournisseur_name, :presence => true, :if => :public_fournisseur_name_needed?
@ -269,6 +271,7 @@ class PriceDocument < ApplicationRecord
:end_date => {:name => "Fin de consultation", :reorder => true}, :end_date => {:name => "Fin de consultation", :reorder => true},
:dp_comment => {:name => "Commentaire", :reorder => true}, :dp_comment => {:name => "Commentaire", :reorder => true},
:acheteur_text => {:name => "Envoyé à", :reorder => true}, :acheteur_text => {:name => "Envoyé à", :reorder => true},
:customer_ref => {:name => "Ref cotation", :reorder => false},
:p_commercial => {:name => "Commercial", :reorder => false}, :p_commercial => {:name => "Commercial", :reorder => false},
@ -291,7 +294,7 @@ class PriceDocument < ApplicationRecord
:cc_cost_ht => {:name => "Coût HT", :reorder => true, :as => :currency}, :cc_cost_ht => {:name => "Coût HT", :reorder => true, :as => :currency},
:cc_marge_ht => {:name => "Marge HT", :reorder => true, :as => :currency}, :cc_marge_ht => {:name => "Marge HT", :reorder => true, :as => :currency},
:cost_ok => {:name => "Marge calculée", :reorder => true, :as => :boolean}, :cost_ok => {:name => "Marge calculée", :reorder => true, :as => :boolean},
:f_token => {:name => "Liens consultation"},

View File

@ -2,6 +2,15 @@ class PriceLine < ApplicationRecord
belongs_to :price_line_block belongs_to :price_line_block
belongs_to :p_product belongs_to :p_product
belongs_to :p_product_ref belongs_to :p_product_ref
belongs_to :p_product_power
has_many :price_line_resp_selects, :foreign_key => :price_line_demand
has_many :price_line_resps, through: :price_line_resp_selects, :source => :price_line_resp
has_one :p_fournisseur, :through => :price_line_block
#has_many :price_line_demands, through: :price_line_resp_selects
default_scope { order('position ASC') } default_scope { order('position ASC') }
validates :p_product_ref_id, :presence => true, :if => :p_product_ref_needed? validates :p_product_ref_id, :presence => true, :if => :p_product_ref_needed?
@ -17,7 +26,10 @@ class PriceLine < ApplicationRecord
:ref => {:name => "Ref", :reorder => true}, :ref => {:name => "Ref", :reorder => true},
:title => {:name => "Désignation", :reorder => true}, :title => {:name => "Désignation", :reorder => true},
:qte => {:name => "Qté", :reorder => true}, :qte => {:name => "Qté", :reorder => true},
:qte_available => {:name => "Qté dispo.", :reorder => true}, :qte_available => {:name => "Qté dispo.", :reorder => true},
:ct_u_price_ht => {:name => "Prix de vente", :reorder => true},
:ref_fournisseur => {:name => "Réf. fournisseur", :reorder => true}, :ref_fournisseur => {:name => "Réf. fournisseur", :reorder => true},
:p_product_power_id => {:name => "Chargeur", :reorder => true}, :p_product_power_id => {:name => "Chargeur", :reorder => true},
:p_product_zone_id => {:name => "Zone", :reorder => true}, :p_product_zone_id => {:name => "Zone", :reorder => true},
@ -26,7 +38,8 @@ class PriceLine < ApplicationRecord
:ram_unit => {:name => "Ram unité", :reorder => true}, :ram_unit => {:name => "Ram unité", :reorder => true},
:eu => {:name => "EU ?", :reorder => true}, :eu => {:name => "EU ?", :reorder => true},
:fullkit => {:name => "Fullkit ?", :reorder => true}, :fullkit => {:name => "Fullkit ?", :reorder => true},
:lang_start => {:name => "Démarrage écran langue ?", :reorder => true} :lang_start => {:name => "Démarrage écran langue ?", :reorder => true},
:actions => {:name => "Actions"}
} }
@ -39,7 +52,9 @@ class PriceLine < ApplicationRecord
BON_DE_LIVRAISON_TO_RESET = %w(block_type weight_tot tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc) BON_DE_LIVRAISON_TO_RESET = %w(block_type weight_tot tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc)
FACTURE_DACHAT_TO_RESET = %w(devise_rate local_tot_amount_ht block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id) FACTURE_ACHAT_TO_RESET = %w(devise_rate local_tot_amount_ht block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
BON_DE_RECEPTION_ACHAT_TO_RESET = %w(devise_rate local_tot_amount_ht block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
COMMANDE_ACHAT_TO_RESET = %w(block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id) COMMANDE_ACHAT_TO_RESET = %w(block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
@ -209,7 +224,7 @@ class PriceLine < ApplicationRecord
def ca_product_no_remise def ca_product_no_remise
if self.p_product_ref and self.p_customer and p_customer_product_price = self.p_product_ref.p_customer_product_prices.where(:p_customer_id => self.p_customer.id).first if false #self.p_product_ref and self.p_customer and p_customer_product_price = self.p_product_ref.p_customer_product_prices.where(:p_customer_id => self.p_customer.id).first
p_customer_product_price.no_remise p_customer_product_price.no_remise
@ -533,38 +548,36 @@ class PriceLine < ApplicationRecord
def ca_tot_amount_ht def ca_tot_amount_ht
if ct_tot_amount_ht if self.ct_tot_amount_ht
self.ct_tot_amount_ht self.ct_tot_amount_ht
else else
(self.ca_price_u_kg_net_ht * self.weight_qte.to_f).round(2) (self.ca_price_u_ht * self.qte.to_f).round(3)
end end
end end
def ca_tot_amount_tva def ca_tot_amount_tva
(self.tot_amount_ht * (self.tva_account_value/100)).round(2) (self.tot_amount_ht * (self.tva_account_value/100)).round(3)
end end
def ca_tot_amount_ttc def ca_tot_amount_ttc
(self.tot_amount_ht + self.tot_amount_tva).round(2) (self.tot_amount_ht + self.tot_amount_tva).round(3)
end end
def ca_tot_discount_ht def ca_tot_discount_ht
(self.ca_price_u_ht * self.qte.to_f).round(2) - self.ca_tot_amount_ht (self.ca_price_u_ht * self.qte.to_f).round(3) - self.ca_tot_amount_ht
end end
def ca_tot_discount_tva def ca_tot_discount_tva
(self.tot_discount_ht * (self.tva_account_value/100)).round(2) (self.tot_discount_ht * (self.tva_account_value/100)).round(3)
end end
def ca_tot_discount_ttc def ca_tot_discount_ttc
(self.tot_discount_ht+self.tot_discount_tva).round(2) (self.tot_discount_ht+self.tot_discount_tva).round(3)
end end
@ -597,7 +610,12 @@ class PriceLine < ApplicationRecord
AVOIR_TO_RESET = %w(block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id) AVOIR_TO_RESET = %w(block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
def self.asap_triage(limit)
total = self.sum(:qte).to_i
asap = self.where('cc_wish_date < ?', Date.today + limit).sum(:qte).to_i
non_asap = total - asap
return [asap, non_asap]
end

View File

@ -23,11 +23,12 @@ class PriceLineBlock < ApplicationRecord
belongs_to :p_payment_type belongs_to :p_payment_type
PURCHASE_BLOCKS = ["Facture d'achat", "Commande achat"] PURCHASE_BLOCKS = ["Réponse fournisseur", "Consultation fournisseur", "Facture d'achat", "Commande achat", "Demande prix", "Bon de commande achat", "Bon de réception achat", "Facture achat", "Avoir achat"]
SALE_BLOCKS = ["Demande de commande", "Bon de commande", "Devis", "Bon de livraison", "Facture", "Avoir"] SALE_BLOCKS = ["Demande de commande", "Bon de commande", "Devis", "Bon de livraison", "Facture", "Avoir"]
belongs_to :p_fournisseur belongs_to :p_fournisseur
accepts_nested_attributes_for :p_fournisseur
def to_no_archive def to_no_archive
if self.imported if self.imported
@ -261,7 +262,9 @@ class PriceLineBlock < ApplicationRecord
end end
def wish_date_needed? def wish_date_needed?
if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type) or self.block_type == "Réponse fournisseur" if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
false
elsif self.block_type == "Devis"
false false
else else
true true
@ -270,7 +273,9 @@ class PriceLineBlock < ApplicationRecord
def particular_bill_needed? def particular_bill_needed?
if !self.imported if !self.imported
if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type) or self.block_type == "Demande prix" or self.block_type == "Réponse fournisseur" if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
false
elsif self.block_type == "Devis"
false false
else else
true true
@ -280,7 +285,9 @@ class PriceLineBlock < ApplicationRecord
def particular_send_needed? def particular_send_needed?
if !self.imported if !self.imported
if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type) or self.block_type == "Demande prix" or self.block_type == "Réponse fournisseur" if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
false
elsif self.block_type == "Devis"
false false
else else
true true
@ -289,7 +296,9 @@ class PriceLineBlock < ApplicationRecord
end end
def p_fournisseur_needed? def p_fournisseur_needed?
if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type) if ["Demande prix", "Consultation fournisseur", "Réponse fournisseur"].include?(self.block_type)
false
elsif PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
true true
else else
false false
@ -297,9 +306,11 @@ class PriceLineBlock < ApplicationRecord
end end
def p_customer_needed? def p_customer_needed?
if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type) or self.block_type == "Demande prix" or self.block_type == "Réponse fournisseur" if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
false false
elsif !self.imported elsif self.block_type == "Devis"
false
else
true true
end end
end end
@ -315,7 +326,9 @@ class PriceLineBlock < ApplicationRecord
BON_DE_LIVRAISON_TO_RESET = %w(weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship) BON_DE_LIVRAISON_TO_RESET = %w(weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
FACTURE_DACHAT_TO_RESET = %w(devise_rate weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship) FACTURE_ACHAT_TO_RESET = %w(devise_rate weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
BON_DE_RECEPTION_ACHAT_TO_RESET = %w(devise_rate weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
COMMANDE_ACHAT_TO_RESET = %w(weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship) COMMANDE_ACHAT_TO_RESET = %w(weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
@ -337,12 +350,12 @@ class PriceLineBlock < ApplicationRecord
eval("self.ac_#{qid} = nil") eval("self.ac_#{qid} = nil")
end end
self.archive_now(:skip_personalised_archive => true) self.archive_now()
self.price_lines.each do |pl| self.price_lines.each do |pl|
pl.archive_now(:skip_personalised_archive => true) pl.archive_now()
end end

View File

@ -0,0 +1,4 @@
class PriceLineRespSelect < ApplicationRecord
belongs_to :price_line_demand, class_name: "PriceLine"
belongs_to :price_line_resp, class_name: "PriceLine"
end

View File

@ -1,3 +1,4 @@
-checkbox = false
.qi_header .qi_header
.right .right
=link_to ic(:plus)+" Demande de commande", admin_p_customers_path(:offre => true), :class => "btn btn-primary btn-ap-add" =link_to ic(:plus)+" Demande de commande", admin_p_customers_path(:offre => true), :class => "btn btn-primary btn-ap-add"
@ -10,16 +11,76 @@
=form_tag "", :method => "get", :onsubmit => "" do =form_tag "", :method => "get", :onsubmit => "" do
-params[:search] =params[:search] || {} -params[:search] =params[:search] || {}
%table %table
%tr %tr.form-inline
%td
Date saisie commande :
Début
%td.input-group
=text_field_tag :cc_creation_date_start, params[:cc_creation_date_start],:class => "form-control datepicker", :placeholder => "Début"
.input-group-append
%span.input-group-text{:onclick => "$(this).prev('input').val('');"}
=ic(:times)
%td.pl-4
Fin
%td.input-group
=text_field_tag :cc_creation_date_stop, params[:cc_creation_date_stop],:class => "form-control datepicker", :placeholder => "Fin"
.input-group-append
%span.input-group-text{:onclick => "$(this).prev('input').val('');"}
=ic(:times)
%td %td
Statut : Statut :
=select_tag "search[state]", options_for_select([["",""]]+PCustomerSheet.group(:state).all.map{|a| [a.state, a.state]}, params[:search][:state]) =select_tag "search[state]", options_for_select([["",""]]+PCustomerSheet.group(:state).all.map{|a| [a.state, a.state]}, params[:search][:state]), class: "custom-select"
%td
Marque :
=select_tag "search[s_brand]", options_for_select([["",""],["Aucune","null"]]+SBrand.pluck(:name, :id), params[:search][:s_brand]), class: "custom-select"
%td
Code client :
=text_field_tag "search[p_customer_code]", params[:search][:p_customer_code],:class => "form-control"
%tr.form-inline
%td{width: "110px"}
%td.right.mx-4
-if @cc_creation_date_start and @cc_creation_date_stop
=link_to "< Mois précédent",request.query_parameters.merge({cc_creation_date_start: ((@cc_creation_date_start - 1.month).beginning_of_month.strftime('%d/%m/%Y')), cc_creation_date_stop: ((@cc_creation_date_stop - 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-tertiary"
%td{width: "20px"}
%td.mr-auto
-if @cc_creation_date_start and @cc_creation_date_stop
=link_to "Mois suivant >",request.query_parameters.merge({cc_creation_date_start: ((@cc_creation_date_start + 1.month).beginning_of_month.strftime('%d/%m/%Y')), cc_creation_date_stop: ((@cc_creation_date_stop + 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-tertiary"
%tr.form-inline
%td
Date ETA :
Début
%td.input-group
=text_field_tag :wish_date_start, params[:wish_date_start],:class => "form-control datepicker", :placeholder => "Début"
.input-group-append
%span.input-group-text{:onclick => "$(this).prev('input').val('');"}
=ic(:times)
%td.pl-4
Fin
%td.input-group
=text_field_tag :wish_date_stop, params[:wish_date_stop],:class => "form-control datepicker", :placeholder => "Fin"
.input-group-append
%span.input-group-text{:onclick => "$(this).prev('input').val('');"}
=ic(:times)
%tr.form-inline
%td{width: "110px"}
%td.right.mx-4
-if @wish_date_start and @wish_date_stop
=link_to "< Mois précédent",request.query_parameters.merge({wish_date_start: ((@wish_date_start - 1.month).beginning_of_month.strftime('%d/%m/%Y')), wish_date_stop: ((@wish_date_stop - 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-tertiary"
%td{width: "20px"}
%td.mr-auto
-if @wish_date_start and @wish_date_stop
=link_to "Mois suivant >",request.query_parameters.merge({wish_date_start: ((@wish_date_start + 1.month).beginning_of_month.strftime('%d/%m/%Y')), wish_date_stop: ((@wish_date_stop + 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-tertiary"
=link_to ic(:search)+" Rechercher", "#", :class => "btn btn-default btn-qi-search", :onclick => "$(this).closest('form').submit();$(this).html('...');return false;"
@ -27,7 +88,7 @@
=#render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_customer_sheets} =#render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_customer_sheets}
-nbr_td = 15 -nbr_td = 10
.qi_pannel.padding.new_table_container .qi_pannel.padding.new_table_container
.table-slider .table-slider
@ -39,32 +100,42 @@
=form_tag new_admin_price_document_path(), :method => "get" do =form_tag new_admin_price_document_path(), :method => "get" do
=hidden_field_tag :"document_type", "Demande prix" =hidden_field_tag :"document_type", "Demande prix"
=hidden_field_tag :"price_line_ids[]", "" =hidden_field_tag :"p_product_ref_ids[]", ""
.freezeTable .freezeTable
%table.table.table-striped.table-hover.table-bordered.data_table %table.table.table-striped.table-hover.table-bordered.data_table
%thead.header %thead.header
%tr %tr
-if checkbox
%th %th
%th.mask.plus-all
=link_to ic("plus-square-o"), '#'
%th %th
Produit Produit
%th %th
Référence Référence
%th Qté / %th Qté
%th.mask.col-detail
%th.mask
N° Commande N° Commande
%th.mask %th.mask.col-detail
Client Client
%th.mask %th.mask.col-detail
Statut Statut
%th.mask Date saisie %th.mask.col-detail Commentaire
%th.mask Date validation %th.mask.col-detail Date saisie
%th.mask.col-detail Date validation
%th.mask Date livraison (ETA) %th.mask Date livraison (ETA)
%th.mask %th.mask
Qté commandée Qté nécessaire
%th.mask Commentaire %th.mask
Qté en stock
%th.mask
Qté souhaité
%span.info
=ic("info-circle")
%span.info-text-bottom BPA - Qté en stock
%th.mask BPA %th.mask BPA
%th.mask AV BPA %th.mask AV BPA
%th.mask PAS BPA %th.mask PAS BPA
@ -81,15 +152,25 @@
%tr.prdct_tr %tr.prdct_tr
-nbr_td.times.each do -nbr_td.times.each do
%td %td
%td.col-detail
%td.col-detail
%td.col-detail
%td.col-detail
%td.col-detail
%td.col-detail
-ppr_lines = @price_lines.where(:p_product_ref_id => plr.p_product_ref.id) -ppr_lines = @price_lines.where(:p_product_ref_id => plr.p_product_ref.id)
%tr.ref_tr %tr.ref_tr
- bpa_qte = ppr_lines.where(:cc_state => "BPA").sum(:qte).to_i
- qte_available = LineStock.where(p_product_ref_id: plr.p_product_ref.id).sum(:qte_available).to_i
-if checkbox
%td %td
%td.plus
=link_to ic("plus-square-o"), "#"
%td %td
=link_to plr.p_product_ref.p_product.name, [:admin, plr.p_product_ref] =link_to plr.p_product_ref.p_product.name, [:admin, plr.p_product_ref]
%td %td
@ -97,77 +178,103 @@
=plr.p_product_ref.ct_sub_name =plr.p_product_ref.ct_sub_name
=plr.p_product_ref.p_product_color.name if plr.p_product_ref.p_product_color =plr.p_product_ref.p_product_color.name if plr.p_product_ref.p_product_color
%td %td.col-detail
=ppr_lines.sum(:qte)
%td.mask.col-detail
/ %td.mask
%td.mask.col-detail
%td.mask.col-detail
%td.mask.col-detail
%td.mask.col-detail
%td.mask %td.mask
%td.mask %td.mask
&#8721
=ppr_lines.sum(:qte).to_i
%br
%span.asap
=ic(:fire)
=ppr_lines.asap_triage(20).first
%br
%span.non-asap
=ic(:hourglass)
=ppr_lines.asap_triage(20).last
%td.mask %td.mask
= qte_available
%td.mask %td.mask
%td.mask - default_qte = [bpa_qte - qte_available, 0].max
%td.mask =check_box_tag :"p_product_ref_ids[]", plr.p_product_ref.id, (true if default_qte > 0 )
%td.mask
%td.mask
=number_field_tag "qte[#{plr.p_product_ref.id}]", '', class: "small-input", value: default_qte, min: 0
%td.mask %td.mask
=ppr_lines.where(:cc_state => "BPA").sum(:qte) = bpa_qte
%td.mask %td.mask
=ppr_lines.where(:cc_state => "AV BPA").sum(:qte) =ppr_lines.where(:cc_state => "AV BPA").sum(:qte).to_i
%td.mask %td.mask
=ppr_lines.where(:cc_state => "PAS BPA").sum(:qte) =ppr_lines.where(:cc_state => "PAS BPA").sum(:qte).to_i
%tbody.detail
-ppr_lines.each do |price_line| -ppr_lines.each do |price_line|
%tr %tr
- if checkbox
%td %td
=check_box_tag :"price_line_ids[]", price_line.id =check_box_tag :"price_line_ids[]", price_line.id
/ %td
%td %td
%td %td
%td %td
%td %td.col-detail
=link_to [:admin, price_line.price_line_block.price_lineable] do =link_to [:admin, price_line.price_line_block.price_lineable] do
=price_line.price_line_block.price_lineable.id =price_line.price_line_block.price_lineable.id
=price_line.price_line_block.price_lineable.past_id =price_line.price_line_block.price_lineable.past_id
%td %td.col-detail
=link_to price_line.p_customer.show_name, [:admin, price_line.p_customer] =link_to price_line.p_customer.show_name, [:admin, price_line.p_customer]
%td %td
=state_helper price_line.price_line_block.price_lineable.state =state_helper price_line.price_line_block.price_lineable.state
%td
=price_line.comment
%td %td
= l price_line.cc_creation_date, :format => :short_date = l price_line.cc_creation_date, :format => :short_date
%td %td
= l price_line.cc_validation_date, :format => :short_date if price_line.cc_validation_date = l price_line.cc_validation_date, :format => :short_date if price_line.cc_validation_date
%td %td
= l price_line.cc_wish_date, :format => "semaine %V (%Y)" = l price_line.cc_wish_date, :format => "semaine %V (%Y)"
%td %td
=price_line.qte =price_line.qte.to_i
%td
%td %td
=price_line.comment
%td %td
=price_line.qte if price_line.cc_state == "BPA" =price_line.qte.to_i if price_line.cc_state == "BPA"
%td %td
=price_line.qte if price_line.cc_state == "AV BPA" =price_line.qte.to_i if price_line.cc_state == "AV BPA"
%td %td
=price_line.qte if price_line.cc_state == "PAS BPA" =price_line.qte.to_i if price_line.cc_state == "PAS BPA"
-p_product_id = plr.p_product_id -p_product_id = plr.p_product_id
%tr %tr
-nbr_td.times.each do -nbr_td.times.each do
%td %td
%td.col-detail
%td.col-detail
%td.col-detail
%td.col-detail
%td.col-detail
%td.col-detail
=submit_tag "Créer une demande de prix", :class => "btn btn-primary" =submit_tag "Créer une demande de prix", :class => "btn btn-primary"
@ -188,8 +295,75 @@
} }
} }
.asap {
color: red;
}
.non-asap {
color: darkblue;
}
.small-input {
max-width: 100px;
}
:javascript
// TOOGLE ORDERS DETAILS - set to hidden
$('.detail').hide()
$('.col-detail').hide()
let state = 0
// TOGGLE ORDER LINE DETAILS
$('.plus').click(function(event){
if( event.currentTarget.className == "plus") {
$(event.currentTarget).removeClass('plus').addClass('minus')
state += 1
$('.col-detail').show()
$(event.currentTarget).parent().parent().next('tbody.detail').toggle();
}else{
$(event.currentTarget).removeClass('minus').addClass('plus')
state -= 1
$(event.currentTarget).parent().parent().next('tbody.detail').toggle();
}
$(event.currentTarget).find('i').toggleClass('fa fa-plus-square-o').toggleClass('fa fa-minus-square-o')
if(state == 0){
$('.col-detail').hide()
}else{
$('.col-detail').show()
}
});
// TOOGLE ALL ORDERS DETAILS
$('.plus-all').click(function(event){
if( event.currentTarget.className == "mask plus-all") {
state += $('.plus').length
$(event.currentTarget).removeClass('plus-all').addClass('minus-all')
$('tbody.detail').show();
$('.plus').find('i').toggleClass('fa fa-plus-square-o').toggleClass('fa fa-minus-square-o')
$('.plus').removeClass('plus').addClass('minus')
$(event.currentTarget).find('i').removeClass('fa fa-plus-square-o').addClass('fa fa-minus-square-o')
}else{
state -= $('.minus').length
$(event.currentTarget).removeClass('minus-all').addClass('plus-all')
$('.minus').find('i').removeClass('fa fa-minus-square-o').addClass('fa fa-plus-square-o')
$('.minus').removeClass('minus').addClass('plus')
$('tbody.detail').hide();
$(event.currentTarget).find('i').removeClass('fa fa-minus-square-o').addClass('fa fa-plus-square-o')
}
if(state == 0){
$('.col-detail').hide()
}else{
$('.col-detail').show()
}
});
// CHECK QTE IF QTE CHANGE
$('.small-input').change(function(){
let checkbox = $(this).closest('td').find("input[type=checkbox]")
if (this.value > 0) {
checkbox.prop("checked", true)
} else {
checkbox.prop("checked", false)
}
})

View File

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

View File

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

View File

@ -0,0 +1,2 @@
$('#p_article_serial_nums_rows').prepend("<%= escape_javascript(render(@p_article_serial_num))%>");
close_pane_hover();

View File

@ -0,0 +1 @@
$('#p_article_serial_num_row_<%= @p_article_serial_num.id %>').remove();

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);

View File

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

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);

View File

@ -0,0 +1,10 @@
.qi_header
%h1
%span
.qi_row
.qi_pannel.qi_plain.padding
=debug @p_article_serial_num

View File

@ -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();

View File

@ -0,0 +1,20 @@
=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)
-if PGrade::ACTIVATED
= 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"

View File

@ -0,0 +1,44 @@
%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
-if p_article.p_grade
= 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}

View File

@ -0,0 +1,2 @@
$('#p_articles_rows').prepend("<%= escape_javascript(render(@p_article))%>");
close_pane_hover();

View File

@ -0,0 +1 @@
$('#p_article_row_<%= @p_article.id %>').remove();

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);

View File

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

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);

View File

@ -0,0 +1,10 @@
.qi_header
%h1
%span
.qi_row
.qi_pannel.qi_plain.padding
=debug @p_article

View File

@ -0,0 +1,2 @@
$('#p_article_row_<%= @p_article.id %>').replaceWith("<%= escape_javascript(render(@p_article))%>");
close_pane_hover();

View File

@ -1,23 +1,27 @@
=semantic_form_for [:admin, @p_customer_sheet], :html => {:class => "qi_price_form"}, :remote => false do |form| =semantic_form_for [:admin, @p_customer_sheet], :html => {:class => "qi_price_form"}, :remote => false do |form|
=form.semantic_fields_for :price_line_block do |f|
=render :partial => "admin/price_line_blocks/form", :locals => {:f => f}
.content .content
.qi_row .qi_row
.qi_pannel.qi_plain.padding .qi_pannel.qi_plain.padding.row
.col-2
-if @p_customer_sheet and @p_customer_sheet.state != "commande" -if @p_customer_sheet and @p_customer_sheet.state != "commande"
=#form.input :demande_type, :collection => ["Brouillon", "Demande de bon de commande","Demande de devis"], :as => :select, :include_blank => false, :label => "Type de demande :" =#form.input :demande_type, :collection => ["Brouillon", "Demande de bon de commande","Demande de devis"], :as => :select, :include_blank => false, :label => "Type de demande :"
=form.input :state, :collection => ["AV BPA", "PAS BPA","BPA", "Traitée"], :as => :select, :include_blank => false, :label => "Statut :" =form.input :state, :collection => ["AV BPA", "PAS BPA","BPA", "Traitée"], :as => :select, :include_blank => false, :label => "Statut :"
=form.input :past_id, :label => "N° système actuel" =form.input :past_id, :label => "N° système actuel"
=yield :discount
.price_line_block_form .col-2
=form.semantic_fields_for :price_line_block do |f| =yield :shipping_date
=render :partial => "admin/price_line_blocks/form", :locals => {:f => f} .col-8
=yield :particular
=yield :price_lines
.large_actions
.right.actions .actions
=link_to "Annuler", admin_p_customer_sheets_path(), :class => "btn" =link_to "Annuler", admin_p_customer_sheets_path(), :class => "btn"
=form.submit "sauvegarder", :class => "btn btn-primary btn-ap-add" =form.submit "sauvegarder", :class => "btn btn-primary btn-ap-add"
.clear .clear

View File

@ -44,7 +44,9 @@
%td.numeraire %td.numeraire
=number_to_currency p_customer_sheet.cc_tot_amount_ttc =number_to_currency p_customer_sheet.cc_tot_amount_ttc
-tr[:check_box] = capture do
%td
=check_box_tag "p_customer_sheet_ids[]", p_customer_sheet.id, false, data: { client: p_customer_sheet.p_customer.id }, id: "p_customer_sheet_id_checkbox_#{p_customer_sheet.id}"
-tr[:actions] = capture do -tr[:actions] = capture do
%td.actions %td.actions

View File

@ -1,7 +1,6 @@
.qi_header .qi_header
.right .right
=link_to ic(:plus)+" Demande de commande", admin_p_customers_path(:offre => true), :class => "btn btn-primary btn-ap-add" =link_to ic(:plus)+" Demande de commande", admin_p_customers_path(:offre => true), :class => "btn btn-primary btn-ap-add"
%h1 %h1
Ventes Ventes
%span %span
@ -179,5 +178,77 @@
="-" ="-"
=link_to ic(:times)+" Supprimer ce filtre", params.permit!.merge({ :active_kpi => nil, :p_customer_sheet_ids => nil}) =link_to ic(:times)+" Supprimer ce filtre", params.permit!.merge({ :active_kpi => nil, :p_customer_sheet_ids => nil})
%div
=form_tag export_xls_admin_p_customer_sheets_path(format: :csv), id: 'export-form', :method => "get" do
.table
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_customer_sheets}
%button.btn.btn-primary.ml-4{onclick: "checkMultipleClient()"}
=ic("file-excel-o")
Export xls
.modal.fade#multi-client-export{"tab-index" => "-1", "role" => "dialog", "aria-labelledby" => "Raprochement Fournisseur", "aria-hidden" => "true"}
.modal-dialog{role: "dialog"}
.modal-content
.modal-header
%h5.modal-title
Export Excel
%button.close{"data-dismiss" => "modal", "aria-label" => "Close"}
%span{"aria-hidden" => "true"}
&times;
.modal-body
Attention !
%br
%br
Selection de plusieurs clients détéctée
%br
Vous avez selectionné des commandes liées à différents clients.
%br
Etes-vous sûr ?
.modal-footer
%button.btn.btn-light{"data-dismiss" => "modal"}
Annuler l'export
%button.btn.btn-primary{"data-dismiss" => "modal", onclick: "submitExport()"}
=ic("file-excel-o")
Confirmer
:javascript
$("#check-all").parent().on("click", function(event) {
console.log(event.currentTarget)
event.currentTarget.classList.toggle("checked")
if(event.currentTarget.classList.contains("checked")){
$('.table input[type=checkbox]').prop("checked", true)
}else{
$('.table input[type=checkbox]').prop("checked", false)
}
})
"#dataTable tbody tr"
function submitExport() {
$('#export-form').submit()
}
function checkDiff(arr) {
return arr.every(e => e == arr[0]);
}
const checkMultipleClient = () => {
let arr = []
$('.table input[type=checkbox]').each(function( i ) {
if ( this.checked === true)
arr.push($(this).data('client'))
})
if (checkDiff(arr) === false) {
$('#multi-client-export').modal('show')
} else {
submitExport()
}
}
:scss
th > i {
cursor: pointer;
}
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_customer_sheets}

View File

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

View File

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

View File

@ -0,0 +1,2 @@
$('#p_grades_rows').prepend("<%= escape_javascript(render(@p_grade))%>");
close_pane_hover();

View File

@ -0,0 +1 @@
$('#p_grade_row_<%= @p_grade.id %>').remove();

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);

View File

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

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);

View File

@ -0,0 +1,10 @@
.qi_header
%h1
%span
.qi_row
.qi_pannel.qi_plain.padding
=debug @p_grade

View File

@ -0,0 +1,2 @@
$('#p_grade_row_<%= @p_grade.id %>').replaceWith("<%= escape_javascript(render(@p_grade))%>");
close_pane_hover();

View File

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

View File

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

View File

@ -0,0 +1,2 @@
$('#p_product_ref_specs_rows').prepend("<%= escape_javascript(render(@p_product_ref_spec))%>");
close_pane_hover();

View File

@ -0,0 +1 @@
$('#p_product_ref_spec_row_<%= @p_product_ref_spec.id %>').remove();

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);

View File

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

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);

View File

@ -0,0 +1,10 @@
.qi_header
%h1
%span
.qi_row
.qi_pannel.qi_plain.padding
=debug @p_product_ref_spec

View File

@ -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();

View File

@ -1,12 +1,11 @@
=#debug form.object.errors.messages
=# form.input :ref, :label => "Ref :" =# form.input :ref, :label => "Ref :"
.qi_row.field .qi_row.field
.qi_pannel.qi_plain.padding .qi_pannel.qi_plain.padding
%table.form-table %table.form-table
%tr %tr
%td
=# form.input :enabled, :label => "Actif ?" =# 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 :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 %td
@ -21,8 +20,25 @@
%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 :ct_sorecop, :label => "Sorecop personalisée :"
%td
=form.input :sorecop_comment, :label => "Type de Sorecop :"
%td
=form.input :ct_deee, :label => "DEEE personalisée :"
%td
=form.input :ean
%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
=# form.input :s_brand_id, :label => "Marque :", :collection => SBrand.all, :as => :select, :include_blank => true
%tr %tr

View File

@ -31,6 +31,12 @@
%td.actions %td.actions
=# link_to i(:"trash-o"), [:admin, p_product_ref], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer ce produit ? ' } , :remote => true if !PriceLine.where(:p_product_ref_id => p_product_ref).first =# link_to i(:"trash-o"), [:admin, p_product_ref], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer ce produit ? ' } , :remote => true if !PriceLine.where(:p_product_ref_id => p_product_ref).first
=#debug PriceLine.where(:p_product_ref_id => p_product_ref.id).first =#debug PriceLine.where(:p_product_ref_id => p_product_ref.id).first
-if @manager
= link_to i(:eye), admin_p_product_ref_path(p_product_ref), :remote => false, :target => "_blank"
= link_to i(:"check"), "#",:onclick => "send_manager_product('"+p_product_ref.id.to_s+"', '"+escape_javascript(p_product_ref.member_label.to_s)+"');return false;"
-else
= link_to i(:pencil), edit_admin_p_product_path(p_product_ref.p_product), :remote => false = link_to i(:pencil), edit_admin_p_product_path(p_product_ref.p_product), :remote => false
= link_to i(:eye), admin_p_product_ref_path(p_product_ref), :remote => false = link_to i(:eye), admin_p_product_ref_path(p_product_ref), :remote => false

View File

@ -1,17 +1,19 @@
.qi_header -if !@manager
.qi_header
.right= link_to ic(:plus)+' Ajouter un produit', new_admin_p_product_path(), :class => "btn btn-primary btn-ap-add", :remote => false .right= link_to ic(:plus)+' Ajouter un produit', new_admin_p_product_path(), :class => "btn btn-primary btn-ap-add", :remote => false
%h1 %h1
Achats Achats
%span %span
Produits Références
.qi_search_row .qi_search_row
=form_tag "", :method => "get", :onsubmit => "" do =form_tag admin_p_product_refs_path, :method => "get", :onsubmit => "", :remote => true do
=hidden_field_tag :column, params[:column] =hidden_field_tag :column, params[:column]
=hidden_field_tag :direction, params[:direction] =hidden_field_tag :direction, params[:direction]
=hidden_field_tag :manager, params[:manager]
%table %table
%tr %tr
%td %td
@ -42,7 +44,7 @@
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_product_refs} #p_product_refs_index_wrapper=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_product_refs, :remote => true}
@ -53,3 +55,6 @@
}); });
:coffeescript
$(".qi_search_row form").on "submit", ->
$("#p_product_refs_index_wrapper").html('recherche en cours ...')

View File

@ -0,0 +1,9 @@
var p_product_refs_url = "<%= escape_javascript(request.url) %>";
$('#p_product_refs_index_wrapper').html("<%= escape_javascript(render(:partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_product_refs, :remote => true}))%>");
$(".btn-qi-search").html('<i class="fa fa-search "></i> Rechercher');

View File

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

View File

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

View File

@ -0,0 +1,2 @@
$('#p_serial_num_types_rows').prepend("<%= escape_javascript(render(@p_serial_num_type))%>");
close_pane_hover();

View File

@ -0,0 +1 @@
$('#p_serial_num_type_row_<%= @p_serial_num_type.id %>').remove();

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);

View File

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

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);

View File

@ -0,0 +1,10 @@
.qi_header
%h1
%span
.qi_row
.qi_pannel.qi_plain.padding
=debug @p_serial_num_type

View File

@ -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();

View File

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

View File

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

View File

@ -0,0 +1,2 @@
$('#p_serial_num_values_rows').prepend("<%= escape_javascript(render(@p_serial_num_value))%>");
close_pane_hover();

Some files were not shown because too many files have changed in this diff Show More