suite
This commit is contained in:
parent
7a1ea4f4c1
commit
91722c7262
@ -11,7 +11,7 @@ class Admin::MOdrPrimesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@m_odr_primes = MOdrPrime.all
|
@m_odr_primes = MOdrPrime.joins(:p_customer).all
|
||||||
|
|
||||||
@m_odr_primes = sort_by_sorting(@m_odr_primes, "id DESC")
|
@m_odr_primes = sort_by_sorting(@m_odr_primes, "id DESC")
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -59,7 +59,7 @@ class Circuit < ApplicationRecord
|
|||||||
|
|
||||||
|
|
||||||
before_save do
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -15,6 +15,9 @@ class MOdrFileRoulage < ApplicationRecord
|
|||||||
|
|
||||||
def generate_prime
|
def generate_prime
|
||||||
prime_ids = []
|
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 nbr_primes_to_use = self.nbr_primes_not_useds and nbr_primes_to_use > 0
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +53,7 @@ class MOdrFileRoulage < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
prime_ids = prime_ids.uniq
|
prime_ids = prime_ids.uniq
|
||||||
|
|
||||||
|
@ -14,13 +14,16 @@ class MOdrPrime < ApplicationRecord
|
|||||||
|
|
||||||
acts_as_sorting :fields => {
|
acts_as_sorting :fields => {
|
||||||
:id => {:name => "Id", :reorder => true},
|
:id => {:name => "Id", :reorder => true},
|
||||||
:p_customer => {:name => "Client"},
|
:p_customer => {:name => "Client", :reorder => true, :sort_name => "p_customers.cc_show_name"},
|
||||||
:state => {:name => "Statut", :reorder => true},
|
:state => {:name => "Statut", :reorder => true},
|
||||||
:amount => {:name => "Montant"},
|
:amount => {:name => "Montant"},
|
||||||
:actions => {:name => "Actions", :reorder => true},
|
:actions => {:name => "Actions", :reorder => true},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
before_validation do
|
before_validation do
|
||||||
|
|
||||||
self.nbr_pneus = 0
|
self.nbr_pneus = 0
|
||||||
|
@ -43,7 +43,7 @@ class Organisateur < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
before_save do
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -73,6 +73,9 @@ class PCustomer < ApplicationRecord
|
|||||||
|
|
||||||
validates :past_id, :uniqueness => true, :if => :imported
|
validates :past_id, :uniqueness => true, :if => :imported
|
||||||
|
|
||||||
|
acts_as_caching :fields => [:show_name]
|
||||||
|
|
||||||
|
|
||||||
attr_accessor :refresh_import
|
attr_accessor :refresh_import
|
||||||
|
|
||||||
def do_import
|
def do_import
|
||||||
@ -249,7 +252,7 @@ class PCustomer < ApplicationRecord
|
|||||||
def self.qi_table_order
|
def self.qi_table_order
|
||||||
{
|
{
|
||||||
:created_at => {:name => "Date de création", :reorder => true, :as => :date},
|
:created_at => {:name => "Date de création", :reorder => true, :as => :date},
|
||||||
:show_name => "Nom",
|
:cc_show_name => {:name => "Nom", :reorder => true},
|
||||||
:mlm_token => {:name => "Code ambassadeur", :reorder => true},
|
:mlm_token => {:name => "Code ambassadeur", :reorder => true},
|
||||||
:enabled => "Actif ?",
|
:enabled => "Actif ?",
|
||||||
:parent => "Ambassadeur",
|
:parent => "Ambassadeur",
|
||||||
@ -262,7 +265,7 @@ class PCustomer < ApplicationRecord
|
|||||||
|
|
||||||
def self.valid_sort
|
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", "created_at", "cache_encours_th", "cache_encours", "cache_payments_th", "cache_payments", "cache_payments_tot", "cache_ca"]
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -470,7 +473,7 @@ class PCustomer < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def show_name
|
def ca_show_name
|
||||||
if self.particular
|
if self.particular
|
||||||
n = ""
|
n = ""
|
||||||
n += self.particular.organisation+" " if self.particular.organisation?
|
n += self.particular.organisation+" " if self.particular.organisation?
|
||||||
|
@ -107,6 +107,19 @@
|
|||||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @mail_hists}
|
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @mail_hists}
|
||||||
|
|
||||||
|
|
||||||
|
%hr
|
||||||
|
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}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
11
db/migrate/20200715113020_add_name_cache_to_p_customers.rb
Normal file
11
db/migrate/20200715113020_add_name_cache_to_p_customers.rb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
class AddNameCacheToPCustomers < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
add_column :p_customers, :cc_show_name, :string
|
||||||
|
add_column :p_customers, :ac_show_name, :string
|
||||||
|
|
||||||
|
PCustomer.all.each do |pc|
|
||||||
|
pc.save
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
348
db/schema.rb
348
db/schema.rb
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user