Compare commits

..

No commits in common. "8bbfd5ae884e4798bdd022354ff63996a31c91c2" and "4534a76afb547d892d5f737b2b2e44ca2b6b60c4" have entirely different histories.

9 changed files with 233 additions and 299 deletions

View File

@ -4,7 +4,7 @@ class MOdrFile < ApplicationRecord
mount_uploader :file, OdrUploader
validates :file, :presence => true, :if => :file_needed?
validates :file, :presence => true
before_create { generate_token() }
@ -14,19 +14,6 @@ class MOdrFile < ApplicationRecord
self[:token] = SecureRandom.urlsafe_base64
end while MOdrFile.exists?(:token => self[:token])
end
def file_needed?
if self.m_odr_file_type&.need_file
true
else
false
end
end

View File

@ -35,7 +35,6 @@ 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,16 +46,7 @@ class MOdrRep < ApplicationRecord
belongs_to :m_odr_product_cat
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
@ -128,7 +118,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 == self.m_odr_files.count
if self.m_odr_files.where(:admin_ok => true).count > 0
true
else
false
@ -327,7 +317,6 @@ 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},

View File

@ -32,17 +32,6 @@
%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
@ -59,65 +48,60 @@
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
%table.table.table-striped.table-hover.table-bordered
%tr
%td Etat
%td
-if file.admin_ok == true
=state_helper "Validé"
-elsif file.admin_ok == false
=state_helper "Refusé"
-else
=link_to admin_m_odr_file_path(:id => file.id, :m_odr_file => {:admin_ok => true}), :remote => true, :method => :put do
=ic :check
Valider
=link_to i(:pencil), edit_admin_m_odr_file_path(file), :remote => true
%tr
%td{:style => "width:200px;"} Fichier
%td
=File.basename file.file.path
%tr
%td Lien
%td
=link_to ic(:download)+" Télécharger ce fichier", download_admin_m_odr_file_path(file, :disposition => "attachment")
%tr
%td Validation
%td
-if file.admin_ok == false
=file.reject_reason
=simple_format file.reject_reason_description if file.reject_reason_description?
-if file.admin_ok == false
%tr
%td Type
%td Envois de mail
%td
=file.m_odr_file_type.name if file.m_odr_file_type
%tr
%td Etat
%td
-if file.admin_ok == true
=state_helper "Validé"
-elsif file.admin_ok == false
=state_helper "Refusé"
Envoyer un mail de notification :
-if mail_type_cat = @m_odr_rep.m_odr.mail_type_cats.where(:slug => "refus-facture").first
-slugs = mail_type_cat.mail_types.map{|u| [u.slug, u.slug]}
-else
=link_to admin_m_odr_file_path(:id => file.id, :m_odr_file => {:admin_ok => true}), :remote => true, :method => :put do
=ic :check
Valider
=link_to i(:pencil), edit_admin_m_odr_file_path(file), :remote => true
%tr
%td{:style => "width:200px;"} Fichier
%td
=File.basename file.file.path
%tr
%td Lien
%td
=link_to ic(:download)+" Télécharger ce fichier", download_admin_m_odr_file_path(file, :disposition => "attachment")
%tr
%td Validation
%td
-if file.admin_ok == false
=file.reject_reason
=simple_format file.reject_reason_description if file.reject_reason_description?
-if file.admin_ok == false
%tr
%td Envois de mail
%td
Envoyer un mail de notification :
-if mail_type_cat = @m_odr_rep.m_odr.mail_type_cats.where(:slug => "refus-facture").first
-slugs = mail_type_cat.mail_types.map{|u| [u.slug, u.slug]}
-else
-slugs = [["facture-illisible", "Facture illisible"]]
-slugs.each do |key|
%br
=link_to ic(:envelope)+" #{key[1]}", send_mail_admin_m_odr_file_path(file, :slug => key[0]), :remote => false, :class => "btn btn-primary", :style => "margin-bottom:4px;"
-slugs = [["facture-illisible", "Facture illisible"]]
-slugs.each do |key|
%br
=link_to ic(:envelope)+" #{key[1]}", send_mail_admin_m_odr_file_path(file, :slug => key[0]), :remote => false, :class => "btn btn-primary", :style => "margin-bottom:4px;"
RIB :
-@m_odr_rep.m_odr_rep_ribs.order("id DESC").each do |m_odr_rep_rib|

View File

@ -44,23 +44,22 @@
.columns.span_8{:style => "padding-left:20px;"}
-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.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;"}
-else
&nbsp;&nbsp;
=link_to ic(:"rotate-left"), rotate_admin_m_odr_file_path(:id => file.id, :direction => "right"), :remote => true
&nbsp;&nbsp;
=link_to ic(:"rotate-right"), rotate_admin_m_odr_file_path(file), :remote => true
#image_previ{:style => "width:100%;height:800px;border:1px solid gray;overflow:auto;"}
=render :partial => "admin/m_odr_files/image", :locals => {:file => file}
-file = @m_odr_rep.m_odr_files.order("id DESC").first
-if file
=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"
%iframe{:src => file.file.url, :style => "width:100%;height:800px;border:1px solid gray;"}
-else
&nbsp;&nbsp;
=link_to ic(:"rotate-left"), rotate_admin_m_odr_file_path(:id => file.id, :direction => "right"), :remote => true
&nbsp;&nbsp;
=link_to ic(:"rotate-right"), rotate_admin_m_odr_file_path(file), :remote => true
#image_previ{:style => "width:100%;height:800px;border:1px solid gray;overflow:auto;"}
=render :partial => "admin/m_odr_files/image", :locals => {:file => file}

View File

@ -78,9 +78,6 @@
= f.input :reduc_needed, :label => "Obligatoire ?"
= 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 ?"
@ -96,8 +93,7 @@
= f.input :placeholder, :label => "Afficher les libellés ?"
= 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 :confirm_case_label, :label => "Label case de confirmation :"
= f.input :product_cat_label, :label => "Label catégorie produit :"
= f.input :product_label, :label => "Label produit :"
= f.input :qte_label, :label => "Label quantité :"

View File

@ -193,11 +193,6 @@
-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

View File

@ -1,7 +0,0 @@
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

View File

@ -1,5 +0,0 @@
class AddCustomCaseToMOdrReps < ActiveRecord::Migration[6.0]
def change
add_column :m_odr_reps, :custom_case, :boolean, :default => false
end
end

File diff suppressed because it is too large Load Diff