Ameliorations demandees par le client
This commit is contained in:
parent
81bbd7d5ac
commit
6fe10f5faa
@ -78,7 +78,7 @@
|
||||
.my-account-link{
|
||||
display:inline-block;
|
||||
color:#3C763D;
|
||||
font-size:10px;
|
||||
font-size:15px;
|
||||
float:right;
|
||||
position:absolute;
|
||||
right:10px;
|
||||
|
@ -9,6 +9,32 @@ class Admin::MessagesController < ApplicationController
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
@message = Message.new
|
||||
@message.admin = current_admin
|
||||
@message.content = params[:message][:content]
|
||||
@need = Need.find(params[:need_id])
|
||||
@message.need = @need
|
||||
if @message.save
|
||||
admins = Admin.where.not(email: nil)
|
||||
admins.each do |admin|
|
||||
AdminMailer.customer_post_comment(admin, @need, @message).deliver
|
||||
end
|
||||
|
||||
@need.customers.each do |customer|
|
||||
CustomerMailer.need_commented(customer, @need, @message).deliver
|
||||
end
|
||||
|
||||
flash[:notice] = "Commentaire envoyé"
|
||||
|
||||
redirect_to action: 'index'
|
||||
else
|
||||
flash[:error] = "Impossible de créer ce commentaire"
|
||||
|
||||
redirect_to action: 'index'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@message = Message.find(params['id'])
|
||||
if @message.destroy
|
||||
|
@ -63,6 +63,7 @@ class Public::CustomersController < ApplicationController
|
||||
@customer = Customer.new(params.require(:customer).permit!)
|
||||
|
||||
if @customer.save
|
||||
|
||||
CustomerMailer.confirm(@customer).deliver
|
||||
CustomerMailer.notify_ins(@customer).deliver
|
||||
|
||||
@ -87,6 +88,7 @@ class Public::CustomersController < ApplicationController
|
||||
|
||||
|
||||
else
|
||||
|
||||
render :action => "new"
|
||||
end
|
||||
end
|
||||
@ -108,6 +110,13 @@ class Public::CustomersController < ApplicationController
|
||||
def update
|
||||
@customer = Customer.find(params[:id])
|
||||
|
||||
@accepted_offers = @customer.accepted_offers.order(created_at: :desc).page(params[:page_offers]).per(5)
|
||||
@wishes = @customer.wishes.includes(:need).page(params[:page_wishes]).per(5)
|
||||
|
||||
@needs = Kaminari.paginate_array(@customer.owned_needs.order(created_at: :desc))
|
||||
.page(params[:page_needs])
|
||||
.per(5)
|
||||
|
||||
if params[:order]
|
||||
|
||||
@customer.force_address = true
|
||||
@ -118,17 +127,13 @@ class Public::CustomersController < ApplicationController
|
||||
|
||||
if @customer.update_attributes(params.require(:customer).permit!)
|
||||
|
||||
|
||||
redirect_to public_my_account_path
|
||||
flash[:success] = "Vos informations ont bien été enregistrées"
|
||||
redirect_to public_my_account_path
|
||||
|
||||
else
|
||||
if params[:customer][:step2] or params[:customer][:step3]
|
||||
flash[:error] = "Certains champs sont invalides"
|
||||
render :template => "public/my_account/edit_infos"
|
||||
|
||||
render :template => "public/my_account/index"
|
||||
else
|
||||
render :template => "public/my_account/edit_infos"
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -5,6 +5,7 @@ class Public::MyAccountController < ApplicationController
|
||||
before_filter :auth_customer
|
||||
|
||||
def index
|
||||
|
||||
@accepted_offers = current_customer.accepted_offers.order(created_at: :desc).page(params[:page_offers]).per(5)
|
||||
|
||||
@wishes = current_customer.wishes.includes(:need).page(params[:page_wishes]).per(5)
|
||||
@ -13,8 +14,6 @@ class Public::MyAccountController < ApplicationController
|
||||
.page(params[:page_needs])
|
||||
.per(5)
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
def edit_infos
|
||||
|
@ -40,12 +40,18 @@ class Customer < ActiveRecord::Base
|
||||
validates_presence_of :name
|
||||
validates_presence_of :firstname
|
||||
|
||||
|
||||
|
||||
|
||||
validates_presence_of :organisation
|
||||
|
||||
validates_presence_of :phone
|
||||
|
||||
#validates_presence_of :parent_code
|
||||
|
||||
validates :capital, :numericality => true, :presence => true, :if => :step2
|
||||
validates :role_signataire, :presence => true, :if => :step2
|
||||
|
||||
validates_presence_of :password, :on => :create
|
||||
validates :email, :presence => true, :uniqueness => true, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
class Message < ActiveRecord::Base
|
||||
belongs_to :customer
|
||||
belongs_to :admin
|
||||
belongs_to :need
|
||||
paginates_per 5
|
||||
|
||||
|
@ -40,29 +40,34 @@
|
||||
%td{style:"text-align:center"}
|
||||
-if !document.document?
|
||||
= form_tag admin_offer_accepted_offer_document_upload_document_path(@offer, @accepted_offer, document), name: :document, method: :post, multipart: true do
|
||||
%span.btn.btn-default.btn-file
|
||||
="Ouvrir (PDF)"
|
||||
%span.btn.btn-xs.btn-default.btn-file
|
||||
= ic(:'folder-open')
|
||||
= file_field_tag :document
|
||||
= submit_tag("Charger" , class:"btn btn-primary")
|
||||
%button.btn.btn-xs.upload-file{type: :submit, title: "Charger"}
|
||||
= ic(:check)
|
||||
|
||||
|
||||
-else
|
||||
=link_to i(:"download"),public_download_document_path(document.download_token, admin: true),title: "Télécharger le document"
|
||||
=link_to ic(:"download"),public_download_document_path(document.download_token, admin: true),title: "Télécharger le document", class: "btn btn-primary btn-xs"
|
||||
-if !document.document_verified?
|
||||
=link_to i(:"remove"), admin_offer_accepted_offer_document_delete_path(@offer, @accepted_offer, document), title: "Supprimer le fichier chargé", :data => {:confirm => 'Voulez-vous vraiment supprimer le fichier chargé ?'}
|
||||
=link_to ic(:"remove"), admin_offer_accepted_offer_document_delete_path(@offer, @accepted_offer, document), title: "Supprimer le fichier chargé",class: "btn btn-danger btn-xs", :data => {:confirm => 'Voulez-vous vraiment supprimer le fichier chargé ?'}
|
||||
|
||||
%td{style:"text-align:center"}
|
||||
-if !document.not_available?
|
||||
-if !document.returned_document?
|
||||
= form_tag admin_offer_accepted_offer_document_upload_returned_document_path(@offer, @accepted_offer, document), name: :returned_document, method: :post, multipart: true do
|
||||
%span.btn.btn-default.btn-file
|
||||
="Ouvrir (PDF)"
|
||||
%span.btn.btn-xs.btn-default.btn-file
|
||||
= ic(:'folder-open')
|
||||
= file_field_tag :returned_document
|
||||
= submit_tag("Charger manuellement" , class:"btn btn-primary")
|
||||
%button.btn.btn-xs.upload-file{type: :submit, title: "Charger manuellement"}
|
||||
= ic(:check)
|
||||
|
||||
-else
|
||||
=link_to i(:"download"), admin_offer_accepted_offer_document_download_returned_path(@offer, @accepted_offer, document, :admin => true),title: "Télécharger le document"
|
||||
=link_to ic(:"download"), admin_offer_accepted_offer_document_download_returned_path(@offer, @accepted_offer, document, :admin => true),class: "btn btn-primary btn-xs", title: "Télécharger le document"
|
||||
-if !document.document_verified?
|
||||
=link_to i(:"remove"), admin_offer_accepted_offer_document_delete_returned_path(@offer, @accepted_offer, document), title: "Supprimer le fichier chargé", :data => {:confirm => 'Voulez-vous vraiment supprimer le fichier chargé ?'}
|
||||
=link_to ic(:"remove"), admin_offer_accepted_offer_document_delete_returned_path(@offer, @accepted_offer, document),class: "btn btn-danger btn-xs", title: "Supprimer le fichier chargé", :data => {:confirm => 'Voulez-vous vraiment supprimer le fichier chargé ?'}
|
||||
-if document.document_returned?
|
||||
=link_to i(:"check"), admin_offer_accepted_offer_document_verify_returned_path(@offer, @accepted_offer, document), :data => {:confirm => 'Voulez-vous vraiment marquer le document retourné par le client comme vérifié ?'}, title: "Marquer le document comme vérifié"
|
||||
=link_to ic(:"check"), admin_offer_accepted_offer_document_verify_returned_path(@offer, @accepted_offer, document),class: "btn btn-success btn-xs", :data => {:confirm => 'Voulez-vous vraiment marquer le document retourné par le client comme vérifié ?'}, title: "Marquer le document comme vérifié"
|
||||
|
||||
-else
|
||||
Charger un document d'abord
|
||||
@ -80,3 +85,12 @@
|
||||
=link_to ic(:check) + " Je confirme que tous les documents ont été retournés et vérifiés", validate_all_documents_admin_offer_accepted_offer_path(@offer, @accepted_offer), class:"btn btn-lg btn-success pull-right",:data => {:confirm => 'Voulez-vous vraiment confirmer que tous les documents ont été retournés et vérifiés ?'}
|
||||
|
||||
=link_to ic(:"chevron-circle-left") + " Gestion des propositions par client pour le besoin #{@offer.need.title}", accepted_admin_offer_path(@offer), class: "btn btn-default"
|
||||
|
||||
|
||||
:javascript
|
||||
$(".upload-file").prop("disabled","disabled");
|
||||
$(".btn-file input").change(function(){
|
||||
|
||||
$(this).parent().next(".upload-file").prop("disabled","");
|
||||
$(this).parent().next(".upload-file").addClass("btn-success");
|
||||
})
|
||||
|
@ -1,45 +1,45 @@
|
||||
|
||||
|
||||
|
||||
=semantic_form_for [:admin, @customer] do |f|
|
||||
=semantic_form_for [:admin, @customer] do |f|
|
||||
.content
|
||||
|
||||
|
||||
=f.inputs do
|
||||
=f.input :domains, :label => "Domaine : ", :collection => Domain.all, :as => :check_boxes
|
||||
|
||||
|
||||
=f.input :organisation, :label => "Société : "
|
||||
|
||||
|
||||
=f.input :name, :label => "Nom : "
|
||||
=f.input :firstname, :label => "Prénom : "
|
||||
=f.input :email, :label => "Email : "
|
||||
=f.input :phone, :label => "Tél : "
|
||||
=f.input :password, :label => "Mot de passe : "
|
||||
|
||||
|
||||
=#f.hidden_field :step2
|
||||
=f.input :tva_number, :label => "Numéro de TVA intra. :"
|
||||
=f.input :siret, :label => "Numéro de siret :"
|
||||
=f.input :capital, :label => "Capital :"
|
||||
=f.input :role_signataire, :label => "Fonction du signataire :"
|
||||
= f.input :address, :label => "Adresse"
|
||||
= f.input :address2, :label => "Adresse (suite)"
|
||||
= f.input :cp, :label => "Code postal"
|
||||
= f.input :city, :label => "Ville"
|
||||
|
||||
|
||||
|
||||
|
||||
=#f.hidden_field :step3
|
||||
|
||||
=f.input :need_1, :label => "1er besoin : ",:as => :select, :collection => [ "Materiel professionnel", "Matériel informatique", "Achat de véhicules", "Energie"]
|
||||
=f.input :need_2, :label => "2ième besoin : ",:as => :select, :collection => [ "Materiel professionnel", "Matériel informatique", "Achat de véhicules", "Energie"]
|
||||
=f.input :need_3, :label => "3ième besoin : ", :placeholder => "Autre, précisez ",:rows => 5, :input_html => {:style => "height:100px;"}
|
||||
|
||||
|
||||
=f.input :particulars_text, :label => "En-tête contrats : ",:rows => 5, :input_html => {:style => "height:100px;"}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=f.input :newsgroups, :label => "Newsletters :", :collection => Newsgroup.all, :as => :check_boxes
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions= f.submit "Sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
|
||||
|
@ -1,6 +1,13 @@
|
||||
.white.padding.message-item
|
||||
|
||||
%h4=message.customer.anonyme_nick
|
||||
-if message.customer
|
||||
%h4
|
||||
=message.customer.anonyme_nick
|
||||
="(#{message.customer.fullname} de #{message.customer.organisation})"
|
||||
|
||||
-elsif message.admin
|
||||
%h4="#{message.admin.fullname} (ADMINISTRATEUR)"
|
||||
|
||||
%p.info="Posté le #{message.created_at.strftime('%d/%m/%Y à %H:%M')}, il y a #{time_ago_in_words(message.created_at)}"
|
||||
|
||||
|
||||
|
@ -1,5 +1,16 @@
|
||||
%h1= "Commentaires du besoin #{@need.title}"
|
||||
|
||||
= semantic_form_for [:admin, @need, Message.new], :html => {id: :message_form, :method => :post } do |f|
|
||||
|
||||
|
||||
|
||||
%h4 Écrire un nouveau message
|
||||
= f.inputs do
|
||||
= f.input :content, as: :text, label: false, rows: 5, :input_html => {:style => "height:100px;"}
|
||||
|
||||
=f.submit "Envoyer", :class => "btn btn-square btn-primary pull-right"
|
||||
|
||||
|
||||
%h4= " #{pluralize(@need.messages.count, 'Commentaire')} pour ce besoin"
|
||||
|
||||
=render collection: @comments, partial: 'message'
|
||||
|
18
app/views/admin_mailer/customer_post_comment.html.haml
Normal file → Executable file
18
app/views/admin_mailer/customer_post_comment.html.haml
Normal file → Executable file
@ -1,10 +1,18 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Un client a laissé un commentaire sur le besoin
|
||||
%strong= @need.title
|
||||
-if @comment.customer
|
||||
%p
|
||||
Un utilisateur a laissé un commentaire sur le besoin
|
||||
%strong= @need.title
|
||||
|
||||
%p
|
||||
%strong= @comment.customer.fullname
|
||||
%p
|
||||
%strong= @comment.customer.fullname
|
||||
-elsif @comment.admin
|
||||
%p
|
||||
Un administrateur a laissé un commentaire sur le besoin
|
||||
%strong= @need.title
|
||||
|
||||
%p
|
||||
%strong= @comment.admin.fullname
|
||||
|
||||
%p= @comment.content
|
||||
|
20
app/views/customer_mailer/need_commented.html.haml
Normal file → Executable file
20
app/views/customer_mailer/need_commented.html.haml
Normal file → Executable file
@ -1,10 +1,20 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Un autre utilisateur a laissé un commentaire sur le besoin
|
||||
%strong= @need.title
|
||||
|
||||
%p
|
||||
%strong= @comment.customer.fullname
|
||||
-if @comment.customer
|
||||
%p
|
||||
Un autre utilisateur a laissé un commentaire sur le besoin
|
||||
%strong= @need.title
|
||||
|
||||
%p
|
||||
%strong= @comment.customer.anonyme_nick
|
||||
-elsif @comment.admin
|
||||
%p
|
||||
Un administrateur a laissé un commentaire sur le besoin
|
||||
%strong= @need.title
|
||||
|
||||
%p
|
||||
%strong= @comment.admin.fullname
|
||||
|
||||
|
||||
%p= @comment.content
|
||||
|
@ -1,23 +1,34 @@
|
||||
%tr{class: document.document_verified? ? "success" : ""}
|
||||
%td
|
||||
= i(:file) + " " + document.title
|
||||
%td{style:"text-align:center"}
|
||||
%td{style:"text-align:center;vertical-align:middle"}
|
||||
-if document.document?
|
||||
=link_to ic(:download), public_download_document_path(document.download_token),class: "btn btn-primary btn-sm",title: "Télécharger le document"
|
||||
=link_to ic(:download), public_download_document_path(document.download_token),class: "btn btn-primary btn-xs",title: "Télécharger le document"
|
||||
-else
|
||||
Pas encore disponible
|
||||
%td{style:"text-align:center"}
|
||||
%td{style:"text-align:center;vertical-align:middle"}
|
||||
-if !document.not_available?
|
||||
-if !document.returned_document?
|
||||
= form_tag upload_returned_public_accepted_offer_document_path(@accepted_offer, document), name: :returned_document, method: :post, multipart: true do
|
||||
%span.btn.btn-default.btn-file
|
||||
="Ouvrir (PDF)"
|
||||
%span.btn.btn-xs.btn-default.btn-file
|
||||
= ic(:'folder-open')
|
||||
= file_field_tag :returned_document
|
||||
= submit_tag("Charger" , class:"btn btn-primary")
|
||||
-else
|
||||
=link_to i(:"download"),download_returned_public_accepted_offer_document_path(@accepted_offer, document), class:"btn btn-sm btn-primary",title: "Télécharger le document"
|
||||
-if !document.document_verified?
|
||||
=link_to i(:"remove"),destroy_returned_public_accepted_offer_document_path(@accepted_offer, document), class:"btn btn-sm btn-danger", title: "Supprimer le fichier chargé", :data => {:confirm => 'Voulez-vous vraiment supprimer le fichier chargé ?'}
|
||||
%button.btn.btn-xs.upload-file{type: :submit, title: "Valider le document"}
|
||||
= ic(:check)
|
||||
|
||||
%td{style:"text-align:right"}
|
||||
-else
|
||||
=link_to i(:"download"),download_returned_public_accepted_offer_document_path(@accepted_offer, document), class:"btn btn-xs btn-primary",title: "Télécharger le document"
|
||||
-if !document.document_verified?
|
||||
=link_to i(:"remove"),destroy_returned_public_accepted_offer_document_path(@accepted_offer, document), class:"btn btn-xs btn-danger", title: "Supprimer le fichier chargé", :data => {:confirm => 'Voulez-vous vraiment supprimer le fichier chargé ?'}
|
||||
-else
|
||||
= "Pas encore disponible"
|
||||
%td{style:"text-align:right;vertical-align:middle"}
|
||||
=document.human_state
|
||||
|
||||
:javascript
|
||||
$(".upload-file").prop("disabled","disabled");
|
||||
$(".btn-file input").change(function(){
|
||||
|
||||
$(this).parent().next(".upload-file").prop("disabled","");
|
||||
$(this).parent().next(".upload-file").addClass("btn-success");
|
||||
})
|
||||
|
@ -2,25 +2,27 @@
|
||||
-@customer = @customer || current_customer
|
||||
-@customer.step2 = true
|
||||
|
||||
= semantic_form_for [:public, @customer] do |f|
|
||||
|
||||
|
||||
|
||||
= semantic_form_for [:public, @customer] do |f|
|
||||
|
||||
|
||||
|
||||
%h2 Informations détaillées
|
||||
=f.inputs do
|
||||
=f.inputs do
|
||||
=f.hidden_field :step2
|
||||
=f.input :tva_number, :label => "Numéro de TVA intra. :"
|
||||
=f.input :siret, :label => "Numéro de siret :"
|
||||
|
||||
=f.input :capital, :label => "Capital :"
|
||||
=f.input :role_signataire, :label => "Fonction du signataire :"
|
||||
|
||||
=render :partial => "public/my_account/address", :locals => {:f => f}
|
||||
=#%h2 Préférences concernant les envois de mail
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=#f.inputs do
|
||||
=#f.input :newsgroups, :label => "Les types d'informations qui m'intéressent :", :collection => Newsgroup.all, :as => :check_boxes
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=f.submit "Sauvegarder", :class => "btn btn-primary"
|
||||
%br
|
||||
|
@ -1,6 +1,14 @@
|
||||
.white.padding.message-item
|
||||
|
||||
%h4= i(:"user") + " " + message.customer.anonyme_nick
|
||||
-if message.customer
|
||||
%h4
|
||||
=message.customer.anonyme_nick
|
||||
-elsif message.admin
|
||||
%h4
|
||||
="#{message.admin.fullname}"
|
||||
%span{style:"color:red"}
|
||||
="ADMINISTRATEUR"
|
||||
|
||||
%p.info=i(:"clock-o") + " Posté le #{message.created_at.strftime('%d/%m/%Y à %H:%M')}, il y a #{time_ago_in_words(message.created_at)}"
|
||||
|
||||
%p= message.content
|
||||
|
@ -114,7 +114,7 @@
|
||||
-if offer.need.customers.include?(current_customer)
|
||||
-if !offer.customers.include?(current_customer)
|
||||
.accept-offer
|
||||
=link_to i(:"check") + " Accepter l'offre", accept_public_need_offer_path(@need, offer), data: {confirm: "Voulez-vous vraiment accepter cette offre ? Attention, cette action vous engage à payer la somme proposée."}, class: "btn btn-lg btn-success "
|
||||
=link_to i(:"check") + " J'accepte l'offre et je retourne le mandat signé", accept_public_need_offer_path(@need, offer), data: {confirm: "Pour que l’offre soit validée veuillez retourné le mandat signé que vous allez recevoir"}, class: "btn btn-lg btn-success "
|
||||
-else
|
||||
.offer-accepted
|
||||
=i(:"check") + " Offre Acceptée"
|
||||
|
6
db/migrate/20161017150545_add_some_extra_fields.rb
Executable file
6
db/migrate/20161017150545_add_some_extra_fields.rb
Executable file
@ -0,0 +1,6 @@
|
||||
class AddSomeExtraFields < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :customers, :capital,:float
|
||||
add_column :customers, :role_signataire,:string
|
||||
end
|
||||
end
|
5
db/migrate/20161018122307_add_admin_to_message.rb
Executable file
5
db/migrate/20161018122307_add_admin_to_message.rb
Executable file
@ -0,0 +1,5 @@
|
||||
class AddAdminToMessage < ActiveRecord::Migration
|
||||
def change
|
||||
add_reference :messages, :admin, index: true
|
||||
end
|
||||
end
|
@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20160926090902) do
|
||||
ActiveRecord::Schema.define(version: 20161018122307) do
|
||||
|
||||
create_table "accepted_offers", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
@ -225,6 +225,8 @@ ActiveRecord::Schema.define(version: 20160926090902) do
|
||||
t.float "longitude", limit: 24
|
||||
t.datetime "last_activity"
|
||||
t.text "particulars_text", limit: 65535
|
||||
t.float "capital", limit: 24
|
||||
t.string "role_signataire", limit: 255
|
||||
end
|
||||
|
||||
create_table "data_files", force: :cascade do |t|
|
||||
@ -468,8 +470,11 @@ ActiveRecord::Schema.define(version: 20160926090902) do
|
||||
t.integer "customer_id", limit: 4
|
||||
t.integer "need_id", limit: 4
|
||||
t.text "content", limit: 65535
|
||||
t.integer "admin_id", limit: 4
|
||||
end
|
||||
|
||||
add_index "messages", ["admin_id"], name: "index_messages_on_admin_id", using: :btree
|
||||
|
||||
create_table "need_categories", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
|
Loading…
x
Reference in New Issue
Block a user