commit
1f9b84fd48
13 changed files with 244 additions and 30 deletions
|
@ -159,10 +159,15 @@ $landing-breakpoint: 1040px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.usagers-panel,
|
.usagers-panel,
|
||||||
.numbers-panel {
|
.numbers-panel,
|
||||||
|
.cta-panel-2 {
|
||||||
background-color: $light-grey;
|
background-color: $light-grey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.more-info {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
.numbers {
|
.numbers {
|
||||||
@extend %horizontal-list;
|
@extend %horizontal-list;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
|
@ -316,6 +321,15 @@ $users-breakpoint: 950px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.role-more-info-image {
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
@media (max-width: $users-breakpoint) {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 45px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.role-usagers-image {
|
.role-usagers-image {
|
||||||
@media (max-width: $users-breakpoint) {
|
@media (max-width: $users-breakpoint) {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -437,3 +451,12 @@ $cta-panel-button-border-size: 2px;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.half {
|
||||||
|
width: 45%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.first-half {
|
||||||
|
margin-right: 10%;
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,10 @@ class SupportController < ApplicationController
|
||||||
setup_context
|
setup_context
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def admin
|
||||||
|
setup_context_admin
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if direct_message? && create_commentaire
|
if direct_message? && create_commentaire
|
||||||
flash.notice = "Votre message a été envoyé sur la messagerie de votre dossier."
|
flash.notice = "Votre message a été envoyé sur la messagerie de votre dossier."
|
||||||
|
@ -13,14 +17,23 @@ class SupportController < ApplicationController
|
||||||
elsif create_conversation
|
elsif create_conversation
|
||||||
flash.notice = "Votre message a été envoyé."
|
flash.notice = "Votre message a été envoyé."
|
||||||
|
|
||||||
|
if params[:admin]
|
||||||
|
redirect_to root_path(formulaire_contact_admin_submitted: true)
|
||||||
|
else
|
||||||
redirect_to root_path(formulaire_contact_general_submitted: true)
|
redirect_to root_path(formulaire_contact_general_submitted: true)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
flash.now.alert = "Une erreur est survenue. Vous pouvez nous contacter à #{helpers.mail_to(CONTACT_EMAIL)}."
|
||||||
|
|
||||||
|
if params[:admin]
|
||||||
|
setup_context_admin
|
||||||
|
render :admin
|
||||||
else
|
else
|
||||||
setup_context
|
setup_context
|
||||||
flash.now.alert = "Une erreur est survenue. Vous pouvez nous contactez à #{helpers.mail_to(CONTACT_EMAIL)}."
|
|
||||||
|
|
||||||
render :index
|
render :index
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
@ -30,10 +43,16 @@ class SupportController < ApplicationController
|
||||||
@options = Helpscout::FormAdapter::OPTIONS
|
@options = Helpscout::FormAdapter::OPTIONS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def setup_context_admin
|
||||||
|
@tags = tags
|
||||||
|
@options = Helpscout::FormAdapter::ADMIN_OPTIONS
|
||||||
|
end
|
||||||
|
|
||||||
def create_conversation
|
def create_conversation
|
||||||
Helpscout::FormAdapter.new(
|
Helpscout::FormAdapter.new(
|
||||||
subject: params[:subject],
|
subject: params[:subject],
|
||||||
email: email,
|
email: email,
|
||||||
|
phone: params[:phone],
|
||||||
text: params[:text],
|
text: params[:text],
|
||||||
file: params[:file],
|
file: params[:file],
|
||||||
dossier_id: dossier&.id,
|
dossier_id: dossier&.id,
|
||||||
|
|
|
@ -3,6 +3,8 @@ class Helpscout::API
|
||||||
CONVERSATIONS = 'conversations'
|
CONVERSATIONS = 'conversations'
|
||||||
TAGS = 'tags'
|
TAGS = 'tags'
|
||||||
FIELDS = 'fields'
|
FIELDS = 'fields'
|
||||||
|
CUSTOMERS = 'customers'
|
||||||
|
PHONES = 'phones'
|
||||||
OAUTH2_TOKEN = 'oauth2/token'
|
OAUTH2_TOKEN = 'oauth2/token'
|
||||||
|
|
||||||
def add_tags(conversation_id, tags)
|
def add_tags(conversation_id, tags)
|
||||||
|
@ -42,6 +44,21 @@ class Helpscout::API
|
||||||
call_api(:post, CONVERSATIONS, body)
|
call_api(:post, CONVERSATIONS, body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_phone_number(email, phone)
|
||||||
|
query = URI.encode("(email:#{email})")
|
||||||
|
response = call_api(:get, "#{CUSTOMERS}?mailbox=#{mailbox_id}&query=#{query}")
|
||||||
|
if response.success?
|
||||||
|
body = parse_response_body(response)
|
||||||
|
if body[:page][:totalElements] > 0
|
||||||
|
customer_id = body[:_embedded][:customers].first[:id]
|
||||||
|
call_api(:post, "#{CUSTOMERS}/#{customer_id}/#{PHONES}", {
|
||||||
|
type: "work",
|
||||||
|
value: phone
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def attachments(file)
|
def attachments(file)
|
||||||
|
|
|
@ -20,6 +20,18 @@ class Helpscout::FormAdapter
|
||||||
[I18n.t(TYPE_AUTRE, scope: [:support]), TYPE_AUTRE]
|
[I18n.t(TYPE_AUTRE, scope: [:support]), TYPE_AUTRE]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
ADMIN_TYPE_RDV = 'admin demande rdv'
|
||||||
|
ADMIN_TYPE_QUESTION = 'admin question'
|
||||||
|
ADMIN_TYPE_SOUCIS = 'admin soucis'
|
||||||
|
ADMIN_TYPE_AUTRE = 'admin autre'
|
||||||
|
|
||||||
|
ADMIN_OPTIONS = [
|
||||||
|
[I18n.t(ADMIN_TYPE_QUESTION, scope: [:supportadmin]), ADMIN_TYPE_QUESTION],
|
||||||
|
[I18n.t(ADMIN_TYPE_RDV, scope: [:supportadmin]), ADMIN_TYPE_RDV],
|
||||||
|
[I18n.t(ADMIN_TYPE_SOUCIS, scope: [:supportadmin]), ADMIN_TYPE_SOUCIS],
|
||||||
|
[I18n.t(ADMIN_TYPE_AUTRE, scope: [:supportadmin]), ADMIN_TYPE_AUTRE]
|
||||||
|
]
|
||||||
|
|
||||||
def send_form
|
def send_form
|
||||||
conversation_id = create_conversation
|
conversation_id = create_conversation
|
||||||
|
|
||||||
|
@ -51,6 +63,11 @@ class Helpscout::FormAdapter
|
||||||
params[:file]
|
params[:file]
|
||||||
)
|
)
|
||||||
|
|
||||||
response.success? ? response.headers['Resource-ID'] : nil
|
if response.success?
|
||||||
|
if params[:phone].present?
|
||||||
|
@api.add_phone_number(params[:email], params[:phone])
|
||||||
|
end
|
||||||
|
response.headers['Resource-ID']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Dossier < ApplicationRecord
|
||||||
|
|
||||||
has_one :etablissement, dependent: :destroy
|
has_one :etablissement, dependent: :destroy
|
||||||
has_one :individual, dependent: :destroy
|
has_one :individual, dependent: :destroy
|
||||||
has_one :attestation
|
has_one :attestation, dependent: :destroy
|
||||||
|
|
||||||
has_many :pieces_justificatives, dependent: :destroy
|
has_many :pieces_justificatives, dependent: :destroy
|
||||||
has_many :champs, -> { public_only.ordered }, dependent: :destroy
|
has_many :champs, -> { public_only.ordered }, dependent: :destroy
|
||||||
|
@ -26,7 +26,7 @@ class Dossier < ApplicationRecord
|
||||||
has_many :followers_gestionnaires, through: :follows, source: :gestionnaire
|
has_many :followers_gestionnaires, through: :follows, source: :gestionnaire
|
||||||
has_many :avis, dependent: :destroy
|
has_many :avis, dependent: :destroy
|
||||||
|
|
||||||
has_many :dossier_operation_logs
|
has_many :dossier_operation_logs, dependent: :destroy
|
||||||
|
|
||||||
belongs_to :procedure
|
belongs_to :procedure
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
|
@ -7,7 +7,7 @@ class BaseUploader < CarrierWave::Uploader::Base
|
||||||
def remove!
|
def remove!
|
||||||
begin
|
begin
|
||||||
super
|
super
|
||||||
rescue Fog::Storage::OpenStack::NotFound
|
rescue Fog::OpenStack::Storage::NotFound
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
.hero-wrapper
|
.hero-wrapper
|
||||||
.hero-text
|
.hero-text
|
||||||
%p.hero-tagline
|
%p.hero-tagline
|
||||||
%em.hero-tagline-em Dématérialiser et simplifier
|
%em.hero-tagline-em Dématérialisez et simplifiez
|
||||||
les démarches administratives
|
vos démarches administratives
|
||||||
|
|
||||||
.hero-illustration
|
.hero-illustration
|
||||||
%img{ :src => image_url("landing/hero/dematerialiser.svg"), alt: "" }
|
%img{ :src => image_url("landing/hero/dematerialiser.svg"), alt: "" }
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
%img.role-image{ :src => image_url("landing/roles/administrations.svg"), alt: "" }
|
%img.role-image{ :src => image_url("landing/roles/administrations.svg"), alt: "" }
|
||||||
|
|
||||||
.role-panel-70
|
.role-panel-70
|
||||||
%h1.role-panel-title Vous êtes une administration et vous souhaitez dématérialiser une démarche papier et réduire vos temps d'instruction ?
|
%h1.role-panel-title Vous êtes une administration et êtes prête pour dématérialiser ?
|
||||||
%p.role-panel-explanation Créez des formulaires en ligne en quelques minutes et instruisez les demandes des usagers sur une plateforme dédiée
|
%p.role-panel-explanation Créez des formulaires en ligne en quelques minutes et instruisez les demandes des usagers sur une plateforme dédiée
|
||||||
|
|
||||||
= link_to "Demander un compte administrateur",
|
= link_to "Demander un compte administrateur",
|
||||||
|
@ -34,12 +34,26 @@
|
||||||
class: "role-panel-button-primary",
|
class: "role-panel-button-primary",
|
||||||
rel: "noopener noreferrer"
|
rel: "noopener noreferrer"
|
||||||
|
|
||||||
= link_to "Voir la documentation",
|
.landing-panel.more-info
|
||||||
|
.container
|
||||||
|
.role-panel-wrapper.role-administrations-panel
|
||||||
|
.role-panel-70
|
||||||
|
%h1.role-panel-title Vous voulez en savoir plus ?
|
||||||
|
%p.role-panel-explanation Découvrez notre outil
|
||||||
|
|
||||||
|
= link_to "Contactez-nous",
|
||||||
|
contact_admin_path,
|
||||||
|
rel: "noopener noreferrer",
|
||||||
|
class: "role-panel-button-primary"
|
||||||
|
|
||||||
|
= link_to "Consultez notre documentation",
|
||||||
DOC_URL,
|
DOC_URL,
|
||||||
target: "_blank",
|
|
||||||
rel: "noopener noreferrer",
|
rel: "noopener noreferrer",
|
||||||
class: "role-panel-button-secondary"
|
class: "role-panel-button-secondary"
|
||||||
|
|
||||||
|
.role-panel-30.role-more-info-image
|
||||||
|
%img.role-image{ :src => image_url("landing/roles/usagers.svg"), alt: "" }
|
||||||
|
|
||||||
.landing-panel.features-panel
|
.landing-panel.features-panel
|
||||||
.container
|
.container
|
||||||
%ul.features
|
%ul.features
|
||||||
|
@ -181,6 +195,24 @@
|
||||||
= link_to "http://www.lillemetropole.fr/", target: :blank, rel: "noopener noreferrer" do
|
= link_to "http://www.lillemetropole.fr/", target: :blank, rel: "noopener noreferrer" do
|
||||||
%img.user-image{ :src => image_url("landing/users/mel.jpg"), alt: "Métropole Européenne de Lille" }
|
%img.user-image{ :src => image_url("landing/users/mel.jpg"), alt: "Métropole Européenne de Lille" }
|
||||||
|
|
||||||
|
.landing-panel.cta-panel-2
|
||||||
|
.container
|
||||||
|
.half.first-half
|
||||||
|
%h1.cta-panel-title Vous êtes prêt pour dématérialiser ?
|
||||||
|
%p.cta-panel-explanation Réduisez vos temps d'instruction de 50 %
|
||||||
|
= link_to "Demander un compte",
|
||||||
|
new_demande_path,
|
||||||
|
class: "cta-panel-button-blue"
|
||||||
|
|
||||||
|
.half
|
||||||
|
%h1.cta-panel-title Vous voulez en savoir plus ?
|
||||||
|
%p.cta-panel-explanation Nous vous faisons découvrir l'outil
|
||||||
|
= link_to "Contactez-nous",
|
||||||
|
contact_admin_path,
|
||||||
|
class: "cta-panel-button-blue"
|
||||||
|
|
||||||
|
.clearfix
|
||||||
|
|
||||||
.landing-panel.cta-panel
|
.landing-panel.cta-panel
|
||||||
.container
|
.container
|
||||||
.cta-panel-wrapper
|
.cta-panel-wrapper
|
||||||
|
@ -188,19 +220,5 @@
|
||||||
%h1.cta-panel-title Une question, un problème ?
|
%h1.cta-panel-title Une question, un problème ?
|
||||||
%p.cta-panel-explanation Notre équipe est disponible pour vous renseigner et vous aider
|
%p.cta-panel-explanation Notre équipe est disponible pour vous renseigner et vous aider
|
||||||
%div
|
%div
|
||||||
= contact_link "Contactez-nous",
|
%a.cta-panel-button-white{ rel: 'noopener noreferrer', href:'/contact-admin' }
|
||||||
tags: 'administration',
|
Contactez-nous
|
||||||
class: "cta-panel-button-white",
|
|
||||||
target: "_blank",
|
|
||||||
rel: "noopener noreferrer"
|
|
||||||
|
|
||||||
.landing-panel
|
|
||||||
.container
|
|
||||||
.cta-panel-wrapper
|
|
||||||
%div
|
|
||||||
%h1.cta-panel-title Vous êtes prêt pour dématérialiser ?
|
|
||||||
%p.cta-panel-explanation Réduisez vos temps d'instruction de 50 %
|
|
||||||
%div
|
|
||||||
= link_to "Demander un compte administrateur",
|
|
||||||
new_demande_path,
|
|
||||||
class: "cta-panel-button-blue"
|
|
||||||
|
|
51
app/views/support/admin.html.haml
Normal file
51
app/views/support/admin.html.haml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
- content_for(:title, 'Contact')
|
||||||
|
|
||||||
|
#contact-form
|
||||||
|
.container
|
||||||
|
%h1.new-h1 Contactez notre équipe
|
||||||
|
|
||||||
|
.description
|
||||||
|
En tant qu'administration, vous pouvez nous contactez via ce formulaire. Nous vous répondrons dans les plus brefs délais, par email ou par téléphone.
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%strong
|
||||||
|
Attention, ce formulaire est réservée uniquement aux organismes publics.
|
||||||
|
Il ne concerne ni les particuliers, ni les entreprises, ni les associations (sauf celles reconnues d'utilité publique). Si c'est votre cas, rendez-vous sur notre
|
||||||
|
= link_to contact_path do
|
||||||
|
formulaire de contact public
|
||||||
|
\.
|
||||||
|
|
||||||
|
= form_tag contact_path, method: :post, class: 'form' do |f|
|
||||||
|
- if !logged_in?
|
||||||
|
.contact-champ
|
||||||
|
= label_tag :email do
|
||||||
|
Adresse email professionnelle
|
||||||
|
%span.mandatory *
|
||||||
|
= text_field_tag :email, params[:email], required: true
|
||||||
|
|
||||||
|
.contact-champ
|
||||||
|
= label_tag :type do
|
||||||
|
Catégorie
|
||||||
|
%span.mandatory *
|
||||||
|
= select_tag :type, options_for_select(@options, params[:type])
|
||||||
|
|
||||||
|
.contact-champ
|
||||||
|
= label_tag :phone, 'Numéro de téléphone professionnel (ligne directe)'
|
||||||
|
= text_field_tag :phone
|
||||||
|
|
||||||
|
.contact-champ
|
||||||
|
= label_tag :subject do
|
||||||
|
Sujet
|
||||||
|
= text_field_tag :subject, params[:subject], required: false
|
||||||
|
|
||||||
|
.contact-champ
|
||||||
|
= label_tag :text do
|
||||||
|
Message
|
||||||
|
%span.mandatory *
|
||||||
|
= text_area_tag :text, params[:text], rows: 6, required: true
|
||||||
|
|
||||||
|
= hidden_field_tag :tags, @tags&.join(',')
|
||||||
|
= hidden_field_tag :admin, true
|
||||||
|
|
||||||
|
.send-wrapper
|
||||||
|
= button_tag 'Envoyer le message', type: :submit, class: 'button send primary'
|
|
@ -61,4 +61,9 @@ Rails.application.configure do
|
||||||
|
|
||||||
# Raises error for missing translations
|
# Raises error for missing translations
|
||||||
# config.action_view.raise_on_missing_translations = true
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
|
||||||
|
# This is useful to run rails in development with :async queue adapter
|
||||||
|
if ENV['RAILS_QUEUE_ADAPTER']
|
||||||
|
config.active_job.queue_adapter = ENV['RAILS_QUEUE_ADAPTER'].to_sym
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -61,6 +61,11 @@ fr:
|
||||||
produit: J'ai une idée d'amélioration pour votre site
|
produit: J'ai une idée d'amélioration pour votre site
|
||||||
usager perdu: Je ne trouve pas la démarche que je veux faire
|
usager perdu: Je ne trouve pas la démarche que je veux faire
|
||||||
autre: Autre sujet
|
autre: Autre sujet
|
||||||
|
supportadmin:
|
||||||
|
admin demande rdv: Demande de RDV pour une présentation à distance de demarches-simplifiees.fr
|
||||||
|
admin question: J'ai une question sur demarches-simplifiees.fr
|
||||||
|
admin soucis: J'ai un problème technique avec demarches-simplifiees.fr
|
||||||
|
admin autre: Autre sujet
|
||||||
|
|
||||||
number:
|
number:
|
||||||
currency:
|
currency:
|
||||||
|
|
|
@ -137,6 +137,8 @@ Rails.application.routes.draw do
|
||||||
get "contact", to: "support#index"
|
get "contact", to: "support#index"
|
||||||
post "contact", to: "support#create"
|
post "contact", to: "support#create"
|
||||||
|
|
||||||
|
get "contact-admin", to: "support#admin"
|
||||||
|
|
||||||
post "webhooks/helpscout", to: "webhook#helpscout"
|
post "webhooks/helpscout", to: "webhook#helpscout"
|
||||||
match "webhooks/helpscout", to: lambda { |_| [204, {}, nil] }, via: :head
|
match "webhooks/helpscout", to: lambda { |_| [204, {}, nil] }, via: :head
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
namespace :after_party do
|
||||||
|
desc 'Deployment task: destroy_orphaned_dossier_operation_logs'
|
||||||
|
task destroy_orphaned_dossier_operation_logs: :environment do
|
||||||
|
bar = RakeProgressbar.new(DossierOperationLog.count)
|
||||||
|
|
||||||
|
DossierOperationLog.find_each do |log|
|
||||||
|
if log.dossier.blank?
|
||||||
|
log.destroy
|
||||||
|
end
|
||||||
|
bar.inc
|
||||||
|
end
|
||||||
|
|
||||||
|
bar.finished
|
||||||
|
|
||||||
|
AfterParty::TaskRecord.create version: '20181128155650'
|
||||||
|
end
|
||||||
|
end
|
|
@ -66,5 +66,45 @@ describe Helpscout::FormAdapter do
|
||||||
.with(conversation_id, nil, nil)
|
.with(conversation_id, nil, nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'add_phone' do
|
||||||
|
before do
|
||||||
|
allow(api).to receive(:create_conversation)
|
||||||
|
.and_return(
|
||||||
|
double(
|
||||||
|
success?: true,
|
||||||
|
headers: {
|
||||||
|
'Resource-ID' => conversation_id
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
described_class.new(params, api).send_form
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:params) {
|
||||||
|
{
|
||||||
|
email: email,
|
||||||
|
subject: subject,
|
||||||
|
text: text,
|
||||||
|
phone: '0666666666'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let(:phone) { '0666666666' }
|
||||||
|
let(:email) { 'paul.chavard@beta.gouv.fr' }
|
||||||
|
let(:subject) { 'Bonjour' }
|
||||||
|
let(:text) { "J'ai un problem" }
|
||||||
|
let(:tags) { ['info demarche'] }
|
||||||
|
let(:conversation_id) { '123' }
|
||||||
|
|
||||||
|
it 'should call method' do
|
||||||
|
expect(api).to have_received(:create_conversation)
|
||||||
|
.with(email, subject, text, nil)
|
||||||
|
expect(api).to have_received(:add_phone_number)
|
||||||
|
.with(email, phone)
|
||||||
|
expect(api).to have_received(:add_custom_fields)
|
||||||
|
.with(conversation_id, nil, nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue