class MOdrRepRib < ApplicationRecord
  belongs_to :admin
  
  belongs_to :p_customer

  belongs_to :m_odr_rep
  
  has_one :m_odr, :through => :m_odr_rep
  
  validates :bic, :presence => true, length: { in: 8..11 }
  
  validates :iban, :presence => true
  
  validates_with IbanValidator
  
  has_many :mail_hists, :as => :element


  acts_as_sorting :fields => {
    :id => {:name => "Id", :reorder => true},
    :p_customer => {:name => "Client"},
    :iban => {:name => "IBAN", :reorder => true},
    :bic => {:name => "BIC", :reorder => true},
    :admin_ok => {:name => "Décision", :reorder => true},
    :reject_reason => {:name => "Raison du rejet", :reorder => true},
    :reject_reason_description => {:name => "Raison du rejet : commentaire", :reorder => true},
    :actions => {:name => "Actions", :reorder => true},

  }
  
  
end
