Compare commits

..

No commits in common. "e2e2f6cab350582932b808c0773d7e890bf8f4d2" and "b77c13cf36f56543097b699053a69956af1f94ed" have entirely different histories.

5 changed files with 26 additions and 103 deletions

View File

@ -23,71 +23,6 @@ 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

View File

@ -454,7 +454,28 @@ class Admin::PCustomersController < ApplicationController
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
def show
@p_customer = PCustomer.find(params[:id])

View File

@ -162,29 +162,6 @@ 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
@ -263,7 +240,5 @@ class ApplicationController < ActionController::Base
helper_method :current_admin, :get_specific_pref, :sort_by_sorting, :current_p_customer
end

View File

@ -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, :csv => true}
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @organisateurs}
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @organisateurs}

View File

@ -128,7 +128,8 @@
.clear
-c = current_p_customer.m_odr_primes.where(:state => ["En attente de roulage", "Virement envoyé"]).count
-ca = current_p_customer.m_odr_primes.where(:state => ["En attente de roulage"]).count
@ -171,16 +172,7 @@
.empty
Pour obtenir des primes déposez vos factures d'achat et de roulage
.alert.alert-primary{:style => "text-align:center;"}
Rendez-vous en 2021 pour obtenir vos primes. ❄️☃️ Joyeuses fêtes de fin dannée ! ☃️❄️
:scss
.alert-primary {
color: #004085;
background-color: #cce5ff;
border-color: #b8daff;
}
.doc_pannel
%h3 Mes factures de pneus