diff --git a/app/controllers/admin/m_odr_primes_controller.rb b/app/controllers/admin/m_odr_primes_controller.rb index 5cad994..1c49823 100644 --- a/app/controllers/admin/m_odr_primes_controller.rb +++ b/app/controllers/admin/m_odr_primes_controller.rb @@ -100,5 +100,13 @@ class Admin::MOdrPrimesController < ApplicationController redirect_back(fallback_location:"/") end + def attente_roulage + @m_odr_prime = MOdrPrime.find(params[:id]) + @m_odr_prime.change_state("En attente de roulage") + + redirect_back(fallback_location:"/") + + end + end diff --git a/app/controllers/admin/p_customers_controller.rb b/app/controllers/admin/p_customers_controller.rb index a45ac4d..56e4a75 100644 --- a/app/controllers/admin/p_customers_controller.rb +++ b/app/controllers/admin/p_customers_controller.rb @@ -213,6 +213,19 @@ class Admin::PCustomersController < ApplicationController elsif params[:search][:test_user].to_s == "Non" @p_customers = @p_customers.where(:test_user => false) end + + if params[:search][:npai].to_s == "Oui" + @p_customers = @p_customers.where(:npai => true) + elsif params[:search][:npai].to_s == "Non" + @p_customers = @p_customers.where(:npai => false) + end + + + if params[:search][:sticker].to_s == "Oui" + @p_customers = @p_customers.where(:sticker => true) + elsif params[:search][:sticker].to_s == "Non" + @p_customers = @p_customers.where(:sticker => false) + end if params[:code].to_s != "" @@ -222,6 +235,10 @@ class Admin::PCustomersController < ApplicationController if params[:name].to_s != "" @p_customers = @p_customers.joins(:particulars).where("p_customers.code LIKE ? or particulars.organisation LIKE ? or particulars.name LIKE ? or particulars.firstname LIKE ?","%#{params[:name]}%", "%#{params[:name]}%", "%#{params[:name]}%", "%#{params[:name]}%") end + + if params[:email].to_s != "" + @p_customers = @p_customers.where("p_customers.email LIKE ?","%#{params[:email]}%") + end if params[:city].to_s != "" @p_customers = @p_customers.joins(:particulars).where("particulars.cp LIKE ? or particulars.city LIKE ?","%#{params[:city]}%", "%#{params[:city]}%") @@ -416,6 +433,33 @@ class Admin::PCustomersController < ApplicationController @p_customer = PCustomer.find(params[:id]) end + + def npai + + + @p_customer = PCustomer.find(params[:id]) + end + + + def toggle_npai + + + @p_customer = PCustomer.find(params[:id]) + + if @p_customer.npai + @p_customer.npai = false + message = "NPAI levé" + else + @p_customer.npai = true + message = "NPAI signalé" + + end + + @p_customer.save + @p_customer.particular.generate_hist(message) if @p_customer.particular + + redirect_back(fallback_location:"/") + end def create @p_customer = PCustomer.new(params.require(:p_customer).permit!) diff --git a/app/controllers/admin/particular_hists_controller.rb b/app/controllers/admin/particular_hists_controller.rb new file mode 100644 index 0000000..a69059e --- /dev/null +++ b/app/controllers/admin/particular_hists_controller.rb @@ -0,0 +1,76 @@ +# -*- encoding : utf-8 -*- + +class Admin::ParticularHistsController < ApplicationController + layout "admin" + before_action :auth_admin + + before_action :admin_space + + def admin_space + @admin_space = "default" + end + + def index + @particular_hists = ParticularHist.all + + @particular_hists = sort_by_sorting(@particular_hists, "id DESC") + respond_to do |format| + format.html{ + + params[:search][:per_page] = params[:search][:per_page] || 100 + per_page = params[:search][:per_page] + page = (params[:page] and params[:page] != "") ? params[:page] : 1 + @particular_hists = @particular_hists.page(page).per(per_page) + + } + end + end + + def show + @particular_hist = ParticularHist.find(params[:id]) + + end + + def new + @particular_hist = ParticularHist.new + + end + + def edit + @particular_hist = ParticularHist.find(params[:id]) + + end + + def create + @particular_hist = ParticularHist.new(params.require(:particular_hist).permit!) + + if @particular_hist.save + + else + render action: "new" + + end + + end + + + def update + @particular_hist = ParticularHist.find(params[:id]) + + + if @particular_hist.update_attributes(params.require(:particular_hist).permit!) + + else + render action: "edit" + + end + + end + + + def destroy + @particular_hist = ParticularHist.find(params[:id]) + @particular_hist.destroy + + end +end diff --git a/app/models/p_customer.rb b/app/models/p_customer.rb index a9cf34e..1742530 100644 --- a/app/models/p_customer.rb +++ b/app/models/p_customer.rb @@ -2,6 +2,8 @@ class PCustomer < ApplicationRecord acts_as_tree + has_many :particular_hists + has_many :price_documents has_many :particulars, :as => :owner, :dependent => :destroy @@ -257,6 +259,8 @@ class PCustomer < ApplicationRecord :mlm_token => {:name => "Code ambassadeur", :reorder => true}, :enabled => "Actif ?", :test_user => "Utilisateur test ?", + :npai => "NPAI ?", + :sticker => "Stickers envoyés ?", :parent => "Ambassadeur", @@ -280,6 +284,10 @@ class PCustomer < ApplicationRecord end + def particular_fill? + true if self.particular.firstname? and self.particular.name? and self.particular.address2? and self.particular.cp? and self.particular.city? + end + before_destroy do if self.p_customer_sheets.count > 0 or self.p_payments.count > 0 false diff --git a/app/models/particular.rb b/app/models/particular.rb index ba20df2..e38ca4b 100644 --- a/app/models/particular.rb +++ b/app/models/particular.rb @@ -100,4 +100,28 @@ class Particular < ApplicationRecord end + after_save do + self.generate_hist + end + + def generate_hist(message = "Changement des coordonnées") + + if self.owner_type == "PCustomer" + particular_hist = ParticularHist.new(:p_customer_id => self.owner_id, :particular_id => self.id) + + [:civilite, :name, :firstname, :address_2, :address_3, :cp, :city, :country, :tel, :email].each do |att| + eval "particular_hist.#{att.to_s} = self.#{att.to_s}" + end + + particular_hist.description = message + particular_hist.email = self.owner.email + particular_hist.npai = self.owner.npai + + particular_hist.save + + + end + end + + end diff --git a/app/models/particular_hist.rb b/app/models/particular_hist.rb new file mode 100644 index 0000000..5c0d589 --- /dev/null +++ b/app/models/particular_hist.rb @@ -0,0 +1,29 @@ +class ParticularHist < ApplicationRecord + belongs_to :particular + belongs_to :p_customer + + + acts_as_sorting :fields => { + :id => {:name => "Id", :reorder => true}, + # :p_customer => {:name => "Client", :reorder => true, :sort_name => "p_customers.cc_show_name"}, + :created_at => {:name => "Date", :reorder => true}, + :npai => {:name => "NPAI ?", :reorder => true, :as => :boolean}, + :description => {:name => "Evenement", :reorder => true}, + + :civilite => {:name => "Civilité", :reorder => true}, + :name => {:name => "Nom", :reorder => true}, + :firstname => {:name => "Nom", :reorder => true}, + #:address_1 => {:name => "Nom", :reorder => true}, + :address_2 => {:name => "Adresse", :reorder => true}, + :address_3 => {:name => "Adresse suite", :reorder => true}, + :cp => {:name => "Code postal", :reorder => true}, + :city => {:name => "Ville", :reorder => true}, + :country => {:name => "Pays", :reorder => true}, + :tel => {:name => "Tel", :reorder => true}, + :email => {:name => "Email", :reorder => true}, + + #:actions => {:name => "Actions", :reorder => true}, + + } + +end diff --git a/app/views/admin/m_odr_primes/show.html.haml b/app/views/admin/m_odr_primes/show.html.haml index a8a6c96..8e84cd1 100644 --- a/app/views/admin/m_odr_primes/show.html.haml +++ b/app/views/admin/m_odr_primes/show.html.haml @@ -74,14 +74,17 @@ = link_to i(:pencil), edit_admin_m_odr_file_path(m_odr_prime_file.m_odr_file), :remote => false - -if @m_odr_prime.state == "A traiter" or @m_odr_prime.state == "Validé" and @m_odr_prime.m_odr_virements.where(:refused => false).count == 0 + -if @m_odr_prime.state == "A traiter" or @m_odr_prime.state == "Validé" or @m_odr_prime.state == "En attente de roulage" and @m_odr_prime.m_odr_virements.where(:refused => false).count == 0 -if @m_odr_prime.m_odr_file_roulage.date? and @m_odr_prime.m_odr_file_roulage.date <= Date.today =link_to "Générer le virement", generate_virement_admin_m_odr_prime_path(@m_odr_prime), :class => "btn btn-primary" -else - %span.btn.btn-default - Vous pourrez générer le virement une fois la date de roulage passée. - + + -if @m_odr_prime.state == "En attente de roulage" + %span.btn.btn-default + Vous pourrez générer le virement une fois la date de roulage passée. + -else + =link_to 'Valider et passer au statut "en attente de roulage"', attente_roulage_admin_m_odr_prime_path(@m_odr_prime), :class => "btn btn-primary" %hr Virements diff --git a/app/views/admin/p_customers/_p_customer.html.haml b/app/views/admin/p_customers/_p_customer.html.haml index 28b2fcb..d7b828e 100644 --- a/app/views/admin/p_customers/_p_customer.html.haml +++ b/app/views/admin/p_customers/_p_customer.html.haml @@ -83,8 +83,10 @@ -else -if current_admin.has_permission?("customers-d") = link_to i(:"trash-o"), [:admin, p_customer], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer ce client ? ' } , :remote => true if p_customer.can_destroy? - -if current_admin.has_permission?("customers-d") + -if current_admin.has_permission?("customers-u") = link_to i(:pencil), edit_admin_p_customer_path(p_customer), :remote => false + -if current_admin.has_permission?("customers-npai") + = link_to "NPAI", npai_admin_p_customer_path(p_customer), :remote => false -if current_admin.has_permission?("customers-s") = link_to i(:eye), admin_p_customer_path(p_customer) diff --git a/app/views/admin/p_customers/index.html.haml b/app/views/admin/p_customers/index.html.haml index ef64068..3f6318f 100644 --- a/app/views/admin/p_customers/index.html.haml +++ b/app/views/admin/p_customers/index.html.haml @@ -23,8 +23,13 @@ %td=text_field_tag :code, params[:code],:class => "form-control", :placeholder => "Code client" %td=text_field_tag :name, params[:name],:class => "form-control", :placeholder => "Nom" + + %td=text_field_tag :email, params[:email],:class => "form-control", :placeholder => "Email" + + %td=text_field_tag :city, params[:city],:class => "form-control", :placeholder => "Ville" + %td=text_field_tag :tel, params[:tel],:class => "form-control", :placeholder => "Tel" @@ -59,14 +64,14 @@ =select_tag "search[test_user]", options_for_select([[""], "Oui", "Non"], params[:search][:test_user]) %td - Catégorie : - =select_tag "search[p_customer_cat_id]", options_for_select([["",""],["Aucune","null"]]+PCustomerCat.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:p_customer_cat_id]) - - -if !current_admin.p_commercial - %td - Commercial : - =select_tag "search[p_commercial_id]", options_for_select([["",""],["Aucun","null"]]+PCommercial.order(:name).all.map{|a| [a.member_label, a.id]}, params[:search][:p_commercial_id]) - + NPAI ? + =select_tag "search[npai]", options_for_select([[""], "Oui", "Non"], params[:search][:npai]) + + %td + Stickers envoyés ? + =select_tag "search[sticker]", options_for_select([[""], "Oui", "Non"], params[:search][:sticker]) + + diff --git a/app/views/admin/p_customers/npai.html.haml b/app/views/admin/p_customers/npai.html.haml new file mode 100644 index 0000000..38205c2 --- /dev/null +++ b/app/views/admin/p_customers/npai.html.haml @@ -0,0 +1,48 @@ +.qi_header + .right{:style => "text-align:right;"} + = link_to i(:pencil), edit_admin_p_customer_path(@p_customer), :remote => false + + + + %h1 + Utilisateurs + %span + Historique des changements de coordonnées + %span + =@p_customer.code + =@p_customer.show_name + + + + +%br +.qi_tab_header.qi_padding + .right{:style => "text-align:right;"} + -if @p_customer.npai + = link_to "Lever le NPAI", toggle_npai_admin_p_customer_path(@p_customer), :remote => false, :class => "btn btn-success" + + -else + = link_to "Signaler le NPAI", toggle_npai_admin_p_customer_path(@p_customer), :remote => false, :class => "btn btn-danger" + + +.clear + +-params[:search][:per_page] = params[:search][:per_page] || 50 +-per_page = params[:search][:per_page] +-page = (params[:page] and params[:page] != "") ? params[:page] : 1 +-@particular_hists =@p_customer.particular_hists +-@particular_hists = sort_by_sorting(@particular_hists, "created_at DESC") +-@particular_hists = @particular_hists.page(page).per(per_page) + +=#debug MailHist.qi_ordered_table_name +=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @particular_hists} + + + + + + + + + + \ No newline at end of file diff --git a/app/views/admin/particular_hists/_form.html.haml b/app/views/admin/particular_hists/_form.html.haml new file mode 100644 index 0000000..7c8b836 --- /dev/null +++ b/app/views/admin/particular_hists/_form.html.haml @@ -0,0 +1,28 @@ +=semantic_form_for [:admin, @particular_hist], :remote => true do |f| + + .content + =f.inputs do + = f.input :particular, :label => "particular :" + = f.input :p_customer, :label => "p_customer :" + = f.input :description, :label => "description :" + = f.input :name, :label => "name :" + = f.input :firstname, :label => "firstname :" + = f.input :address_1, :label => "address_1 :" + = f.input :address_2, :label => "address_2 :" + = f.input :address_3, :label => "address_3 :" + = f.input :address_4, :label => "address_4 :" + = f.input :address_5, :label => "address_5 :" + = f.input :cp, :label => "cp :" + = f.input :city, :label => "city :" + = f.input :country, :label => "country :" + = f.input :tel, :label => "tel :" + = f.input :email, :label => "email :" + = f.input :civilite, :label => "civilite :" + = f.input :npai, :label => "npai :" + + + + + + .actions=f.submit "sauvegarder", :class => "btn btn-primary" + \ No newline at end of file diff --git a/app/views/admin/particular_hists/_particular_hist.html.haml b/app/views/admin/particular_hists/_particular_hist.html.haml new file mode 100644 index 0000000..2f41c2d --- /dev/null +++ b/app/views/admin/particular_hists/_particular_hist.html.haml @@ -0,0 +1,16 @@ +%tr#particular_hist_row{:id => particular_hist.id} + -tr = {} + + -tr[:actions] = capture do + %td.actions + = link_to i(:"trash-o"), [:admin, particular_hist], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true + = link_to i(:pencil), edit_admin_particular_hist_path(particular_hist), :remote => true + = link_to i(:eye), admin_particular_hist_path(particular_hist), :remote => true + + + + =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => particular_hist} + + + + \ No newline at end of file diff --git a/app/views/admin/particular_hists/create.js.erb b/app/views/admin/particular_hists/create.js.erb new file mode 100644 index 0000000..c700490 --- /dev/null +++ b/app/views/admin/particular_hists/create.js.erb @@ -0,0 +1,2 @@ +$('#particular_hists_rows').prepend("<%= escape_javascript(render(@particular_hist))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/particular_hists/destroy.js.erb b/app/views/admin/particular_hists/destroy.js.erb new file mode 100644 index 0000000..654c8b6 --- /dev/null +++ b/app/views/admin/particular_hists/destroy.js.erb @@ -0,0 +1 @@ +$('#particular_hist_row_<%= @particular_hist.id %>').remove(); \ No newline at end of file diff --git a/app/views/admin/particular_hists/edit.js.erb b/app/views/admin/particular_hists/edit.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/particular_hists/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/particular_hists/index.html.haml b/app/views/admin/particular_hists/index.html.haml new file mode 100644 index 0000000..b0416ed --- /dev/null +++ b/app/views/admin/particular_hists/index.html.haml @@ -0,0 +1,15 @@ +.qi_header + .right= link_to ic(:plus)+' Ajouter', new_admin_particular_hist_path(), :class => "btn btn-primary btn-ap-add", :remote => true + %h1 + + + +.qi_search_row + =form_tag "", :method => "get", :onsubmit => "" do + =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @particular_hists} + + +=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @particular_hists} + + + diff --git a/app/views/admin/particular_hists/new.js.erb b/app/views/admin/particular_hists/new.js.erb new file mode 100644 index 0000000..6c8f015 --- /dev/null +++ b/app/views/admin/particular_hists/new.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900); \ No newline at end of file diff --git a/app/views/admin/particular_hists/show.html.haml b/app/views/admin/particular_hists/show.html.haml new file mode 100644 index 0000000..563003b --- /dev/null +++ b/app/views/admin/particular_hists/show.html.haml @@ -0,0 +1,10 @@ +.qi_header + %h1 + + %span + + + +.qi_row + .qi_pannel.qi_plain.padding + =debug @particular_hist \ No newline at end of file diff --git a/app/views/admin/particular_hists/update.js.erb b/app/views/admin/particular_hists/update.js.erb new file mode 100644 index 0000000..28972a1 --- /dev/null +++ b/app/views/admin/particular_hists/update.js.erb @@ -0,0 +1,2 @@ +$('#particular_hist_row_<%= @particular_hist.id %>').replaceWith("<%= escape_javascript(render(@particular_hist))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 0ef407d..bdbe4e9 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -31,10 +31,11 @@ .element - =link_to admin_menu_items_path(:menu_id => 1) do - .cat#big_cat_ventes - =ic :"globe" - CMS + -if current_admin.has_permission?("CMS") + =link_to admin_menu_items_path(:menu_id => 1) do + .cat#big_cat_ventes + =ic :"globe" + CMS diff --git a/app/views/public/my_account/index.html.haml b/app/views/public/my_account/index.html.haml index 5f007cc..dee1149 100644 --- a/app/views/public/my_account/index.html.haml +++ b/app/views/public/my_account/index.html.haml @@ -131,8 +131,8 @@ - -c = current_p_customer.m_odr_primes.where(:state => "Virement envoyé").count - + -c = current_p_customer.m_odr_primes.where(:state => ["En attente de roulage", "Virement envoyé"]).count + -ca = current_p_customer.m_odr_primes.where(:state => ["En attente de roulage"]).count -if c > 0 %br %br @@ -154,6 +154,15 @@ primes obtenues sur 5 pour 2020 -else prime obtenue sur 5 pour 2020 + + -if ca > 1 + (dont + =ca + primes versées après la date du roulage sur circuit.) + -elsif ca > 0 + (dont + =ca + prime versée après la date du roulage sur circuit.) -if current_p_customer.m_odr_primes.count > 0 %table.table diff --git a/app/views/qi/_qi_ordered_table_object.html.haml b/app/views/qi/_qi_ordered_table_object.html.haml index 15e39b6..13fdc39 100644 --- a/app/views/qi/_qi_ordered_table_object.html.haml +++ b/app/views/qi/_qi_ordered_table_object.html.haml @@ -21,14 +21,14 @@ -v = object.send(key.to_s) - -if value.instance_of? Hash and value[:format] - - -if value[:format] == :date + -if value.instance_of? Hash and (value[:format] or value[:as]) + -value[:as] = value[:format] if value[:format] and !value[:as] + -if value[:as] == :date %td=l v, :format => :short_date - -elsif value[:format] == :boolean + -elsif value[:as] == :boolean %td="Oui" if v - -elsif value[:format] == :currency + -elsif value[:as] == :currency %td.numeraire=number_to_currency v -else diff --git a/config/locales/fr.yml b/config/locales/fr.yml index f12c677..821e9c3 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -91,6 +91,7 @@ fr: human: "le %A %d %B %Y à %Hh%M" human_date: "%A %d %B %Y" only_month: "%B %Y" + short_date: "%d/%m/%Y" am: 'am' pm: 'pm' diff --git a/config/routes.rb b/config/routes.rb index 1cfe910..7d37c0a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,17 @@ Rails.application.routes.draw do + namespace :admin do + resources :particular_hists do + member do + + end + collection do + + end + end + end + namespace :admin do resources :circuit_region_cats do member do @@ -95,6 +106,7 @@ Rails.application.routes.draw do namespace :admin do resources :m_odr_primes do member do + get :attente_roulage get :generate_virement get :send_mail get :refuse @@ -848,6 +860,9 @@ Rails.application.routes.draw do member do get :etat get :archive_import + get :npai + get :toggle_npai + get :ask_particular end collection do diff --git a/db/migrate/20200722105401_create_particular_hists.rb b/db/migrate/20200722105401_create_particular_hists.rb new file mode 100644 index 0000000..3c0a2c8 --- /dev/null +++ b/db/migrate/20200722105401_create_particular_hists.rb @@ -0,0 +1,28 @@ +class CreateParticularHists < ActiveRecord::Migration[6.0] + def change + create_table :particular_hists do |t| + t.references :particular, foreign_key: true + t.references :p_customer, foreign_key: true + t.text :description + t.string :name + t.string :firstname + t.string :address_1 + t.string :address_2 + t.string :address_3 + t.string :address_4 + t.string :address_5 + t.string :cp + t.string :city + t.string :country + t.string :tel + t.string :email + t.string :civilite + t.boolean :npai, :default => false + + t.timestamps + + PCustomer.update_all(:npai => false) + PCustomer.where(:imp_npai => "oui").update_all(:npai => true) + end + end +end diff --git a/db/migrate/20200722123358_add_particular_thankable_to_p_customers.rb b/db/migrate/20200722123358_add_particular_thankable_to_p_customers.rb new file mode 100644 index 0000000..bd5c15c --- /dev/null +++ b/db/migrate/20200722123358_add_particular_thankable_to_p_customers.rb @@ -0,0 +1,6 @@ +class AddParticularThankableToPCustomers < ActiveRecord::Migration[6.0] + def change + add_column :p_customers, :particular_thankable, :boolean, :default => false + add_column :p_customers, :particular_mail_sended, :boolean, :default => false + end +end diff --git a/db/schema.rb b/db/schema.rb index ce46ff9..ace37f9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_07_22_084354) do +ActiveRecord::Schema.define(version: 2020_07_22_123358) do create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.string "name" @@ -1735,6 +1735,8 @@ ActiveRecord::Schema.define(version: 2020_07_22_084354) do t.boolean "test_user", default: false t.string "cc_show_name" t.string "ac_show_name" + t.boolean "particular_thankable", default: false + t.boolean "particular_mail_sended", default: false t.index ["market_discount_id"], name: "index_p_customers_on_market_discount_id" t.index ["p_customer_cat_id"], name: "index_p_customers_on_p_customer_cat_id" t.index ["particular_id"], name: "index_p_customers_on_particular_id" @@ -2262,6 +2264,30 @@ ActiveRecord::Schema.define(version: 2020_07_22_084354) do t.datetime "updated_at", precision: 6, null: false end + create_table "particular_hists", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + t.bigint "particular_id" + t.bigint "p_customer_id" + t.text "description" + t.string "name" + t.string "firstname" + t.string "address_1" + t.string "address_2" + t.string "address_3" + t.string "address_4" + t.string "address_5" + t.string "cp" + t.string "city" + t.string "country" + t.string "tel" + t.string "email" + t.string "civilite" + t.boolean "npai", default: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["p_customer_id"], name: "index_particular_hists_on_p_customer_id" + t.index ["particular_id"], name: "index_particular_hists_on_particular_id" + end + create_table "particulars", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.boolean "pro", default: false t.string "organisation" @@ -2963,6 +2989,8 @@ ActiveRecord::Schema.define(version: 2020_07_22_084354) do add_foreign_key "p_product_prices", "p_price_cats" add_foreign_key "p_product_prices", "p_product_refs" add_foreign_key "p_product_ref_price_histories", "p_product_refs" + add_foreign_key "particular_hists", "p_customers" + add_foreign_key "particular_hists", "particulars" add_foreign_key "s_modules", "s_modules_states" add_foreign_key "timer_watchers", "admins" add_foreign_key "tva_rates", "accounting_zones"