Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
2a6fc4cce6
1
.gitignore
vendored
1
.gitignore
vendored
@ -42,5 +42,6 @@ yarn-debug.log*
|
|||||||
/pdf/*
|
/pdf/*
|
||||||
|
|
||||||
/.sass_cache/*
|
/.sass_cache/*
|
||||||
|
/.sass-cache/*
|
||||||
/test*
|
/test*
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -224,7 +224,9 @@ GEM
|
|||||||
mime-types (3.3.1)
|
mime-types (3.3.1)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2019.1009)
|
mime-types-data (3.2019.1009)
|
||||||
mimemagic (0.3.5)
|
mimemagic (0.3.10)
|
||||||
|
nokogiri (~> 1)
|
||||||
|
rake
|
||||||
mini_magick (4.10.1)
|
mini_magick (4.10.1)
|
||||||
mini_mime (1.0.2)
|
mini_mime (1.0.2)
|
||||||
mini_portile2 (2.4.0)
|
mini_portile2 (2.4.0)
|
||||||
|
@ -20,7 +20,7 @@ class MOdrFile < ApplicationRecord
|
|||||||
|
|
||||||
mount_uploader :file, OdrUploader
|
mount_uploader :file, OdrUploader
|
||||||
|
|
||||||
validates :file, :presence => true
|
validates :file, :presence => true, :if => :file_needed?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -28,6 +28,31 @@ class MOdrFile < ApplicationRecord
|
|||||||
|
|
||||||
validates :buy_at, :presence => true, :if => :buy_at_needed?
|
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?
|
def buy_at_needed?
|
||||||
true if self.m_odr_file_type_id == 2
|
true if self.m_odr_file_type_id == 2
|
||||||
end
|
end
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
%h3
|
%h3
|
||||||
=link_to m_event.m_event_type_title, public_m_events_path(:search => {:m_event_type_title => [m_event.m_event_type_title]})
|
=link_to m_event.m_event_type_title, public_m_events_path(:search => {:m_event_type_title => [m_event.m_event_type_title]})
|
||||||
="-"
|
="-"
|
||||||
=link_to m_event.circuit.name, public_m_events_path(:search => {:circuit_id => m_event.circuit.id})
|
=link_to m_event.circuit.name, public_circuit_path(:id => m_event.circuit.slug)
|
||||||
|
|
||||||
%span.date
|
%span.date
|
||||||
-if m_event.start_at.to_date == m_event.end_at.to_date
|
-if m_event.start_at.to_date == m_event.end_at.to_date
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
=link_to "Modifier mes coordonnées", edit_public_particular_path(current_p_customer.particular)
|
=link_to "Modifier mes coordonnées", edit_public_particular_path(current_p_customer.particular)
|
||||||
|
|
||||||
%p
|
%p
|
||||||
-if current_p_customer.sticker
|
-if false #current_p_customer.sticker
|
||||||
%br
|
%br
|
||||||
%span.green
|
%span.green
|
||||||
=ic :flag
|
=ic :flag
|
||||||
@ -186,8 +186,10 @@
|
|||||||
|
|
||||||
.doc_pannel
|
.doc_pannel
|
||||||
|
|
||||||
%h3 Mes factures de pneus
|
%h3
|
||||||
-if m_odr_files = current_p_customer.m_odr_files.where(:m_odr_file_type_id => 2) and m_odr_files.count > 0
|
Mes factures de pneus
|
||||||
|
=Date.today.year
|
||||||
|
-if m_odr_files = current_p_customer.m_odr_files.where(:m_odr_file_type_id => 2).where("cc_doc_date >= ? and cc_doc_date <= ?", Date.today.beginning_of_year, Date.today.end_of_year) and m_odr_files.count > 0
|
||||||
%table.table
|
%table.table
|
||||||
=render m_odr_files
|
=render m_odr_files
|
||||||
|
|
||||||
@ -199,8 +201,10 @@
|
|||||||
= link_to 'Envoyer une facture de pneus', new_public_m_odr_file_path(:m_odr_file_type_id => 2), :class => "new_btn"
|
= link_to 'Envoyer une facture de pneus', new_public_m_odr_file_path(:m_odr_file_type_id => 2), :class => "new_btn"
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
%h3 Mes journées de roulages
|
%h3
|
||||||
-if m_odr_files = current_p_customer.m_odr_files.where(:m_odr_file_type_id => 1) and m_odr_files.count > 0
|
Mes journées de roulages
|
||||||
|
=Date.today.year
|
||||||
|
-if m_odr_files = current_p_customer.m_odr_files.where(:m_odr_file_type_id => 1).where("cc_doc_date >= ? and cc_doc_date <= ?", Date.today.beginning_of_year, Date.today.end_of_year) and m_odr_files.count > 0
|
||||||
%table.table
|
%table.table
|
||||||
=render m_odr_files
|
=render m_odr_files
|
||||||
-else
|
-else
|
||||||
|
12
db/migrate/20220111154814_add_cc_doc_date_to_m_odr_files.rb
Normal file
12
db/migrate/20220111154814_add_cc_doc_date_to_m_odr_files.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
class AddCcDocDateToMOdrFiles < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
add_column :m_odr_files, :cc_doc_date, :date
|
||||||
|
add_column :m_odr_files, :ac_doc_date, :date
|
||||||
|
|
||||||
|
MOdrFile.all.each do |odr|
|
||||||
|
odr.save
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2021_07_01_095917) do
|
ActiveRecord::Schema.define(version: 2022_01_11_154814) do
|
||||||
|
|
||||||
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
@ -790,6 +790,8 @@ ActiveRecord::Schema.define(version: 2021_07_01_095917) do
|
|||||||
t.integer "nbr_primes"
|
t.integer "nbr_primes"
|
||||||
t.integer "nbr_primes_useds"
|
t.integer "nbr_primes_useds"
|
||||||
t.integer "nbr_primes_not_useds"
|
t.integer "nbr_primes_not_useds"
|
||||||
|
t.date "cc_doc_date"
|
||||||
|
t.date "ac_doc_date"
|
||||||
t.index ["m_odr_file_type_id"], name: "index_m_odr_files_on_m_odr_file_type_id"
|
t.index ["m_odr_file_type_id"], name: "index_m_odr_files_on_m_odr_file_type_id"
|
||||||
t.index ["m_odr_rep_id"], name: "index_m_odr_files_on_m_odr_rep_id"
|
t.index ["m_odr_rep_id"], name: "index_m_odr_files_on_m_odr_rep_id"
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user