suite
This commit is contained in:
parent
b97e5612d0
commit
8dd009c330
@ -33,9 +33,17 @@ class MOdrRep < ApplicationRecord
|
||||
|
||||
validates :rgpd, :presence => true, :if => :rgpd_needed?
|
||||
|
||||
validates :reduc_code, :presence => true, length: { in: 6..6 }, :if => :reduc_code_needed?
|
||||
|
||||
belongs_to :m_odr_tracker
|
||||
|
||||
|
||||
def reduc_code_needed?
|
||||
if self.m_odr.reduc_code_needed
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def product_cat_needed?
|
||||
if self.m_odr.m_odr_product_cats.count > 0
|
||||
|
@ -59,6 +59,10 @@
|
||||
= f.input :email_needed, :label => "Obligatoire ?"
|
||||
= f.input :tel_process, :label => "Tel ?"
|
||||
= f.input :tel_needed, :label => "Obligatoire ?"
|
||||
|
||||
= f.input :reduc_code_process, :label => "Code de réduction ?"
|
||||
= f.input :reduc_code_needed, :label => "Obligatoire ?"
|
||||
|
||||
= f.input :confirm_case_needed, :label => "Case de confirmation obligatoire ?"
|
||||
|
||||
|
||||
|
@ -140,6 +140,8 @@
|
||||
=f.inputs do
|
||||
=f.input :m_odr_place, :label => (!@m_odr_rep.m_odr.placeholder ? false :(@m_odr_rep.m_odr.place_label? ? @m_odr_rep.m_odr.place_label : "Point de vente :")), :as => :select, :collection => f.object.m_odr.m_odr_places.order(:name), :include_blank => true, :prompt => (@m_odr_rep.m_odr.place_label? ? @m_odr_rep.m_odr.place_label : "Point de vente :")
|
||||
|
||||
-if @m_odr_rep.m_odr.reduc_code_process
|
||||
=f.input :reduc_code, :label => (!@m_odr_rep.m_odr.placeholder? ? false : "Code de réduction :"), :placeholder => (@m_odr_rep.m_odr.placeholder? ? false : "Code de réduction")
|
||||
|
||||
|
||||
=f.inputs do
|
||||
|
@ -0,0 +1,5 @@
|
||||
class AddReducCodeToMOdrReps < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :m_odr_reps, :reduc_code, :string
|
||||
end
|
||||
end
|
7
db/migrate/20200309142522_add_reduc_code_to_m_odrs.rb
Normal file
7
db/migrate/20200309142522_add_reduc_code_to_m_odrs.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class AddReducCodeToMOdrs < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :m_odrs, :reduc_code_process, :boolean, :default => false
|
||||
add_column :m_odrs, :reduc_code_needed, :boolean, :default => false
|
||||
add_column :m_odrs, :reduc_code_lenght, :integer
|
||||
end
|
||||
end
|
@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2020_03_07_104157) do
|
||||
ActiveRecord::Schema.define(version: 2020_03_09_142522) do
|
||||
|
||||
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||
t.string "name"
|
||||
@ -762,6 +762,7 @@ ActiveRecord::Schema.define(version: 2020_03_07_104157) do
|
||||
t.boolean "cc_admin_ok_to_send", default: false
|
||||
t.boolean "ac_admin_ok_to_send", default: false
|
||||
t.bigint "m_odr_product_cat_id"
|
||||
t.string "reduc_code"
|
||||
t.index ["m_odr_id"], name: "index_m_odr_reps_on_m_odr_id"
|
||||
t.index ["m_odr_place_id"], name: "index_m_odr_reps_on_m_odr_place_id"
|
||||
t.index ["m_odr_product_cat_id"], name: "index_m_odr_reps_on_m_odr_product_cat_id"
|
||||
@ -873,6 +874,9 @@ ActiveRecord::Schema.define(version: 2020_03_07_104157) do
|
||||
t.string "product_label"
|
||||
t.string "qte_label"
|
||||
t.string "place_label"
|
||||
t.boolean "reduc_code_process", default: false
|
||||
t.boolean "reduc_code_needed", default: false
|
||||
t.integer "reduc_code_lenght"
|
||||
t.index ["p_customer_id"], name: "index_m_odrs_on_p_customer_id"
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user