diff --git a/app/assets/javascripts/public.js.coffee b/app/assets/javascripts/public.js.coffee index 49b321c..5629f60 100644 --- a/app/assets/javascripts/public.js.coffee +++ b/app/assets/javascripts/public.js.coffee @@ -44,6 +44,16 @@ $(document).ready -> language: 'fr' ).focus(); + + + $(document).on 'click', 'input.year_date_picker', -> + $(this).datetimepicker( + language: 'fr' + pickTime: false + minDate: (new Date(new Date().getFullYear(), 0, 1)) + maxDate: (new Date(new Date().getFullYear(), 11, 31)) + ).focus(); + $(document).on 'click', 'input.timepicker', -> $(this).datetimepicker( diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index ae5580f..7aff43e 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -6,6 +6,7 @@ @import "fontawesome/v4-shims"; @import "fontawesome/regular"; +@import "fontawesome/brands"; @import "fontawesome/solid"; diff --git a/app/assets/stylesheets/public.scss b/app/assets/stylesheets/public.scss index 914d623..eacc419 100644 --- a/app/assets/stylesheets/public.scss +++ b/app/assets/stylesheets/public.scss @@ -6,6 +6,7 @@ @import "fontawesome/v4-shims"; @import "fontawesome/regular"; @import "fontawesome/solid"; +@import "fontawesome/brands"; @import "qi_grids"; @@ -1897,9 +1898,10 @@ body { opacity: 0.6; padding: 0px 10px; font-size: 15px; + padding-right:0px; } a { - color: #fff; + color: rgba(255, 255, 255, 0.7); } } .header-topbarbox-1 { @@ -3374,12 +3376,16 @@ select { border-bottom: 1px solid #000; font-family: "Roboto Condensed", sans-serif; text-transform: uppercase; - &:hover { + &:hover, &.active { border-bottom: 1px solid #fd0; } } } } + +.social-links{ + font-family: "Roboto Condensed", sans-serif; +} .menu-sub { position: absolute; top: 49px; @@ -3434,9 +3440,7 @@ select { #contenu { padding: 0px; width: 100%; - h2 { - display: none; - } + } #ariane { display: none; @@ -7149,10 +7153,7 @@ div.modeles_similaires { border-color: #5e605f; } } -.green { - font-size: 24px; - color: #CC4B14; -} + .inline_check { display: inline-block; width: 22%; @@ -10013,14 +10014,11 @@ a.sp-video { text-transform:uppercase; color:black; } - .img{ - position:absolute; - top:0; - left:0; - bottom:0; + img{ + width:160px; - background:white no-repeat center; - background-size:contain; + margin:5px; + float:left; } h3{ font-weight:bold; @@ -10174,8 +10172,8 @@ a.sp-video { .new_btn{ color: #fff !important; background-color: #000000; - font-size: 20px !important; - padding: 7px 50px; + font-size: 16px !important; + padding: 5px 20px; cursor: pointer; border: none; font-weight: normal !important; @@ -10183,11 +10181,20 @@ a.sp-video { -webkit-transition: 0.5s all ease; font-family: 'Fugaz One', cursive; text-transform: uppercase; + + &:hover{ + background-color:#ffe500; + color:black !important; + } + + &.yellow{ + background-color:#ffe500; + + } } h1{ - font-family: 'Montserrat' !important; - font-size: 30px; + font-size: 30px; font-weight: 700; color: #111111; text-transform: uppercase; @@ -10375,3 +10382,70 @@ a.sp-video { margin-bottom:30px; } } + + + .green{ + color:green; + } + + .orange{ + color:orange; + } + + .red{ + color:red; + } + + td.state{ + text-align:right; + } + + + + h1{ + font-weight: normal !important; + + text-align:center; + font-family: 'Fugaz One', cursive; + text-transform: uppercase; + margin:20px 0px; + + } + + h3{ + font-weight: normal !important; + + + font-family: 'Fugaz One', cursive; + text-transform: uppercase; + margin:20px 0px; + + } + + .marg_top{ + margin-top:20px; + } + + + .doc_pannel{ + background:rgba(0,0,0,0.05); + + border-top:4px solid #fd0; + padding:20px; + padding-bottom:30px; + .empty{ + color:rgba(0,0,0,0.5); + text-align:center; + padding-bottom:20px; + } + margin:30px 0; + h3{ + margin-top:0; + } + + } + + .align_center{ + text-align:center; + } + \ No newline at end of file diff --git a/app/controllers/admin/import_csvs_controller.rb b/app/controllers/admin/import_csvs_controller.rb index 4f8ae2c..cf69777 100644 --- a/app/controllers/admin/import_csvs_controller.rb +++ b/app/controllers/admin/import_csvs_controller.rb @@ -7,7 +7,7 @@ class Admin::ImportCsvsController < ApplicationController before_action :admin_space def admin_space - @admin_space = "default" + @admin_space = "preferences" end def index diff --git a/app/controllers/admin/mail_type_cats_controller.rb b/app/controllers/admin/mail_type_cats_controller.rb new file mode 100644 index 0000000..c57b67f --- /dev/null +++ b/app/controllers/admin/mail_type_cats_controller.rb @@ -0,0 +1,76 @@ +# -*- encoding : utf-8 -*- + +class Admin::MailTypeCatsController < ApplicationController + layout "admin" + before_action :auth_admin + + before_action :admin_space + + def admin_space + @admin_space = "default" + end + + def index + @mail_type_cats = MailTypeCat.all + + @mail_type_cats = sort_by_sorting(@mail_type_cats, "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 + @mail_type_cats = @mail_type_cats.page(page).per(per_page) + + } + end + end + + def show + @mail_type_cat = MailTypeCat.find(params[:id]) + + end + + def new + @mail_type_cat = MailTypeCat.new + + end + + def edit + @mail_type_cat = MailTypeCat.find(params[:id]) + + end + + def create + @mail_type_cat = MailTypeCat.new(params.require(:mail_type_cat).permit!) + + if @mail_type_cat.save + + else + render action: "new" + + end + + end + + + def update + @mail_type_cat = MailTypeCat.find(params[:id]) + + + if @mail_type_cat.update_attributes(params.require(:mail_type_cat).permit!) + + else + render action: "edit" + + end + + end + + + def destroy + @mail_type_cat = MailTypeCat.find(params[:id]) + @mail_type_cat.destroy + + end +end diff --git a/app/controllers/admin/mail_types_controller.rb b/app/controllers/admin/mail_types_controller.rb index e3b57d5..cdd6124 100644 --- a/app/controllers/admin/mail_types_controller.rb +++ b/app/controllers/admin/mail_types_controller.rb @@ -7,7 +7,7 @@ class Admin::MailTypesController < ApplicationController before_action :admin_space def admin_space - @admin_space = "stocks" + @admin_space = "preferences" end def index diff --git a/app/controllers/public/circuits_controller.rb b/app/controllers/public/circuits_controller.rb index 65426fa..45bd483 100644 --- a/app/controllers/public/circuits_controller.rb +++ b/app/controllers/public/circuits_controller.rb @@ -5,13 +5,13 @@ class Public::CircuitsController < ApplicationController def index @circuits = Circuit.all - + @circuits_active = true end def show @circuit = Circuit.find(params[:id]) - + @circuits_active = true end diff --git a/app/controllers/public/organisateurs_controller.rb b/app/controllers/public/organisateurs_controller.rb index e205ca2..3dda118 100644 --- a/app/controllers/public/organisateurs_controller.rb +++ b/app/controllers/public/organisateurs_controller.rb @@ -5,13 +5,13 @@ class Public::OrganisateursController < ApplicationController def index @organisateurs = Organisateur.all - + @organisateurs_active = true end def show @organisateur = Organisateur.find(params[:id]) - + @organisateurs_active = true end diff --git a/app/controllers/public/p_customer_auths_controller.rb b/app/controllers/public/p_customer_auths_controller.rb index 6a9f084..6824608 100644 --- a/app/controllers/public/p_customer_auths_controller.rb +++ b/app/controllers/public/p_customer_auths_controller.rb @@ -4,6 +4,23 @@ class Public::PCustomerAuthsController < ApplicationController before_action :auth_p_customer, :only => [:index, :edit_password] + + def valid_account + @p_customer = PCustomer.find_by_mlm_token(params[:token]) + + if !@p_customer.enabled + @p_customer.enabled = true + + @p_customer.save + + mail_hist = MailHist.auto_generate_mail(:fr, "confirmation-inscription", @p_customer.email, {:arguments => {:nbr_inscrits => PCustomer.count}, :p_customer => @p_customer}) + end + + + redirect_to public_my_account_path(), :notice => "Votre email a été validé, merci !" + end + + def index #current_p_customer.consolide_operations diff --git a/app/controllers/public/p_customers_controller.rb b/app/controllers/public/p_customers_controller.rb index a251468..7b5b694 100644 --- a/app/controllers/public/p_customers_controller.rb +++ b/app/controllers/public/p_customers_controller.rb @@ -18,6 +18,9 @@ class Public::PCustomersController < ApplicationController #@p_customer.particulars << Particular.new(:pro => true, :skip_validation => true) @p_customer.valid_public = true @p_customer.require_cgv = true + + @p_customer.enabled = false + if @p_customer.save @p_customer.last_sign_in_at = Time.now @@ -26,7 +29,10 @@ class Public::PCustomersController < ApplicationController cookies[:p_customer_auth_token] = @p_customer.auth_token - mail_hist = MailHist.generate_mail(:fr, MailType.find_or_create("new_account"), @p_customer.email, {:arguments => {:email => @p_customer.email}, :p_customer => @p_customer, :element => @p_customer}) + + mail_hist = MailHist.auto_generate_mail(:fr, "confirmer-inscription", @p_customer.email, {:arguments => {:lien => valid_account_public_p_customer_auths_url(:token => @p_customer.mlm_token) }, :p_customer => @p_customer}) + + #mail_hist = MailHist.generate_mail(:fr, MailType.find_or_create("new_account"), @p_customer.email, {:arguments => {:email => @p_customer.email}, :p_customer => @p_customer, :element => @p_customer}) redirect_to public_my_account_path diff --git a/app/controllers/public/particulars_controller.rb b/app/controllers/public/particulars_controller.rb index 413d7a2..ebf12bd 100644 --- a/app/controllers/public/particulars_controller.rb +++ b/app/controllers/public/particulars_controller.rb @@ -36,12 +36,8 @@ class Public::ParticularsController < ApplicationController if @particular.save - if params[:for_order] - redirect_to particulars_public_p_orders_path() - elsif - redirect_to public_particulars_path - end - + redirect_to public_my_account_path + else render action: "new" @@ -57,11 +53,7 @@ class Public::ParticularsController < ApplicationController if @particular.update_attributes(params.require(:particular).permit!) - if params[:for_order] - redirect_to particulars_public_p_orders_path() - elsif - redirect_to public_particulars_path - end + redirect_to public_my_account_path diff --git a/app/helpers/translation_helper.rb b/app/helpers/translation_helper.rb index 4a702e9..fbb49c5 100755 --- a/app/helpers/translation_helper.rb +++ b/app/helpers/translation_helper.rb @@ -25,7 +25,7 @@ module TranslationHelper def state_helper(value) value = value.to_s - if ["brouillon","Reçue","A traiter"].include?(value) + if ["brouillon","Reçue","A traiter", "En cours de vérification", "Manque RIB"].include?(value) r = ''+value+'' elsif ["Virement envoyé", "Validé"].include?(value) r = ''+value+'' diff --git a/app/models/m_event.rb b/app/models/m_event.rb index 0415cd0..00125e8 100644 --- a/app/models/m_event.rb +++ b/app/models/m_event.rb @@ -26,5 +26,18 @@ class MEvent < ApplicationRecord end - + acts_as_csv_import :fields => [:m_event_type_title, :start_at, :end_at, :title, :description, :link, :encadrant, :imp_circuit_name, :imp_circuit_organisateur ] + + + before_validation do + if self.imp_circuit_organisateur? and !self.organisateur + self.organisateur = Organisateur.where(:name => self.imp_circuit_organisateur).first + + end + + if self.imp_circuit_name? and !self.circuit + self.circuit = Circuit.where(:name => self.imp_circuit_name).first + + end + end end diff --git a/app/models/m_odr_file.rb b/app/models/m_odr_file.rb index e3a8f3c..0f269c0 100644 --- a/app/models/m_odr_file.rb +++ b/app/models/m_odr_file.rb @@ -39,7 +39,7 @@ class MOdrFile < ApplicationRecord elsif self.m_odr_file_type_id == 2 nbr_pneus = 0 self.m_odr_file_products.each do |mofp| - nbr_pneus += mofp.qte + nbr_pneus += mofp.qte.to_i end self.nbr_pneus = nbr_pneus diff --git a/app/models/m_odr_file_product.rb b/app/models/m_odr_file_product.rb index e8590dd..a364866 100644 --- a/app/models/m_odr_file_product.rb +++ b/app/models/m_odr_file_product.rb @@ -3,6 +3,7 @@ class MOdrFileProduct < ApplicationRecord belongs_to :m_odr_product belongs_to :m_odr_product_size + validates :qte, :presence => true before_save do if self.m_odr_product_size self.m_odr_product = self.m_odr_product_size.m_odr_product diff --git a/app/models/mail_hist.rb b/app/models/mail_hist.rb index 749d2a4..c57aa1b 100644 --- a/app/models/mail_hist.rb +++ b/app/models/mail_hist.rb @@ -54,7 +54,14 @@ class MailHist < ApplicationRecord - arguments = @arguments + arguments = @arguments || {} + + if @p_customer and @p_customer.particular + arguments[:civilite] = @p_customer.particular.civilite + arguments[:nom] = @p_customer.particular.name + arguments[:prenom] = @p_customer.particular.firstname + + end s = @mail_content.subject.to_s diff --git a/app/models/mail_type.rb b/app/models/mail_type.rb index a751bec..790ef8f 100644 --- a/app/models/mail_type.rb +++ b/app/models/mail_type.rb @@ -5,7 +5,9 @@ class MailType < ApplicationRecord accepts_nested_attributes_for :mail_contents - + belongs_to :mail_type_cat + + acts_as_sorting :fields => { @@ -31,4 +33,18 @@ class MailType < ApplicationRecord end + def lang(slug) + self.mail_contents.where(:lang_site => LangSite.where(:slug => slug.to_s).first).first + + + end + + def default_title + self.lang(:fr).subject + end + + def default_message + self.lang(:fr).message.to_s.truncate(100) + end + end diff --git a/app/models/mail_type_cat.rb b/app/models/mail_type_cat.rb new file mode 100644 index 0000000..45b73c2 --- /dev/null +++ b/app/models/mail_type_cat.rb @@ -0,0 +1,2 @@ +class MailTypeCat < ApplicationRecord +end diff --git a/app/models/p_customer.rb b/app/models/p_customer.rb index e3269cf..41fb26f 100644 --- a/app/models/p_customer.rb +++ b/app/models/p_customer.rb @@ -1,5 +1,7 @@ class PCustomer < ApplicationRecord + acts_as_tree + has_many :price_documents has_many :particulars, :as => :owner, :dependent => :destroy @@ -68,10 +70,22 @@ class PCustomer < ApplicationRecord validates :cgv, :presence => true, :if => :require_cgv validates :rgpd, :presence => true, :if => :require_cgv + + attr_accessor :actual_password, :valid_last_password, :valid_public, :generate_mdp, :valid_pswd_confirmation, :require_cgv NBR_ROULAGES = ["Entre 1 et 2", "Entre 3 et 5", "Entre 6 et 8", "Entre 9 et 10", "> 10", "Pas pour l'instant"] + def particular_ok? + + if self.particular and self.particular.address_2? and self.particular.cp? and self.particular.city? and self.particular.country? + true + else + false + end + + end + def valid_m_odr_rep_rib self.m_odr_rep_ribs.where(:admin_ok => true).order("id DESC").first end @@ -149,15 +163,14 @@ class PCustomer < ApplicationRecord def self.qi_table_order { - :show_name => "RNom", - :code => {:name => "Code", :reorder => true}, + :show_name => "Nom", + :mlm_token => {:name => "Code ambassadeur", :reorder => true}, #:created_at => {:name => "Date création", :reorder => true}, - :enabled => "Etat", - :p_commercial => "Commercial", - :p_customer_cat => "Catégorie", + :enabled => "Actif ?", + :parent => "Ambassadeur", :particular => "Ville", - :market_discount => "Remise marché" - + :actions => "Actions" + } #, :sort_name => "code" end @@ -192,7 +205,15 @@ class PCustomer < ApplicationRecord end - + def self.find_parrain(token) + + + if token != "" + self.find_by_mlm_token(token.upcase) + else + nil + end + end before_validation do @@ -201,6 +222,21 @@ class PCustomer < ApplicationRecord generate_mlm_token + + if !self.id + if self.parent_code? + + if mlm_parent = PCustomer.find_parrain(self.parent_code) + self.parent_id = mlm_parent.id + self.parent_at_create = true + else + errors.add(:parent_code, "Ce code ambassadeur n'est pas valide, merci de vérifier son exactitude. ") + end + end + end + + + if self.comptant if self.acompte @@ -348,24 +384,14 @@ class PCustomer < ApplicationRecord self.show_name end - def show_name - if self.particular - n = "" - n += self.mlm_token+" " - n += self.particular.organisation+" " if self.particular.organisation? - n += self.particular.name+" " if self.particular.name? - n += self.particular.firstname+" " if self.particular.firstname? - return n - end - end - def show_name if self.particular n = "" n += self.particular.organisation+" " if self.particular.organisation? - n += self.particular.name+" " if self.particular.name? + n += self.particular.firstname+" " if self.particular.firstname? + n += self.particular.name+" " if self.particular.name? return n end end diff --git a/app/views/admin/admin_spaces/_preferences.html.haml b/app/views/admin/admin_spaces/_preferences.html.haml index 56e18a1..fdad4a4 100644 --- a/app/views/admin/admin_spaces/_preferences.html.haml +++ b/app/views/admin/admin_spaces/_preferences.html.haml @@ -4,6 +4,8 @@ %li= link_to "Gestion des permissions", admin_admin_permissions_path +%li= link_to "Gestion des mails types", admin_mail_types_path + -if false %li= link_to "Zones de vente", admin_accounting_zones_path diff --git a/app/views/admin/import_csv_champs/_form.html.haml b/app/views/admin/import_csv_champs/_form.html.haml index 9982c97..6c296ec 100644 --- a/app/views/admin/import_csv_champs/_form.html.haml +++ b/app/views/admin/import_csv_champs/_form.html.haml @@ -1,5 +1,10 @@ %tr.m_odr_product_remise_form.field %td{:style => "width:200px;"}= form.input :champ, :label => false, :as => :select, :collection => @import_csv.table_name.classify.constantize.import_csv_fields.map{|a| a.to_s} + + + -if !form.object.header? and @import_csv.import_csv_headers.all.map{|a| a.name}.include?(form.object.champ) + -form.object.header = form.object.champ + %td{:style => "width:200px;"}= form.input :header, :label => false, :as => :select, :collection => @import_csv.import_csv_headers.all.map{|a| a.name} %td{:style => "width:200px;"}= form.input :value, :label => false, :placeholder => "Valeure fixe" diff --git a/app/views/admin/import_csv_champs/_import_csv_champ.html.haml b/app/views/admin/import_csv_champs/_import_csv_champ.html.haml deleted file mode 100644 index bab04da..0000000 --- a/app/views/admin/import_csv_champs/_import_csv_champ.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%tr#import_csv_champ_row{:id => import_csv_champ.id} - -tr = {} - - -tr[:actions] = capture do - %td.actions - = link_to i(:"trash-o"), [:admin, import_csv_champ], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true - = link_to i(:pencil), edit_admin_import_csv_champ_path(import_csv_champ), :remote => true - = link_to i(:eye), admin_import_csv_champ_path(import_csv_champ), :remote => true - - - - =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => import_csv_champ} - - - - \ No newline at end of file diff --git a/app/views/admin/import_csv_champs/create.js.erb b/app/views/admin/import_csv_champs/create.js.erb deleted file mode 100644 index ce8f997..0000000 --- a/app/views/admin/import_csv_champs/create.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('#import_csv_champs_rows').prepend("<%= escape_javascript(render(@import_csv_champ))%>"); -close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/import_csv_champs/destroy.js.erb b/app/views/admin/import_csv_champs/destroy.js.erb deleted file mode 100644 index e38b4ed..0000000 --- a/app/views/admin/import_csv_champs/destroy.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('#import_csv_champ_row_<%= @import_csv_champ.id %>').remove(); \ No newline at end of file diff --git a/app/views/admin/import_csv_champs/update.js.erb b/app/views/admin/import_csv_champs/update.js.erb deleted file mode 100644 index b45756f..0000000 --- a/app/views/admin/import_csv_champs/update.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('#import_csv_champ_row_<%= @import_csv_champ.id %>').replaceWith("<%= escape_javascript(render(@import_csv_champ))%>"); -close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/import_csvs/_form.html.haml b/app/views/admin/import_csvs/_form.html.haml index 479a529..5001b7e 100644 --- a/app/views/admin/import_csvs/_form.html.haml +++ b/app/views/admin/import_csvs/_form.html.haml @@ -6,7 +6,7 @@ = f.input :name, :label => "Nom de l'import :" = f.input :file, :label => "file :" - = f.input :table_name, :label => "Table :" , :as => :select, :collection => ["circuits", "organisateurs", "m_odr_product_sizes", "m_odr_places", "circuit_regions"] + = f.input :table_name, :label => "Table :" , :as => :select, :collection => ["circuits", "organisateurs", "m_odr_product_sizes", "m_odr_places", "circuit_regions", "m_events"] -if f.object.id %table.import_csv_champs_form diff --git a/app/views/admin/import_csvs/index.html.haml b/app/views/admin/import_csvs/index.html.haml index b162d1b..d44f920 100644 --- a/app/views/admin/import_csvs/index.html.haml +++ b/app/views/admin/import_csvs/index.html.haml @@ -10,6 +10,3 @@ =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @import_csvs} - - - diff --git a/app/views/admin/mail_type_cats/_form.html.haml b/app/views/admin/mail_type_cats/_form.html.haml new file mode 100644 index 0000000..0756c48 --- /dev/null +++ b/app/views/admin/mail_type_cats/_form.html.haml @@ -0,0 +1,12 @@ +=semantic_form_for [:admin, @mail_type_cat], :remote => true do |f| + + .content + =f.inputs do + = f.input :name, :label => "name :" + + + + + + .actions=f.submit "sauvegarder", :class => "btn btn-primary" + \ No newline at end of file diff --git a/app/views/admin/mail_type_cats/_mail_type_cat.html.haml b/app/views/admin/mail_type_cats/_mail_type_cat.html.haml new file mode 100644 index 0000000..3996f21 --- /dev/null +++ b/app/views/admin/mail_type_cats/_mail_type_cat.html.haml @@ -0,0 +1,16 @@ +%tr#mail_type_cat_row{:id => mail_type_cat.id} + -tr = {} + + -tr[:actions] = capture do + %td.actions + = link_to i(:"trash-o"), [:admin, mail_type_cat], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true + = link_to i(:pencil), edit_admin_mail_type_cat_path(mail_type_cat), :remote => true + = link_to i(:eye), admin_mail_type_cat_path(mail_type_cat), :remote => true + + + + =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => mail_type_cat} + + + + \ No newline at end of file diff --git a/app/views/admin/mail_type_cats/create.js.erb b/app/views/admin/mail_type_cats/create.js.erb new file mode 100644 index 0000000..bbafb5e --- /dev/null +++ b/app/views/admin/mail_type_cats/create.js.erb @@ -0,0 +1,2 @@ +$('#mail_type_cats_rows').prepend("<%= escape_javascript(render(@mail_type_cat))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/mail_type_cats/destroy.js.erb b/app/views/admin/mail_type_cats/destroy.js.erb new file mode 100644 index 0000000..805c06d --- /dev/null +++ b/app/views/admin/mail_type_cats/destroy.js.erb @@ -0,0 +1 @@ +$('#mail_type_cat_row_<%= @mail_type_cat.id %>').remove(); \ No newline at end of file diff --git a/app/views/admin/import_csv_champs/edit.js.erb b/app/views/admin/mail_type_cats/edit.js.erb similarity index 100% rename from app/views/admin/import_csv_champs/edit.js.erb rename to app/views/admin/mail_type_cats/edit.js.erb diff --git a/app/views/admin/import_csv_champs/index.html.haml b/app/views/admin/mail_type_cats/index.html.haml similarity index 50% rename from app/views/admin/import_csv_champs/index.html.haml rename to app/views/admin/mail_type_cats/index.html.haml index 972790b..7b58e51 100644 --- a/app/views/admin/import_csv_champs/index.html.haml +++ b/app/views/admin/mail_type_cats/index.html.haml @@ -1,15 +1,15 @@ .qi_header - .right= link_to ic(:plus)+' Ajouter', new_admin_import_csv_champ_path(), :class => "btn btn-primary btn-ap-add", :remote => true + .right= link_to ic(:plus)+' Ajouter', new_admin_mail_type_cat_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 => @import_csv_champs} + =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @mail_type_cats} -=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @import_csv_champs} +=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @mail_type_cats} diff --git a/app/views/admin/import_csv_champs/new.js.erb b/app/views/admin/mail_type_cats/new.js.erb similarity index 100% rename from app/views/admin/import_csv_champs/new.js.erb rename to app/views/admin/mail_type_cats/new.js.erb diff --git a/app/views/admin/import_csv_champs/show.html.haml b/app/views/admin/mail_type_cats/show.html.haml similarity index 73% rename from app/views/admin/import_csv_champs/show.html.haml rename to app/views/admin/mail_type_cats/show.html.haml index d9b865c..2eefa47 100644 --- a/app/views/admin/import_csv_champs/show.html.haml +++ b/app/views/admin/mail_type_cats/show.html.haml @@ -7,4 +7,4 @@ .qi_row .qi_pannel.qi_plain.padding - =debug @import_csv_champ \ No newline at end of file + =debug @mail_type_cat \ No newline at end of file diff --git a/app/views/admin/mail_type_cats/update.js.erb b/app/views/admin/mail_type_cats/update.js.erb new file mode 100644 index 0000000..d6a4486 --- /dev/null +++ b/app/views/admin/mail_type_cats/update.js.erb @@ -0,0 +1,2 @@ +$('#mail_type_cat_row_<%= @mail_type_cat.id %>').replaceWith("<%= escape_javascript(render(@mail_type_cat))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/admin/mail_types/_form.html.haml b/app/views/admin/mail_types/_form.html.haml index cb0af1c..33511e4 100644 --- a/app/views/admin/mail_types/_form.html.haml +++ b/app/views/admin/mail_types/_form.html.haml @@ -2,7 +2,7 @@ .content - + = form.input :mail_type_cat, :label => "Catégorie mail type :" =form.input :slug, :label => "Référence mail :" @@ -12,6 +12,8 @@ -form.object.mail_contents.build(:lang_site_id => ls.id, :content_type => "text") =form.semantic_fields_for :mail_contents do |form| + + = form.input :subject = form.input :message = form.hidden_field :lang_site_id diff --git a/app/views/admin/p_customers/_p_customer.html.haml b/app/views/admin/p_customers/_p_customer.html.haml index 61c7a29..e64d60b 100644 --- a/app/views/admin/p_customers/_p_customer.html.haml +++ b/app/views/admin/p_customers/_p_customer.html.haml @@ -4,12 +4,15 @@ -tr[:enabled] = capture do %td -if p_customer.enabled - Actif - -else - %span.red - =ic :lock - - =p_customer.disabled_raison + Oui + + -tr[:parent] = capture do + %td + -if p_customer.parent + =p_customer.parent.mlm_token + ="-" + =p_customer.show_name + -tr[:p_commercial] = capture do %td @@ -25,43 +28,26 @@ = p_customer.particular.city = p_customer.particular.country - -tr[:market_discount] = capture do - %td - -if p_customer.market_discount - =p_customer.market_discount.percent - ="%" - - - -if !@qi_table_orders - =render :partial => "qi/qi_ordered_table_head", :locals => {:qi_ordered_table_name => p_product.class.to_s.tableize, :qi_ordered_table_model => p_product.class} - - - - - - -@qi_table_orders[:p_customers].each do |key,value| - -if tr[:"#{key}"] - =raw tr[:"#{key}"] - -elsif (p_customer.respond_to?(key)) - %td - =p_customer.send(key.to_s) - - - - %td.actions - -if params[:offre].to_s == "true" - -if p_customer.enabled - =link_to ic(:"arrow-right")+" Demande de commande", new_admin_p_customer_sheet_path(:p_customer_id => p_customer.id), :class => "btn btn-primary btn-ap-add" - -else - .badge.badge-danger - =ic :lock - =p_customer.disabled_raison + -tr[:actions] = capture do + %td.actions + -if params[:offre].to_s == "true" + -if p_customer.enabled + =link_to ic(:"arrow-right")+" Demande de commande", new_admin_p_customer_sheet_path(:p_customer_id => p_customer.id), :class => "btn btn-primary btn-ap-add" + -else + .badge.badge-danger + =ic :lock + =p_customer.disabled_raison - -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") - = link_to i(:pencil), edit_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) + -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") + = link_to i(:pencil), edit_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) + + =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_customer} + + + \ No newline at end of file diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index 3c18d21..58046f6 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -108,6 +108,23 @@ .header-topbarbox-1 .header-topbarbox-2 %ul.social-links + + -if current_p_customer + =link_to ic(:"power-off")+" Déconnexion", logout_public_p_customer_auths_path() + + + %li + -if current_p_customer + =link_to public_my_account_path do + =ic(:user) + Mon compte : + =current_p_customer.particular.firstname + =current_p_customer.particular.name + + -else + =link_to ic(:user)+" Mon compte", public_my_account_path + + %li %a{:href => "https://www.facebook.com/mamotosurcircuit/", :target => "_blank"} =ic :"facebook-f" @@ -121,24 +138,7 @@ #position-menu #menu_haut.WithCarousel %ul - -if false - %li.PGS_PRIMES.sousmenu - %a{:href => "https://www.mamotosurcircuit.com/136-primes.html", :title => "Primes"} - %span Primes - / [if gt IE 6]> "#"} - %i.fa.fa-chevron-down - / "https://www.mamotosurcircuit.com/135-dunlop.html", :title => "Dunlop"} - %span Dunlop - %li - %a{:href => "https://www.mamotosurcircuit.com/137-stickers.html", :title => "Stickers"} - %span Stickers - /[if lte IE 6] - - + -MenuItem.where(:parent_id => nil, :menu_id => 1).order(:position).each do |menu_item| -if menu_item_link(menu_item) and menu_item_link(menu_item) != "" @@ -146,21 +146,21 @@ =menu_item_link(menu_item) - %li.PGS_ROULAGE - =link_to "Trouvez votre journée", public_m_events_path + -if false + %li.PGS_ROULAGE + =link_to "Trouvez votre journée", public_m_events_path %li.PGS_ANNUAIRE_CIRCUIT - =link_to "Circuits", public_circuits_path + =link_to "Circuits", public_circuits_path, :class => ("active" if @circuits_active) %li.PGS_ANNUAIRE_ORGA - =link_to "Organisateurs", public_organisateurs_path + =link_to "Organisateurs", public_organisateurs_path, :class => ("active" if @organisateurs_active) %li.PGS_DISTRIBUTEUR %a{:href => "https://www.dunlop.eu/fr_fr/motorcycle/dealers/find-a-dealer.html", :target => "_blank", :title => "Distributeurs"} %span Distributeurs - %li.PGS_COMPTE - =link_to "Mon compte", public_my_account_path + %button.navbar-toggle.collapsed.btn-menu{"aria-controls" => "navbar", "aria-expanded" => "false", "data-target" => "#navbar", "data-toggle" => "collapse", :type => "button"} @@ -204,7 +204,7 @@ %a{:accesskey => "8", :href => "https://www.mamotosurcircuit.com/123-conditions-generales-utilisation.html", :title => "Conditions générales d'utilisation"} Conditions générales d'utilisation .col-md-4 %section.footer-section - %h3.footer-section__title.ui-title-inner Nous situer + %h3.footer-section__title.ui-title-inner Nous contacter .footer-contact %i.icon.icon-xs.fa.fa-envelope-o %a{:href => "mailto:contact@mamotosurcircuit.com"} contact@mamotosurcircuit.com diff --git a/app/views/public/m_events/_m_event.html.haml b/app/views/public/m_events/_m_event.html.haml index 1859ecd..416e10d 100644 --- a/app/views/public/m_events/_m_event.html.haml +++ b/app/views/public/m_events/_m_event.html.haml @@ -2,11 +2,15 @@ .m_event -img = "" -img = m_event.organisateur.logo.file.large.medium.url if m_event.organisateur and m_event.organisateur.logo - .img{:style => ("background-image:url('#{img}');" if img)} + + =image_tag img .desc .head %h3 - =m_event.title + =link_to m_event.m_event_type_title, public_m_events_path(:search => {:m_event_type_title => [m_event.m_event_type_title]}) + ="-" + =link_to m_event.circuit.name, public_m_events_path(:search => {:circuit_id => m_event.circuit.id}) + %span.date -if m_event.start_at.to_date == m_event.end_at.to_date le @@ -16,22 +20,22 @@ =l m_event.start_at, :format => :date au =l m_event.end_at, :format => :date - .circuit_name - %strong Circuit : - =link_to m_event.circuit.name, public_m_events_path(:search => {:circuit_id => m_event.circuit.id}) - - .details=simple_format m_event.description - - .right_roulage.right - =link_to "Détail", m_event.link.to_s, :target => "_blank" - .type - %strong Type : - =link_to m_event.m_event_type_title, public_m_events_path(:search => {:m_event_type_title => [m_event.m_event_type_title]}) - + .organisateur_name - %strong Organisateur : - =link_to m_event.organisateur.name, public_organisateur_path(m_event.organisateur), :target => "_blank" if m_event.organisateur - + Organisé par + %strong=link_to m_event.organisateur.name, public_organisateur_path(m_event.organisateur), :target => "_blank" if m_event.organisateur + + -if m_event.description? + %br + =link_to "+ d'infos", "#", :onclick => "$(this).next('.details').toggle();return false;" + .details{:style => "display:none;"}=simple_format m_event.description + + %br + %br + .right_roulage.right + =link_to "Réserver (site officiel)", m_event.link.to_s, :target => "_blank" + + .clear diff --git a/app/views/public/m_odr_file_roulages/_form.html.haml b/app/views/public/m_odr_file_roulages/_form.html.haml index 443290b..e7f2375 100644 --- a/app/views/public/m_odr_file_roulages/_form.html.haml +++ b/app/views/public/m_odr_file_roulages/_form.html.haml @@ -1,6 +1,6 @@ %tr.m_odr_file_roulage_form.field - %td= form.input :date, :label => "date :" , :as => :date - %td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.all, :member_label => :member_label, :as => :select + %td= form.input :date, :label => "Date :" , :as => :string , :input_html => {:autocomplete => "off", :class => "year_date_picker"} + =#%td=# form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.all, :member_label => :member_label, :as => :select %td.actions=link_to_remove_fields ic(:"trash-o"), form \ No newline at end of file diff --git a/app/views/public/m_odr_files/_form.html.haml b/app/views/public/m_odr_files/_form.html.haml index 5f5209c..671136d 100644 --- a/app/views/public/m_odr_files/_form.html.haml +++ b/app/views/public/m_odr_files/_form.html.haml @@ -7,18 +7,17 @@ = f.input :file, :label => "Fichier :" - = f.input :buy_at, :label => "Date de la facture :", :as => :date - + = f.hidden_field :m_odr_file_type_id -if f.object.m_odr_file_type_id == 2 %table.m_odr_file_products_form.form-table - = f.input :buy_at, :label => "Date de l'achat", :as => :date - = f.input :m_odr_place, :label => "Revendeur :", :as => :date, :collection => MOdrPlace.all, :member_label => :member_label, :as => :select + = f.input :buy_at, :label => "Date de l'achat",:as => :string, :input_html => {:autocomplete => "off", :class => "year_date_picker"} + -if true - %p= public_link_to_add_fields ic(:plus)+" Ajouter un produit", f, :m_odr_file_products + %p= public_link_to_add_fields ic(:plus)+" Ajouter un ou plusieurs pneus", f, :m_odr_file_products =f.semantic_fields_for :m_odr_file_products do |form| =render :partial => "public/m_odr_file_products/form", :locals => {:form => form} @@ -30,12 +29,14 @@ =f.semantic_fields_for :m_odr_file_roulages do |form| =render :partial => "public/m_odr_file_roulages/form", :locals => {:form => form} - -if false - %p= link_to_add_fields ic(:plus)+" Ajouter une date de roulage", f, :m_odr_file_roulages + -if true + %p= public_link_to_add_fields ic(:plus)+" Ajouter une journée de roulage", f, :m_odr_file_roulages .large_actions .actions=f.submit "sauvegarder", :class => "btn btn-primary" - \ No newline at end of file + %br + %br + diff --git a/app/views/public/m_odr_files/_m_odr_file.html.haml b/app/views/public/m_odr_files/_m_odr_file.html.haml index 792f41c..9f1af2b 100644 --- a/app/views/public/m_odr_files/_m_odr_file.html.haml +++ b/app/views/public/m_odr_files/_m_odr_file.html.haml @@ -8,7 +8,7 @@ =link_to ic(:download)+" Télécharger le document", download_admin_m_odr_file_path(m_odr_file, :disposition => "attachment") - %td + %td.state -if m_odr_file.admin_ok =state_helper("Validé") -elsif m_odr_file.admin_ok == false diff --git a/app/views/public/m_odr_primes/_m_odr_prime.html.haml b/app/views/public/m_odr_primes/_m_odr_prime.html.haml index 4eed868..37255ab 100644 --- a/app/views/public/m_odr_primes/_m_odr_prime.html.haml +++ b/app/views/public/m_odr_primes/_m_odr_prime.html.haml @@ -3,6 +3,6 @@ =l m_odr_prime.created_at, :format => :date %td =number_to_currency m_odr_prime.amount - %td + %td.state =state_helper(m_odr_prime.state) diff --git a/app/views/public/menu_items/index.html.haml b/app/views/public/menu_items/index.html.haml index d33c12b..3451295 100644 --- a/app/views/public/menu_items/index.html.haml +++ b/app/views/public/menu_items/index.html.haml @@ -29,15 +29,15 @@ .block_avantage %a{:href => "/fr/primes.html"} .container_picto - %img.img_av{:src => "https://www.mamotosurcircuit.com/images/interface/pneu_left_2.png"}/ - %img.img_av_hover{:src => "https://www.mamotosurcircuit.com/images/interface/pneu_left_2_white.png"}/ + %img.img_av{:src => "https://www.mamotosurcircuit.com/images/interface/bonus_left.png"}/ + %img.img_av_hover{:src => "https://www.mamotosurcircuit.com/images/interface/bonus_left_white.png"}/ %h5 Prime de roulage pneus Dunlop %p Achetez, roulez et soyez remboursé .block_avantage %a{:href => public_my_account_path()} .container_picto - %img.img_av{:src => "https://www.mamotosurcircuit.com/images/interface/bonus_left.png"}/ - %img.img_av_hover{:src => "https://www.mamotosurcircuit.com/images/interface/bonus_left_white.png"}/ + %img.img_av{:src => "https://www.mamotosurcircuit.com/images/interface/pneu_left_2.png"}/ + %img.img_av_hover{:src => "https://www.mamotosurcircuit.com/images/interface/pneu_left_2_white.png"}/ %h5 Des stickers %p Inscrivez-vous et recevez gratuitement vos stickers .block_avantage diff --git a/app/views/public/my_account/index.html.haml b/app/views/public/my_account/index.html.haml index 041e186..4c05997 100644 --- a/app/views/public/my_account/index.html.haml +++ b/app/views/public/my_account/index.html.haml @@ -1,64 +1,146 @@ .center_content - %a{:accesskey => "s", :href => "#contenu", :name => "contenu"} - #contenu_scroller - #paragraphe292.paragraphe - %a{:name => "paragraphe292"} - .panel_user - .nav_user - %h3 Mon compte - .link_nav - =link_to ic(:"user")+" me déconnecter", logout_public_p_customer_auths_path(), :class => "disconnect" - .new_compte - %h4 - Bonjour - %span{:style => "font-weight:300;"}=current_p_customer.show_name - .nav_user_full - %div - %a{:href => "https://www.mamotosurcircuit.com/104--195-mon-compte.html"} - %span Mes demandes de prime - = link_to 'Envoyer une facture de roulage', new_public_m_odr_file_path(:m_odr_file_type_id => 1) - = link_to 'Envoyer une facture d\'achat', new_public_m_odr_file_path(:m_odr_file_type_id => 2) - = link_to "Suivre mes demandes de prime", public_m_odr_files_path - -if current_p_customer.m_odr_rep_ribs.count > 0 - = link_to "Modifier mon rib", edit_public_m_odr_rep_rib_path(current_p_customer.m_odr_rep_ribs.first) - -else - = link_to "Ajouter mon rib", new_public_m_odr_rep_rib_path() - - - %div + #contenu_scroller + + %h1 Mon compte + + .right + =link_to ic(:lock)+" Modifier mon mot de passe", edit_password_public_p_customer_auths_path() + + .clear + .row + .col-md-6 + %h3 Mes informations personnelles + .particular_div + %p + -if current_p_customer.particular_ok? + %span.green + =ic :flag + Adresse remplie + -else + %span.orange + =ic :flag + Remplissez votre adresse pour recevoir vos stickers - %span Mes informations personnelles - =link_to "Modifier mes coordonnées, indiquer mes préférences, ...", edit_public_particular_path(current_p_customer.particular) - =link_to "Modifier mon mot de passe", edit_password_public_p_customer_auths_path() + + -particular = current_p_customer.particular + -if particular + =particular.firstname + =particular.name + %br + -if particular.address_2? + + =particular.address_2 + %br + -if particular.address_3? + + =particular.address_3 + %br + -if particular.cp? or particular.city? or particular.country? + + =particular.cp - %div - %a{:href => "/fr/primes.html"} - %span Dunlop Sponsor Program - %span Découvrir mes avantages - %h4 Contacter l'équipe de mamotosurcircuit.com - .info_contact - %div - %span.picto_cmpt.arobase @ - %a{:href => "mailto:contact@mamotosurcircuit.com", :target => "_blank"} contact@mamotosurcircuit.com - %div - %span.picto_cmpt - =ic :"facebook-f" - %a{:href => "https://www.facebook.com/mamotosurcircuit/", :target => "_blank"} @mamotosurcircuit - %div - %span.picto_cmpt - %i.fa.fa-phone{"aria-hidden" => "true"} - %a{:href => "tel:0476313838", :target => "_blank"} 04 76 31 38 38 - %div - %span.picto_cmpt.adresse_cpt - %i.fa.fa-envelope-o{"aria-hidden" => "true"} - %span.inlince_adresse - Market-Inn - %br/ - Service relation client Mamotosurcircuit.com - %br/ - 8 route des Bois Bat A - %br/ - 38500 Voiron - %br.clr/ + =particular.city + + =particular.country + %br + %p + =link_to "Modifier mes coordonnées", edit_public_particular_path(current_p_customer.particular) + + + + + + + .col-md-6 + %h3 Mon rib + .rib + -if current_p_customer.valid_m_odr_rep_rib + %p + %span.green + =ic :flag + RIB validé + -rib = current_p_customer.valid_m_odr_rep_rib + + .rib + IBAN : + =rib.iban + %br + BIC : + =rib.bic + %br + = link_to "Modifier mon rib", edit_public_m_odr_rep_rib_path(current_p_customer.m_odr_rep_ribs.first) + + -elsif current_p_customer.m_odr_rep_ribs.count > 0 + %p + %span.orange + =ic :flag + RIB en cours de validation + + -rib = current_p_customer.m_odr_rep_ribs.first + + .rib + IBAN : + =rib.iban + %br + BIC : + =rib.bic + + + -else + %p + %span.red + =ic :flag + RIB non renseigné + .rib= link_to "Ajouter mon rib", new_public_m_odr_rep_rib_path() + + + .doc_pannel + %h3 Mes primes + -if current_p_customer.m_odr_primes.count > 0 + %table.table + =render current_p_customer.m_odr_primes + + -else + .empty + Pour obtenir des primes déposez vos factures d'achat et de roulage + + + .doc_pannel + + %h3 Mes factures d'achat + -if m_odr_files = current_p_customer.m_odr_files.where(:m_odr_file_type_id => 2) and m_odr_files.count > 0 + %table.table + =render m_odr_files + + -else + .empty + Vous n'avez pas encore déposé de facture d'achat + + .align_center + = link_to 'Envoyer une facture d\'achat', new_public_m_odr_file_path(:m_odr_file_type_id => 2), :class => "new_btn" + .doc_pannel + %h3 Mes factures de roulage + -if m_odr_files = current_p_customer.m_odr_files.where(:m_odr_file_type_id => 1) and m_odr_files.count > 0 + %table.table + =render m_odr_files + -else + .empty + Vous n'avez pas encore déposé de facture de roulage + + .align_center + = link_to 'Envoyer une facture de roulage', new_public_m_odr_file_path(:m_odr_file_type_id => 1), :class => "new_btn" + + =link_to "Découvrir les avantages du Dunlop Sponsor Program", "/fr/primes.html" + + %br + %br + %br + + + + + + + %br.clr/ diff --git a/app/views/public/p_customer_auths/new.haml b/app/views/public/p_customer_auths/new.haml index 35e80e1..ed52a40 100755 --- a/app/views/public/p_customer_auths/new.haml +++ b/app/views/public/p_customer_auths/new.haml @@ -9,7 +9,7 @@ .connexion_form - %h2 Déjà inscrit ? + %h3 Déjà inscrit ? = form_tag public_p_customer_auths_path, {:class => "formtastic"} do =hidden_field_tag :for_order, params[:for_order] @@ -35,7 +35,13 @@ %p{:style => "text-align:center"} =link_to qit("lost-password","Mot de passe perdu ?"), password_reset_public_p_customer_auths_path(:for_order => params[:for_order]), :class => "shop" - + %br .col-md-6 - =link_to "Créer mon compte", new_public_p_customer_path ,:class => "new_btn" + %h3 Pas encore de compte ? + + %br + %br + %br + %center + =link_to "Créer mon compte", new_public_p_customer_path ,:class => "new_btn" =#render :partial => "public/p_customers/new_form" diff --git a/app/views/public/p_customers/_new_form.html.haml b/app/views/public/p_customers/_new_form.html.haml index 88be802..1e9f7ce 100644 --- a/app/views/public/p_customers/_new_form.html.haml +++ b/app/views/public/p_customers/_new_form.html.haml @@ -1,11 +1,12 @@ -%h2 Pas encore client ? =#debug @p_customer.errors.messages = semantic_form_for [:public, @p_customer] do |f| =hidden_field_tag :for_order, params[:for_order] =f.inputs do =f.hidden_field :valid_public + =f.input :parent_code, :label => "Code ambassadeur :" + =f.input :email, :label => "Email :" =f.input :password, :label => "Mot de passe :", :as => :password diff --git a/config/routes.rb b/config/routes.rb index 8c998fc..439b773 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,16 @@ Rails.application.routes.draw do + namespace :admin do + resources :mail_type_cats do + member do + + end + collection do + + end + end + end + namespace :admin do resources :circuit_regions do member do @@ -610,6 +621,8 @@ Rails.application.routes.draw do resources :p_customer_auths do collection do + get :valid_account + get :password_reset post :save_password_reset diff --git a/db/migrate/20200602223325_add_imports_to_m_events.rb b/db/migrate/20200602223325_add_imports_to_m_events.rb new file mode 100644 index 0000000..0ed464b --- /dev/null +++ b/db/migrate/20200602223325_add_imports_to_m_events.rb @@ -0,0 +1,7 @@ +class AddImportsToMEvents < ActiveRecord::Migration[6.0] + def change + add_column :m_events, :encadrant, :string + add_column :m_events, :imp_circuit_name, :string + add_column :m_events, :imp_circuit_organisateur, :string + end +end diff --git a/db/migrate/20200602230532_create_mail_type_cats.rb b/db/migrate/20200602230532_create_mail_type_cats.rb new file mode 100644 index 0000000..358d2c1 --- /dev/null +++ b/db/migrate/20200602230532_create_mail_type_cats.rb @@ -0,0 +1,9 @@ +class CreateMailTypeCats < ActiveRecord::Migration[6.0] + def change + create_table :mail_type_cats do |t| + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20200602230712_add_mail_type_cat_to_mail_types.rb b/db/migrate/20200602230712_add_mail_type_cat_to_mail_types.rb new file mode 100644 index 0000000..b0cc938 --- /dev/null +++ b/db/migrate/20200602230712_add_mail_type_cat_to_mail_types.rb @@ -0,0 +1,5 @@ +class AddMailTypeCatToMailTypes < ActiveRecord::Migration[6.0] + def change + add_column :mail_types, :mail_type_cat_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 81bf13c..0d8bd23 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_05_25_085510) do +ActiveRecord::Schema.define(version: 2020_06_02_230712) do create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.string "name" @@ -676,6 +676,9 @@ ActiveRecord::Schema.define(version: 2020_05_25_085510) do t.integer "image_file_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.string "encadrant" + t.string "imp_circuit_name" + t.string "imp_circuit_organisateur" t.index ["circuit_id"], name: "index_m_events_on_circuit_id" t.index ["organisateur_id"], name: "index_m_events_on_organisateur_id" end @@ -1149,6 +1152,12 @@ ActiveRecord::Schema.define(version: 2020_05_25_085510) do t.datetime "updated_at", precision: 6, null: false end + create_table "mail_type_cats", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + t.string "name" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + create_table "mail_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.string "slug" t.string "default_title" @@ -1159,6 +1168,7 @@ ActiveRecord::Schema.define(version: 2020_05_25_085510) do t.bigint "m_odr_id" t.text "tags" t.bigint "file_tunel_id" + t.integer "mail_type_cat_id" t.index ["file_tunel_id"], name: "index_mail_types_on_file_tunel_id" t.index ["m_odr_id"], name: "index_mail_types_on_m_odr_id" t.index ["mail_type_reference_id"], name: "index_mail_types_on_mail_type_reference_id" diff --git a/lib/acts_as_caching.rb b/lib/acts_as_caching.rb index 8d6197b..30be821 100644 --- a/lib/acts_as_caching.rb +++ b/lib/acts_as_caching.rb @@ -7,3 +7,4 @@ module ActsAsCaching #autoload :InstanceMethods, File.join(File.dirname(__FILE__), "acts_as_caching/instance_methods") end +# V 0.1 \ No newline at end of file diff --git a/lib/acts_as_caching/hook.rb b/lib/acts_as_caching/hook.rb index f730a2d..75f16c3 100644 --- a/lib/acts_as_caching/hook.rb +++ b/lib/acts_as_caching/hook.rb @@ -29,6 +29,9 @@ module ActsAsCaching::Hook define_method("qi_dynamics_cache"){ puts "qi_dynamics_cache" + puts "hook" + puts self.class + if self.methods.include?(:to_no_archive) self.to_no_archive.each do |noc| diff --git a/lib/acts_as_csv_import.rb b/lib/acts_as_csv_import.rb index 18a1bb9..e8964a0 100644 --- a/lib/acts_as_csv_import.rb +++ b/lib/acts_as_csv_import.rb @@ -7,3 +7,4 @@ module ActsAsCsvImport #autoload :InstanceMethods, File.join(File.dirname(__FILE__), "acts_as_csv_import/instance_methods") end +# V 0.1 \ No newline at end of file diff --git a/lib/acts_as_csv_import/hook.rb b/lib/acts_as_csv_import/hook.rb index 1da1049..ab6502b 100644 --- a/lib/acts_as_csv_import/hook.rb +++ b/lib/acts_as_csv_import/hook.rb @@ -24,15 +24,17 @@ module ActsAsCsvImport::Hook n = self.new row.each do |key, value| - eval "n.#{key} = value" + + if self.type_for_attribute(key) and self.type_for_attribute(key).type == :decimal + eval "n.#{key} = value.to_s.gsub(' ', '').gsub(',', '.')" + else + eval "n.#{key} = value" + end end - puts "ENREGISTREMENT" - puts n.save - puts "ERREURS" - puts n.errors.messages - puts "FIN" + + n.save import_csv.import_csv_elements << ImportCsvElement.new(:element => n) diff --git a/lib/acts_as_sorting.rb b/lib/acts_as_sorting.rb index 93da84e..9f4fd70 100644 --- a/lib/acts_as_sorting.rb +++ b/lib/acts_as_sorting.rb @@ -7,3 +7,4 @@ module ActsAsSorting #autoload :InstanceMethods, File.join(File.dirname(__FILE__), "acts_as_sorting/instance_methods") end +# V 0.1 \ No newline at end of file diff --git a/lib/generators/rails/qis/qis_generator.rb b/lib/generators/rails/qis/qis_generator.rb index fa780bc..ad7cab1 100644 --- a/lib/generators/rails/qis/qis_generator.rb +++ b/lib/generators/rails/qis/qis_generator.rb @@ -53,3 +53,5 @@ end end + +# V 0.1 \ No newline at end of file diff --git a/public/uploads/tmp/1591170866-565484713068175-0001-4610/Capture_d_écran_2020-06-02_à_22.23.07.png b/public/uploads/tmp/1591170866-565484713068175-0001-4610/Capture_d_écran_2020-06-02_à_22.23.07.png new file mode 100644 index 0000000..b74698f Binary files /dev/null and b/public/uploads/tmp/1591170866-565484713068175-0001-4610/Capture_d_écran_2020-06-02_à_22.23.07.png differ diff --git a/test/fixtures/mail_type_cats.yml b/test/fixtures/mail_type_cats.yml new file mode 100644 index 0000000..7d41224 --- /dev/null +++ b/test/fixtures/mail_type_cats.yml @@ -0,0 +1,7 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + +two: + name: MyString diff --git a/test/models/mail_type_cat_test.rb b/test/models/mail_type_cat_test.rb new file mode 100644 index 0000000..e0f449a --- /dev/null +++ b/test/models/mail_type_cat_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class MailTypeCatTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end