Compare commits
52 Commits
update-css
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
2a6fc4cce6 | ||
|
91b5537924 | ||
d2d186724c | |||
|
8a252602af | ||
|
8e8abdcf76 | ||
|
128dc118c4 | ||
|
9c36df619b | ||
|
e444d3f0c4 | ||
|
3c0b028157 | ||
|
1a63ef9f44 | ||
|
318bffc203 | ||
|
0438ecf52e | ||
|
6649167bee | ||
|
52acb2094f | ||
|
4a3c92af46 | ||
|
abed8c9111 | ||
|
26ab4bbf93 | ||
|
9dbbb093a1 | ||
|
8c5c5ca0cc | ||
|
43ede8de94 | ||
|
0848b6ef2e | ||
|
e5b04f41cf | ||
|
02c7748571 | ||
|
fa8ed3576c | ||
|
e2e2f6cab3 | ||
|
4ffcbc1159 | ||
|
b77c13cf36 | ||
|
7c71bcda55 | ||
|
3fde739862 | ||
|
c9b2379531 | ||
|
a9d5755886 | ||
|
9f8ecec536 | ||
|
a3568f1262 | ||
|
345fd6d572 | ||
|
78d0355224 | ||
|
7ff2f312f7 | ||
|
a4170d531d | ||
|
fb5eac464a | ||
|
ee42f7c0f6 | ||
|
71350f9b8c | ||
|
f4ccdc82dc | ||
|
e6260010a4 | ||
|
dbcab11c01 | ||
|
3fecbf7e7f | ||
|
0c53f506e7 | ||
|
647e71e8d6 | ||
|
fe24493d07 | ||
|
5a3eb40c61 | ||
|
9fa5bd6646 | ||
|
91722c7262 | ||
|
7a1ea4f4c1 | ||
|
56fc2b17d3 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -42,5 +42,6 @@ yarn-debug.log*
|
||||
/pdf/*
|
||||
|
||||
/.sass_cache/*
|
||||
/.sass-cache/*
|
||||
/test*
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -224,7 +224,9 @@ GEM
|
||||
mime-types (3.3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2019.1009)
|
||||
mimemagic (0.3.5)
|
||||
mimemagic (0.3.10)
|
||||
nokogiri (~> 1)
|
||||
rake
|
||||
mini_magick (4.10.1)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
@ -286,6 +288,9 @@ GEM
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
rmagick (4.0.0)
|
||||
roo (2.8.2)
|
||||
nokogiri (~> 1)
|
||||
rubyzip (>= 1.2.1, < 2.0.0)
|
||||
ruby-vips (2.0.17)
|
||||
ffi (~> 1.9)
|
||||
ruby_dep (1.5.0)
|
||||
@ -409,6 +414,7 @@ DEPENDENCIES
|
||||
rails (= 6.0.3)
|
||||
rails_autolink
|
||||
rmagick
|
||||
roo
|
||||
sass-rails (~> 5)
|
||||
searchkick
|
||||
selenium-webdriver
|
||||
|
@ -120,12 +120,6 @@ $(document).ready ->
|
||||
|
||||
|
||||
@resize = () ->
|
||||
petition_margin = (($(".petition_3 .bandeau").height()-$(".petition_3 .petition").height())/ 2 - 30)
|
||||
|
||||
if petition_margin < 0
|
||||
petition_margin = 0
|
||||
|
||||
$(".petition_3 .petition").css('margin-top': petition_margin+'px')
|
||||
|
||||
|
||||
top = $("#menu_top_container").outerHeight()
|
||||
|
@ -34,6 +34,8 @@
|
||||
.numbers{
|
||||
background-color: #cc4b14;
|
||||
padding: 30px 0px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.center_programme {
|
||||
@ -273,5 +275,16 @@
|
||||
}
|
||||
.numbers {
|
||||
padding: 30px 20px;
|
||||
|
||||
text-align:center;
|
||||
|
||||
.chiffre{
|
||||
font-size:25px ;
|
||||
}
|
||||
.label-chiffre{
|
||||
font-size:20px ;
|
||||
padding-left:3px !important;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8450,8 +8450,8 @@ img{
|
||||
}
|
||||
|
||||
.right_intro{
|
||||
text-align:left;
|
||||
padding:5px 30px;
|
||||
|
||||
padding:0;
|
||||
|
||||
}
|
||||
|
||||
@ -8567,6 +8567,124 @@ img{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.inline_check_boxes{
|
||||
span{
|
||||
display:block;
|
||||
}
|
||||
|
||||
strong{
|
||||
display:block;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
}
|
||||
|
||||
.row_home, .right_intro{
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.row1{
|
||||
.block_intro:last-child{
|
||||
padding-bottom:0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.row2{
|
||||
.block_intro:first-child{
|
||||
padding-top:0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.circuit{
|
||||
|
||||
h3{
|
||||
text-align:center;
|
||||
display:block;
|
||||
}
|
||||
.absolute_logo{
|
||||
float: none;
|
||||
text-align:center;
|
||||
margin: 10px auto;
|
||||
display: block;
|
||||
position: static;
|
||||
height: 100px;
|
||||
margin-top: 20px;
|
||||
|
||||
padding:0;
|
||||
|
||||
img{
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.block_info{
|
||||
display:block;
|
||||
text-align:center;
|
||||
padding-bottom:5px;
|
||||
margin-right:0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.circuit_show{
|
||||
.localisation{
|
||||
display:block;
|
||||
text-align:center;
|
||||
span{
|
||||
display:block;
|
||||
}
|
||||
}
|
||||
|
||||
.circuit_img{
|
||||
width:auto;
|
||||
float:none;
|
||||
margin-bottom:20px;
|
||||
}
|
||||
|
||||
.info_lien{
|
||||
margin-bottom:0;
|
||||
}
|
||||
|
||||
.block_info{
|
||||
display:block;
|
||||
text-align:center;
|
||||
padding-bottom:5px;
|
||||
margin-right:0;
|
||||
}
|
||||
|
||||
|
||||
.right{
|
||||
float:none;
|
||||
text-align:center;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.primes{
|
||||
.render_block{
|
||||
padding:0 15px;
|
||||
.new_btn{
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
img{
|
||||
width:auto !important;
|
||||
margin:0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.m_event{
|
||||
.right_roulage{
|
||||
text-align:center;
|
||||
float:none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.country_icon{
|
||||
|
76
app/controllers/admin/circuit_region_cats_controller.rb
Normal file
76
app/controllers/admin/circuit_region_cats_controller.rb
Normal file
@ -0,0 +1,76 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::CircuitRegionCatsController < ApplicationController
|
||||
layout "admin"
|
||||
before_action :auth_admin
|
||||
|
||||
before_action :admin_space
|
||||
|
||||
def admin_space
|
||||
@admin_space = "default"
|
||||
end
|
||||
|
||||
def index
|
||||
@circuit_region_cats = CircuitRegionCat.all
|
||||
|
||||
@circuit_region_cats = sort_by_sorting(@circuit_region_cats, "id DESC")
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
|
||||
params[:search][:per_page] = params[:search][:per_page] || 100
|
||||
per_page = params[:search][:per_page]
|
||||
page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
@circuit_region_cats = @circuit_region_cats.page(page).per(per_page)
|
||||
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@circuit_region_cat = CircuitRegionCat.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@circuit_region_cat = CircuitRegionCat.new
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@circuit_region_cat = CircuitRegionCat.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
@circuit_region_cat = CircuitRegionCat.new(params.require(:circuit_region_cat).permit!)
|
||||
|
||||
if @circuit_region_cat.save
|
||||
|
||||
else
|
||||
render action: "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@circuit_region_cat = CircuitRegionCat.find(params[:id])
|
||||
|
||||
|
||||
if @circuit_region_cat.update_attributes(params.require(:circuit_region_cat).permit!)
|
||||
|
||||
else
|
||||
render action: "edit"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@circuit_region_cat = CircuitRegionCat.find(params[:id])
|
||||
@circuit_region_cat.destroy
|
||||
|
||||
end
|
||||
end
|
@ -12,7 +12,7 @@ class Admin::CircuitsController < ApplicationController
|
||||
|
||||
def index
|
||||
@circuits = Circuit.all
|
||||
@circuits = sort_by_sorting(@circuits, "name DESC")
|
||||
@circuits = sort_by_sorting(@circuits, "name ASC")
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
|
||||
|
@ -79,8 +79,12 @@ class Admin::MEventsController < ApplicationController
|
||||
end
|
||||
|
||||
def new
|
||||
@m_event = MEvent.new(:m_event_type_title => "Roulage libre")
|
||||
|
||||
if params[:parent_id]
|
||||
@m_event = MEvent.find(params[:parent_id]).dup
|
||||
else
|
||||
@m_event = MEvent.new(:m_event_type_title => "Roulage libre")
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@ -120,4 +124,14 @@ class Admin::MEventsController < ApplicationController
|
||||
@m_event.destroy
|
||||
|
||||
end
|
||||
|
||||
def autocomplete
|
||||
|
||||
@m_events = MEvent.order("start_at").where("start_at <= ? and end_at >= ?", Date.parse(params[:date]), Date.parse(params[:date]))
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render json: @m_events.map{|me| {:id => me.id, :member_label => me.member_label}} }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -11,7 +11,13 @@ class Admin::MOdrFilesController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
@m_odr_files = MOdrFile.all
|
||||
@m_odr_files = MOdrFile.joins(:p_customer).all
|
||||
|
||||
|
||||
if params[:search][:name].to_s != ""
|
||||
|
||||
@m_odr_files = @m_odr_files.joins(:particular).where("particulars.organisation LIKE ? or particulars.name LIKE ? or particulars.firstname LIKE ?", "%#{params[:search][:name]}%", "%#{params[:search][:name]}%", "%#{params[:search][:name]}%")
|
||||
end
|
||||
|
||||
@m_odr_files = sort_by_sorting(@m_odr_files, "id DESC")
|
||||
respond_to do |format|
|
||||
@ -34,12 +40,20 @@ class Admin::MOdrFilesController < ApplicationController
|
||||
|
||||
def new
|
||||
@m_odr_file = MOdrFile.new(:m_odr_file_type_id => params[:m_odr_file_type_id], :p_customer_id => params[:p_customer_id])
|
||||
if params[:m_odr_file_type_id] == "1"
|
||||
@m_odr_file.m_odr_file_roulages.build
|
||||
else
|
||||
@m_odr_file.m_odr_file_products.build(:admin_form => true)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@m_odr_file = MOdrFile.find(params[:id])
|
||||
|
||||
@m_odr_file.m_odr_file_products.each do |mofp|
|
||||
mofp.admin_form = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -74,4 +74,20 @@ class Admin::MOdrPlacesController < ApplicationController
|
||||
@m_odr_place.destroy
|
||||
|
||||
end
|
||||
|
||||
def autocomplete
|
||||
|
||||
search = params[:search]
|
||||
@m_odr_places = MOdrPlace.where("name LIKE ? or city LIKE ? or cp LIKE ? or enseigne LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%")
|
||||
|
||||
@m_odr_places = @m_odr_places.distinct.limit(50)
|
||||
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render json: @m_odr_places.map{|a| {:id => a.id, :member_label => a.member_label}} }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -11,7 +11,17 @@ class Admin::MOdrPrimesController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
@m_odr_primes = MOdrPrime.all
|
||||
@m_odr_primes = MOdrPrime.joins(:p_customer).joins(:m_odr_file_roulage).all
|
||||
|
||||
if params[:search][:state].to_s != ""
|
||||
@m_odr_primes = @m_odr_primes.where(:state => params[:search][:state])
|
||||
end
|
||||
|
||||
if params[:search][:name].to_s != ""
|
||||
|
||||
@m_odr_primes = @m_odr_primes.joins(:particular).where("particulars.organisation LIKE ? or particulars.name LIKE ? or particulars.firstname LIKE ?", "%#{params[:search][:name]}%", "%#{params[:search][:name]}%", "%#{params[:search][:name]}%")
|
||||
end
|
||||
|
||||
|
||||
@m_odr_primes = sort_by_sorting(@m_odr_primes, "id DESC")
|
||||
respond_to do |format|
|
||||
@ -23,6 +33,71 @@ class Admin::MOdrPrimesController < ApplicationController
|
||||
@m_odr_primes = @m_odr_primes.page(page).per(per_page)
|
||||
|
||||
}
|
||||
|
||||
|
||||
format.csv {
|
||||
@headers = []
|
||||
@columns = []
|
||||
MOdrPrime.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: "import") do |sheet|
|
||||
sheet.add_row @headers
|
||||
|
||||
@m_odr_primes.each do |m_odr_prime|
|
||||
line = []
|
||||
|
||||
@columns.each do |column|
|
||||
|
||||
if (m_odr_prime.respond_to?("csv_"+column.to_s))
|
||||
line << m_odr_prime.send("csv_"+column.to_s)
|
||||
elsif (m_odr_prime.respond_to?(column))
|
||||
if m_odr_prime.send(column.to_s).class.to_s == "BigDecimal"
|
||||
line << m_odr_prime.send(column.to_s).to_s.gsub('.', ',')
|
||||
else
|
||||
line << m_odr_prime.send(column.to_s)
|
||||
end
|
||||
else
|
||||
line << column.to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
sheet.add_row line, types: line.map{|t| self.cell_type_from_value(t)}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@final_file = "#{Rails.root}/private_medias/export-primes-#{Time.now.to_s.to_slug}.xlsx"
|
||||
|
||||
|
||||
xlsx_package.serialize(@final_file)
|
||||
|
||||
|
||||
send_file @final_file
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@ -100,5 +175,13 @@ class Admin::MOdrPrimesController < ApplicationController
|
||||
redirect_back(fallback_location:"/")
|
||||
end
|
||||
|
||||
def attente_roulage
|
||||
@m_odr_prime = MOdrPrime.find(params[:id])
|
||||
@m_odr_prime.change_state("En attente de roulage")
|
||||
|
||||
redirect_back(fallback_location:"/")
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
@ -52,6 +52,8 @@ class Admin::MOdrRemisesController < ApplicationController
|
||||
m_odr_virement.m_odr_prime.change_state("Virement envoyé") if m_odr_virement.m_odr_prime
|
||||
m_odr_virement.save
|
||||
|
||||
m_odr_virement.m_odr_prime.save
|
||||
|
||||
#m_odr_virement.m_odr_prime.send_mail_type("succes", m_odr_virement)
|
||||
|
||||
end
|
||||
|
@ -13,7 +13,7 @@ class Admin::MOdrRepRibsController < ApplicationController
|
||||
def index
|
||||
@m_odr_rep_ribs = MOdrRepRib.all
|
||||
|
||||
@m_odr_rep_ribs = sort_by_sorting(@m_odr_rep_ribs, "id DESC")
|
||||
@m_odr_rep_ribs = sort_by_sorting(@m_odr_rep_ribs, "admin_ok ASC")
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
|
||||
@ -72,11 +72,20 @@ class Admin::MOdrRepRibsController < ApplicationController
|
||||
|
||||
def send_mail
|
||||
@m_odr_rep_rib = MOdrRepRib.find(params[:id])
|
||||
@m_odr_rep = @m_odr_rep_rib.m_odr_rep
|
||||
|
||||
@m_odr_rep.send_mail_type("erreur-coordonnees-bancaire", @m_odr_rep_rib)
|
||||
@m_odr_rep_rib.mail_sended = true
|
||||
@m_odr_rep_rib.save
|
||||
|
||||
redirect_to [:admin, @m_odr_rep]
|
||||
@p_customer = @m_odr_rep_rib.p_customer
|
||||
|
||||
|
||||
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, params[:slug].to_s, @p_customer.email, {:arguments => {}, :p_customer => @p_customer, :element => @m_odr_rep_rib})
|
||||
|
||||
|
||||
|
||||
#redirect_to [:admin, @m_odr_rep]
|
||||
|
||||
|
||||
end
|
||||
|
@ -18,6 +18,11 @@ class Admin::MOdrVirementsController < ApplicationController
|
||||
@m_odr_virements = @m_odr_virements.where(:m_odr_id => params[:search][:m_odr_id])
|
||||
end
|
||||
|
||||
if params[:search][:name].to_s != ""
|
||||
|
||||
@m_odr_virements = @m_odr_virements.joins(:p_customer).where("p_customers.cc_particular_name LIKE ? or p_customers.cc_particular_firstname LIKE ? ", "%#{params[:search][:name]}%", "%#{params[:search][:name]}%")
|
||||
end
|
||||
|
||||
|
||||
@m_odr_virements = sort_by_sorting(@m_odr_virements, "created_at DESC")
|
||||
|
||||
|
@ -13,7 +13,7 @@ class Admin::OrganisateursController < ApplicationController
|
||||
def index
|
||||
@organisateurs = Organisateur.all
|
||||
|
||||
@organisateurs = sort_by_sorting(@organisateurs, "name DESC")
|
||||
@organisateurs = sort_by_sorting(@organisateurs, "name ASC")
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
|
||||
@ -23,6 +23,71 @@ class Admin::OrganisateursController < ApplicationController
|
||||
@organisateurs = @organisateurs.page(page).per(per_page)
|
||||
|
||||
}
|
||||
|
||||
|
||||
format.csv {
|
||||
@headers = []
|
||||
@columns = []
|
||||
Organisateur.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: "import") do |sheet|
|
||||
sheet.add_row @headers
|
||||
|
||||
@organisateurs.each do |p_customer|
|
||||
line = []
|
||||
|
||||
@columns.each do |column|
|
||||
|
||||
if (p_customer.respond_to?("csv_"+column.to_s))
|
||||
line << p_customer.send("csv_"+column.to_s)
|
||||
elsif (p_customer.respond_to?(column))
|
||||
if p_customer.send(column.to_s).class.to_s == "BigDecimal"
|
||||
line << p_customer.send(column.to_s).to_s.gsub('.', ',')
|
||||
else
|
||||
line << p_customer.send(column.to_s)
|
||||
end
|
||||
else
|
||||
line << column.to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
sheet.add_row line, types: line.map{|t| self.cell_type_from_value(t)}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@final_file = "#{Rails.root}/private_medias/export-organisateurs-#{Time.now.to_s.to_slug}.xlsx"
|
||||
|
||||
|
||||
xlsx_package.serialize(@final_file)
|
||||
|
||||
|
||||
send_file @final_file
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -7,11 +7,46 @@ class Admin::PCustomersController < ApplicationController
|
||||
before_action :admin_space
|
||||
|
||||
|
||||
def update_tel
|
||||
PCustomer.find_each do |pc|
|
||||
if !pc.tel?
|
||||
if pc.imp_tel?
|
||||
pc.tel = pc.imp_tel
|
||||
pc.save
|
||||
elsif pc.imp_portable
|
||||
pc.tel = pc.imp_portable
|
||||
pc.save
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_mail
|
||||
@p_customer = PCustomer.find(params[:id])
|
||||
|
||||
if params[:slug] == "stickers-manque-adresse"
|
||||
@p_customer.particular_mail_sended = true
|
||||
|
||||
@p_customer.save
|
||||
|
||||
end
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, params[:slug].to_s, @p_customer.email, {:arguments => {}, :p_customer => @p_customer, :element => @p_customer})
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
def archive_import
|
||||
@p_customer = PCustomer.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
def import3
|
||||
if false #params[:force]
|
||||
require "csv"
|
||||
@ -198,6 +233,36 @@ class Admin::PCustomersController < ApplicationController
|
||||
|
||||
|
||||
|
||||
#params[:search][:enabled] = "Oui" if !params[:search][:enabled]
|
||||
|
||||
if params[:search][:enabled].to_s == "Oui"
|
||||
@p_customers = @p_customers.where(:enabled => true)
|
||||
elsif params[:search][:enabled].to_s == "Non"
|
||||
@p_customers = @p_customers.where(:enabled => false)
|
||||
end
|
||||
|
||||
params[:search][:test_user] = "Non" if !params[:search][:test_user]
|
||||
|
||||
if params[:search][:test_user].to_s == "Oui"
|
||||
@p_customers = @p_customers.where(:test_user => true)
|
||||
elsif params[:search][:test_user].to_s == "Non"
|
||||
@p_customers = @p_customers.where(:test_user => false)
|
||||
end
|
||||
|
||||
if params[:search][:npai].to_s == "Oui"
|
||||
@p_customers = @p_customers.where(:npai => true)
|
||||
elsif params[:search][:npai].to_s == "Non"
|
||||
@p_customers = @p_customers.where(:npai => false)
|
||||
end
|
||||
|
||||
|
||||
if params[:search][:sticker].to_s == "Oui"
|
||||
@p_customers = @p_customers.where(:sticker => true)
|
||||
elsif params[:search][:sticker].to_s == "Non"
|
||||
@p_customers = @p_customers.where(:sticker => false)
|
||||
end
|
||||
|
||||
|
||||
if params[:code].to_s != ""
|
||||
@p_customers = @p_customers.where("p_customers.code LIKE ?","#{params[:code]}%")
|
||||
end
|
||||
@ -206,6 +271,10 @@ class Admin::PCustomersController < ApplicationController
|
||||
@p_customers = @p_customers.joins(:particulars).where("p_customers.code LIKE ? or particulars.organisation LIKE ? or particulars.name LIKE ? or particulars.firstname LIKE ?","%#{params[:name]}%", "%#{params[:name]}%", "%#{params[:name]}%", "%#{params[:name]}%")
|
||||
end
|
||||
|
||||
if params[:email].to_s != ""
|
||||
@p_customers = @p_customers.where("p_customers.email LIKE ?","%#{params[:email]}%")
|
||||
end
|
||||
|
||||
if params[:city].to_s != ""
|
||||
@p_customers = @p_customers.joins(:particulars).where("particulars.cp LIKE ? or particulars.city LIKE ?","%#{params[:city]}%", "%#{params[:city]}%")
|
||||
end
|
||||
@ -298,16 +367,95 @@ class Admin::PCustomersController < ApplicationController
|
||||
|
||||
|
||||
@p_customers = @p_customers.distinct
|
||||
@p_customers = @p_customers.limit(50)
|
||||
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
|
||||
|
||||
|
||||
params[:per_page] = params[:per_page] || 50
|
||||
|
||||
per_page = params[:per_page]
|
||||
page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
@p_customers = @p_customers.page(page).per(per_page)
|
||||
|
||||
}
|
||||
|
||||
format.csv {
|
||||
@headers = []
|
||||
@columns = []
|
||||
PCustomer.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: "import") do |sheet|
|
||||
sheet.add_row @headers
|
||||
|
||||
@p_customers.each do |p_customer|
|
||||
line = []
|
||||
|
||||
@columns.each do |column|
|
||||
|
||||
if (p_customer.respond_to?("csv_"+column.to_s))
|
||||
line << p_customer.send("csv_"+column.to_s)
|
||||
elsif (p_customer.respond_to?(column))
|
||||
if p_customer.send(column.to_s).class.to_s == "BigDecimal"
|
||||
line << p_customer.send(column.to_s).to_s.gsub('.', ',')
|
||||
else
|
||||
line << p_customer.send(column.to_s)
|
||||
end
|
||||
else
|
||||
line << column.to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
sheet.add_row line, types: line.map{|t| self.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
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
@p_customer = PCustomer.find(params[:id])
|
||||
|
||||
@ -330,6 +478,41 @@ class Admin::PCustomersController < ApplicationController
|
||||
@p_customer = PCustomer.find(params[:id])
|
||||
end
|
||||
|
||||
def npai
|
||||
|
||||
|
||||
@p_customer = PCustomer.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def toggle_npai
|
||||
|
||||
|
||||
@p_customer = PCustomer.find(params[:id])
|
||||
|
||||
if @p_customer.npai
|
||||
@p_customer.npai = false
|
||||
@p_customer.sticker = false
|
||||
message = "NPAI levé"
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "stickers-npai-a-jour", @p_customer.email, {:arguments => {}, :p_customer => @p_customer, :element => @p_customer})
|
||||
|
||||
|
||||
else
|
||||
@p_customer.npai = true
|
||||
message = "NPAI signalé"
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "stickers-npai", @p_customer.email, {:arguments => {}, :p_customer => @p_customer, :element => @p_customer})
|
||||
|
||||
|
||||
end
|
||||
|
||||
@p_customer.save
|
||||
@p_customer.particular.generate_hist(message) if @p_customer.particular
|
||||
|
||||
redirect_back(fallback_location:"/")
|
||||
end
|
||||
|
||||
def create
|
||||
@p_customer = PCustomer.new(params.require(:p_customer).permit!)
|
||||
|
||||
@ -487,6 +670,30 @@ class Admin::PCustomersController < ApplicationController
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update_stickers
|
||||
|
||||
if params[:file]
|
||||
data = Roo::Spreadsheet.open(params[:file].tempfile.path, extension: :xlsx) # open spreadsheet
|
||||
headers = data.row(1) # get header row
|
||||
@data = []
|
||||
data.each_with_index do |row, idx|
|
||||
next if idx == 0 # skip header
|
||||
# create hash from headers and cells
|
||||
user_data = Hash[[headers, row].transpose]
|
||||
@data << user_data
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
@ -22,8 +22,10 @@ class Admin::PStatsController < ApplicationController
|
||||
if params[:start] and params[:start] =~ date_regex
|
||||
@start = Date.parse(params[:start]).beginning_of_day
|
||||
|
||||
elsif !params[:start]
|
||||
@start = Date.today.beginning_of_year
|
||||
else
|
||||
@start = Date.today.beginning_of_month
|
||||
@start = Date.parse("2000-01-01")
|
||||
end
|
||||
params[:start]= @start.strftime('%d/%m/%Y')
|
||||
|
||||
@ -45,6 +47,100 @@ class Admin::PStatsController < ApplicationController
|
||||
|
||||
@finished = @p_customer_sheets.where(:state => ["livrée","facturée"])
|
||||
|
||||
|
||||
|
||||
params[:search][:per_page] = params[:search][:per_page] || 500000
|
||||
per_page = params[:search][:per_page]
|
||||
page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
|
||||
@m_odr_primes = MOdrPrime.where("m_odr_primes.created_at >= ? and m_odr_primes.created_at < ?",@start.beginning_of_year, @stop).where(:state => ["Virement envoyé"])
|
||||
@m_odr_primes = @m_odr_primes.joins(:p_customer)
|
||||
@m_odr_primes = @m_odr_primes.where("m_odr_primes.created_at >= ?", @start)
|
||||
@m_odr_primes = sort_by_sorting(@m_odr_primes, "m_odr_primes.cc_virement_date DESC")
|
||||
@all_m_odr_primes = @m_odr_primes
|
||||
@m_odr_primes = @m_odr_primes.page(page).per(per_page)
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
|
||||
|
||||
|
||||
params[:per_page] = params[:per_page] || 50
|
||||
|
||||
per_page = params[:per_page]
|
||||
page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
@m_odr_primes = @m_odr_primes.page(page).per(per_page)
|
||||
|
||||
}
|
||||
|
||||
format.csv {
|
||||
@headers = []
|
||||
@columns = []
|
||||
MOdrPrime.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: "import") do |sheet|
|
||||
sheet.add_row @headers
|
||||
|
||||
@m_odr_primes.each do |m_odr_prime|
|
||||
line = []
|
||||
|
||||
@columns.each do |column|
|
||||
|
||||
if (m_odr_prime.respond_to?("csv_"+column.to_s))
|
||||
line << m_odr_prime.send("csv_"+column.to_s)
|
||||
elsif (m_odr_prime.respond_to?(column))
|
||||
if m_odr_prime.send(column.to_s).class.to_s == "BigDecimal"
|
||||
line << m_odr_prime.send(column.to_s).to_s.gsub('.', ',')
|
||||
else
|
||||
line << m_odr_prime.send(column.to_s)
|
||||
end
|
||||
else
|
||||
line << column.to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
sheet.add_row line, types: line.map{|t| self.cell_type_from_value(t)}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@final_file = "#{Rails.root}/private_medias/export-primes-#{Time.now.to_s.to_slug}.xlsx"
|
||||
|
||||
|
||||
xlsx_package.serialize(@final_file)
|
||||
|
||||
|
||||
send_file @final_file
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
76
app/controllers/admin/particular_hists_controller.rb
Normal file
76
app/controllers/admin/particular_hists_controller.rb
Normal file
@ -0,0 +1,76 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::ParticularHistsController < ApplicationController
|
||||
layout "admin"
|
||||
before_action :auth_admin
|
||||
|
||||
before_action :admin_space
|
||||
|
||||
def admin_space
|
||||
@admin_space = "default"
|
||||
end
|
||||
|
||||
def index
|
||||
@particular_hists = ParticularHist.all
|
||||
|
||||
@particular_hists = sort_by_sorting(@particular_hists, "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
|
||||
@particular_hists = @particular_hists.page(page).per(per_page)
|
||||
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@particular_hist = ParticularHist.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@particular_hist = ParticularHist.new
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@particular_hist = ParticularHist.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
@particular_hist = ParticularHist.new(params.require(:particular_hist).permit!)
|
||||
|
||||
if @particular_hist.save
|
||||
|
||||
else
|
||||
render action: "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@particular_hist = ParticularHist.find(params[:id])
|
||||
|
||||
|
||||
if @particular_hist.update_attributes(params.require(:particular_hist).permit!)
|
||||
|
||||
else
|
||||
render action: "edit"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@particular_hist = ParticularHist.find(params[:id])
|
||||
@particular_hist.destroy
|
||||
|
||||
end
|
||||
end
|
@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
|
||||
|
||||
require "csv"
|
||||
|
||||
before_action :set_locale
|
||||
|
||||
@ -162,6 +162,29 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
|
||||
def cell_type_from_value(v)
|
||||
if v.is_a?(Date)
|
||||
:date
|
||||
elsif v.is_a?(String)
|
||||
:string
|
||||
elsif v.is_a?(Time)
|
||||
:time
|
||||
elsif v.is_a?(TrueClass) || v.is_a?(FalseClass)
|
||||
:boolean
|
||||
elsif v.to_s =~ /\A[+-]?\d+?\Z/ #numeric
|
||||
:integer
|
||||
elsif v.to_s =~ /\A[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\Z/ #float
|
||||
:float
|
||||
# \A(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])
|
||||
# T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?
|
||||
# (Z|[+-](?:2[0-3]|[0-1][0-9]):[0-5][0-9])?\Z
|
||||
elsif v.to_s =~/\A(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-](?:2[0-3]|[0-1][0-9]):[0-5][0-9])?\Z/
|
||||
:iso_8601
|
||||
else
|
||||
:string
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@ -240,5 +263,7 @@ class ApplicationController < ActionController::Base
|
||||
helper_method :current_admin, :get_specific_pref, :sort_by_sorting, :current_p_customer
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
@ -6,6 +6,8 @@ class Public::MEventsController < ApplicationController
|
||||
def index
|
||||
@m_events = MEvent.all
|
||||
|
||||
@m_events = @m_events.joins(:organisateur).where(:organisateurs => {:public => true})
|
||||
|
||||
params[:search] = params[:search] || []
|
||||
|
||||
@m_events = @m_events.where("start_at >= ? or end_at >= ?", Date.today.beginning_of_day, Date.today.beginning_of_day)
|
||||
|
@ -55,6 +55,9 @@ class Public::MOdrRepRibsController < ApplicationController
|
||||
@m_odr_rep = @m_odr_rep_rib.m_odr_rep
|
||||
|
||||
if @m_odr_rep_rib.update_attributes(params.require(:m_odr_rep_rib).permit!)
|
||||
@m_odr_rep_rib.admin_ok = nil
|
||||
@m_odr_rep_rib.mail_sended = false
|
||||
@m_odr_rep_rib.save
|
||||
redirect_to public_my_account_path, :notice => "Votre RIB a bien été modifié"
|
||||
else
|
||||
render action: "edit"
|
||||
|
@ -4,7 +4,7 @@ class Public::OrganisateursController < ApplicationController
|
||||
|
||||
|
||||
def index
|
||||
@organisateurs = Organisateur.order(:name).all
|
||||
@organisateurs = Organisateur.order(:name).where(:public => true).all
|
||||
@organisateurs_active = true
|
||||
|
||||
|
||||
@ -35,9 +35,7 @@ class Public::OrganisateursController < ApplicationController
|
||||
def show
|
||||
@organisateurs_active = true
|
||||
|
||||
if @organisateur = Organisateur.where(:id => params[:id]).first
|
||||
|
||||
elsif @organisateur = Organisateur.where(:slug => params[:id]).first
|
||||
if @organisateur = Organisateur.where(:slug => params[:id]).first
|
||||
|
||||
else
|
||||
redirect_to public_organisateurs_path
|
||||
|
@ -13,7 +13,7 @@ class Public::PCustomerAuthsController < ApplicationController
|
||||
|
||||
@p_customer.save
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "confirmation-inscription", @p_customer.email, {:arguments => {:nbr_inscrits => PCustomer.count}, :p_customer => @p_customer})
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "confirmation-inscription", @p_customer.email, {:arguments => {:nbr_inscrits => PCustomer.where(:enabled => true, :test_user => false).count}, :p_customer => @p_customer})
|
||||
end
|
||||
|
||||
|
||||
|
@ -6,6 +6,12 @@ class Public::PCustomersController < ApplicationController
|
||||
|
||||
|
||||
@p_customer = PCustomer.new()
|
||||
|
||||
if params[:a] and parent = PCustomer.where(:mlm_token => params[:a].to_s.upcase).first
|
||||
@p_customer.parent_code = parent.mlm_token
|
||||
parent.update_token_count
|
||||
end
|
||||
|
||||
@p_customer.particulars << Particular.new(:pro => false, :skip_validation => true)
|
||||
@p_customer.valid_public = true
|
||||
end
|
||||
@ -30,7 +36,7 @@ class Public::PCustomersController < ApplicationController
|
||||
cookies[:p_customer_auth_token] = @p_customer.auth_token
|
||||
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "confirmer-inscription", @p_customer.email, {:arguments => {:lien => valid_account_public_p_customer_auths_url(:token => @p_customer.mlm_token) }, :p_customer => @p_customer})
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "confirmer-inscription", @p_customer.email, {:arguments => {:lien => "<a href='#{valid_account_public_p_customer_auths_url(:token => @p_customer.mlm_token)}' >#{valid_account_public_p_customer_auths_url(:token => @p_customer.mlm_token)}</a>" }, :p_customer => @p_customer})
|
||||
|
||||
#mail_hist = MailHist.generate_mail(:fr, MailType.find_or_create("new_account"), @p_customer.email, {:arguments => {:email => @p_customer.email}, :p_customer => @p_customer, :element => @p_customer})
|
||||
|
||||
|
@ -48,11 +48,26 @@ class Public::ParticularsController < ApplicationController
|
||||
|
||||
|
||||
def update
|
||||
|
||||
allready_fill = current_p_customer.particular_fill?
|
||||
|
||||
|
||||
|
||||
|
||||
@particular = current_p_customer.particulars.find(params[:id])
|
||||
|
||||
|
||||
if @particular.update_attributes(params.require(:particular).permit!)
|
||||
|
||||
|
||||
if !allready_fill and pc = PCustomer.find(current_p_customer.id) and pc.particular_fill? and !pc.particular_thankable
|
||||
|
||||
mail_hist = MailHist.auto_generate_mail(:fr, "utilisateur-remerciement-infos", current_p_customer.email, {:arguments => {}, :p_customer => current_p_customer, :element => current_p_customer})
|
||||
|
||||
current_p_customer.particular_thankable = true
|
||||
current_p_customer.save
|
||||
end
|
||||
|
||||
redirect_to public_my_account_path
|
||||
|
||||
|
||||
|
@ -7,7 +7,10 @@ module DocumentLineHelper
|
||||
end
|
||||
|
||||
def link_to_add_fields(name, f, association, options={})
|
||||
new_object = f.object.class.reflect_on_association(association).klass.new()
|
||||
|
||||
options[:attributes] = options[:attributes] || {}
|
||||
|
||||
new_object = f.object.class.reflect_on_association(association).klass.new(options[:attributes])
|
||||
|
||||
|
||||
if association == :product_options
|
||||
|
@ -59,7 +59,7 @@ class Circuit < ApplicationRecord
|
||||
|
||||
|
||||
before_save do
|
||||
self.slug = "#{self.name} #{self.cp} #{self.city}".to_slug if !self.slug
|
||||
self.slug = "#{self.name} #{self.cp} #{self.city}".to_slug if !self.slug?
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,6 +1,7 @@
|
||||
class CircuitRegion < ApplicationRecord
|
||||
acts_as_csv_import :fields => [:name]
|
||||
|
||||
belongs_to :circuit_region_cat
|
||||
acts_as_sorting :fields => {
|
||||
:name => {:name => "Nom",:reorder => true},
|
||||
:actions => {:name => "Actions"}
|
||||
|
10
app/models/circuit_region_cat.rb
Normal file
10
app/models/circuit_region_cat.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class CircuitRegionCat < ApplicationRecord
|
||||
has_many :circuit_regions, -> { order("name") }
|
||||
acts_as_sorting fields: {
|
||||
name: { name: "Nom", reorder: true },
|
||||
position: { name: "Position", reorder: true },
|
||||
actions: "Actions"
|
||||
}
|
||||
|
||||
|
||||
end
|
@ -6,6 +6,8 @@ class ImportCsv < ApplicationRecord
|
||||
|
||||
has_many :import_csv_elements
|
||||
|
||||
has_many :elements, :through => :import_csv_elements
|
||||
|
||||
acts_as_tree
|
||||
|
||||
validates :file, :presence => true
|
||||
@ -41,10 +43,10 @@ class ImportCsv < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
self.table_name.classify.constantize.import_csv_fields.each do |h|
|
||||
self.table_source.classify.constantize.import_csv_fields.each do |h|
|
||||
if self.parent and c = self.parent.import_csv_champs.where(:champ => h.to_s).first
|
||||
self.import_csv_champs.new(:champ => h.to_s, :header => c.header)
|
||||
else
|
||||
self.import_csv_champs.new(:champ => h.to_s, :header => c.header, :value => c.value)
|
||||
elsif !self.parent
|
||||
self.import_csv_champs.new(:champ => h.to_s)
|
||||
end
|
||||
|
||||
@ -56,6 +58,15 @@ class ImportCsv < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def table_source
|
||||
if self.table_name == "val_de_vienne"
|
||||
name = "p_customer"
|
||||
else
|
||||
name = self.table_name
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def charge
|
||||
|
||||
if false
|
||||
@ -87,7 +98,7 @@ class ImportCsv < ApplicationRecord
|
||||
end
|
||||
|
||||
def load
|
||||
self.table_name.classify.constantize.import_csv(self.charge, self)
|
||||
self.table_source.classify.constantize.import_csv(self.charge, self)
|
||||
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ class MEvent < ApplicationRecord
|
||||
belongs_to :image_file
|
||||
|
||||
def member_label
|
||||
self.start_at.to_date.to_s+" - "+self.title.to_s+" - "+(self.organisateur.name if self.organisateur).to_s
|
||||
self.start_at.to_date.to_s+" - "+(self.end_at.to_date.to_s+" - " if self.start_at.to_date != self.end_at.to_date).to_s+self.title.to_s+" - "+(self.organisateur.name if self.organisateur).to_s
|
||||
end
|
||||
|
||||
|
||||
|
@ -5,24 +5,54 @@ class MOdrFile < ApplicationRecord
|
||||
belongs_to :m_odr_place
|
||||
belongs_to :m_event
|
||||
|
||||
has_one :particular, :through => :p_customer
|
||||
|
||||
has_many :mail_hists
|
||||
|
||||
has_many :m_odr_file_products, :dependent => :destroy
|
||||
accepts_nested_attributes_for :m_odr_file_products, :allow_destroy => true
|
||||
|
||||
validates_associated :m_odr_file_products
|
||||
|
||||
has_many :m_odr_file_roulages, :dependent => :destroy
|
||||
accepts_nested_attributes_for :m_odr_file_roulages, :allow_destroy => true
|
||||
|
||||
|
||||
mount_uploader :file, OdrUploader
|
||||
|
||||
validates :file, :presence => true
|
||||
validates :file, :presence => true, :if => :file_needed?
|
||||
|
||||
|
||||
|
||||
before_create { generate_token() }
|
||||
|
||||
validates :buy_at, :presence => true, :if => :buy_at_needed?
|
||||
|
||||
acts_as_caching :fields => [:doc_date]
|
||||
|
||||
|
||||
def file_needed?
|
||||
true if !self.id
|
||||
end
|
||||
|
||||
def ca_doc_date
|
||||
if self.m_odr_file_type_id == 1
|
||||
if m_odr_file_roulage = self.m_odr_file_roulages.order("date DESC").first
|
||||
m_odr_file_roulage.date
|
||||
else
|
||||
self.created_at
|
||||
end
|
||||
|
||||
elsif self.m_odr_file_type_id == 2
|
||||
if self.buy_at
|
||||
self.buy_at
|
||||
else
|
||||
self.created_at
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def buy_at_needed?
|
||||
true if self.m_odr_file_type_id == 2
|
||||
end
|
||||
@ -62,13 +92,24 @@ class MOdrFile < ApplicationRecord
|
||||
self.nbr_primes_not_useds = self.nbr_primes - nbr_primes_useds
|
||||
|
||||
elsif self.m_odr_file_type_id == 2
|
||||
nbr_pneus = 0
|
||||
self.nbr_pneus = 0
|
||||
self.m_odr_file_products.each do |mofp|
|
||||
nbr_pneus += mofp.qte.to_i
|
||||
self.nbr_pneus += mofp.qte.to_i
|
||||
end
|
||||
if self.nbr_pneus > 2
|
||||
self.nbr_pneus = 2
|
||||
|
||||
|
||||
end
|
||||
|
||||
self.nbr_pneus = nbr_pneus
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
self.nbr_pneus_not_useds = self.nbr_pneus - self.nbr_pneus_useds.to_i
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@ -104,7 +145,7 @@ class MOdrFile < ApplicationRecord
|
||||
acts_as_sorting :fields => {
|
||||
:id => {:name => "Id", :reorder => true},
|
||||
:created_at => {:name => "Date de téléchargement", :reorder => true},
|
||||
:p_customer => {:name => "Utilisateur"},
|
||||
:p_customer => {:name => "Utilisateur", :reorder => true, :sort_name => "p_customers.cc_show_name"},
|
||||
:m_odr_file_type => {:name => "Type de document"},
|
||||
:admin_ok => {:name => "Décision", :reorder => true},
|
||||
:reject_reason => {:name => "Raison du rejet", :reorder => true},
|
||||
|
@ -5,6 +5,26 @@ class MOdrFileProduct < ApplicationRecord
|
||||
|
||||
#validates :qte, :presence => true, numericality: { greater_than: 0}
|
||||
|
||||
attr_accessor :admin_form
|
||||
|
||||
validates :qte, :presence => true, :if => :is_tire_admin_form?
|
||||
validates :price, :presence => true, :if => :is_tire_admin_form?
|
||||
validates :m_odr_product_size_id, :presence => true, :if => :is_tire_admin_form?
|
||||
|
||||
def is_tire_admin_form?
|
||||
if self.m_odr_file and self.m_odr_file.m_odr_file_type_id == 2
|
||||
if self.admin_form
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
else
|
||||
false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
before_save do
|
||||
if self.m_odr_product_size
|
||||
|
@ -15,10 +15,13 @@ class MOdrFileRoulage < ApplicationRecord
|
||||
|
||||
def generate_prime
|
||||
prime_ids = []
|
||||
|
||||
if self.m_odr_file.p_customer.m_odr_primes.where("created_at > ?", Date.today.beginning_of_year).count < 5
|
||||
|
||||
if nbr_primes_to_use = self.nbr_primes_not_useds and nbr_primes_to_use > 0
|
||||
|
||||
|
||||
if achats = MOdrFile.where(:admin_ok => true, :p_customer_id => self.m_odr_file.p_customer_id,:m_odr_file_type_id => 2).where("buy_at <= ? and nbr_pneus_not_useds > 0", self.date) and (achats.sum(:nbr_pneus_not_useds) > 0)
|
||||
if achats = MOdrFile.where(:admin_ok => true, :p_customer_id => self.m_odr_file.p_customer_id,:m_odr_file_type_id => 2).where("buy_at <= ? and nbr_pneus_not_useds > 0 and buy_at >= ? and buy_at <= ?", self.date, self.date.beginning_of_year, self.date.end_of_year) and (achats.sum(:nbr_pneus_not_useds) > 0)
|
||||
|
||||
state = "A traiter"
|
||||
|
||||
@ -50,6 +53,7 @@ class MOdrFileRoulage < ApplicationRecord
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
prime_ids = prime_ids.uniq
|
||||
|
||||
|
@ -2,24 +2,77 @@ class MOdrPrime < ApplicationRecord
|
||||
belongs_to :p_customer
|
||||
belongs_to :m_odr_file_roulage
|
||||
|
||||
has_one :particular, :through => :p_customer
|
||||
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include ActionView::Helpers::TranslationHelper
|
||||
include ActionView::Helpers::UrlHelper
|
||||
|
||||
|
||||
|
||||
has_many :m_odr_prime_files #, :dependent => :destroy
|
||||
|
||||
|
||||
has_many :m_odr_files, :through => :m_odr_prime_files
|
||||
|
||||
has_many :m_odr_places, :through => :m_odr_files
|
||||
|
||||
has_many :m_odr_file_products, :through => :m_odr_files
|
||||
|
||||
|
||||
has_many :m_odr_products, :through => :m_odr_file_products
|
||||
|
||||
|
||||
has_many :mail_hists
|
||||
has_many :m_odr_virements
|
||||
|
||||
|
||||
|
||||
acts_as_sorting :fields => {
|
||||
:id => {:name => "Id", :reorder => true},
|
||||
:p_customer => {:name => "Client"},
|
||||
#:p_customer => {:name => "Client", :reorder => true, :sort_name => "p_customers.cc_show_name"},
|
||||
|
||||
:p_customer_created_at => {:name => "Inscription", :reorder => true, :sort_name => "p_customers.created_at"},
|
||||
|
||||
:particular_name => {:name => "Nom", :reorder => true, :sort_name => "p_customers.cc_particular_name"},
|
||||
:particular_firstname => {:name => "Prénom", :reorder => true, :sort_name => "p_customers.cc_particular_firstname"},
|
||||
:amount => {:name => "Montant", :as => :currency},
|
||||
|
||||
:created_at => {:name => "Date"},
|
||||
|
||||
|
||||
:pneu_gamme => {:name => "Gamme"},
|
||||
|
||||
#:pneu_tailles => {:name => "Tailles"},
|
||||
|
||||
:m_odr_place_name => {:name => "Revendeur - Nom"},
|
||||
:m_odr_place_cp=> {:name => "Revendeur - CP"},
|
||||
:m_odr_place_city => {:name => "Revendeur - Ville"},
|
||||
|
||||
:organisateur_name => {:name => "Organisateur"},
|
||||
|
||||
|
||||
|
||||
:date_roulage => {:name => "Date de roulage", :reorder => true, :sort_name => "m_odr_file_roulages.date"},
|
||||
:state => {:name => "Statut", :reorder => true},
|
||||
:amount => {:name => "Montant"},
|
||||
#:date_virement => {:name => "Date de virement"},
|
||||
:cc_virement_date => {:name => "Date de virement", :reorder => true},
|
||||
|
||||
:actions => {:name => "Actions", :reorder => true},
|
||||
|
||||
}
|
||||
acts_as_caching :fields => [:virement_date]
|
||||
|
||||
def ca_virement_date
|
||||
virement = self.m_odr_virements.where(:refused => 0, :sended => 1).order('id DESC').first
|
||||
if virement and virement.m_odr_remise
|
||||
virement.m_odr_remise.created_at
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
before_validation do
|
||||
|
||||
@ -95,4 +148,69 @@ class MOdrPrime < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def csv_particular_name
|
||||
self.particular.name if self.particular
|
||||
end
|
||||
|
||||
|
||||
def csv_particular_firstname
|
||||
self.particular.firstname if self.particular
|
||||
end
|
||||
|
||||
def csv_p_customer_created_at
|
||||
self.p_customer.created_at if self.p_customer
|
||||
end
|
||||
|
||||
def csv_state
|
||||
self.state
|
||||
end
|
||||
|
||||
def csv_date_roulage
|
||||
self.m_odr_file_roulage.date if self.m_odr_file_roulage
|
||||
end
|
||||
|
||||
|
||||
|
||||
def csv_pneu_gamme
|
||||
self.m_odr_products.uniq.map{ |u| (u.name)}.join(" | ")
|
||||
end
|
||||
|
||||
def csv_m_odr_place_name
|
||||
self.m_odr_places.uniq.map{ |u| u.name}.join(" | ")
|
||||
end
|
||||
|
||||
def csv_m_odr_place_cp
|
||||
self.m_odr_places.uniq.map{ |u| u.cp}.join(" | ")
|
||||
end
|
||||
|
||||
def csv_m_odr_place_city
|
||||
self.m_odr_places.uniq.map{ |u| u.city}.join(" | ")
|
||||
end
|
||||
|
||||
def csv_organisateur_name
|
||||
self.m_odr_file_roulage.m_event.organisateur.name if self.m_odr_file_roulage and self.m_odr_file_roulage.m_event and self.m_odr_file_roulage.m_event.organisateur
|
||||
end
|
||||
|
||||
def csv_date_virement
|
||||
virement = self.m_odr_virements.where(:refused => 0, :sended => 1).order('id DESC').first
|
||||
if virement and virement.m_odr_remise
|
||||
virement.m_odr_remise.created_at
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
@ -4,6 +4,7 @@ class MOdrProduct < ApplicationRecord
|
||||
belongs_to :m_odr
|
||||
|
||||
has_many :m_odr_product_sizes
|
||||
accepts_nested_attributes_for :m_odr_product_sizes, :allow_destroy => true
|
||||
|
||||
has_many :m_odr_product_remises, :dependent => :destroy
|
||||
accepts_nested_attributes_for :m_odr_product_remises, :allow_destroy => true
|
||||
|
@ -3,6 +3,8 @@ class MOdrProductSize < ApplicationRecord
|
||||
|
||||
acts_as_csv_import :fields => [:name, :m_odr_product_id, :position, :sap]
|
||||
|
||||
default_scope { order(name: :asc) }
|
||||
|
||||
def member_label
|
||||
if self.m_odr_product
|
||||
"#{self.m_odr_product.name} - #{self.name} - #{self.position}"
|
||||
|
@ -24,6 +24,8 @@ class MOdrRepRib < ApplicationRecord
|
||||
:admin_ok => {:name => "Décision", :reorder => true},
|
||||
:reject_reason => {:name => "Raison du rejet", :reorder => true},
|
||||
:reject_reason_description => {:name => "Raison du rejet : commentaire", :reorder => true},
|
||||
:updated_at => {:name => "Date de modification", :reorder => true},
|
||||
|
||||
:actions => {:name => "Actions", :reorder => true},
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ class MOdrVirement < ApplicationRecord
|
||||
belongs_to :m_odr_prime
|
||||
belongs_to :m_odr_remise
|
||||
|
||||
has_one :p_customer, :through => :m_odr_prime
|
||||
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ class Organisateur < ApplicationRecord
|
||||
end
|
||||
|
||||
before_save do
|
||||
self.slug = "#{self.name} #{self.cp} #{self.city}".to_slug if !self.slug
|
||||
self.slug = "#{self.name} #{self.cp} #{self.city}".to_slug if !self.slug?
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -2,6 +2,8 @@ class PCustomer < ApplicationRecord
|
||||
|
||||
acts_as_tree
|
||||
|
||||
has_many :particular_hists
|
||||
|
||||
has_many :price_documents
|
||||
|
||||
has_many :particulars, :as => :owner, :dependent => :destroy
|
||||
@ -71,7 +73,10 @@ class PCustomer < ApplicationRecord
|
||||
validates :cgv, :presence => true, :if => :require_cgv
|
||||
#validates :rgpd, :presence => true, :if => :require_cgv
|
||||
|
||||
validates :past_id, :uniqueness => true, :if => :imported
|
||||
#validates :past_id, :uniqueness => true, :if => :imported
|
||||
|
||||
acts_as_caching :fields => [:show_name, :particular_name, :particular_firstname]
|
||||
|
||||
|
||||
attr_accessor :refresh_import
|
||||
|
||||
@ -122,15 +127,15 @@ class PCustomer < ApplicationRecord
|
||||
self.sticker = true
|
||||
end
|
||||
|
||||
if circuit = Circuit.where(:past_id => self.imp_circuit_1).first
|
||||
if self.imp_circuit_1? and circuit = Circuit.where(:past_id => self.imp_circuit_1).first
|
||||
self.circuit_1_id = circuit.id
|
||||
end
|
||||
|
||||
if circuit = Circuit.where(:past_id => self.imp_circuit_2).first
|
||||
if self.imp_circuit_2? and circuit = Circuit.where(:past_id => self.imp_circuit_2).first
|
||||
self.circuit_2_id = circuit.id
|
||||
end
|
||||
|
||||
if circuit = Circuit.where(:past_id => self.imp_circuit_3).first
|
||||
if self.imp_circuit_3? and circuit = Circuit.where(:past_id => self.imp_circuit_3).first
|
||||
self.circuit_3_id = circuit.id
|
||||
end
|
||||
|
||||
@ -155,7 +160,12 @@ class PCustomer < ApplicationRecord
|
||||
self.do_import if self.refresh_import == "true"
|
||||
end
|
||||
|
||||
acts_as_csv_import :fields =>[:imported, :email, :password, :past_id,:imp_cp,:imp_country,:imp_ref,:imp_email,:imp_firstname,:imp_name,:imp_fonction,:imp_organisme,:imp_address,:imp_cp2,:imp_city,:imp_tel,:imp_portable,:imp_lien,:imp_comment,:imp_iban,:imp_bic,:imp_circuit_1,:imp_circuit_2,:imp_circuit_3,:imp_partenaire,:imp_ecran,:imp_blocage,:imp_valid,:imp_user_valid,:imp_offre,:imp_info,:imp_cgu,:imp_test,:imp_stickers,:imp_npai,:npai,:imp_relance_adresse,:imp_demande_info,:imp_creation,:imp_modification, :refresh_import]
|
||||
|
||||
before_validation do
|
||||
self.generate_mdp = true if !self.id and self.import_name == "val"
|
||||
end
|
||||
|
||||
acts_as_csv_import :fields =>[:generate_mdp, :imported,:import_name,:unlimited, :email, :password, :past_id,:imp_cp,:imp_country,:imp_ref,:imp_email,:imp_firstname,:imp_name,:imp_fonction,:imp_organisme,:imp_address,:imp_cp2,:imp_city,:imp_tel,:imp_portable,:imp_lien,:imp_comment,:imp_iban,:imp_bic,:imp_circuit_1,:imp_circuit_2,:imp_circuit_3,:imp_partenaire,:imp_ecran,:imp_blocage,:imp_valid,:imp_user_valid,:imp_offre,:imp_info,:imp_cgu,:imp_test,:imp_stickers,:imp_npai,:npai,:imp_relance_adresse,:imp_demande_info,:imp_creation,:imp_modification, :refresh_import]
|
||||
|
||||
attr_accessor :actual_password, :valid_last_password, :valid_public, :generate_mdp, :valid_pswd_confirmation, :require_cgv
|
||||
|
||||
@ -197,7 +207,13 @@ class PCustomer < ApplicationRecord
|
||||
|
||||
|
||||
before_validation do
|
||||
|
||||
if !self.id and self.import_name = "val"
|
||||
if p = PCustomer.where(:email => self.email).first
|
||||
p.unlimited = true
|
||||
p.import_name = "val"
|
||||
p.save
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if self.valid_last_password and !PCustomer.find(self.id).authenticate(self.actual_password)
|
||||
@ -234,9 +250,12 @@ class PCustomer < ApplicationRecord
|
||||
self.generate_mdp = false
|
||||
if self.save
|
||||
#GeneralMailer.send_qi_mail("fr", "generation_mdp", self.email, {"mdp" => ps}).deliver
|
||||
if self.import_name.to_s == "val"
|
||||
mail_hist = MailHist.generate_mail(:fr, MailType.find_by_slug("import_val_de_vienne"), self.email, {:arguments => {:mdp => ps, :civilite => self.particular.civilite, :nom => self.particular.name, :prenom => self.particular.firstname }, :p_customer => self, :element => self})
|
||||
else
|
||||
|
||||
mail_hist = MailHist.generate_mail(:fr, MailType.find_by_slug("generation_mdp"), self.email, {:arguments => {:mdp => ps, :civilite => self.particular.civilite, :nom => self.particular.name, :prenom => self.particular.firstname }, :p_customer => self, :element => self})
|
||||
|
||||
end
|
||||
else
|
||||
|
||||
end
|
||||
@ -245,15 +264,37 @@ class PCustomer < ApplicationRecord
|
||||
end
|
||||
|
||||
|
||||
def update_token_count
|
||||
self.link_token_count = self.link_token_count.to_i + 1
|
||||
self.save
|
||||
end
|
||||
|
||||
|
||||
def self.qi_table_order
|
||||
{
|
||||
:created_at => {:name => "Date de création", :reorder => true, :as => :date},
|
||||
:show_name => "Nom",
|
||||
:name => {:name => "Nom", :reorder => true, :sort_name => "particulars.name"},
|
||||
:firstname => {:name => "Prénom", :reorder => true, :sort_name => "particulars.firstname"},
|
||||
:mlm_token => {:name => "Code ambassadeur", :reorder => true},
|
||||
:enabled => "Actif ?",
|
||||
:test_user => "Utilisateur test ?",
|
||||
:npai => "NPAI ?",
|
||||
:sticker => "Stickers envoyés ?",
|
||||
:particular_fill => "Adresse remplie ?",
|
||||
:parent => "Ambassadeur",
|
||||
:particular => "Ville",
|
||||
|
||||
:particular_address_2 => "Adresse",
|
||||
:particular_address_3 => "Adresse (suite)",
|
||||
|
||||
:particular_cp => "Code postal",
|
||||
:particular_city => "Ville",
|
||||
:particular_country => "Pays",
|
||||
|
||||
|
||||
|
||||
:email => "Email",
|
||||
:particular_tel => "Téléphone",
|
||||
:link_token_count => {:name => "Nbr. aff. lien amb.", :reorder => true},
|
||||
:actions => "Actions"
|
||||
|
||||
}
|
||||
@ -262,11 +303,15 @@ class PCustomer < ApplicationRecord
|
||||
|
||||
def self.valid_sort
|
||||
|
||||
["code", "created_at", "cache_encours_th", "cache_encours", "cache_payments_th", "cache_payments", "cache_payments_tot", "cache_ca"]
|
||||
["code", "cc_show_name","particulars.firstname","particulars.name", "created_at", "cache_encours_th", "cache_encours", "cache_payments_th", "cache_payments", "cache_payments_tot", "cache_ca"]
|
||||
|
||||
end
|
||||
|
||||
|
||||
def particular_fill?
|
||||
true if self.particular.firstname? and self.particular.name? and self.particular.address_2? and self.particular.cp? and self.particular.city?
|
||||
end
|
||||
|
||||
before_destroy do
|
||||
if self.p_customer_sheets.count > 0 or self.p_payments.count > 0
|
||||
false
|
||||
@ -470,17 +515,30 @@ class PCustomer < ApplicationRecord
|
||||
end
|
||||
|
||||
|
||||
def show_name
|
||||
def ca_show_name
|
||||
if self.particular
|
||||
n = ""
|
||||
n += self.particular.organisation+" " if self.particular.organisation?
|
||||
|
||||
n += self.particular.firstname+" " if self.particular.firstname?
|
||||
n += self.particular.name+" " if self.particular.name?
|
||||
n += self.particular.firstname+" " if self.particular.firstname?
|
||||
return n
|
||||
end
|
||||
end
|
||||
|
||||
def ca_particular_name
|
||||
if self.particular
|
||||
self.particular.name+" " if self.particular.name?
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def ca_particular_firstname
|
||||
if self.particular
|
||||
self.particular.firstname+" " if self.particular.firstname?
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def show_name_extend
|
||||
if self.particular
|
||||
@ -547,4 +605,57 @@ class PCustomer < ApplicationRecord
|
||||
end
|
||||
|
||||
|
||||
|
||||
def csv_parent
|
||||
if self.parent
|
||||
self.parent.mlm_token.to_s+" - "+self.show_name.to_s
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def csv_mlm_token
|
||||
self.mlm_token if self.ambassadeur
|
||||
|
||||
end
|
||||
|
||||
|
||||
def csv_tel
|
||||
self.particular.tel if self.particular
|
||||
end
|
||||
|
||||
def csv_name
|
||||
self.particular.name if self.particular
|
||||
end
|
||||
|
||||
def csv_firstname
|
||||
self.particular.firstname if self.particular
|
||||
end
|
||||
|
||||
def csv_particular_address_2
|
||||
self.particular.address_2 if self.particular
|
||||
end
|
||||
|
||||
def csv_particular_address_3
|
||||
self.particular.address_3 if self.particular
|
||||
end
|
||||
|
||||
def csv_particular_cp
|
||||
self.particular.cp if self.particular
|
||||
end
|
||||
|
||||
def csv_particular_city
|
||||
self.particular.city if self.particular
|
||||
end
|
||||
|
||||
def csv_particular_country
|
||||
self.particular.country if self.particular
|
||||
end
|
||||
|
||||
|
||||
def csv_particular_tel
|
||||
self.particular.tel if self.particular
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
@ -100,4 +100,28 @@ class Particular < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
after_save do
|
||||
self.generate_hist
|
||||
end
|
||||
|
||||
def generate_hist(message = "Changement des coordonnées")
|
||||
|
||||
if self.owner_type == "PCustomer"
|
||||
particular_hist = ParticularHist.new(:p_customer_id => self.owner_id, :particular_id => self.id)
|
||||
|
||||
[:civilite, :name, :firstname, :address_2, :address_3, :cp, :city, :country, :tel, :email].each do |att|
|
||||
eval "particular_hist.#{att.to_s} = self.#{att.to_s}"
|
||||
end
|
||||
|
||||
particular_hist.description = message
|
||||
particular_hist.email = self.owner.email
|
||||
particular_hist.npai = self.owner.npai
|
||||
|
||||
particular_hist.save
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
29
app/models/particular_hist.rb
Normal file
29
app/models/particular_hist.rb
Normal file
@ -0,0 +1,29 @@
|
||||
class ParticularHist < ApplicationRecord
|
||||
belongs_to :particular
|
||||
belongs_to :p_customer
|
||||
|
||||
|
||||
acts_as_sorting :fields => {
|
||||
:id => {:name => "Id", :reorder => true},
|
||||
# :p_customer => {:name => "Client", :reorder => true, :sort_name => "p_customers.cc_show_name"},
|
||||
:created_at => {:name => "Date", :reorder => true},
|
||||
:npai => {:name => "NPAI ?", :reorder => true, :as => :boolean},
|
||||
:description => {:name => "Evenement", :reorder => true},
|
||||
|
||||
:civilite => {:name => "Civilité", :reorder => true},
|
||||
:name => {:name => "Nom", :reorder => true},
|
||||
:firstname => {:name => "Nom", :reorder => true},
|
||||
#:address_1 => {:name => "Nom", :reorder => true},
|
||||
:address_2 => {:name => "Adresse", :reorder => true},
|
||||
:address_3 => {:name => "Adresse suite", :reorder => true},
|
||||
:cp => {:name => "Code postal", :reorder => true},
|
||||
:city => {:name => "Ville", :reorder => true},
|
||||
:country => {:name => "Pays", :reorder => true},
|
||||
:tel => {:name => "Tel", :reorder => true},
|
||||
:email => {:name => "Email", :reorder => true},
|
||||
|
||||
#:actions => {:name => "Actions", :reorder => true},
|
||||
|
||||
}
|
||||
|
||||
end
|
@ -17,7 +17,7 @@
|
||||
.qi_kpi
|
||||
.kpi
|
||||
.number
|
||||
=PCustomer.where(:test_user => false).where("created_at >= ?", Date.today.beginning_of_day).count
|
||||
=PCustomer.where(:test_user => false, :enabled => true).where("created_at >= ?", Date.today.beginning_of_day).count
|
||||
|
||||
.label
|
||||
Inscriptions
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
.kpi
|
||||
.number
|
||||
=PCustomer.where(:test_user => false).where("created_at >= ? and created_at < ?",(Date.today.beginning_of_day-1.day), Date.today.beginning_of_day).count
|
||||
=PCustomer.where(:test_user => false, :enabled => true).where("created_at >= ? and created_at < ?",(Date.today.beginning_of_day-1.day), Date.today.beginning_of_day).count
|
||||
|
||||
.label
|
||||
Inscriptions
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
.kpi
|
||||
.number
|
||||
=PCustomer.where(:test_user => false).where("created_at >= ?", (Date.today - 7.day).beginning_of_day).count
|
||||
=PCustomer.where(:test_user => false, :enabled => true).where("created_at >= ?", (Date.today - 7.day).beginning_of_day).count
|
||||
|
||||
.label
|
||||
Inscriptions
|
||||
@ -47,7 +47,7 @@
|
||||
|
||||
.kpi
|
||||
.number
|
||||
=PCustomer.where(:test_user => false).where("created_at >= ?", (Date.today).beginning_of_year.beginning_of_day).count
|
||||
=PCustomer.where(:test_user => false, :enabled => true).where("created_at >= ?", (Date.today).beginning_of_year.beginning_of_day).count
|
||||
|
||||
.label
|
||||
Inscriptions
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
.kpi
|
||||
.number
|
||||
=PCustomer.where(:test_user => false).count
|
||||
=PCustomer.where(:test_user => false, :enabled => true).count
|
||||
|
||||
.label
|
||||
Utilisateurs
|
||||
|
@ -1,2 +1,2 @@
|
||||
%li= link_to "Stats générales", admin_p_stats_path
|
||||
%li= link_to "Export compta", admin_p_compta_exports_path
|
||||
-#%li= link_to "Export compta", admin_p_compta_exports_path
|
@ -0,0 +1,16 @@
|
||||
%tr#circuit_region_cat_row{:id => circuit_region_cat.id}
|
||||
-tr = {}
|
||||
|
||||
-tr[:actions] = capture do
|
||||
%td.actions
|
||||
= link_to i(:"trash-o"), [:admin, circuit_region_cat], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||
= link_to i(:pencil), edit_admin_circuit_region_cat_path(circuit_region_cat), :remote => true
|
||||
= link_to i(:eye), admin_circuit_region_cat_path(circuit_region_cat), :remote => true
|
||||
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => circuit_region_cat}
|
||||
|
||||
|
||||
|
||||
|
13
app/views/admin/circuit_region_cats/_form.html.haml
Normal file
13
app/views/admin/circuit_region_cats/_form.html.haml
Normal file
@ -0,0 +1,13 @@
|
||||
=semantic_form_for [:admin, @circuit_region_cat], :remote => true do |f|
|
||||
|
||||
.content
|
||||
=f.inputs do
|
||||
= f.input :name, :label => "name :"
|
||||
= f.input :position, :label => "position :"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
2
app/views/admin/circuit_region_cats/create.js.erb
Normal file
2
app/views/admin/circuit_region_cats/create.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#circuit_region_cats_rows').prepend("<%= escape_javascript(render(@circuit_region_cat))%>");
|
||||
close_pane_hover();
|
1
app/views/admin/circuit_region_cats/destroy.js.erb
Normal file
1
app/views/admin/circuit_region_cats/destroy.js.erb
Normal file
@ -0,0 +1 @@
|
||||
$('#circuit_region_cat_row_<%= @circuit_region_cat.id %>').remove();
|
1
app/views/admin/circuit_region_cats/edit.js.erb
Normal file
1
app/views/admin/circuit_region_cats/edit.js.erb
Normal file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
15
app/views/admin/circuit_region_cats/index.html.haml
Normal file
15
app/views/admin/circuit_region_cats/index.html.haml
Normal file
@ -0,0 +1,15 @@
|
||||
.qi_header
|
||||
.right= link_to ic(:plus)+' Ajouter', new_admin_circuit_region_cat_path(), :class => "btn btn-primary btn-ap-add", :remote => true
|
||||
%h1
|
||||
|
||||
|
||||
|
||||
.qi_search_row
|
||||
=form_tag "", :method => "get", :onsubmit => "" do
|
||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @circuit_region_cats}
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @circuit_region_cats}
|
||||
|
||||
|
||||
|
1
app/views/admin/circuit_region_cats/new.js.erb
Normal file
1
app/views/admin/circuit_region_cats/new.js.erb
Normal file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
10
app/views/admin/circuit_region_cats/show.html.haml
Normal file
10
app/views/admin/circuit_region_cats/show.html.haml
Normal file
@ -0,0 +1,10 @@
|
||||
.qi_header
|
||||
%h1
|
||||
|
||||
%span
|
||||
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding
|
||||
=debug @circuit_region_cat
|
2
app/views/admin/circuit_region_cats/update.js.erb
Normal file
2
app/views/admin/circuit_region_cats/update.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#circuit_region_cat_row_<%= @circuit_region_cat.id %>').replaceWith("<%= escape_javascript(render(@circuit_region_cat))%>");
|
||||
close_pane_hover();
|
@ -2,6 +2,7 @@
|
||||
|
||||
.content
|
||||
=f.inputs do
|
||||
= f.input :circuit_region_cat, :label => "Grande région :"
|
||||
= f.input :name, :label => "name :"
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
%tr.m_odr_product_remise_form.field
|
||||
%td{:style => "width:200px;"}= form.input :champ, :label => false, :as => :select, :collection => @import_csv.table_name.classify.constantize.import_csv_fields.map{|a| a.to_s}
|
||||
%td{:style => "width:200px;"}= form.input :champ, :label => false, :as => :select, :collection => @import_csv.table_source.classify.constantize.import_csv_fields.map{|a| a.to_s}
|
||||
|
||||
|
||||
-if !form.object.header? and @import_csv.import_csv_headers.all.map{|a| a.name}.include?(form.object.champ)
|
||||
|
@ -6,12 +6,12 @@
|
||||
= f.input :name, :label => "Nom de l'import :"
|
||||
= f.input :file, :label => "file :"
|
||||
|
||||
= f.input :table_name, :label => "Table :" , :as => :select, :collection => ["p_customers", "circuits", "organisateurs", "m_odr_product_sizes", "m_odr_places", "circuit_regions", "m_events", "departement_frances"]
|
||||
= f.input :table_name, :label => "Table :" , :as => :select, :collection => ["p_customers", "circuits", "organisateurs", "m_odr_product_sizes", "m_odr_places", "circuit_regions", "m_events", "departement_frances", "val_de_vienne"]
|
||||
|
||||
-if f.object.id
|
||||
%table.import_csv_champs_form
|
||||
-if f.object.import_csv_champs.count == 0
|
||||
-@import_csv.table_name.classify.constantize.import_csv_fields.each do |h|
|
||||
-@import_csv.table_source.classify.constantize.import_csv_fields.each do |h|
|
||||
-f.object.import_csv_champs.new(:champ => h.to_s)
|
||||
|
||||
=f.semantic_fields_for :import_csv_champs do |form|
|
||||
|
@ -8,3 +8,7 @@
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding
|
||||
=debug @import_csv
|
||||
|
||||
%table
|
||||
-@import_csv.import_csv_elements.all.each do |el|
|
||||
=render el.element if el.element
|
@ -9,8 +9,8 @@
|
||||
=render :partial => "qi/autocomplete", :locals => {:form => f, :field => :organisateur, :label => "Organisateur :"}
|
||||
|
||||
=# f.input :organisateur, :label => "Organisateur :", :member_label => :member_label, :collection => Organisateur.order("name").all
|
||||
= f.input :start_at, :label => "Date de début :", :as => :date
|
||||
= f.input :end_at, :label => "Date de fin :" , :as => :date
|
||||
= f.input :start_at, :label => "Date de début :", :as => :date, :input_html => {:id => "start_at_input"}
|
||||
= f.input :end_at, :label => "Date de fin :" , :as => :date, :input_html => {:id => "end_at_input"}
|
||||
= f.input :title, :label => "Titre :"
|
||||
= f.input :link, :label => "Lien réservation :"
|
||||
= f.input :description, :label => "Description :" , :input_html => {:class => "redactor_textarea"}
|
||||
@ -27,6 +27,10 @@
|
||||
|
||||
|
||||
|
||||
:coffeescript
|
||||
$("#start_at_input").focusout ->
|
||||
if $("#end_at_input").val() == ""
|
||||
$("#end_at_input").val($(this).val())
|
||||
|
||||
:javascript
|
||||
$(".redactor_textarea").redactor({
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
-tr[:actions] = capture do
|
||||
%td.actions
|
||||
=link_to i(:copy), new_admin_m_event_path(:parent_id => m_event.id), :remote => true
|
||||
|
||||
= link_to i(:"trash-o"), [:admin, m_event], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||
= link_to i(:pencil), edit_admin_m_event_path(m_event), :remote => true
|
||||
= link_to i(:eye), admin_m_event_path(m_event), :remote => true
|
||||
|
@ -1,6 +1,9 @@
|
||||
|
||||
%tr.m_odr_file_product_form.field
|
||||
%td
|
||||
|
||||
= form.input :admin_form, :as => :hidden
|
||||
|
||||
= form.input :m_odr_product_size_id, :label => "Produit :", :collection => option_groups_from_collection_for_select(MOdrProduct.all, :m_odr_product_sizes, :name, :id, :name, form.object.m_odr_product_size_id), :as => :select, :include_blank => false, :member_label => :member_label, :include_blank => "Choisissez le profil et la dimension"
|
||||
|
||||
|
||||
|
@ -1,11 +1,23 @@
|
||||
%tr.m_odr_file_roulage_form.field
|
||||
%td= form.input :date, :label => "date :" , :as => :date
|
||||
%td.td_roulage_date_input= form.input :date, :label => "date :" , :as => :date, :input_html => {:class => "roulage_date_input"}
|
||||
|
||||
-if form.object.date?
|
||||
%td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.order("start_at").where("start_at <= ? and end_at >= ?", form.object.date, form.object.date).all, :member_label => :member_label, :as => :select
|
||||
%td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.order("start_at").where("start_at <= ? and end_at >= ?", form.object.date, form.object.date).all, :member_label => :member_label, :as => :select, :input_html => {:class => "select_date_input"}
|
||||
|
||||
-else
|
||||
%td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.all, :member_label => :member_label, :as => :select
|
||||
%td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => [], :member_label => :member_label, :as => :select, :input_html => {:class => "select_date_input"}
|
||||
=#%td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.all, :member_label => :member_label, :as => :select
|
||||
|
||||
|
||||
%td.actions=link_to_remove_fields ic(:"trash-o"), form
|
||||
|
||||
|
||||
|
||||
:coffeescript
|
||||
|
||||
$("body").on "change", ".td_roulage_date_input input", ->
|
||||
obj = $(this)
|
||||
$.getJSON "/admin/m_events/autocomplete.json?date="+$(this).val(), (data) ->
|
||||
obj.closest(".field").find(".select_date_input").html("")
|
||||
$.each data, ->
|
||||
obj.closest(".field").find(".select_date_input").append '<option value="' + @id + '">' + @member_label + '</option>'
|
||||
|
@ -20,11 +20,13 @@
|
||||
-if f.object.m_odr_file_type_id == 2
|
||||
%table.m_odr_file_products_form.form-table
|
||||
= f.input :buy_at, :label => "Date de l'achat", :as => :date
|
||||
= f.input :m_odr_place, :label => "Revendeur :", :as => :date, :collection => MOdrPlace.order("enseigne ASC, name ASC, city ASC").all, :member_label => :member_label, :as => :select
|
||||
|
||||
=render :partial => "qi/autocomplete", :locals => {:form => f, :field => :m_odr_place, :label => "Revendeur :"}
|
||||
|
||||
=f.semantic_fields_for :m_odr_file_products do |form|
|
||||
=render :partial => "admin/m_odr_file_products/form", :locals => {:form => form}
|
||||
|
||||
%p= link_to_add_fields ic(:plus)+" Ajouter un produit", f, :m_odr_file_products
|
||||
%p= link_to_add_fields ic(:plus)+" Ajouter un produit", f, :m_odr_file_products, {:attributes => {:admin_form => true}}
|
||||
|
||||
|
||||
-else
|
||||
|
@ -9,6 +9,21 @@
|
||||
|
||||
|
||||
|
||||
%hr
|
||||
Historique des factures
|
||||
|
||||
-params[:search][:per_page] = params[:search][:per_page] || 50
|
||||
-per_page = params[:search][:per_page]
|
||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
-@m_odr_files = @m_odr_file.p_customer.m_odr_files.where("id != ?", @m_odr_file.id).where(:m_odr_file_type_id => @m_odr_file.m_odr_file_type_id )
|
||||
-@m_odr_files = @m_odr_files.where("created_at >= ? and created_at <= ?", @m_odr_file.created_at.beginning_of_year, @m_odr_file.created_at.end_of_year)
|
||||
-@m_odr_files = sort_by_sorting(@m_odr_files, "created_at DESC")
|
||||
-@m_odr_files = @m_odr_files.page(page).per(per_page)
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @m_odr_files}
|
||||
|
||||
.clear
|
||||
|
||||
.left{:style => "float:left;width:30%;"}
|
||||
=render :partial => "form"
|
||||
|
||||
@ -28,3 +43,6 @@
|
||||
#image_previ{:style => "width:100%;height:800px;border:1px solid gray;overflow:auto;"}
|
||||
=render :partial => "admin/m_odr_files/image", :locals => {:file => @m_odr_file}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -16,7 +16,8 @@
|
||||
-params[:search] =params[:search] || {}
|
||||
%table
|
||||
%tr
|
||||
%td
|
||||
%td=text_field_tag "search[name]", params[:search][:name],:class => "form-control", :placeholder => "Nom"
|
||||
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @m_odr_files}
|
||||
|
@ -12,7 +12,19 @@
|
||||
|
||||
|
||||
|
||||
Historique des factures
|
||||
|
||||
-params[:search][:per_page] = params[:search][:per_page] || 50
|
||||
-per_page = params[:search][:per_page]
|
||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
-@m_odr_files = @m_odr_file.p_customer.m_odr_files.where("id != ?", @m_odr_file.id).where(:m_odr_file_type_id => @m_odr_file.m_odr_file_type_id )
|
||||
-@m_odr_files = @m_odr_files.where("created_at >= ? and created_at <= ?", @m_odr_file.created_at.beginning_of_year, @m_odr_file.created_at.end_of_year)
|
||||
-@m_odr_files = sort_by_sorting(@m_odr_files, "created_at DESC")
|
||||
-@m_odr_files = @m_odr_files.page(page).per(per_page)
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @m_odr_files}
|
||||
|
||||
%hr
|
||||
|
||||
.left{:style => "float:left;width:30%;"}
|
||||
.qi_row
|
||||
@ -20,7 +32,7 @@
|
||||
%table.table
|
||||
%tr
|
||||
%td Utilisateur
|
||||
%td=@m_odr_file.p_customer.show_name if @m_odr_file.p_customer
|
||||
%td=link_to @m_odr_file.p_customer.show_name, [:admin, @m_odr_file.p_customer] if @m_odr_file.p_customer
|
||||
|
||||
%tr
|
||||
%td Date de la facture
|
||||
@ -65,9 +77,17 @@
|
||||
|
||||
%td
|
||||
=m_odr_file_roulage.m_event.title if m_odr_file_roulage.m_event
|
||||
-if @m_odr_file.admin_ok == true
|
||||
-if @m_odr_file.m_odr_file_type_id == 2
|
||||
=link_to ic(:envelope)+"Envoyer un mail demandant la facture de roulage", send_mail_admin_m_odr_file_path(@m_odr_file, :slug => "achat-manque-roulage"), :remote => false, :class => "btn btn-primary", :style => "margin-bottom:4px;"
|
||||
|
||||
-else
|
||||
-slugs = MailType.where(:mail_type_cat_id => 4).map{|m| m.slug}
|
||||
|
||||
-slugs.each do |slug|
|
||||
%br
|
||||
=link_to ic(:envelope)+" #{slug}", send_mail_admin_m_odr_file_path(@m_odr_file, :slug => slug), :remote => false, :class => "btn btn-primary", :style => "margin-bottom:4px;"
|
||||
|
||||
|
||||
-if @m_odr_file.admin_ok == false
|
||||
.red Facture refusée
|
||||
@ -85,6 +105,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#show{:style => "margin-left:31%;"}
|
||||
=link_to ic(:download)+" Télécharger le document", download_admin_m_odr_file_path(@m_odr_file, :disposition => "attachment")
|
||||
|
||||
@ -113,3 +134,6 @@ Historique des mails envoyés
|
||||
-@mail_hists = @mail_hists.page(page).per(per_page)
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @mail_hists}
|
||||
|
||||
|
||||
.clear
|
@ -1,14 +1,62 @@
|
||||
%tr#m_odr_prime_row{:id => m_odr_prime.id}
|
||||
-tr = {}
|
||||
|
||||
-tr[:p_customer] = capture do
|
||||
-tr[:particular_name] = capture do
|
||||
%td
|
||||
=link_to m_odr_prime.p_customer.show_name, [:admin, m_odr_prime.p_customer] if m_odr_prime.p_customer
|
||||
=link_to m_odr_prime.particular.name, [:admin, m_odr_prime.p_customer] if m_odr_prime.particular
|
||||
|
||||
-tr[:particular_firstname] = capture do
|
||||
%td
|
||||
=link_to m_odr_prime.particular.firstname, [:admin, m_odr_prime.p_customer] if m_odr_prime.particular
|
||||
|
||||
|
||||
-tr[:p_customer_created_at] = capture do
|
||||
%td
|
||||
=l m_odr_prime.p_customer.created_at if m_odr_prime.p_customer
|
||||
|
||||
-tr[:state] = capture do
|
||||
%td
|
||||
=state_helper(m_odr_prime.state)
|
||||
|
||||
-tr[:date_roulage] = capture do
|
||||
%td
|
||||
=l m_odr_prime.m_odr_file_roulage.date if m_odr_prime.m_odr_file_roulage
|
||||
|
||||
|
||||
|
||||
|
||||
-tr[:pneu_gamme] = capture do
|
||||
%td
|
||||
=m_odr_prime.m_odr_products.uniq.map{ |u| (u.name)}.join(" | ")
|
||||
|
||||
-tr[:m_odr_place_name] = capture do
|
||||
%td
|
||||
=m_odr_prime.m_odr_places.uniq.map{ |u| u.name}.join(" | ")
|
||||
|
||||
-tr[:m_odr_place_cp] = capture do
|
||||
%td
|
||||
=m_odr_prime.m_odr_places.uniq.map{ |u| u.cp}.join(" | ")
|
||||
|
||||
-tr[:m_odr_place_city] = capture do
|
||||
%td
|
||||
=m_odr_prime.m_odr_places.uniq.map{ |u| u.city}.join(" | ")
|
||||
|
||||
|
||||
-tr[:organisateur_name] = capture do
|
||||
%td
|
||||
=m_odr_prime.m_odr_file_roulage.m_event.organisateur.name if m_odr_prime.m_odr_file_roulage and m_odr_prime.m_odr_file_roulage.m_event and m_odr_prime.m_odr_file_roulage.m_event.organisateur
|
||||
|
||||
|
||||
-tr[:date_virement] = capture do
|
||||
%td
|
||||
-virement = m_odr_prime.m_odr_virements.where(:refused => 0, :sended => 1).order('id DESC').first
|
||||
-if virement and virement.m_odr_remise
|
||||
=l virement.m_odr_remise.created_at, :format => :date
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-tr[:actions] = capture do
|
||||
%td.actions
|
||||
|
@ -9,7 +9,20 @@
|
||||
|
||||
.qi_search_row
|
||||
=form_tag "", :method => "get", :onsubmit => "" do
|
||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @m_odr_primes}
|
||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @m_odr_primes, :csv => true}
|
||||
-params[:search] =params[:search] || {}
|
||||
|
||||
%table
|
||||
%tr
|
||||
%td=text_field_tag "search[name]", params[:search][:name],:class => "form-control", :placeholder => "Nom"
|
||||
|
||||
%td
|
||||
Statut :
|
||||
=select_tag "search[state]", options_for_select([["",""]]+MOdrPrime.group(:state).order(:state).all.map{|a| [a.state, a.state]}, params[:search][:state])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @m_odr_primes}
|
||||
@ -22,8 +35,8 @@
|
||||
-if true
|
||||
-#MOdrPrime.reset_primes
|
||||
|
||||
-PCustomer.all.each do |p_customer|
|
||||
-p_customer.generate_prime
|
||||
-#PCustomer.all.each do |p_customer|
|
||||
-#p_customer.generate_prime
|
||||
|
||||
|
||||
|
||||
|
@ -11,6 +11,21 @@
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding
|
||||
|
||||
Dernières primes versées au client
|
||||
|
||||
-params[:search][:per_page] = params[:search][:per_page] || 50
|
||||
-per_page = params[:search][:per_page]
|
||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
-@m_odr_primes = @m_odr_prime.p_customer.m_odr_primes.where("id != ? ", @m_odr_prime.id)
|
||||
-@m_odr_primes = sort_by_sorting(@m_odr_primes, "created_at DESC")
|
||||
-@m_odr_primes = @m_odr_primes.page(page).per(per_page)
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @m_odr_primes}
|
||||
|
||||
%hr
|
||||
|
||||
|
||||
#head=render :partial => "admin/m_odr_primes/head"
|
||||
|
||||
%h3
|
||||
@ -73,15 +88,20 @@
|
||||
%td
|
||||
= link_to i(:pencil), edit_admin_m_odr_file_path(m_odr_prime_file.m_odr_file), :remote => false
|
||||
|
||||
-if @m_odr_prime.state == "Erreur sur virement" and @m_odr_prime.m_odr_virements.where(:refused => false).count == 0
|
||||
=link_to "Générer le virement", generate_virement_admin_m_odr_prime_path(@m_odr_prime), :class => "btn btn-primary"
|
||||
|
||||
-if @m_odr_prime.state == "A traiter" and @m_odr_prime.m_odr_virements.where(:refused => false).count == 0
|
||||
-if @m_odr_prime.state == "A traiter" or @m_odr_prime.state == "Validé" or @m_odr_prime.state == "En attente de roulage" and @m_odr_prime.m_odr_virements.where(:refused => false).count == 0
|
||||
|
||||
-if @m_odr_prime.m_odr_file_roulage.date? and @m_odr_prime.m_odr_file_roulage.date <= Date.today
|
||||
=link_to "Générer le virement", generate_virement_admin_m_odr_prime_path(@m_odr_prime), :class => "btn btn-primary"
|
||||
-else
|
||||
|
||||
-if @m_odr_prime.state == "En attente de roulage"
|
||||
%span.btn.btn-default
|
||||
Vous pourrez générer le virement une fois la date de roulage passée.
|
||||
|
||||
-else
|
||||
=link_to 'Valider et passer au statut "en attente de roulage"', attente_roulage_admin_m_odr_prime_path(@m_odr_prime), :class => "btn btn-primary"
|
||||
%hr
|
||||
Virements
|
||||
|
||||
@ -113,3 +133,5 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -2,4 +2,4 @@
|
||||
%td= form.input :qte, :label => "Qté :"
|
||||
%td= form.input :amount, :label => "Montant :"
|
||||
|
||||
%td.actions=link_to_remove_fields ic(:"trash-o"), form
|
||||
%td=link_to_remove_fields ic(:"trash-o"), form
|
@ -1,15 +1,7 @@
|
||||
=semantic_form_for [:admin, @m_odr_product_size], :remote => true do |f|
|
||||
|
||||
.content
|
||||
=f.inputs do
|
||||
= f.input :name, :label => "name :"
|
||||
= f.input :position, :label => "position :"
|
||||
= f.input :m_odr_product, :label => "m_odr_product :"
|
||||
= f.input :sap, :label => "sap :"
|
||||
|
||||
|
||||
%tr.m_odr_product_remise_form.field
|
||||
%td{:style => "width:400px"}= form.input :name, :label => "Nom :"
|
||||
%td= form.input :sap, :label => "SAP :"
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
%td=link_to_remove_fields ic(:"trash-o"), form
|
@ -13,6 +13,14 @@
|
||||
%p= link_to_add_fields ic(:plus)+" Ajouter une remise", f, :m_odr_product_remises
|
||||
|
||||
|
||||
%table.m_odr_product_sizes_form
|
||||
|
||||
=f.semantic_fields_for :m_odr_product_sizes do |form|
|
||||
=render :partial => "admin/m_odr_product_sizes/form", :locals => {:form => form}
|
||||
|
||||
%p= link_to_add_fields ic(:plus)+" Ajouter une taille", f, :m_odr_product_sizes
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -18,6 +18,13 @@
|
||||
=state_helper("Refusé")
|
||||
|
||||
|
||||
-if !m_odr_rep_rib.mail_sended
|
||||
|
||||
-slug = "erreur-coordonnees-bancaire"
|
||||
=link_to ic(:envelope)+" #{slug}", send_mail_admin_m_odr_rep_rib_path(m_odr_rep_rib, :slug => slug), :remote => true, :class => "btn btn-primary"
|
||||
|
||||
|
||||
|
||||
-tr[:actions] = capture do
|
||||
%td.actions
|
||||
= link_to i(:"trash-o"), [:admin, m_odr_rep_rib], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||
|
2
app/views/admin/m_odr_rep_ribs/send_mail.js.erb
Normal file
2
app/views/admin/m_odr_rep_ribs/send_mail.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#m_odr_rep_rib_row_<%= @m_odr_rep_rib.id %>').replaceWith("<%= escape_javascript(render(@m_odr_rep_rib))%>");
|
||||
close_pane_hover();
|
@ -12,6 +12,9 @@
|
||||
-params[:search] =params[:search] || {}
|
||||
%table
|
||||
%tr
|
||||
%td=text_field_tag "search[name]", params[:search][:name],:class => "form-control", :placeholder => "Nom"
|
||||
|
||||
|
||||
%td
|
||||
Statut :
|
||||
=select_tag "search[state]", options_for_select([["",""]]+MOdrRep.group(:state).order(:state).all.map{|a| [a.state, a.state]}, params[:search][:state])
|
||||
|
@ -18,6 +18,13 @@
|
||||
= form.input :message
|
||||
= form.hidden_field :lang_site_id
|
||||
|
||||
-if current_admin.id == 1
|
||||
= form.input :tags
|
||||
-else
|
||||
%p
|
||||
-form.object.tags.split(",").each do |t|
|
||||
="[#{t}]"
|
||||
|
||||
|
||||
.actions=form.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
.content
|
||||
=f.inputs do
|
||||
|
||||
= f.input :public, :label => "Organisateur référencé ?"
|
||||
|
||||
= f.input :logo_id, :label => "Logo :", :as => :qi_image_select
|
||||
= f.input :image_file_id, :label => "Image :" , :as => :qi_image_select
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
.qi_search_row
|
||||
=form_tag "", :method => "get", :onsubmit => "" do
|
||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @organisateurs}
|
||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @organisateurs, :csv => true}
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @organisateurs}
|
||||
|
@ -40,9 +40,20 @@
|
||||
%br
|
||||
= form.input :test_user, :label => "Client test ?", :as => :boolean
|
||||
|
||||
.row.qi_cancel_margins
|
||||
.col-sm-4
|
||||
%br
|
||||
= form.input :unlimited, :label => "Nbr de primes déplafonné ?", :as => :boolean
|
||||
|
||||
.col-sm-4
|
||||
= form.object.import_name
|
||||
|
||||
.col-sm-4
|
||||
=l form.object.import_date if form.object.import_date
|
||||
|
||||
|
||||
= form.input :tel, :label => "Tel :"
|
||||
|
||||
=# form.input :tel, :label => "Tel :"
|
||||
= form.input :email, :label => "Email (login) :"
|
||||
= form.input :generate_mdp, :label => "Forcer la génération d'un nouveau mot de passe ? (un mail sera envoyé au client)", :as => :boolean
|
||||
|
||||
|
@ -6,6 +6,11 @@
|
||||
-if p_customer.enabled
|
||||
Oui
|
||||
|
||||
-tr[:test_user] = capture do
|
||||
%td
|
||||
-if p_customer.test_user
|
||||
Oui
|
||||
|
||||
-tr[:parent] = capture do
|
||||
%td
|
||||
-if p_customer.parent
|
||||
@ -19,6 +24,12 @@
|
||||
=p_customer.mlm_token
|
||||
|
||||
|
||||
-tr[:particular_tel] = capture do
|
||||
%td
|
||||
-if p_customer.particular
|
||||
=p_customer.particular.tel
|
||||
|
||||
|
||||
|
||||
-tr[:p_commercial] = capture do
|
||||
%td
|
||||
@ -27,12 +38,65 @@
|
||||
-tr[:p_customer_cat] = capture do
|
||||
%td= p_customer.p_customer_cat.name if p_customer.p_customer_cat
|
||||
|
||||
-tr[:particular] = capture do
|
||||
-tr[:particular_country] = capture do
|
||||
%td
|
||||
-if p_customer.particular
|
||||
= p_customer.particular.country
|
||||
|
||||
|
||||
-tr[:particular_address_2] = capture do
|
||||
%td
|
||||
-if p_customer.particular
|
||||
= p_customer.particular.address_2
|
||||
|
||||
-tr[:particular_address_3] = capture do
|
||||
%td
|
||||
-if p_customer.particular
|
||||
= p_customer.particular.address_3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-tr[:particular_cp] = capture do
|
||||
%td
|
||||
-if p_customer.particular
|
||||
= p_customer.particular.cp
|
||||
|
||||
|
||||
|
||||
-tr[:particular_city] = capture do
|
||||
%td
|
||||
-if p_customer.particular
|
||||
= p_customer.particular.city
|
||||
= p_customer.particular.country
|
||||
|
||||
|
||||
-tr[:name] = capture do
|
||||
%td
|
||||
-if p_customer.particular
|
||||
= p_customer.particular.name
|
||||
|
||||
|
||||
-tr[:firstname] = capture do
|
||||
%td
|
||||
-if p_customer.particular
|
||||
= p_customer.particular.firstname
|
||||
|
||||
-tr[:particular_fill] = capture do
|
||||
%td
|
||||
-if p_customer.particular_fill?
|
||||
Oui
|
||||
-elsif p_customer.particular_mail_sended == false
|
||||
-slug = "stickers-manque-adresse"
|
||||
=link_to ic(:envelope)+" #{slug}", send_mail_admin_p_customer_path(p_customer, :slug => slug), :remote => true, :class => "btn btn-primary"
|
||||
|
||||
-else
|
||||
Non (mail déjà envoyé)
|
||||
|
||||
|
||||
|
||||
|
||||
-tr[:actions] = capture do
|
||||
%td.actions
|
||||
@ -47,8 +111,10 @@
|
||||
-else
|
||||
-if current_admin.has_permission?("customers-d")
|
||||
= link_to i(:"trash-o"), [:admin, p_customer], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer ce client ? ' } , :remote => true if p_customer.can_destroy?
|
||||
-if current_admin.has_permission?("customers-d")
|
||||
-if current_admin.has_permission?("customers-u")
|
||||
= link_to i(:pencil), edit_admin_p_customer_path(p_customer), :remote => false
|
||||
-if current_admin.has_permission?("customers-npai")
|
||||
= link_to "NPAI", npai_admin_p_customer_path(p_customer), :remote => false
|
||||
-if current_admin.has_permission?("customers-s")
|
||||
= link_to i(:eye), admin_p_customer_path(p_customer)
|
||||
|
||||
|
@ -23,8 +23,13 @@
|
||||
%td=text_field_tag :code, params[:code],:class => "form-control", :placeholder => "Code client"
|
||||
|
||||
%td=text_field_tag :name, params[:name],:class => "form-control", :placeholder => "Nom"
|
||||
|
||||
%td=text_field_tag :email, params[:email],:class => "form-control", :placeholder => "Email"
|
||||
|
||||
|
||||
%td=text_field_tag :city, params[:city],:class => "form-control", :placeholder => "Ville"
|
||||
|
||||
|
||||
%td=text_field_tag :tel, params[:tel],:class => "form-control", :placeholder => "Tel"
|
||||
|
||||
|
||||
@ -50,15 +55,22 @@
|
||||
|
||||
%table
|
||||
%tr
|
||||
%td
|
||||
Actif :
|
||||
=select_tag "search[enabled]", options_for_select([[""], "Oui", "Non"], params[:search][:enabled])
|
||||
|
||||
%td
|
||||
Catégorie :
|
||||
=select_tag "search[p_customer_cat_id]", options_for_select([["",""],["Aucune","null"]]+PCustomerCat.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:p_customer_cat_id])
|
||||
Utilisateur test ?
|
||||
=select_tag "search[test_user]", options_for_select([[""], "Oui", "Non"], params[:search][:test_user])
|
||||
|
||||
-if !current_admin.p_commercial
|
||||
%td
|
||||
Commercial :
|
||||
=select_tag "search[p_commercial_id]", options_for_select([["",""],["Aucun","null"]]+PCommercial.order(:name).all.map{|a| [a.member_label, a.id]}, params[:search][:p_commercial_id])
|
||||
NPAI ?
|
||||
=select_tag "search[npai]", options_for_select([[""], "Oui", "Non"], params[:search][:npai])
|
||||
|
||||
%td
|
||||
Stickers envoyés ?
|
||||
=select_tag "search[sticker]", options_for_select([[""], "Oui", "Non"], params[:search][:sticker])
|
||||
|
||||
|
||||
|
||||
|
||||
@ -113,16 +125,8 @@
|
||||
|
||||
|
||||
|
||||
=link_to ic(:search)+" Rechercher", "#", :class => "btn btn-default btn-qi-search", :onclick => "$(this).closest('form').submit();$(this).html('...');return false;"
|
||||
|
||||
|
||||
.results_count
|
||||
="(#{@p_customers.total_count}) résultat(s)"
|
||||
|
||||
="-"
|
||||
|
||||
=select_tag "search[per_page]", options_for_select([50,100,200,500], params[:search][:per_page])
|
||||
résultats par page
|
||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_customers, :csv => true}
|
||||
|
||||
|
||||
|
||||
|
48
app/views/admin/p_customers/npai.html.haml
Normal file
48
app/views/admin/p_customers/npai.html.haml
Normal file
@ -0,0 +1,48 @@
|
||||
.qi_header
|
||||
.right{:style => "text-align:right;"}
|
||||
= link_to i(:pencil), edit_admin_p_customer_path(@p_customer), :remote => false
|
||||
|
||||
|
||||
|
||||
%h1
|
||||
Utilisateurs
|
||||
%span
|
||||
Historique des changements de coordonnées
|
||||
%span
|
||||
=@p_customer.code
|
||||
=@p_customer.show_name
|
||||
|
||||
|
||||
|
||||
|
||||
%br
|
||||
.qi_tab_header.qi_padding
|
||||
.right{:style => "text-align:right;"}
|
||||
-if @p_customer.npai
|
||||
= link_to "Lever le NPAI", toggle_npai_admin_p_customer_path(@p_customer), :remote => false, :class => "btn btn-success"
|
||||
|
||||
-else
|
||||
= link_to "Signaler le NPAI", toggle_npai_admin_p_customer_path(@p_customer), :remote => false, :class => "btn btn-danger"
|
||||
|
||||
|
||||
.clear
|
||||
|
||||
-params[:search][:per_page] = params[:search][:per_page] || 50
|
||||
-per_page = params[:search][:per_page]
|
||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
-@particular_hists =@p_customer.particular_hists
|
||||
-@particular_hists = sort_by_sorting(@particular_hists, "created_at DESC")
|
||||
-@particular_hists = @particular_hists.page(page).per(per_page)
|
||||
|
||||
=#debug MailHist.qi_ordered_table_name
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @particular_hists}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
2
app/views/admin/p_customers/send_mail.js.erb
Normal file
2
app/views/admin/p_customers/send_mail.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#p_customer_<%= @p_customer.id %>').replaceWith("<%= escape_javascript(render(@p_customer))%>");
|
||||
close_pane_hover();
|
@ -23,6 +23,10 @@
|
||||
Code ambassadeur :
|
||||
=@p_customer.mlm_token
|
||||
|
||||
%p
|
||||
Lien ambassadeur :
|
||||
=link_to new_public_p_customer_url(:a => @p_customer.mlm_token, :lang => "fr"), new_public_p_customer_url(:a => @p_customer.mlm_token, :lang => "fr"), :target => "_blank"
|
||||
|
||||
%p
|
||||
Email :
|
||||
=@p_customer.email
|
||||
|
34
app/views/admin/p_customers/update_stickers.html.haml
Normal file
34
app/views/admin/p_customers/update_stickers.html.haml
Normal file
@ -0,0 +1,34 @@
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding
|
||||
|
||||
=form_tag "", multipart: true do
|
||||
=file_field_tag :file
|
||||
%br
|
||||
=submit_tag "Mettre à jour les stickers", :class => "btn btn-primary"
|
||||
|
||||
|
||||
-if @data
|
||||
|
||||
%table.table
|
||||
-@data.each do |d|
|
||||
%tr
|
||||
%td
|
||||
=d["Nom"]
|
||||
%td
|
||||
=d["Prénom"]
|
||||
|
||||
-if p_customers = PCustomer.where("cc_particular_name = ? and cc_particular_firstname = ?", d["Nom"],d["Prénom"]) and p_customers.count == 1 and p_customer = p_customers.first
|
||||
%td
|
||||
=p_customer.cc_particular_name
|
||||
%td
|
||||
=p_customer.cc_particular_firstname
|
||||
-p_customer.sticker = true
|
||||
-p_customer.save
|
||||
|
||||
-else
|
||||
%td{:style => "color:red;font-weight:bold;"}
|
||||
=ic(:warning)
|
||||
Utilisateur introuvable
|
||||
|
||||
%td
|
||||
|
@ -46,183 +46,70 @@
|
||||
=link_to "Mois suivant >","?start=#{CGI.escape((@start + 1.month).beginning_of_month.strftime('%d/%m/%Y'))}&stop=#{CGI.escape((@stop + 1.month).end_of_month.strftime('%d/%m/%Y'))}", :class => "btn btn-default"
|
||||
|
||||
|
||||
%p
|
||||
-if @start and @stop
|
||||
=link_to "< Année précédente","?start=#{CGI.escape((@start - 1.year).beginning_of_month.strftime('%d/%m/%Y'))}&stop=#{CGI.escape((@stop - 1.year).end_of_month.strftime('%d/%m/%Y'))}", :class => "btn btn-default"
|
||||
-if @start and @stop
|
||||
=link_to "Année suivante >","?start=#{CGI.escape((@start + 1.year).beginning_of_month.strftime('%d/%m/%Y'))}&stop=#{CGI.escape((@stop + 1.year).end_of_month.strftime('%d/%m/%Y'))}", :class => "btn btn-default"
|
||||
|
||||
|
||||
%hr
|
||||
|
||||
|
||||
|
||||
|
||||
%h2
|
||||
=#raw("#{l(@start_at, :format => '%B %Y')}")
|
||||
%table.table
|
||||
%table.table.table-stripped
|
||||
%tr
|
||||
%td{:style => "width:50%;"}
|
||||
=l @start
|
||||
%td{:style => "width:50%;"}
|
||||
=l @stop
|
||||
|
||||
|
||||
%p
|
||||
Nombre de commandes finalisées :
|
||||
|
||||
=orders_ok = @finished.count
|
||||
-if false
|
||||
%table
|
||||
|
||||
-@finished.each do |ps|
|
||||
%th
|
||||
%th Nombre
|
||||
%th Montant
|
||||
%th Nbr pneus
|
||||
%tr
|
||||
%th Motards
|
||||
%td
|
||||
=PCustomer.where(:test_user => false, :enabled => true).where("created_at < ?", @stop).count
|
||||
%td
|
||||
=ps.a_ok_total
|
||||
%td
|
||||
=ps.a_total_cost_ok
|
||||
|
||||
%tr
|
||||
%th Organisateurs
|
||||
%td
|
||||
=Organisateur.where("created_at < ?", @stop).count
|
||||
%td
|
||||
%td
|
||||
|
||||
%tr
|
||||
%th Circuits
|
||||
%td
|
||||
=Circuit.where("created_at < ?", @stop).count
|
||||
%td
|
||||
%td
|
||||
|
||||
|
||||
%tr
|
||||
%th Dates
|
||||
%td
|
||||
-r = 0
|
||||
-MEvent.where("start_at >= ? and start_at < ? and created_at >= ? and created_at < ?",@start.beginning_of_year, @stop.end_of_year, @start.beginning_of_year, @stop).all.each do |m_event|
|
||||
-r+=(m_event.end_at - m_event.start_at ).to_i / (24 * 60 * 60) +1
|
||||
=r
|
||||
%td
|
||||
%td
|
||||
|
||||
%tr
|
||||
%th
|
||||
Primes
|
||||
%td
|
||||
=@all_m_odr_primes.count
|
||||
%td
|
||||
=number_to_currency @all_m_odr_primes.sum(:amount)
|
||||
|
||||
%td
|
||||
= @all_m_odr_primes.sum(:nbr_pneus)
|
||||
|
||||
%br
|
||||
%strong=number_to_percentage ((@finished.count*100)/@p_customer_sheets.count), :precision => 2 if @p_customer_sheets.count > 0
|
||||
|
||||
%p
|
||||
Nombre de commandes non finalisées :
|
||||
=orders_not_ok = (@p_customer_sheets.count - @finished.count)
|
||||
|
||||
%p
|
||||
CA HT :
|
||||
|
||||
%strong=number_to_currency @finished.sum(:a_ok_total)
|
||||
|
||||
-if @sans_marges.count > 0
|
||||
%p{:style => "color:red;"}
|
||||
Attention : le calcul des marges est faussé car certaines factures fournisseurs semblent ne pas être saisies, et donc certaines commandes n'ont pas pu être attribuées.
|
||||
%p
|
||||
Coût estimé HT :
|
||||
-cout = @finished.sum(:a_total_cost_ok)
|
||||
%strong=number_to_currency cout
|
||||
|
||||
%p
|
||||
Marge estimée HT :
|
||||
-marge = @finished.sum(:a_ok_total) - @finished.sum(:a_total_cost_ok)
|
||||
%strong=number_to_currency(marge)
|
||||
%br
|
||||
%strong=number_to_percentage ((@finished.sum(:a_ok_total) - @finished.sum(:a_total_cost_ok))/@finished.sum(:a_ok_total)*100), :precision => 2 if @finished.sum(:a_ok_total) > 0.0
|
||||
|
||||
|
||||
%div{:style => "width:350px;display:inline-block;"}
|
||||
<canvas id="ordersChart" width="400" height="400"></canvas>
|
||||
|
||||
|
||||
|
||||
:javascript
|
||||
var myPieChart = new Chart("ordersChart",{
|
||||
type: 'pie',
|
||||
data: {
|
||||
labels: ["Finalisées", "Non finalisées"],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [#{orders_ok},#{orders_not_ok}],
|
||||
backgroundColor: [
|
||||
'#4BC0C0',
|
||||
'#FF6384',
|
||||
=link_to "Export Excel", params.permit!.merge({:format => :csv})
|
||||
|
||||
],
|
||||
borderColor: [
|
||||
'white',
|
||||
'white',
|
||||
|
||||
],
|
||||
borderWidth: 2
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Finalisation des commandes'
|
||||
}
|
||||
}
|
||||
// options: options
|
||||
});
|
||||
|
||||
|
||||
%div{:style => "width:350px;display:inline-block;"}
|
||||
<canvas id="margeChart" width="400" height="400"></canvas>
|
||||
=#debug MailHist.qi_ordered_table_name
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @m_odr_primes}
|
||||
|
||||
|
||||
|
||||
:javascript
|
||||
var myPieChart = new Chart("margeChart",{
|
||||
type: 'pie',
|
||||
data: {
|
||||
labels: ["Marge", "Cout"],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [#{marge},#{cout}],
|
||||
backgroundColor: [
|
||||
'#4BC0C0',
|
||||
'#FF6384',
|
||||
|
||||
],
|
||||
borderColor: [
|
||||
'white',
|
||||
'white',
|
||||
|
||||
],
|
||||
borderWidth: 2
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Marges'
|
||||
}
|
||||
}
|
||||
// options: options
|
||||
});
|
||||
|
||||
|
||||
-if false
|
||||
<canvas id="myChart" width="400" height="200"></canvas>
|
||||
|
||||
:javascript
|
||||
var ctx = document.getElementById("myChart");
|
||||
var myChart = new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [12, 19, 3, 5, 2, 3],
|
||||
backgroundColor: [
|
||||
'rgba(255, 99, 132, 0.2)',
|
||||
'rgba(54, 162, 235, 0.2)',
|
||||
'rgba(255, 206, 86, 0.2)',
|
||||
'rgba(75, 192, 192, 0.2)',
|
||||
'rgba(153, 102, 255, 0.2)',
|
||||
'rgba(255, 159, 64, 0.2)'
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(255,99,132,1)',
|
||||
'rgba(54, 162, 235, 1)',
|
||||
'rgba(255, 206, 86, 1)',
|
||||
'rgba(75, 192, 192, 1)',
|
||||
'rgba(153, 102, 255, 1)',
|
||||
'rgba(255, 159, 64, 1)'
|
||||
],
|
||||
borderWidth: 0
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero:true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
28
app/views/admin/particular_hists/_form.html.haml
Normal file
28
app/views/admin/particular_hists/_form.html.haml
Normal file
@ -0,0 +1,28 @@
|
||||
=semantic_form_for [:admin, @particular_hist], :remote => true do |f|
|
||||
|
||||
.content
|
||||
=f.inputs do
|
||||
= f.input :particular, :label => "particular :"
|
||||
= f.input :p_customer, :label => "p_customer :"
|
||||
= f.input :description, :label => "description :"
|
||||
= f.input :name, :label => "name :"
|
||||
= f.input :firstname, :label => "firstname :"
|
||||
= f.input :address_1, :label => "address_1 :"
|
||||
= f.input :address_2, :label => "address_2 :"
|
||||
= f.input :address_3, :label => "address_3 :"
|
||||
= f.input :address_4, :label => "address_4 :"
|
||||
= f.input :address_5, :label => "address_5 :"
|
||||
= f.input :cp, :label => "cp :"
|
||||
= f.input :city, :label => "city :"
|
||||
= f.input :country, :label => "country :"
|
||||
= f.input :tel, :label => "tel :"
|
||||
= f.input :email, :label => "email :"
|
||||
= f.input :civilite, :label => "civilite :"
|
||||
= f.input :npai, :label => "npai :"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
16
app/views/admin/particular_hists/_particular_hist.html.haml
Normal file
16
app/views/admin/particular_hists/_particular_hist.html.haml
Normal file
@ -0,0 +1,16 @@
|
||||
%tr#particular_hist_row{:id => particular_hist.id}
|
||||
-tr = {}
|
||||
|
||||
-tr[:actions] = capture do
|
||||
%td.actions
|
||||
= link_to i(:"trash-o"), [:admin, particular_hist], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||
= link_to i(:pencil), edit_admin_particular_hist_path(particular_hist), :remote => true
|
||||
= link_to i(:eye), admin_particular_hist_path(particular_hist), :remote => true
|
||||
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => particular_hist}
|
||||
|
||||
|
||||
|
||||
|
2
app/views/admin/particular_hists/create.js.erb
Normal file
2
app/views/admin/particular_hists/create.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#particular_hists_rows').prepend("<%= escape_javascript(render(@particular_hist))%>");
|
||||
close_pane_hover();
|
1
app/views/admin/particular_hists/destroy.js.erb
Normal file
1
app/views/admin/particular_hists/destroy.js.erb
Normal file
@ -0,0 +1 @@
|
||||
$('#particular_hist_row_<%= @particular_hist.id %>').remove();
|
1
app/views/admin/particular_hists/edit.js.erb
Normal file
1
app/views/admin/particular_hists/edit.js.erb
Normal file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
15
app/views/admin/particular_hists/index.html.haml
Normal file
15
app/views/admin/particular_hists/index.html.haml
Normal file
@ -0,0 +1,15 @@
|
||||
.qi_header
|
||||
.right= link_to ic(:plus)+' Ajouter', new_admin_particular_hist_path(), :class => "btn btn-primary btn-ap-add", :remote => true
|
||||
%h1
|
||||
|
||||
|
||||
|
||||
.qi_search_row
|
||||
=form_tag "", :method => "get", :onsubmit => "" do
|
||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @particular_hists}
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @particular_hists}
|
||||
|
||||
|
||||
|
1
app/views/admin/particular_hists/new.js.erb
Normal file
1
app/views/admin/particular_hists/new.js.erb
Normal file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
10
app/views/admin/particular_hists/show.html.haml
Normal file
10
app/views/admin/particular_hists/show.html.haml
Normal file
@ -0,0 +1,10 @@
|
||||
.qi_header
|
||||
%h1
|
||||
|
||||
%span
|
||||
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding
|
||||
=debug @particular_hist
|
2
app/views/admin/particular_hists/update.js.erb
Normal file
2
app/views/admin/particular_hists/update.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#particular_hist_row_<%= @particular_hist.id %>').replaceWith("<%= escape_javascript(render(@particular_hist))%>");
|
||||
close_pane_hover();
|
@ -26,5 +26,5 @@
|
||||
|
||||
=form.input :country, :label => false, :placeholder => "Pays", :priority_countries => ["FR", "CH", "BE"], :include_blank => false, :locale => @lang.slug
|
||||
=#form.input :email, :label => false, :placeholder => qit("don-particular-email","Email")
|
||||
=#form.input :tel, :label => false, :placeholder => qit("don-particular-phone","Téléphone")
|
||||
=form.input :tel, :label => false, :placeholder => qit("don-particular-phone","Téléphone")
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
|
||||
.element
|
||||
-if current_admin.has_permission?("CMS")
|
||||
=link_to admin_menu_items_path(:menu_id => 1) do
|
||||
.cat#big_cat_ventes
|
||||
=ic :"globe"
|
||||
@ -68,7 +69,14 @@
|
||||
=ic :"file-text-o"
|
||||
Documents
|
||||
|
||||
-if current_admin.has_permission?("virements.view")
|
||||
|
||||
-if current_admin.has_permission?("primes")
|
||||
.element
|
||||
=link_to admin_m_odr_files_path do
|
||||
.cat#big_cat_payments
|
||||
=ic :"eur"
|
||||
Primes
|
||||
-elsif current_admin.has_permission?("virements.view")
|
||||
.element
|
||||
=link_to admin_m_odr_virements_path do
|
||||
.cat#big_cat_payments
|
||||
@ -85,7 +93,7 @@
|
||||
Tunnels fichier sécurisés
|
||||
|
||||
|
||||
-if false
|
||||
-if current_admin.has_permission?("statistiques")
|
||||
.element
|
||||
=link_to admin_p_stats_path do
|
||||
.cat#big_cat_statistiques
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user