Need Images added + Devis attached to devis + text fixing + mail triggers + bug fix
This commit is contained in:
parent
426591453b
commit
6431ec9e64
@ -644,6 +644,17 @@ height: 100%;
|
||||
margin:20px auto;
|
||||
display:block;
|
||||
height:200px;
|
||||
margin-bottom:60px;
|
||||
|
||||
}
|
||||
#big-logo{
|
||||
|
||||
margin:20px auto;
|
||||
width:400px;
|
||||
height:400px;
|
||||
display:block;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -115,14 +115,31 @@
|
||||
|
||||
|
||||
.need-item{
|
||||
height: 150px;
|
||||
height: 200px;
|
||||
background-color:#fff;
|
||||
padding-top:30px;
|
||||
position:relative;
|
||||
padding-left:190px;
|
||||
.need-image{
|
||||
margin-top:26px;
|
||||
position: absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width:174px;
|
||||
height:174px;
|
||||
background-color: rgb(163, 159, 159);
|
||||
background-size: cover;
|
||||
background-position: center center;
|
||||
background-image: url('/placeholder.png');
|
||||
}
|
||||
|
||||
p.description{
|
||||
font-size:12px;
|
||||
color:rgb(163, 159, 159);
|
||||
max-height: 105px;
|
||||
word-wrap: break-word;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
p.info{
|
||||
@ -157,7 +174,7 @@
|
||||
position:absolute;
|
||||
left:0px;
|
||||
bottom:0px;
|
||||
padding-left:5px;
|
||||
padding-left:180px;
|
||||
padding-bottom:5px;
|
||||
.item{
|
||||
display:inline;
|
||||
|
@ -11,10 +11,11 @@ class Admin::ContactMessagesController < ApplicationController
|
||||
@contact_message.read_by_admin = true
|
||||
|
||||
if @contact_message.save
|
||||
flash[:notice] = "Commentaire envoyé."
|
||||
CustomerMailer.contact_message_received(@contact_message.contact, @contact_message).deliver
|
||||
flash[:notice] = "Message envoyé."
|
||||
return redirect_to :back
|
||||
else
|
||||
flash[:error] = "Votre commentaire n'a pas pu être envoyé."
|
||||
flash[:error] = "Votre message n'a pas pu être envoyé."
|
||||
return render 'index'
|
||||
end
|
||||
|
||||
|
@ -29,7 +29,7 @@ class Admin::CustomersController < ApplicationController
|
||||
@customer.account_validated = true
|
||||
@customer.account_validated_at = Time.now
|
||||
@customer.save
|
||||
CustomerMailer.delay.validate_account(@customer)
|
||||
CustomerMailer.validate_account(@customer).deliver
|
||||
|
||||
redirect_to :back
|
||||
end
|
||||
|
@ -25,6 +25,9 @@ class Admin::DocumentsController < ApplicationController
|
||||
@document.document = params[:document]
|
||||
if @document.save
|
||||
@document.state = :document_available
|
||||
|
||||
CustomerMailer.document_available(@accepted_offer.customer, @document).deliver
|
||||
|
||||
if @document.returned_document?
|
||||
@document.remove_returned_document!
|
||||
end
|
||||
@ -130,6 +133,7 @@ class Admin::DocumentsController < ApplicationController
|
||||
|
||||
|
||||
if @document.save
|
||||
CustomerMailer.document_verified(@accepted_offer.customer, @document).deliver
|
||||
flash[:success] = "Document vérifié"
|
||||
else
|
||||
flash[:error] = "Impossible vérifier le document"
|
||||
|
@ -66,6 +66,11 @@ class Admin::NeedsController < ApplicationController
|
||||
@comments = @need.messages.order(created_at: :desc).page params[:page]
|
||||
end
|
||||
|
||||
def download_devis
|
||||
@need = Need.find(params[:need_id])
|
||||
send_file @need.devis.file.path, :filename => "devis-need-#{@need.id}.#{@need.devis.file.extension}"
|
||||
end
|
||||
|
||||
def create
|
||||
@need = Need.new(need_params)
|
||||
|
||||
@ -160,7 +165,7 @@ class Admin::NeedsController < ApplicationController
|
||||
private
|
||||
|
||||
def need_params
|
||||
params.require(:need).permit(:title, :description, :category_id, :author_id)
|
||||
params.require(:need).permit(:title, :image_file_id, :description, :category_id, :author_id)
|
||||
end
|
||||
|
||||
def build_category_tree
|
||||
|
@ -3,7 +3,10 @@ class ApplicationController < ActionController::Base
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
|
||||
|
||||
def auth_customer
|
||||
|
||||
session[:devise_id] = params[:d] if params[:d]
|
||||
if !current_customer
|
||||
session[:before_auth_url] = request.url
|
||||
|
@ -20,10 +20,16 @@ class Public::ContactMessagesController < ApplicationController
|
||||
@contact_message.read_by_customer = true
|
||||
|
||||
if @contact_message.save
|
||||
flash[:notice] = "Commentaire envoyé."
|
||||
flash[:notice] = "Message envoyé."
|
||||
|
||||
admins = Admin.where.not(email: nil)
|
||||
admins.each do |admin|
|
||||
AdminMailer.customer_send_contact_message(admin, @contact_message).deliver
|
||||
end
|
||||
|
||||
return redirect_to :back
|
||||
else
|
||||
flash[:error] = "Votre commentaire n'a pas pu être envoyé."
|
||||
flash[:error] = "Votre message n'a pas pu être envoyé."
|
||||
return render 'index'
|
||||
end
|
||||
|
||||
|
@ -3,6 +3,7 @@ class Public::CustomersAuthsController < ApplicationController
|
||||
layout "public"
|
||||
|
||||
def new
|
||||
@biglogo = true
|
||||
@no_search = true
|
||||
params[:step] = "login"
|
||||
if params[:for_annonce]
|
||||
@ -26,7 +27,7 @@ class Public::CustomersAuthsController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@biglogo = true
|
||||
@customer = Customer.new()
|
||||
if cookies[:mlm_token] and @parent = Customer.find_parrain(cookies[:mlm_token])
|
||||
@customer.parent_code = @parent.mlm_token.upcase
|
||||
@ -54,7 +55,7 @@ class Public::CustomersAuthsController < ApplicationController
|
||||
redirect_to :root
|
||||
else
|
||||
flash.now.alert = "Email ou mot de passe incorect"
|
||||
|
||||
|
||||
render :action => "new"
|
||||
end
|
||||
end
|
||||
|
@ -63,8 +63,8 @@ class Public::CustomersController < ApplicationController
|
||||
@customer = Customer.new(params.require(:customer).permit!)
|
||||
|
||||
if @customer.save
|
||||
CustomerMailer.delay.confirm(@customer)
|
||||
CustomerMailer.delay.notify_ins(@customer)
|
||||
CustomerMailer.confirm(@customer).deliver
|
||||
CustomerMailer.notify_ins(@customer).deliver
|
||||
|
||||
|
||||
@customer.authenticate(params[:password])
|
||||
@ -89,7 +89,7 @@ class Public::CustomersController < ApplicationController
|
||||
@customer.enabled = true
|
||||
@customer.save(:validate => false)
|
||||
|
||||
CustomerMailer.delay.confirm_ins(@customer)
|
||||
CustomerMailer.confirm_ins(@customer).deliver
|
||||
|
||||
cookies[:customer_auth_token] = @customer.token
|
||||
|
||||
|
@ -13,9 +13,14 @@ class Public::DocumentsController < ApplicationController
|
||||
|
||||
def download
|
||||
@document = @accepted_offer.documents.find(params[:id])
|
||||
if @document.state == :document_available
|
||||
if @document.state == 'document_available'
|
||||
@document.state = :document_downloaded
|
||||
@document.save
|
||||
|
||||
admins = Admin.where.not(email: nil)
|
||||
admins.each do |admin|
|
||||
AdminMailer.customer_download_document(admin, @document, current_customer).deliver
|
||||
end
|
||||
end
|
||||
send_file @document.document.file.path
|
||||
|
||||
@ -51,7 +56,12 @@ class Public::DocumentsController < ApplicationController
|
||||
@document = @accepted_offer.documents.find(params[:id])
|
||||
@document.returned_document = params[:returned_document]
|
||||
if @document.save
|
||||
@document.return_document!
|
||||
@document.state = :document_returned
|
||||
@document.save
|
||||
admins = Admin.where.not(email: nil)
|
||||
admins.each do |admin|
|
||||
AdminMailer.customer_upload_document(admin, @document, current_customer).deliver
|
||||
end
|
||||
flash[:success] = "Document chargé"
|
||||
else
|
||||
flash[:error] = "Impossible de charger le document"
|
||||
|
@ -15,6 +15,14 @@ class Public::MessagesController < ApplicationController
|
||||
|
||||
if(@message.save)
|
||||
flash[:notice] = "Commentaire envoyé."
|
||||
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
|
||||
else
|
||||
flash[:error] = "Votre commentaire n'a pas pu être envoyé."
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ class Public::MyAccountController < ApplicationController
|
||||
|
||||
def index
|
||||
@accepted_offers = current_customer.accepted_offers.order(created_at: :desc).page(params[:page_offers]).per(5)
|
||||
|
||||
|
||||
@wishes = current_customer.needs.shared.page(params[:page_wishes]).per(5)
|
||||
|
||||
@needs = Kaminari.paginate_array(current_customer.owned_needs.order(created_at: :desc))
|
||||
@ -45,7 +45,7 @@ class Public::MyAccountController < ApplicationController
|
||||
|
||||
def reconfirm
|
||||
@no_search = true
|
||||
CustomerMailer.delay.confirm(current_customer)
|
||||
CustomerMailer.confirm(current_customer).deliver
|
||||
|
||||
redirect_to public_my_account_path, :notice => "Le mail vous a été renvoyé"
|
||||
end
|
||||
|
@ -66,6 +66,19 @@ class Public::NeedsController < ApplicationController
|
||||
|
||||
end
|
||||
|
||||
|
||||
def download_devis
|
||||
@need = Need.find(params[:need_id])
|
||||
|
||||
if @need.author.id != current_customer.id
|
||||
flash[:error] = "Vous n'êtes pas le propriétaire"
|
||||
return redirect_to :back
|
||||
end
|
||||
|
||||
send_file @need.devis.file.path, filename: "devis-need-#{@need.id}.#{@need.devis.file.extension}"
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
@need = Need.new()
|
||||
end
|
||||
@ -101,10 +114,13 @@ class Public::NeedsController < ApplicationController
|
||||
def create
|
||||
@need = Need.new(need_params)
|
||||
@need.author = current_customer
|
||||
if !@need.devis?
|
||||
flash[:error] = "Vous devez joindre un devis au format PDF"
|
||||
return render :action => "new"
|
||||
end
|
||||
|
||||
if @need.save
|
||||
flash[:notice] = "Votre besoin à été créé avec succès."
|
||||
|
||||
|
||||
redirect_to public_my_account_path
|
||||
else
|
||||
render :action => "new"
|
||||
@ -115,13 +131,22 @@ class Public::NeedsController < ApplicationController
|
||||
|
||||
def wish
|
||||
@need = Need.find(params[:id])
|
||||
|
||||
admins = Admin.where.not(email: nil)
|
||||
if (!@need.customers.include?(current_customer))
|
||||
@need.customers << current_customer
|
||||
flash[:notice] = "Vous avez signalé votre intérêt pour ce besoin"
|
||||
# Find all admins with email
|
||||
|
||||
admins.each do |admin|
|
||||
AdminMailer.customer_interested(admin, @need, current_customer).deliver
|
||||
end
|
||||
|
||||
else
|
||||
@need.customers.delete(current_customer)
|
||||
flash[:error] = "Vous n'êtes maintenant plus intéressé par ce besoin"
|
||||
admins.each do |admin|
|
||||
AdminMailer.customer_disinterested(admin, @need, current_customer).deliver
|
||||
end
|
||||
end
|
||||
redirect_to :back
|
||||
end
|
||||
@ -133,7 +158,7 @@ class Public::NeedsController < ApplicationController
|
||||
end
|
||||
|
||||
def need_params
|
||||
params.require(:need).permit(:title, :description, :category_id)
|
||||
params.require(:need).permit(:title, :devis, :description, :category_id)
|
||||
end
|
||||
|
||||
def check_owner
|
||||
|
@ -18,7 +18,17 @@ class Public::OffersController < ApplicationController
|
||||
@accepted_offer.documents << @document
|
||||
|
||||
if @accepted_offer.save
|
||||
admins = Admin.where.not(email: nil)
|
||||
admins.each do |admin|
|
||||
AdminMailer.customer_accept_offer(admin, @accepted_offer).deliver
|
||||
end
|
||||
|
||||
CustomerMailer.offer_accepted(current_customer, @accepted_offer).deliver
|
||||
|
||||
flash[:notice] = "Proposition acceptée avec succès !"
|
||||
|
||||
|
||||
|
||||
redirect_back_or_default :root
|
||||
end
|
||||
end
|
||||
|
@ -10,4 +10,52 @@ class AdminMailer < ApplicationMailer
|
||||
@need = need
|
||||
mail to: admin.email, subject: "Nouvelle proposition de besoin"
|
||||
end
|
||||
|
||||
# a faire
|
||||
def customer_interested(admin, need, customer)
|
||||
@need = need
|
||||
@customer = customer
|
||||
mail to: admin.email, subject: "Un client s'est intéressé à un besoin"
|
||||
end
|
||||
|
||||
# a faire
|
||||
def customer_disinterested(admin, need, customer)
|
||||
@need = need
|
||||
@customer = customer
|
||||
mail to: admin.email, subject: "Un client s'est désintéressé d'un besoin"
|
||||
end
|
||||
|
||||
# a faire
|
||||
def customer_post_comment(admin, need, comment)
|
||||
@need = need
|
||||
@comment = comment
|
||||
mail to: admin.email, subject: "Un client a laissé un commentaire sur un besoin"
|
||||
end
|
||||
|
||||
# a faire
|
||||
def customer_accept_offer(admin, accepted_offer)
|
||||
@accepted_offer = accepted_offer
|
||||
mail to: admin.email, subject: "Un client a accepté une offre"
|
||||
end
|
||||
|
||||
# a faire
|
||||
def customer_download_document(admin, document, customer)
|
||||
@document = document
|
||||
@customer = customer
|
||||
mail to: admin.email, subject: "Un client a téléchargé un document"
|
||||
end
|
||||
|
||||
# a faire
|
||||
def customer_upload_document(admin, document, customer)
|
||||
@document = document
|
||||
mail to: admin.email, subject: "Un client a renvoyé un document"
|
||||
end
|
||||
|
||||
# a faire
|
||||
def customer_send_contact_message(admin, contact_message)
|
||||
@contact_message = contact_message
|
||||
mail to: admin.email, subject: "Un client a envoyé un message de contact"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
@ -50,19 +50,66 @@ class CustomerMailer < ApplicationMailer
|
||||
def negociate_need(need, customer)
|
||||
@need = need
|
||||
@customer = customer
|
||||
mail to: @customer.email, :subject => "Négociation en cours !"
|
||||
mail to: @customer.email, :subject => "Négociation en cours pour le besoin #{@need.title}"
|
||||
end
|
||||
|
||||
|
||||
def need_negociated(customer ,need)
|
||||
@need = need
|
||||
@customer = customer
|
||||
mail to: @customer.email, :subject => "Besoin #{@need.title} négocié !"
|
||||
end
|
||||
|
||||
|
||||
def need_negociation_failed(customer, need)
|
||||
@need = need
|
||||
@customer = customer
|
||||
mail to: @customer.email, :subject => "Négociation échouée pour le besoin #{@need.title}"
|
||||
end
|
||||
|
||||
def need_commented(customer, need, comment)
|
||||
@need = need
|
||||
@customer = customer
|
||||
@comment = comment
|
||||
mail to: @customer.email, :subject => "Nouveau commentaire pour le besoin #{@need.title}"
|
||||
end
|
||||
|
||||
|
||||
def offer_accepted(customer, accepted_offer)
|
||||
@accepted_offer = accepted_offer
|
||||
@customer = customer
|
||||
mail to: @customer.email, :subject => "Vous avez accepté une proposition"
|
||||
end
|
||||
|
||||
|
||||
def document_available(customer, document)
|
||||
@document = document
|
||||
@customer = customer
|
||||
mail to: @customer.email, :subject => "Document disponible pour la proposition #{@document.accepted_offer.offer.need.title}"
|
||||
end
|
||||
|
||||
|
||||
def document_verified(customer, document)
|
||||
@document = document
|
||||
@customer = customer
|
||||
mail to: @customer.email, :subject => "Document vérifié pour la proposition #{@document.accepted_offer.offer.need.title}"
|
||||
end
|
||||
|
||||
|
||||
def contact_message_received(customer, contact_message)
|
||||
@contact_message = contact_message
|
||||
@customer = customer
|
||||
mail to: @customer.email, :subject => "Message reçu"
|
||||
end
|
||||
|
||||
|
||||
def new_user(customer)
|
||||
@customer = customer
|
||||
@parent = @customer.parent
|
||||
if @parent
|
||||
#mail from: "no-reply@negos.pro", to: @parent.email, :subject => "Vous avez un nouvel affilié sur Negos.pro !" do |format|
|
||||
# format.html { render layout: false }
|
||||
|
||||
|
||||
#end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -30,13 +30,13 @@ class Admin < ActiveRecord::Base
|
||||
generate_token(:reset_password_token)
|
||||
self.reset_password_sent_at = Time.now
|
||||
save!
|
||||
AdminMailer.delay.password_reset(self)
|
||||
AdminMailer.password_reset(self).deliver
|
||||
end
|
||||
|
||||
def fullname
|
||||
"#{firstname.capitalize} #{name.upcase}"
|
||||
end
|
||||
|
||||
|
||||
def generate_token(column)
|
||||
begin
|
||||
self[column] = SecureRandom.urlsafe_base64
|
||||
|
@ -183,7 +183,7 @@ class Customer < ActiveRecord::Base
|
||||
|
||||
|
||||
self.save(:validate => false)
|
||||
CustomerMailer.delay.password_reset(self)
|
||||
CustomerMailer.password_reset(self).deliver
|
||||
end
|
||||
|
||||
|
||||
|
@ -30,12 +30,14 @@ class Need < ActiveRecord::Base
|
||||
has_many :customers, -> { uniq }, through: :wishes
|
||||
has_many :messages, dependent: :destroy
|
||||
has_many :offers, dependent: :destroy
|
||||
belongs_to :image_file
|
||||
belongs_to :category, class_name: "NeedCategory"
|
||||
|
||||
validates :title, :presence => true, length: {within: 4..128}
|
||||
validates :description, presence: true, length: {maximum: 65535}
|
||||
belongs_to :author, class_name: 'Customer'
|
||||
|
||||
mount_uploader :devis, DevisUploader
|
||||
|
||||
# Need's workflow lifecycle
|
||||
workflow do
|
||||
@ -60,41 +62,41 @@ class Need < ActiveRecord::Base
|
||||
# Find all admins with email
|
||||
admins = Admin.where.not(email: nil)
|
||||
admins.each do |admin|
|
||||
AdminMailer.delay.new_need(admin, self)
|
||||
AdminMailer.new_need(admin, self).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def validate
|
||||
if self.author
|
||||
CustomerMailer.delay.validate_need(self)
|
||||
CustomerMailer.validate_need(self).deliver
|
||||
end
|
||||
end
|
||||
|
||||
def negociate
|
||||
customers = self.customers
|
||||
customers.each do |customer|
|
||||
CustomerMailer.delay.negociate_need(self, customer)
|
||||
CustomerMailer.negociate_need(self, customer).deliver
|
||||
end
|
||||
end
|
||||
|
||||
def accept
|
||||
customers = self.customers
|
||||
customers.each do |customer|
|
||||
CustomerMailer.delay.accept_need(self, customer)
|
||||
CustomerMailer.need_negociated(customer, self).deliver
|
||||
end
|
||||
end
|
||||
|
||||
def reject
|
||||
customers = self.customers
|
||||
customers.each do |customer|
|
||||
CustomerMailer.delay.reject_need(self, customer)
|
||||
CustomerMailer.need_negociation_failed(customer, self).deliver
|
||||
end
|
||||
end
|
||||
|
||||
def refuse
|
||||
if self.author
|
||||
CustomerMailer.delay.refuse_need(self)
|
||||
CustomerMailer.refuse_need(self).deliver
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -6,7 +6,7 @@ class DevisUploader < CarrierWave::Uploader::Base
|
||||
|
||||
|
||||
def filename
|
||||
"Devis-#{model.offer.need.title}-pour-#{model.customer.organisation}.#{file.extension}" if original_filename.present?
|
||||
"devis.#{file.extension}" if original_filename.present?
|
||||
end
|
||||
|
||||
def store_dir
|
||||
@ -17,8 +17,5 @@ class DevisUploader < CarrierWave::Uploader::Base
|
||||
%w(pdf)
|
||||
end
|
||||
|
||||
def url
|
||||
download_admin_offer_accepted_offer_path(model.offer, model)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -9,8 +9,10 @@
|
||||
=f.input :title, :label => "Titre : "
|
||||
=f.input :category, include_blank: "Toute catégorie", :as => :select, :collection => @tree.map{|c| [(c.level > 0 ? (' ' * (c.level - 1)) + "|- ": "").html_safe + c.name, c.id]}, label: "Catégorie de besoin"
|
||||
=f.input :description, :label => "Description : ", :rows => 5, :input_html => {:style => "height:100px;"}
|
||||
=f.input :image_file_id, :label => "Image", :as => :qi_image_select
|
||||
=f.input :author, :label => "Auteur", include_blank: "Administrateur"
|
||||
=f.input :created_at, :label => "Créé le", disabled: true
|
||||
=f.input :updated_at, :label => "Dernière modification le", disabled: true
|
||||
|
||||
.actions= f.submit "Sauvegarder", :class => "btn btn-primary"
|
||||
.actions
|
||||
-if @need.devis?
|
||||
= link_to ic(:download) + " Télécharger le devis attaché par l'émetteur", admin_need_download_devis_path(@need), class: "btn btn-default"
|
||||
= f.submit "Sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -4,6 +4,11 @@
|
||||
%tr{:id => need.id, class: css_class}
|
||||
%td
|
||||
=link_to need.title, edit_admin_need_path(need)
|
||||
%td
|
||||
-if need.image_file
|
||||
=link_to "Oui", need.image_file.file.url, target: "_blank"
|
||||
-else
|
||||
Non
|
||||
%td
|
||||
-if need.category
|
||||
=link_to need.category.name, edit_admin_need_category_path(need.category)
|
||||
|
@ -13,6 +13,9 @@
|
||||
Administrateur
|
||||
%td
|
||||
Il y a #{time_ago_in_words( need.created_at)}
|
||||
%td
|
||||
-if need.devis?
|
||||
=link_to ic(:download) + " Offre/Devis", admin_need_download_devis_path(need), class: "btn btn-primary btn-sm"
|
||||
|
||||
%td.actions{:style => "width:150px;text-align:right"}
|
||||
-if(need.created?)
|
||||
|
@ -24,6 +24,8 @@
|
||||
Émetteur
|
||||
%th
|
||||
Créé
|
||||
%th
|
||||
Dévis/Offre
|
||||
%th{:style => "width:100px"}
|
||||
|
||||
|
||||
@ -45,6 +47,8 @@
|
||||
%tr
|
||||
%th
|
||||
Titre
|
||||
%th
|
||||
Image?
|
||||
%th
|
||||
Catégorie
|
||||
|
||||
|
7
app/views/admin_mailer/customer_accept_offer.html.haml
Normal file
7
app/views/admin_mailer/customer_accept_offer.html.haml
Normal file
@ -0,0 +1,7 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Le client
|
||||
%strong= @accepted_offer.customer.fullname
|
||||
vient d'accepter la proposition concernant le besoin
|
||||
%strong= @accepted_offer.offer.need.title
|
7
app/views/admin_mailer/customer_disinterested.html.haml
Normal file
7
app/views/admin_mailer/customer_disinterested.html.haml
Normal file
@ -0,0 +1,7 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Le client
|
||||
%strong= @customer.fullname
|
||||
vient de supprimer son intérêt pour le besoin
|
||||
%strong= @need.title
|
@ -0,0 +1,9 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Le client
|
||||
%strong= @customer.fullname
|
||||
vient de télécharger le document
|
||||
%strong= @document.title
|
||||
concernant le besoin
|
||||
%strong= @document.accepted_offer.offer.need.title
|
7
app/views/admin_mailer/customer_interested.html.haml
Normal file
7
app/views/admin_mailer/customer_interested.html.haml
Normal file
@ -0,0 +1,7 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Le client
|
||||
%strong= @customer.fullname
|
||||
vient de signaler son intérêt pour le besoin
|
||||
%strong= @need.title
|
10
app/views/admin_mailer/customer_post_comment.html.haml
Normal file
10
app/views/admin_mailer/customer_post_comment.html.haml
Normal file
@ -0,0 +1,10 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Un client a laissé un commentaire sur le besoin
|
||||
%strong= @need.title
|
||||
|
||||
%p
|
||||
%strong= @comment.customer.fullname
|
||||
|
||||
%p= @comment.content
|
@ -0,0 +1,8 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p Un client vient de vous envoyer un message de contact. Pour répondre, merci de vous connecter à l'interface administrateur.
|
||||
|
||||
%p
|
||||
%strong= @contact_message.customer.fullname
|
||||
|
||||
%p= @contact_message.content
|
@ -0,0 +1,9 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Le client
|
||||
%strong= @customer.fullname
|
||||
vient de retourner le document
|
||||
%strong= @document.title
|
||||
concernant le besoin
|
||||
%strong= @document.accepted_offer.offer.need.title
|
@ -0,0 +1,8 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p Un administrateur Négos vient de répondre à votre message. Pour répondre, connectez-vous à votre espace perso depuis le site.
|
||||
|
||||
%p
|
||||
%strong= @contact_message.admin.author_name
|
||||
|
||||
%p= @contact_message.content
|
13
app/views/customer_mailer/document_available.html.haml
Normal file
13
app/views/customer_mailer/document_available.html.haml
Normal file
@ -0,0 +1,13 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Un document est disponible pour une proposition que vous avez récemment acceptée:
|
||||
%strong= @document.accepted_offer.offer.need.title
|
||||
|
||||
%p
|
||||
Le titre du document concerné est
|
||||
%strong= @document.title
|
||||
|
||||
%p Rendez-vous dans votre espace perso afin de télécharger ce document et nous le retourner complété.
|
||||
|
||||
%p Merci
|
12
app/views/customer_mailer/document_verified.html.haml
Normal file
12
app/views/customer_mailer/document_verified.html.haml
Normal file
@ -0,0 +1,12 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Un document que vous nous avez récemment retourné pour la proposition
|
||||
%strong= @document.accepted_offer.offer.need.title
|
||||
vient d'être vérifié
|
||||
|
||||
%p
|
||||
Le titre du document concerné est
|
||||
%strong= @document.title
|
||||
|
||||
%p Merci
|
10
app/views/customer_mailer/need_commented.html.haml
Normal file
10
app/views/customer_mailer/need_commented.html.haml
Normal file
@ -0,0 +1,10 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Un autre utilisateur a laissé un commentaire sur le besoin
|
||||
%strong= @need.title
|
||||
|
||||
%p
|
||||
%strong= @comment.customer.fullname
|
||||
|
||||
%p= @comment.content
|
10
app/views/customer_mailer/need_negociated.html.haml
Normal file
10
app/views/customer_mailer/need_negociated.html.haml
Normal file
@ -0,0 +1,10 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Le besoin
|
||||
%strong= @need.title
|
||||
vient d'être négocié !"
|
||||
|
||||
%p Rendez-vous sur notre site afin de voir notre proposition
|
||||
|
||||
%p Merci
|
@ -0,0 +1,8 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Nous avons le regret de vous annoncer que le besoin
|
||||
%strong= @need.title
|
||||
n'a pas pu être négocié.
|
||||
|
||||
%p Merci
|
7
app/views/customer_mailer/offer_accepted.html.haml
Normal file
7
app/views/customer_mailer/offer_accepted.html.haml
Normal file
@ -0,0 +1,7 @@
|
||||
%p Bonjour,
|
||||
|
||||
%p
|
||||
Vous venez d'accepter une proposition pour le besoin
|
||||
%strong= @accepted_offer.offer.need.title
|
||||
|
||||
%p Merci
|
@ -3,59 +3,59 @@
|
||||
%html{:lang => "fr", "xml:lang" => "fr", :xmlns => "http://www.w3.org/1999/xhtml"}
|
||||
%head
|
||||
%title Négos
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%meta{:name=>"viewport", :content=>"width=device-width,initial-scale=1"}
|
||||
%meta{ :"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8" }
|
||||
%meta{ :"name" => "Description", :content => @description }
|
||||
%meta{ :"name" => "Keywords", :content => @keywords }
|
||||
%meta{ :"name" => "Keywords", :content => @keywords }
|
||||
=#<script type="text/javascript" =#src="https://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyDSm3YlFVyeEa6KBPmRRkiylbd-xTl-dkQ">
|
||||
=#</script>
|
||||
|
||||
|
||||
= javascript_include_tag "public"
|
||||
|
||||
|
||||
= csrf_meta_tag
|
||||
|
||||
|
||||
= csrf_meta_tag
|
||||
=#render :partial => "public/shared/ga"
|
||||
|
||||
= stylesheet_link_tag 'public'
|
||||
= stylesheet_link_tag '/fonts/Stylograph/stylesheet.css'
|
||||
|
||||
= stylesheet_link_tag 'public'
|
||||
= stylesheet_link_tag '/fonts/Stylograph/stylesheet.css'
|
||||
<link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
|
||||
|
||||
|
||||
=javascript_include_tag "https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%body
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.top
|
||||
|
||||
|
||||
|
||||
|
||||
#menu
|
||||
|
||||
|
||||
|
||||
|
||||
=render :partial => "public/shared/menu"
|
||||
.clear
|
||||
|
||||
=link_to image_tag("/logo.png", :id => "logo"), "/"
|
||||
|
||||
|
||||
-if @biglogo
|
||||
=link_to image_tag("/logo.png", :id => "big-logo"), "/"
|
||||
-else
|
||||
=link_to image_tag("/logo.png", :id => "logo"), "/"
|
||||
|
||||
#main
|
||||
=yield
|
||||
|
||||
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
|
||||
.clear
|
||||
=#render :partial => "public/shared/bottom"
|
||||
|
||||
|
||||
|
||||
#flashs= bootstrap_flash
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
|
||||
.row
|
||||
.row.container
|
||||
.col-md-6
|
||||
|
||||
|
||||
.connexion_form
|
||||
%h1 Vous avez déjà un compte ?
|
||||
%h1 Déjà membre ?
|
||||
|
||||
= form_tag public_customers_auths_path do
|
||||
=hidden_field_tag :for_annonce, params[:for_annonce]
|
||||
|
@ -1,6 +1,9 @@
|
||||
= semantic_form_for [:public, @need] do |f|
|
||||
=f.inputs do
|
||||
= f.input :title, :label => "Titre de votre besoin"
|
||||
= f.input :devis, type: :file, :label => "Devis/Offre (Fichier au format PDF)"
|
||||
-if @need.devis?
|
||||
= link_to ic(:download) + " Télécharger le devis actuel", public_need_download_devis_path(@need), class: "btn btn-primary"
|
||||
= f.input :category, :as => :select, include_blank: "Toute catégorie", :collection => @tree.map{|c| [(c.level > 0 ? (' ' * (c.level - 1)) + "|- ": "").html_safe + c.name, c.id]}, label: "Catégorie de besoin"
|
||||
= f.input :description, :label => "Description", :rows => 5, :input_html => {:style => "height:100px;"}
|
||||
%br
|
||||
|
@ -1,9 +1,14 @@
|
||||
.col-md-6
|
||||
.col-md-12
|
||||
.padding.need-item
|
||||
|
||||
%h4
|
||||
=link_to need.title.upcase, public_need_path(need)
|
||||
|
||||
-if need.image_file
|
||||
%div.need-image{style: "background-image: url('#{need.image_file.file.url}')"}
|
||||
-else
|
||||
%div.need-image
|
||||
|
||||
-# -if need.author
|
||||
-# %p.info=i(:"clock-o") + " Ajouté il y a #{time_ago_in_words(need.created_at)} par #{need.author.anonyme_nick}"
|
||||
-# -else
|
||||
@ -39,7 +44,7 @@
|
||||
|
||||
|
||||
|
||||
%p.description=truncate(need.description, length: 100)
|
||||
%p.description=need.description
|
||||
|
||||
.counters
|
||||
.item=i(:"hand-paper-o") + " " + need.wishes.length.to_s
|
||||
@ -54,13 +59,13 @@
|
||||
-if(need.customers.include?(current_customer))
|
||||
=link_to "Négociation en cours...", public_need_path(need), class: "btn btn-warning pull-right"
|
||||
-else
|
||||
=link_to i(:"times-circle") + " Trop tard pour vous !", public_need_path(need) , class: "btn btn-danger pull-right"
|
||||
=link_to i(:"times-circle") + " Négociation en cours...", public_need_path(need) , class: "btn btn-warning pull-right"
|
||||
|
||||
-elsif(need.negociated?)
|
||||
-if(need.customers.include?(current_customer))
|
||||
=link_to i(:"download") +" Voir les propositions", public_need_path(need), class: "btn btn-success pull-right"
|
||||
-else
|
||||
=link_to i(:"times-circle") + " Trop tard pour vous !", public_need_path(need) , class: "btn btn-danger pull-right"
|
||||
=link_to i(:"times-circle") + " Négociation terminée", public_need_path(need) , class: "btn btn-success pull-right"
|
||||
|
||||
|
||||
|
||||
|
@ -39,30 +39,34 @@
|
||||
|
||||
%p.description= @need.description
|
||||
|
||||
-if @need.image_file
|
||||
%img{src: @need.image_file.file.url}
|
||||
%br
|
||||
%br
|
||||
|
||||
-if @need.verified?
|
||||
-if @need.customers.include?(current_customer)
|
||||
.alert.alert-success
|
||||
%h3= i(:"check") + ' Vous êtes intéressé par ce besoin'
|
||||
%p Marquer votre interêt pour un besoin vous permettra d'accéder à des propositions intéressantes si nous décidons par la suite de négocier ce besoin auprès de nos fournisseurs.
|
||||
%p Marquer votre intérêt pour un besoin vous permettra d’accéder à des offres intéressantes, si nous décidons par la suite de le négocier auprès des fournisseurs,
|
||||
-else
|
||||
.alert.alert-info
|
||||
%h3 Vous avez aussi ce besoin ? signalez-le nous !
|
||||
%p Vous pouvez marquer votre interêt pour ce besoin en cliquant sur le bouton <strong>Ça m'intéresse !</strong>
|
||||
%p Si il y a un nombre suffisant de personnes avec ce même besoin, une négociation sera entamée auprès de nos fournisseurs afin de vous faire une proposition au meilleur prix.
|
||||
%p Vous ensuite libre d'accepter ou non la proposition
|
||||
%p Si il y a un nombre suffisant de personnes intéressées par ce même besoin, une négociation sera entamée auprès des fournisseurs afin de vous faire une offre intéressante.
|
||||
%p Une fois la négociation terminée, vous serez libre d'accepter ou non la proposition.
|
||||
|
||||
-elsif @need.negociating?
|
||||
-if @need.customers.include?(current_customer)
|
||||
.alert.alert-warning
|
||||
%h3 Négociation en cours...
|
||||
%p Ce besoin a suscité un interêt suffisant pour que nous engagions une négociation afin de vous proposer cet article au meilleur prix.
|
||||
%p Vous avez marqué votre interêt pour ce besoin et vous serez donc prevenu dès que la négociation sera terminée.
|
||||
%p Une ou plusieurs propositions vous seront faites et vous serez libre de les accepter ou non.
|
||||
%p <strong>Attention, accepter la proposition vous engage à payer.</strong>
|
||||
%p Ce besoin a suscité un interêt suffisant pour que nous engagions une négociation auprès des fournisseurs.
|
||||
%p Une fois la négociation terminée, vous serez libre d’accepter ou non l’offre proposée.
|
||||
%p <strong>Afin d’en bénéficier, merci de nous retourner au plus vite le mandat signé</strong>
|
||||
-else
|
||||
.alert.alert-warning
|
||||
%h3 Négociation en cours...
|
||||
%p Ce besoin a suscité un interêt suffisant pour que nous engagions une négociation afin de vous proposer cet article au meilleur prix.
|
||||
%p Ce besoin a suscité un interêt suffisant pour que nous engagions une négociation auprès des fournisseurs.
|
||||
.alert.alert-danger
|
||||
%p Malheureusement vous n'avez pas marqué votre interêt pour ce besoin pendant la période de sondage, vous ne pourrez donc pas profiter de cette négociation.
|
||||
-elsif @need.negociated?
|
||||
@ -71,7 +75,7 @@
|
||||
%h3 Négociation terminée
|
||||
%p= "Nous avons négocié ce besoin à partir de #{number_to_currency(offers.first.price, locale: :fr)}"
|
||||
%p Vous avez maintenant le choix d'accepter ou refuser la proposition.
|
||||
%p <strong>Attention, accepter la proposition vous engage à payer.</strong>
|
||||
%p <strong>Une fois la proposition acceptée, vous devrez nous retourner au plus vite le mandat signé</strong>
|
||||
-else
|
||||
.alert.alert-success
|
||||
%h3 Négociation terminée
|
||||
@ -111,14 +115,15 @@
|
||||
=link_to i(:"check") + " Accepter la proposition", accept_public_need_offer_path(@need, offer), data: {confirm: "Voulez-vous vraiment accepter cette proposition ? Attention, cette action vous engage à payer la somme proposée."}, class: "btn btn-lg btn-success "
|
||||
-else
|
||||
.offer-accepted
|
||||
=i(:"check") + " Propositions Acceptée"
|
||||
=i(:"check") + " Proposition Acceptée"
|
||||
|
||||
.my-account-link
|
||||
Consulter vos propositions acceptées depuis la rubrique
|
||||
Vous devez maintenant nous retourner le mandat signé, rendez-vous rubrique
|
||||
=link_to "Mon compte", public_my_account_path
|
||||
pour gérer vos propositions acceptées.
|
||||
-else
|
||||
.offer-not-aceptable
|
||||
Vous n'êtes pas intéressé
|
||||
Proposition non disponible
|
||||
|
||||
|
||||
.clear
|
||||
|
@ -103,6 +103,7 @@ Rails.application.routes.draw do
|
||||
|
||||
end
|
||||
resources :needs do
|
||||
get :download_devis
|
||||
resources :messages
|
||||
resources :offers do
|
||||
member do
|
||||
@ -265,6 +266,7 @@ Rails.application.routes.draw do
|
||||
|
||||
resources :need_categories
|
||||
resources :needs do
|
||||
get :download_devis
|
||||
resources :messages
|
||||
resources :wishes
|
||||
resources :offers do
|
||||
|
6
db/migrate/20160317130441_add_image_and_file_to_need.rb
Normal file
6
db/migrate/20160317130441_add_image_and_file_to_need.rb
Normal file
@ -0,0 +1,6 @@
|
||||
class AddImageAndFileToNeed < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :needs, :devis, :string
|
||||
add_reference :needs, :image_file, index: true
|
||||
end
|
||||
end
|
19
db/schema.rb
19
db/schema.rb
@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20160308112733) do
|
||||
ActiveRecord::Schema.define(version: 20160317130441) do
|
||||
|
||||
create_table "accepted_offers", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
@ -438,19 +438,22 @@ ActiveRecord::Schema.define(version: 20160308112733) do
|
||||
add_index "need_categories", ["parent_id"], name: "index_need_categories_on_parent_id", using: :btree
|
||||
|
||||
create_table "needs", force: :cascade do |t|
|
||||
t.string "title", limit: 255
|
||||
t.text "description", limit: 65535
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "author_id", limit: 4
|
||||
t.string "title", limit: 255
|
||||
t.text "description", limit: 65535
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "author_id", limit: 4
|
||||
t.datetime "deleted_at"
|
||||
t.string "state", limit: 255
|
||||
t.integer "category_id", limit: 4
|
||||
t.string "state", limit: 255
|
||||
t.integer "category_id", limit: 4
|
||||
t.string "devis", limit: 255
|
||||
t.integer "image_file_id", limit: 4
|
||||
end
|
||||
|
||||
add_index "needs", ["author_id"], name: "index_needs_on_author_id", using: :btree
|
||||
add_index "needs", ["category_id"], name: "index_needs_on_category_id", using: :btree
|
||||
add_index "needs", ["deleted_at"], name: "index_needs_on_deleted_at", using: :btree
|
||||
add_index "needs", ["image_file_id"], name: "index_needs_on_image_file_id", using: :btree
|
||||
add_index "needs", ["title"], name: "index_needs_on_title", using: :btree
|
||||
|
||||
create_table "newsgroups", force: :cascade do |t|
|
||||
|
BIN
public/placeholder.png
Normal file
BIN
public/placeholder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
Loading…
x
Reference in New Issue
Block a user