From 2978de6daae626074341720a40feb0e3cbfd0775 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Mon, 13 May 2019 15:43:28 +0200 Subject: [PATCH] suite --- app/assets/stylesheets/public.scss | 100 +++++++++++++++++--- app/mailers/question_mailer.rb | 3 + app/models/contact.rb | 3 + app/views/admin/contacts/_contact.html.haml | 55 +++++------ app/views/admin/contacts/show.html.haml | 20 +++- app/views/layouts/admin.html.haml | 2 + app/views/layouts/public.html.haml | 1 + app/views/public/contacts/_form.html.haml | 40 +++++--- 8 files changed, 172 insertions(+), 52 deletions(-) diff --git a/app/assets/stylesheets/public.scss b/app/assets/stylesheets/public.scss index 0fba5fc..3206283 100644 --- a/app/assets/stylesheets/public.scss +++ b/app/assets/stylesheets/public.scss @@ -158,6 +158,70 @@ h1{ height:4px; display:block; } + +a{ + color: #428bca; + text-decoration:none; +} + + +.contact_page{ + .contact_products_table{ + + img{ + height:100px; + } + + td{ + padding:5px; + } + + } + fieldset{ + border:0; + padding:0; + margin:0; + + } + + table{ + + max-width:100%; + border-collapse:collapse; + td{ + padding-bottom:12px; + } + } + + + + input, textarea{ + box-sizing:border-box; + padding:12px 15px; + font-size:1em; + width:100%; + border:1px solid black; + + + } + .error{ + color:red; + } + .submit{ + + max-width:100%; + text-align:center; + padding:14px 0; + padding-top:0px; + + } + + .btn{ + + } +} + + #footer{ margin-top:50px; padding:20px 0; @@ -543,27 +607,39 @@ h2{ transform: translate(180%, -15%); } + + // formulaire demande devis + + .contact_page{ + + + } + + //formulaire - #footer table { - width: 100% !important; - max-width: auto; - border-collapse: collapse; - } + #footer{ + + table { + width: 100% !important; + max-width: auto; + border-collapse: collapse; + } - #footer .submit { - width: auto; - max-width: auto; + .submit { + width: auto; + max-width: auto; + } + + margin-top: 0px; } - + + .center { margin: 20px; } - #footer { - margin-top: 0px; - } // articles .actu .description { diff --git a/app/mailers/question_mailer.rb b/app/mailers/question_mailer.rb index e48413b..0ecbaf1 100755 --- a/app/mailers/question_mailer.rb +++ b/app/mailers/question_mailer.rb @@ -11,6 +11,9 @@ class QuestionMailer < ActionMailer::Base mail to: "info@nicolasbally.com,dmoiroud@ets-payre.fr",:reply_to => @contact.email.to_s, :subject => "[Contact site Energies 3P]" end + + + end diff --git a/app/models/contact.rb b/app/models/contact.rb index 11a212f..cce373d 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -35,6 +35,9 @@ class Contact < ActiveRecord::Base end + self.contact_status = "En cours" if !self.contact_status? + + end diff --git a/app/views/admin/contacts/_contact.html.haml b/app/views/admin/contacts/_contact.html.haml index 93f830c..1403584 100644 --- a/app/views/admin/contacts/_contact.html.haml +++ b/app/views/admin/contacts/_contact.html.haml @@ -1,40 +1,41 @@ -%tr.vertical_center.contact#contact{:id => contact.id} +-if contact.contact_products.count > 0 + %tr.vertical_center.contact#contact{:id => contact.id} - %td - -if contact.urgent - %span{:style => "display:inline-block;width:10px;height:10px;border-radius:50%;background:red;"} - %td{:style => "vertical-align:middle;"} - -if !contact.readed - %span{:style => "display:inline-block;width:10px;height:10px;border-radius:50%;background:#00B3EC"} + %td + -if contact.urgent + %span{:style => "display:inline-block;width:10px;height:10px;border-radius:50%;background:red;"} + %td{:style => "vertical-align:middle;"} + -if !contact.readed + %span{:style => "display:inline-block;width:10px;height:10px;border-radius:50%;background:#00B3EC"} - %td{:style => "vertical-align:middle;"} - -if contact.provenance_id - =Category.find(contact.provenance_id).name + %td{:style => "vertical-align:middle;"} + -if contact.provenance_id + =Category.find(contact.provenance_id).name - %td - =l contact.created_at - %td - =contact.name - %td - =contact.cp - =contact.city - %td - =contact.small_comment + %td + =l contact.created_at + %td + =contact.name + %td + =contact.cp + =contact.city + %td + =contact.small_comment - %td + %td - -if contact.admin + -if contact.admin - %span{:style => "background:#{contact.admin.color};padding:5px 10px;"} - =contact.admin.username - %td.actions{:style => "width:430px;text-align:right;"} + %span{:style => "background:#{contact.admin.color};padding:5px 10px;"} + =contact.admin.username + %td.actions{:style => "width:430px;text-align:right;"} - = link_to ic(:"trash-o"), [:admin, contact], :confirm => 'Voulez-vous vraiment supprimer cet utilisateur ?', :method => :delete, :remote => true, :class => "btn btn-danger" + = link_to ic(:"trash-o"), [:admin, contact], :confirm => 'Voulez-vous vraiment supprimer cet utilisateur ?', :method => :delete, :remote => true, :class => "btn btn-danger" - = link_to ic(:pencil)+" modifier / attribuer la fiche", edit_admin_contact_path(contact), :remote => true, :class => "btn btn-warning" + = link_to ic(:pencil)+" modifier / attribuer la fiche", edit_admin_contact_path(contact), :remote => true, :class => "btn btn-warning" - = link_to ic(:eye)+ " détail de la fiche ", [:admin, contact], :class => "btn btn-primary" + = link_to ic(:eye)+ " détail de la fiche ", [:admin, contact], :class => "btn btn-primary" diff --git a/app/views/admin/contacts/show.html.haml b/app/views/admin/contacts/show.html.haml index 95805b4..4b31017 100644 --- a/app/views/admin/contacts/show.html.haml +++ b/app/views/admin/contacts/show.html.haml @@ -23,11 +23,29 @@ + -if @contact.contact_products + %h3 Liste des produits demandés : + -@contact.contact_products.all.each do |cp| + .contact_product + + %table + %tr + %td{:style => "padding-bottom:10px"} + =image_tag cp.d_product.icon.file.url, :style => "height:80px;" + %td +     + =cp.qte + =cp.d_product.unit + + + = link_to 'Ajouter une action', new_admin_contact_action_path(:contact_id => @contact.id), :class => "btn btn-success", :style => "float:right;", :remote => true - + %br + %br + %br %h2 Interactions diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 70cbd81..e452b3e 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -61,6 +61,8 @@ %li= link_to "Produits", admin_d_products_path + %li= link_to "Demandes de devis", admin_d_products_path + diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index 44be265..2fc59ff 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -145,6 +145,7 @@ }); -else + -@img_url = @img_url || "/public_medias/image_file/file/16/large_be38cbd1.jpeg" .slide_home_wrapper.with_ratio{:style => "background-image:url('#{@img_url}');", :data => {:ratio => 0.35}} =render :partial => "public/shared/menu_top" diff --git a/app/views/public/contacts/_form.html.haml b/app/views/public/contacts/_form.html.haml index a959ba2..4d610e2 100755 --- a/app/views/public/contacts/_form.html.haml +++ b/app/views/public/contacts/_form.html.haml @@ -8,29 +8,45 @@ -if @contact.raison_id == 4 -p_ids = [] - %table - =f.semantic_fields_for :contact_products do |f| - %tr - %td - =f.hidden_field :d_product_id - =image_tag f.object.d_product.icon.file.url - %td - =f.input :qte, :label => "Quantité souhaitée (#{f.object.d_product.unit}) :" - -p_ids << f.object.d_product_id - =link_to "supprimer ce produit", public_contact_product_path(:id => f.object.d_product_id), :method => :delete + + -if @contact.contact_products.size > 0 + %h3 + Ma demande concerne les produits suivants : + %table.contact_products_table.table + =f.semantic_fields_for :contact_products do |f| + %tr + %td + =f.hidden_field :d_product_id + =image_tag f.object.d_product.icon.file.url + %td + =f.label :qte, "Quantité souhaitée (#{f.object.d_product.unit}) :" + %td + =f.input :qte, :label => false + -p_ids << f.object.d_product_id + %td + =link_to "supprimer ce produit", public_contact_product_path(:id => f.object.d_product_id), :method => :delete - -if p_ids.size < DProduct.where(:orderable => true).where("icon_id is not null").count.to_i + -if p_ids.size > 0 and p_ids.size < DProduct.where(:orderable => true).where("icon_id is not null").count.to_i %h3 Demander un devis pour les produits suivants également : #products -DProduct.where(:orderable => true).where("icon_id is not null").where("id not in (?)", p_ids).order(:name).each do |d_product| =link_to new_public_contact_product_path(:token => d_product.id) do =image_tag d_product.icon.file.url + + -else + %h3 + Demander un devis pour les produits suivants : + #products + -DProduct.where(:orderable => true).where("icon_id is not null").order(:name).each do |d_product| + =link_to new_public_contact_product_path(:token => d_product.id) do + =image_tag d_product.icon.file.url - + %h3 + Mes coordonnées : %table{:style => "border-collapse:collapse;width:100%;"} %tr