Case personnalisée et double fichier
This commit is contained in:
parent
77e6847052
commit
913af8a1fd
@ -4,7 +4,7 @@ class MOdrFile < ApplicationRecord
|
||||
|
||||
mount_uploader :file, OdrUploader
|
||||
|
||||
validates :file, :presence => true
|
||||
validates :file, :presence => true, :if => :file_needed?
|
||||
|
||||
|
||||
before_create { generate_token() }
|
||||
@ -15,6 +15,19 @@ class MOdrFile < ApplicationRecord
|
||||
end while MOdrFile.exists?(:token => self[:token])
|
||||
end
|
||||
|
||||
def file_needed?
|
||||
|
||||
if self.m_odr_file_type&.need_file
|
||||
|
||||
true
|
||||
|
||||
else
|
||||
false
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
def rotate(degrees=90)
|
||||
|
@ -35,6 +35,7 @@ class MOdrRep < ApplicationRecord
|
||||
validates :m_odr_place_id, :presence => true
|
||||
|
||||
validates :rgpd, :presence => true, :if => :rgpd_needed?
|
||||
validates :custom_case, :presence => true, :if => :custom_case_needed?
|
||||
|
||||
validates :reduc_code, :presence => true, :if => :reduc_code_needed? #length: { in: 6..6 },
|
||||
|
||||
@ -47,6 +48,15 @@ class MOdrRep < ApplicationRecord
|
||||
|
||||
|
||||
|
||||
def custom_case_needed?
|
||||
if self.m_odr.custom_case_needed
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def reduc_needed?
|
||||
if self.m_odr.reduc_needed
|
||||
@ -118,7 +128,7 @@ file_admin_ok remise particular_civilite particular_name particular_firstname pa
|
||||
end
|
||||
|
||||
def ca_file_admin_ok
|
||||
if self.m_odr_files.where(:admin_ok => true).count > 0
|
||||
if self.m_odr_files.where(:admin_ok => true).count == self.m_odr_files.count
|
||||
true
|
||||
else
|
||||
false
|
||||
@ -317,6 +327,7 @@ file_admin_ok remise particular_civilite particular_name particular_firstname pa
|
||||
:cc_place_name => {:name => "Revendeur", :reorder => true},
|
||||
|
||||
:reduc_code => {:name => "Code réduction", :reorder => true},
|
||||
:custom_case => {:name => "Case personnalisée", :reorder => true, :as => :boolean},
|
||||
|
||||
:ba_number => {:name => "N° bon de réduction", :reorder => true},
|
||||
:ba_used => {:name => "Bon utilisé ?", :reorder => true, :as => :boolean},
|
||||
|
@ -32,6 +32,17 @@
|
||||
%td
|
||||
=@m_odr_rep.reduc_code
|
||||
|
||||
-if @m_odr_rep.m_odr.custom_case
|
||||
%tr
|
||||
%td
|
||||
Case personnalisée cochée
|
||||
="(#{@m_odr_rep.m_odr.custom_case_label})"
|
||||
|
||||
%td
|
||||
-if @m_odr_rep.custom_case
|
||||
Oui
|
||||
-else
|
||||
Non
|
||||
|
||||
|
||||
|
||||
@ -48,7 +59,12 @@
|
||||
|
||||
Fichier
|
||||
-@m_odr_rep.m_odr_files.order("id DESC").each do |file|
|
||||
-if file.file? and file.file.path.present?
|
||||
%table.table.table-striped.table-hover.table-bordered
|
||||
%tr
|
||||
%td Type
|
||||
%td
|
||||
=file.m_odr_file_type.name if file.m_odr_file_type
|
||||
%tr
|
||||
%td Etat
|
||||
%td
|
||||
|
@ -44,12 +44,13 @@
|
||||
|
||||
|
||||
.columns.span_8{:style => "padding-left:20px;"}
|
||||
-file = @m_odr_rep.m_odr_files.order("id DESC").first
|
||||
-if file
|
||||
-file = @m_odr_rep.m_odr_files.order("id DESC").each do |file|
|
||||
-if file.file and file.file.path.present?
|
||||
|
||||
=link_to ic(:download)+" Télécharger le document", download_admin_m_odr_file_path(file, :disposition => "attachment")
|
||||
|
||||
|
||||
-if File.extname(file.file.path) == ".pdf" || File.extname(file.file.path) == ".PDF"
|
||||
-if file.file and file.file.path.present? and File.extname(file.file.path) == ".pdf" || File.extname(file.file.path) == ".PDF"
|
||||
|
||||
%iframe{:src => file.file.url, :style => "width:100%;height:800px;border:1px solid gray;"}
|
||||
|
||||
|
@ -79,6 +79,9 @@
|
||||
|
||||
= f.input :confirm_case_needed, :label => "Case de confirmation obligatoire ?"
|
||||
|
||||
= f.input :custom_case, :label => "Case personnalisée ?"
|
||||
= f.input :custom_case_needed, :label => "Case personnalisée obligatoire ?"
|
||||
|
||||
|
||||
= f.input :product_process, :label => "Produit ?"
|
||||
= f.input :product_needed, :label => "Obligatoire ?"
|
||||
@ -94,6 +97,7 @@
|
||||
= f.input :name_label, :label => "Label nom :"
|
||||
= f.input :firstname_label, :label => "Label prénom :"
|
||||
= f.input :confirm_case_label, :label => "Label case de confirmation :"
|
||||
= f.input :custom_case_label, :label => "Label case personnalisée :"
|
||||
= f.input :product_cat_label, :label => "Label catégorie produit :"
|
||||
= f.input :product_label, :label => "Label produit :"
|
||||
= f.input :qte_label, :label => "Label quantité :"
|
||||
|
@ -193,6 +193,11 @@
|
||||
-if @m_odr_rep.m_odr.confirm_case_needed
|
||||
=f.input :rgpd, :label => (@m_odr_rep.m_odr.confirm_case_label? ? @m_odr_rep.m_odr.confirm_case_label : "J'accepte les conditions générales")
|
||||
|
||||
-if @m_odr_rep.m_odr.custom_case
|
||||
=f.input :custom_case, :label => (@m_odr_rep.m_odr.custom_case_label? ? @m_odr_rep.m_odr.custom_case_label : "")
|
||||
|
||||
|
||||
|
||||
-if @m_odr_rep.m_odr.buy_infos?
|
||||
.buy_infos{:style => "text-align:center"}=simple_format @m_odr_rep.m_odr.buy_infos
|
||||
%br
|
||||
|
7
db/migrate/20250612084840_add_custom_case_to_m_odrs.rb
Normal file
7
db/migrate/20250612084840_add_custom_case_to_m_odrs.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class AddCustomCaseToMOdrs < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :m_odrs, :custom_case_needed, :boolean, :default => false
|
||||
add_column :m_odrs, :custom_case, :boolean, :default => false
|
||||
add_column :m_odrs, :custom_case_label, :string
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddCustomCaseToMOdrReps < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :m_odr_reps, :custom_case, :boolean, :default => false
|
||||
end
|
||||
end
|
328
db/schema.rb
328
db/schema.rb
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user