From 3e7fabfbc96308cb9999e06eeb4445115b06351c Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Wed, 24 Jun 2020 18:08:53 +0200 Subject: [PATCH] suite --- app/assets/javascripts/public.js.coffee | 2 +- app/assets/stylesheets/public.scss | 29 ++++++++++++++ .../admin/m_odr_remises_controller.rb | 6 +-- .../admin/m_odr_rep_ribs_controller.rb | 2 + app/models/m_event.rb | 2 +- app/models/m_odr_file.rb | 17 +++++++++ app/models/m_odr_rep_rib.rb | 1 + .../admin/m_odr_file_products/_form.html.haml | 6 ++- .../admin/m_odr_file_roulages/_form.html.haml | 7 +++- .../admin/m_odr_files/_m_odr_file.html.haml | 9 +++-- app/views/admin/m_odr_primes/show.html.haml | 12 ++++-- app/views/admin/m_odr_remises/show.html.haml | 2 +- .../admin/m_odr_rep_ribs/_form.html.haml | 4 +- app/views/layouts/public.html.haml | 38 +++++++++++-------- app/views/public/circuits/show.html.haml | 23 +++++++---- .../m_odr_file_products/_form.html.haml | 2 +- app/views/public/organisateurs/show.html.haml | 12 +++++- 17 files changed, 130 insertions(+), 44 deletions(-) diff --git a/app/assets/javascripts/public.js.coffee b/app/assets/javascripts/public.js.coffee index 5629f60..ac624e6 100644 --- a/app/assets/javascripts/public.js.coffee +++ b/app/assets/javascripts/public.js.coffee @@ -301,7 +301,7 @@ $ -> resize() $(".flashs .remove").click -> - $(this).parent().remove() + $(this).parent().parent().remove() $(document).on "scroll", -> scroll_ajust() diff --git a/app/assets/stylesheets/public.scss b/app/assets/stylesheets/public.scss index 2c2a6d6..af391e2 100644 --- a/app/assets/stylesheets/public.scss +++ b/app/assets/stylesheets/public.scss @@ -10479,4 +10479,33 @@ a.sp-video { .align_center{ text-align:center; } + + + +.flashs{ + background: #F9F1E4; + color: #333f48; + padding: 30px 20px; + font-size: 14px; + position: relative; + + + .notice, .error, .alert{ + margin:0; + padding:0; + max-width:1000px; + margin:auto; + } + .error{ + color:red; + } + + .remove{ + position:absolute; + top:6px; + right:8px; + cursor:pointer; + } + +} \ No newline at end of file diff --git a/app/controllers/admin/m_odr_remises_controller.rb b/app/controllers/admin/m_odr_remises_controller.rb index 2c26f72..2d531bd 100644 --- a/app/controllers/admin/m_odr_remises_controller.rb +++ b/app/controllers/admin/m_odr_remises_controller.rb @@ -19,9 +19,9 @@ class Admin::MOdrRemisesController < ApplicationController @prelevement_date = Time.now - @iban = @m_odr.iban.to_s - @bic = @m_odr.bic.to_s - @name = @m_odr.bank_name.to_s + @iban = "FR7616807001133638997621962" + @bic = "CCBPFRPPGRE" + @name = "Banque Populaire Auvergne Rhone Alpes" diff --git a/app/controllers/admin/m_odr_rep_ribs_controller.rb b/app/controllers/admin/m_odr_rep_ribs_controller.rb index ad1ae17..d94fd01 100644 --- a/app/controllers/admin/m_odr_rep_ribs_controller.rb +++ b/app/controllers/admin/m_odr_rep_ribs_controller.rb @@ -45,6 +45,8 @@ class Admin::MOdrRepRibsController < ApplicationController @m_odr_rep_rib = MOdrRepRib.new(params.require(:m_odr_rep_rib).permit!) if @m_odr_rep_rib.save + + #@m_odr_rep_rib.m_odr_rep.change_state("En cours de traitement") else render action: "new" diff --git a/app/models/m_event.rb b/app/models/m_event.rb index 00125e8..c0d391f 100644 --- a/app/models/m_event.rb +++ b/app/models/m_event.rb @@ -22,7 +22,7 @@ class MEvent < ApplicationRecord belongs_to :image_file def member_label - self.start_at.to_s+" - "+self.title.to_s+" - "+(self.organisateur.name if self.organisateur).to_s + self.start_at.to_date.to_s+" - "+self.title.to_s+" - "+(self.organisateur.name if self.organisateur).to_s end diff --git a/app/models/m_odr_file.rb b/app/models/m_odr_file.rb index 4ca1ad1..8235c16 100644 --- a/app/models/m_odr_file.rb +++ b/app/models/m_odr_file.rb @@ -28,6 +28,23 @@ class MOdrFile < ApplicationRecord end + def new_nbr_primes + self.m_odr_file_roulages.count if self.m_odr_file_type_id == 1 + + end + + def new_nbr_primes_useds + MOdrPrime.where(:m_odr_file_roulage_id => self.m_odr_file_roulages.ids).count if self.m_odr_file_type_id == 1 + + end + + def new_nbr_primes_not_useds + (self.new_nbr_primes - self.new_nbr_primes_useds) if self.m_odr_file_type_id == 1 + + + end + + after_save do #self.p_customer.generate_prime if self.p_customer end diff --git a/app/models/m_odr_rep_rib.rb b/app/models/m_odr_rep_rib.rb index 0611c30..fee35cb 100644 --- a/app/models/m_odr_rep_rib.rb +++ b/app/models/m_odr_rep_rib.rb @@ -30,6 +30,7 @@ class MOdrRepRib < ApplicationRecord def update_prime_status if self.admin_ok and self.p_customer + self.p_customer.m_odr_primes.where(:state => "Manque RIB").all.each do |m_odr_prime| m_odr_prime.state = "Validé" m_odr_prime.save diff --git a/app/views/admin/m_odr_file_products/_form.html.haml b/app/views/admin/m_odr_file_products/_form.html.haml index f2caa39..73b5390 100644 --- a/app/views/admin/m_odr_file_products/_form.html.haml +++ b/app/views/admin/m_odr_file_products/_form.html.haml @@ -1,6 +1,10 @@ %tr.m_odr_file_product_form.field - %td= form.input :m_odr_product_size, :label => "Produit :", :collection => MOdrProductSize.all, :as => :select, :include_blank => false, :member_label => :member_label + %td + = form.input :m_odr_product_size_id, :label => "Produit :", :collection => option_groups_from_collection_for_select(MOdrProduct.all, :m_odr_product_sizes, :name, :id, :name, form.object.m_odr_product_size_id), :as => :select, :include_blank => false, :member_label => :member_label, :include_blank => "Choisissez le profil et la dimension" + + + %td= form.input :qte, :label => "Qté :", :input_html => {:style => "width:60px;"} %td= form.input :price, :label => "Prix :" diff --git a/app/views/admin/m_odr_file_roulages/_form.html.haml b/app/views/admin/m_odr_file_roulages/_form.html.haml index 443290b..8ef702b 100644 --- a/app/views/admin/m_odr_file_roulages/_form.html.haml +++ b/app/views/admin/m_odr_file_roulages/_form.html.haml @@ -1,6 +1,11 @@ %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 + + -if form.object.date? + %td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.order("start_at").where("start_at <= ? and end_at >= ?", form.object.date, form.object.date).all, :member_label => :member_label, :as => :select + + -else + %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/admin/m_odr_files/_m_odr_file.html.haml b/app/views/admin/m_odr_files/_m_odr_file.html.haml index ce808f3..88ef794 100644 --- a/app/views/admin/m_odr_files/_m_odr_file.html.haml +++ b/app/views/admin/m_odr_files/_m_odr_file.html.haml @@ -12,16 +12,17 @@ -tr[:nbr_primes] = capture do %td - =m_odr_file.m_odr_file_roulages.count if m_odr_file.m_odr_file_type_id == 1 + =m_odr_file.new_nbr_primes -tr[:nbr_primes_useds] = capture do %td - =MOdrPrime.where(:m_odr_file_roulage_id => m_odr_file.m_odr_file_roulages.ids).count if m_odr_file.m_odr_file_type_id == 1 + =m_odr_file.new_nbr_primes_useds + -tr[:nbr_primes_not_useds] = capture do %td - =(m_odr_file.m_odr_file_roulages.count - MOdrPrime.where(:m_odr_file_roulage_id => m_odr_file.m_odr_file_roulages.ids).count) if m_odr_file.m_odr_file_type_id == 1 - + =m_odr_file.new_nbr_primes_not_useds + -tr[:admin_ok] = capture do diff --git a/app/views/admin/m_odr_primes/show.html.haml b/app/views/admin/m_odr_primes/show.html.haml index 4a6ecca..0dabad3 100644 --- a/app/views/admin/m_odr_primes/show.html.haml +++ b/app/views/admin/m_odr_primes/show.html.haml @@ -34,12 +34,16 @@ -m_odr_file = @m_odr_prime.m_odr_file_roulage.m_odr_file + + + + %td - =m_odr_file.nbr_primes + =m_odr_file.new_nbr_primes %td - =m_odr_file.nbr_primes_useds + =m_odr_file.new_nbr_primes_useds %td - =m_odr_file.nbr_primes_not_useds + =m_odr_file.new_nbr_primes_not_useds %td = link_to i(:pencil), edit_admin_m_odr_file_path(m_odr_file), :remote => false @@ -70,7 +74,7 @@ = 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" and @m_odr_prime.m_odr_virements.where(:refused => false).count == 0 + -if @m_odr_prime.state == "A traiter" and @m_odr_prime.m_odr_virements.where(:refused => false).count == 0 =link_to "Générer le virement", generate_virement_admin_m_odr_prime_path(@m_odr_prime), :class => "btn btn-primary" %hr diff --git a/app/views/admin/m_odr_remises/show.html.haml b/app/views/admin/m_odr_remises/show.html.haml index 0321b71..58939f2 100644 --- a/app/views/admin/m_odr_remises/show.html.haml +++ b/app/views/admin/m_odr_remises/show.html.haml @@ -7,7 +7,7 @@ %br .qi_side_padding - .right_actions + .right.right_actions -if !@m_odr_remise.confirmed =link_to ic(:envelope)+" Confirmer maintenant TOUS les virements", confirm_admin_m_odr_remise_path(@m_odr_remise) , :class => "btn btn-success" .qi_help diff --git a/app/views/admin/m_odr_rep_ribs/_form.html.haml b/app/views/admin/m_odr_rep_ribs/_form.html.haml index 490a43a..6b6b55e 100644 --- a/app/views/admin/m_odr_rep_ribs/_form.html.haml +++ b/app/views/admin/m_odr_rep_ribs/_form.html.haml @@ -2,7 +2,9 @@ .content =f.inputs do - = f.hidden_field :p_customer_id + = render :partial => "qi/autocomplete", :locals => {:form => f, :field => :p_customer, :label => "Utilisateur :"} + + = f.input :iban, :label => "iban :" , :input_html => {:class => "iban_input"} = f.input :bic, :label => "bic :" diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index 4dacc91..f272aaa 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -84,20 +84,7 @@ %body.pageAccueil - -if flash[:error] or flash[:notice] or flash[:alert] - .flashs - -if flash[:error] - .error - %span.remove=ic :times - =flash[:error] - -if flash[:notice] - .notice - %span.remove=ic :times - =flash[:notice] - -if flash[:alert] - .alert - %span.remove=ic :times - =flash[:alert] + %span.fond_body_1 %span.fond_body_2 #conteneur @@ -169,14 +156,33 @@ %span.icon-bar %span.icon-bar + + + #contenu - / + + -if flash[:error] or flash[:notice] or flash[:alert] + .flashs + -if flash[:error] + .error + %span.remove=ic :times + =flash[:error] + -if flash[:notice] + .notice + %span.remove=ic :times + =flash[:notice] + -if flash[:alert] + .alert + %span.remove=ic :times + =flash[:alert] + + #centreetdroite =yield - / + #pied #conteneur_pied .row diff --git a/app/views/public/circuits/show.html.haml b/app/views/public/circuits/show.html.haml index 4b84437..98478a3 100644 --- a/app/views/public/circuits/show.html.haml +++ b/app/views/public/circuits/show.html.haml @@ -46,22 +46,28 @@ -if @circuit.facebook? =link_to raw(ic(:'facebook-f')), @circuit.facebook, :target => "_blank", :class => "new_btn" - + + %p.localisation + + =@circuit.address2 + =@circuit.address3 if @circuit.address3? + =@circuit.cp + =@circuit.city + =@circuit.country .clear .clear %br %br - %p.localisation - - =@circuit.address2 - =@circuit.address3 if @circuit.address3? - =@circuit.cp - =@circuit.city - =@circuit.country + -@m_events = MEvent.where("start_at >= ? or end_at >= ?", Date.today.beginning_of_day, Date.today.beginning_of_day).where(:circuit_id => @circuit.id) + -params[:search][:per_page] = params[:search][:per_page] || 4 + -per_page = params[:search][:per_page] + -page = (params[:page] and params[:page] != "") ? params[:page] : 1 + -@m_events = @m_events.page(page).per(per_page) + -if @m_events.count > 0 %h3 Les prochaines journées : @@ -71,3 +77,4 @@ =render @m_events + .prevnext= paginate @m_events diff --git a/app/views/public/m_odr_file_products/_form.html.haml b/app/views/public/m_odr_file_products/_form.html.haml index 7e0428c..485977b 100644 --- a/app/views/public/m_odr_file_products/_form.html.haml +++ b/app/views/public/m_odr_file_products/_form.html.haml @@ -1,7 +1,7 @@ %tr.m_odr_file_product_form.field %td - = form.input :m_odr_product_size, :label => "Produit :", :collection => option_groups_from_collection_for_select(MOdrProduct.all, :m_odr_product_sizes, :name, :id, :name), :as => :select, :include_blank => false, :member_label => :member_label, :include_blank => "Choisissez le profil et la dimension" + = form.input :m_odr_product_size_id, :label => "Produit :", :collection => option_groups_from_collection_for_select(MOdrProduct.all, :m_odr_product_sizes, :name, :id, :name, form.object.m_odr_product_size_id), :as => :select, :include_blank => false, :member_label => :member_label, :include_blank => "Choisissez le profil et la dimension"   %td{:style => "width:60px;"} = form.input :qte, :label => "Qté :" diff --git a/app/views/public/organisateurs/show.html.haml b/app/views/public/organisateurs/show.html.haml index d7cc8c8..1c851c4 100644 --- a/app/views/public/organisateurs/show.html.haml +++ b/app/views/public/organisateurs/show.html.haml @@ -44,8 +44,7 @@ %p.localisation{:style => "text-align:center !important;"} - =#@organisateur.address2 - =#@organisateur.address3 if @organisateur.address3? + =@organisateur.cp =@organisateur.city =@organisateur.country @@ -55,6 +54,12 @@ -@m_events = MEvent.where("start_at >= ? or end_at >= ?", Date.today.beginning_of_day, Date.today.beginning_of_day).where(:organisateur_id => @organisateur.id) + + -params[:search][:per_page] = params[:search][:per_page] || 4 + -per_page = params[:search][:per_page] + -page = (params[:page] and params[:page] != "") ? params[:page] : 1 + -@m_events = @m_events.page(page).per(per_page) + -if @m_events.count > 0 %h3 Les prochaines journées : @@ -63,4 +68,7 @@ =render @m_events + + .prevnext= paginate @m_events +