Merge branch 'develop' of ssh://37.187.249.111:2200/opt/git/tps into develop
This commit is contained in:
commit
40310da378
27 changed files with 679 additions and 164 deletions
|
@ -375,3 +375,6 @@ DEPENDENCIES
|
|||
unicorn
|
||||
web-console (~> 2.0)
|
||||
webmock
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.4
|
||||
|
|
|
@ -47,13 +47,7 @@ body {
|
|||
}
|
||||
|
||||
.description {
|
||||
border-color: rgba(200, 200, 200, 0.6);
|
||||
border-style: solid;
|
||||
border-radius: 5px;
|
||||
border-width: 1px;
|
||||
padding: 10px;
|
||||
background-color: rgb(245, 245, 245);
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.btn-file {
|
||||
|
|
9
app/assets/stylesheets/recapiitulatif.scss
Normal file
9
app/assets/stylesheets/recapiitulatif.scss
Normal file
|
@ -0,0 +1,9 @@
|
|||
#infos_dossier{
|
||||
background-color:rgba(248,248,255,0.8);
|
||||
padding-left:13%;
|
||||
padding-right:13%;
|
||||
padding-bottom:20px;
|
||||
padding-top:15px;
|
||||
margin-left:-13%;
|
||||
margin-right:-13%;
|
||||
}
|
|
@ -3,6 +3,7 @@ class Users::RecapitulatifController < UsersController
|
|||
|
||||
@dossier = Dossier.find(params[:dossier_id])
|
||||
@dossier = @dossier.decorate
|
||||
@procedure = @dossier.procedure
|
||||
|
||||
# mettre dans le modele
|
||||
@commentaires = @dossier.commentaires.order(created_at: :desc)
|
||||
|
|
|
@ -10,4 +10,25 @@ class DossierDecorator < Draper::Decorator
|
|||
def last_update
|
||||
updated_at.localtime.strftime('%d/%m/%Y %H:%M')
|
||||
end
|
||||
|
||||
def state_fr
|
||||
case state
|
||||
when 'draft'
|
||||
'Brouillon'
|
||||
when 'proposed'
|
||||
'Proposé'
|
||||
when 'reply'
|
||||
'Répondu'
|
||||
when 'updated'
|
||||
'Mis à jour'
|
||||
when 'confirmed'
|
||||
'Validé'
|
||||
when 'deposited'
|
||||
'Déposé'
|
||||
when 'processed'
|
||||
'Traité'
|
||||
else
|
||||
fail 'State not valid'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
class Dossier < ActiveRecord::Base
|
||||
enum state: { draft: 'draft',
|
||||
submitted: 'submitted',
|
||||
reply: 'reply',
|
||||
updated: 'updated',
|
||||
confirmed: 'confirmed',
|
||||
filed: 'filed',
|
||||
processed: 'processed' }
|
||||
proposed: 'proposed',
|
||||
reply: 'reply',
|
||||
updated: 'updated',
|
||||
confirmed: 'confirmed',
|
||||
deposited: 'deposited',
|
||||
processed: 'processed' }
|
||||
|
||||
has_one :etablissement
|
||||
has_one :entreprise
|
||||
|
@ -30,28 +30,81 @@ class Dossier < ActiveRecord::Base
|
|||
validates :date_previsionnelle, presence: true, allow_blank: false, unless: Proc.new { description.nil? }
|
||||
validates :user, presence: true
|
||||
|
||||
def retrieve_piece_justificative_by_type(type)
|
||||
pieces_justificatives.where(type_de_piece_justificative_id: type).last
|
||||
end
|
||||
def retrieve_piece_justificative_by_type(type)
|
||||
pieces_justificatives.where(type_de_piece_justificative_id: type).last
|
||||
end
|
||||
|
||||
def build_default_pieces_justificatives
|
||||
procedure.types_de_piece_justificative.each do |type_de_piece_justificative|
|
||||
PieceJustificative.create(type_de_piece_justificative_id: type_de_piece_justificative.id, dossier_id: id)
|
||||
end
|
||||
end
|
||||
def build_default_pieces_justificatives
|
||||
procedure.types_de_piece_justificative.each do |type_de_piece_justificative|
|
||||
PieceJustificative.create(type_de_piece_justificative_id: type_de_piece_justificative.id, dossier_id: id)
|
||||
end
|
||||
end
|
||||
|
||||
def sous_domaine
|
||||
if Rails.env.production?
|
||||
'tps'
|
||||
else
|
||||
'tps-dev'
|
||||
end
|
||||
end
|
||||
def sous_domaine
|
||||
if Rails.env.production?
|
||||
'tps'
|
||||
else
|
||||
'tps-dev'
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def next_step! role, action
|
||||
unless ['propose', 'reply', 'update', 'comment', 'confirme', 'depose', 'process'].include?(action)
|
||||
fail 'action is not valid'
|
||||
end
|
||||
|
||||
def build_default_cerfa
|
||||
build_cerfa
|
||||
true
|
||||
end
|
||||
unless ['user', 'gestionnaire'].include?(role)
|
||||
fail 'role is not valid'
|
||||
end
|
||||
|
||||
if role == 'user'
|
||||
case action
|
||||
when 'propose'
|
||||
if draft?
|
||||
proposed!
|
||||
end
|
||||
when 'depose'
|
||||
if confirmed?
|
||||
deposited!
|
||||
end
|
||||
when 'update'
|
||||
if reply?
|
||||
updated!
|
||||
end
|
||||
when 'comment'
|
||||
if reply?
|
||||
updated!
|
||||
end
|
||||
end
|
||||
elsif role == 'gestionnaire'
|
||||
case action
|
||||
when 'comment'
|
||||
if updated?
|
||||
reply!
|
||||
elsif proposed?
|
||||
reply!
|
||||
end
|
||||
when 'confirme'
|
||||
if updated?
|
||||
confirmed!
|
||||
elsif reply?
|
||||
confirmed!
|
||||
elsif proposed?
|
||||
confirmed!
|
||||
end
|
||||
when 'process'
|
||||
if deposited?
|
||||
processed!
|
||||
end
|
||||
end
|
||||
end
|
||||
state
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def build_default_cerfa
|
||||
build_cerfa
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,35 +13,7 @@
|
|||
%br
|
||||
|
||||
.content.row
|
||||
#map_qp.col-lg-6.col-md-6{style: 'height:500px'}
|
||||
#pieces_justificatives.col-lg-6.col-md-6
|
||||
%h3.text-info Liste des pièces justificatives
|
||||
%br
|
||||
%table.table
|
||||
-if @procedure.lien_demarche != nil
|
||||
%tr{id: "piece_justificative_0"}
|
||||
%th{class:'col-lg-6'}
|
||||
='CERFA'
|
||||
%td.col-lg-4.col-md-4
|
||||
- if !@dossier.cerfa.empty?
|
||||
%a{ href: "#{@dossier.cerfa.content}", target: '_blank' } Consulter
|
||||
- else
|
||||
= 'Pièce non fournie'
|
||||
|
||||
- @dossier.pieces_justificatives.each do |piece_justificative|
|
||||
%tr{ id: "piece_justificative_#{piece_justificative.type}" }
|
||||
%th.col-lg-6
|
||||
= piece_justificative.libelle
|
||||
%td.col-lg-4.col-md-4
|
||||
- if piece_justificative.api_entreprise
|
||||
%a{ href: '' } Récupérer
|
||||
- elsif !piece_justificative.empty?
|
||||
%a{ href: "#{piece_justificative.content}", target: '_blank' } Consulter
|
||||
- else
|
||||
= 'Pièce non fournie'
|
||||
|
||||
= render partial: '/carte/carte_sources_CSS'
|
||||
= render partial: '/carte/carte_sources_JS_backend'
|
||||
=render partial: '/dossiers/pieces_justificatives'
|
||||
%br
|
||||
|
||||
= render partial: '/users/recapitulatif/commentaires_flux'
|
||||
|
|
|
@ -1,9 +1,30 @@
|
|||
= javascript_include_tag "https://code.highcharts.com/highcharts.js", "chartkick"
|
||||
.row#infos_dossier
|
||||
.col-md-6
|
||||
%h4.text-info
|
||||
= @dossier.nom_projet
|
||||
%div
|
||||
|
||||
#infos_dossier
|
||||
%div.row
|
||||
.col-lg-6.col-md-6
|
||||
%h3.text-info
|
||||
= @dossier.nom_projet
|
||||
|
||||
%br
|
||||
%div.row
|
||||
.col-lg-6.col-md-6
|
||||
%h4 Montant total
|
||||
%p{style:'margin-left:5%'}
|
||||
=number_to_currency(@dossier.montant_projet.to_f, :unit => " ", :separator => ",", :delimiter => " ")
|
||||
!='€'
|
||||
|
||||
.col-lg-6.col-md-6
|
||||
%h4 Début du projet souhaité
|
||||
%p{style:'margin-left:5%'}
|
||||
= @dossier.date_fr
|
||||
%div.row
|
||||
.col-lg-6.col-md-6
|
||||
%h4 Montant souhaité
|
||||
%p{style:'margin-left:5%'}
|
||||
=number_to_currency(@dossier.montant_aide_demande.to_f, :unit => " ", :separator => ",", :delimiter => " ")
|
||||
!='€'
|
||||
%br
|
||||
.description
|
||||
- begin
|
||||
- @dossier.description.split(/(?:\n\r?|\r\n?')/).each do |line|
|
||||
|
@ -11,28 +32,11 @@
|
|||
%br
|
||||
- rescue
|
||||
=''
|
||||
%br
|
||||
.col-lg-6.col-md-6
|
||||
%h4 Montant total
|
||||
|
||||
%p
|
||||
=number_to_currency(@dossier.montant_projet.to_f, :unit => " ", :separator => ",", :delimiter => " ")
|
||||
!='€'
|
||||
|
||||
.col-lg-6.col-md-6
|
||||
%h4 Début du projet souhaité
|
||||
%p
|
||||
= @dossier.date_fr
|
||||
|
||||
|
||||
/ -if !request.url.include?('admin')
|
||||
- unless gestionnaire_signed_in?
|
||||
.col-lg-6.col-md-6
|
||||
%br
|
||||
%br
|
||||
%a#modif_description{href: "/dossiers/#{@dossier.id}/description?back_url=recapitulatif"} Modifier la description
|
||||
|
||||
|
||||
.col-md-6
|
||||
= pie_chart({"Montant à charge #{(100 - @dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => (@dossier.montant_projet.to_f - @dossier.montant_aide_demande.to_f), "Montant souhaité #{(@dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => @dossier.montant_aide_demande})
|
||||
.col-lg-6.col-md-6
|
||||
=render partial: '/dossiers/pieces_justificatives'
|
||||
-#= pie_chart({"Montant à charge #{(100 - @dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => (@dossier.montant_projet.to_f - @dossier.montant_aide_demande.to_f), "Montant souhaité #{(@dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => @dossier.montant_aide_demande})
|
||||
|
||||
%div.row{style: 'text-align:right'}
|
||||
%a#maj_infos.btn.btn-info{href: "/dossiers/#{@dossier.id}/description?back_url=recapitulatif"}
|
||||
= 'Editer mon dossier'
|
30
app/views/dossiers/_pieces_justificatives.html.haml
Normal file
30
app/views/dossiers/_pieces_justificatives.html.haml
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pieces_justificatives
|
||||
%h3.text-info Liste des pièces justificatives
|
||||
%br
|
||||
%table.table
|
||||
-if @procedure.lien_demarche != nil
|
||||
%tr{id: "piece_justificative_0"}
|
||||
%th{class:'col-lg-6'}
|
||||
='CERFA'
|
||||
-if @procedure.lien_demarche != nil
|
||||
%a{style:'font-size:0.9em; padding-left:3px', id: 'lien_cerfa' ,href: "#{@procedure.lien_demarche}", :target => '_blank'} Lien CERFA
|
||||
%td.col-lg-6.col-md-6
|
||||
- if !@dossier.cerfa.empty?
|
||||
- if user_signed_in?
|
||||
= 'Pièce fournie'
|
||||
- elsif gestionnaire_signed_in?
|
||||
%a{ href: "#{@dossier.cerfa.content}", target: '_blank' } Consulter
|
||||
- else
|
||||
= 'Pièce non fournie'
|
||||
|
||||
- @dossier.pieces_justificatives.each do |piece_justificative|
|
||||
%tr{ id: "piece_justificative_#{piece_justificative.type}" }
|
||||
%th.col-lg-6
|
||||
= piece_justificative.libelle
|
||||
%td.col-lg-6.col-md-6
|
||||
- if piece_justificative.api_entreprise
|
||||
%span.text-success Nous l'avons récupéré pour vous.
|
||||
- elsif !piece_justificative.empty?
|
||||
%a{ href: "#{piece_justificative.content}", target: '_blank' } Consulter
|
||||
- else
|
||||
= 'Pièce non fournie'
|
|
@ -1,24 +1,18 @@
|
|||
.content#commentaires_flux
|
||||
%h3 Commentaires
|
||||
|
||||
%div{style: 'margin-left:3%; width:80%'}
|
||||
-@commentaires.each do |com|
|
||||
%span.text-info#email_contact{style: 'font-weight:bold'}
|
||||
=com.email
|
||||
%span#created_at
|
||||
\-
|
||||
=com.created_at_fr
|
||||
%br
|
||||
.description#body
|
||||
=com.body
|
||||
%br
|
||||
|
||||
%h4{style: 'margin-bottom:2%'} Nouveau
|
||||
.content#commentaires_flux{style:'width:100%;'}
|
||||
%div#commentaire_new{style: 'width:80%; margin-left:auto; margin-right:auto'}
|
||||
= form_tag(url_for({ controller: :commentaires, action: :create, dossier_id: @dossier.id }), class: 'form-inline', method: 'POST') do
|
||||
%input.form-control{:type => 'text', style: 'width: 30%; margin-bottom:2%', :id => 'email_commentaire', :name => 'email_commentaire', :value => @commentaire_email}
|
||||
%textarea.form-control{:id => 'texte_commentaire', :name => 'texte_commentaire', style: 'width: 100%; margin-bottom:2%', rows: '5', maxlength: '255'}
|
||||
%br
|
||||
%input.form-control.btn.btn-success{:type => 'submit', :value => 'Poster', style: 'float:right'}
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
%textarea.form-control{id: 'texte_commentaire', name: 'texte_commentaire', style: 'width: 100%; margin-bottom:2%', rows: '5', maxlength: '255', placeholder:"Dialoguer avec votre interlocuteur privilégié en charge de votre dossier."}
|
||||
%input.form-control.btn.btn-primary{:type => 'submit', :value => 'Poster', style: 'float:right'}
|
||||
%br
|
||||
%br
|
||||
|
||||
-@commentaires.each do |com|
|
||||
%span.text-info#email_contact{style: 'font-weight:bold'}
|
||||
=com.email
|
||||
%span#created_at
|
||||
\-
|
||||
=com.created_at_fr
|
||||
%br
|
||||
.description#body
|
||||
=com.body
|
||||
%br
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
%h2#recap_dossier Récapitulatif
|
||||
%div.row#recap_dossier
|
||||
%div.col-md-2.col-lg-2
|
||||
%h2
|
||||
='Récapitulatif'
|
||||
|
||||
%div.col-md-8.col-lg-8
|
||||
|
||||
%div.col-md-2.col-lg-2
|
||||
%h2#dossier_id{:class => 'text-info', :style => 'text-align:right; margin-bottom:15px'}
|
||||
= "Dossier n°#{@dossier.id}"
|
||||
-#%h3{:class => 'text-success', :style => 'text-align:right'}
|
||||
-# = @dossier.state_fr
|
||||
- unless gestionnaire_signed_in?
|
||||
%button#action_button.btn.btn-success
|
||||
= 'Soumettre mon dossier'
|
||||
|
||||
%div{style: 'text-align:center'}
|
||||
-if request.referer != nil
|
||||
-if (request.referer.include?'/description') && !(request.referer.include?'back_url=recapitulatif')
|
||||
%h4.text-success Félicitation, votre demande a bien été enregistrée.
|
||||
-if (request.referer != nil) && (request.referer.include?'/description') && !(request.referer.include?'back_url=recapitulatif')
|
||||
%h3.text-success Félicitation, votre demande a bien été enregistrée.
|
||||
|
||||
%h3{style: 'text-align:center; line-height:1.5em'}
|
||||
='Votre dossier est le '
|
||||
%br
|
||||
%span{id: 'dossier_id', style: 'font-weight:bold;', class: 'text-success'}
|
||||
="n°#{@dossier.id}"
|
||||
-else
|
||||
%h2#dossier_id{:class => 'text-info', :style => 'text-align:right'}
|
||||
= "Dossier n°#{@dossier.id}"
|
||||
-else
|
||||
%h2#dossier_id{:class => 'text-info', :style => 'text-align:right'}
|
||||
= "Dossier n°#{@dossier.id}"
|
||||
%br
|
||||
|
||||
= render partial: '/dossiers/infos_dossier'
|
||||
%br
|
||||
|
||||
= render partial: 'commentaires_flux'
|
29
app/views/users/recapitulatif/show.html_BACKUP_4662.haml
Normal file
29
app/views/users/recapitulatif/show.html_BACKUP_4662.haml
Normal file
|
@ -0,0 +1,29 @@
|
|||
<<<<<<< HEAD:app/views/recapitulatif/show.html.haml
|
||||
%div.row
|
||||
%div.col-md-2.col-lg-2
|
||||
%h2
|
||||
='Récapitulatif'
|
||||
=======
|
||||
%h2#recap_dossier Récapitulatif
|
||||
>>>>>>> 6eeac88c95dce079195f596e05a7e652fd9720c9:app/views/users/recapitulatif/show.html.haml
|
||||
|
||||
%div.col-md-8.col-lg-8
|
||||
|
||||
%div.col-md-2.col-lg-2
|
||||
%h2#dossier_id{:class => 'text-info', :style => 'text-align:right; margin-bottom:15px'}
|
||||
= "Dossier n°#{@dossier.id}"
|
||||
-#%h3{:class => 'text-success', :style => 'text-align:right'}
|
||||
-# = @dossier.state_fr
|
||||
- unless gestionnaire_signed_in?
|
||||
%button#action_button.btn.btn-success
|
||||
= 'Soumettre mon dossier'
|
||||
|
||||
%div{style: 'text-align:center'}
|
||||
-if (request.referer != nil) && (request.referer.include?'/description') && !(request.referer.include?'back_url=recapitulatif')
|
||||
%h3.text-success Félicitation, votre demande a bien été enregistrée.
|
||||
|
||||
%br
|
||||
|
||||
= render partial: '/dossiers/infos_dossier'
|
||||
%br
|
||||
= render partial: 'commentaires_flux'
|
24
app/views/users/recapitulatif/show.html_BASE_4662.haml
Normal file
24
app/views/users/recapitulatif/show.html_BASE_4662.haml
Normal file
|
@ -0,0 +1,24 @@
|
|||
%h2
|
||||
='Récapitulatif'
|
||||
|
||||
%div{style: 'text-align:center'}
|
||||
-if request.referer != nil
|
||||
-if (request.referer.include?'/description') && !(request.referer.include?'back_url=recapitulatif')
|
||||
%h4.text-success Félicitation, votre demande a bien été enregistrée.
|
||||
|
||||
%h3{style: 'text-align:center; line-height:1.5em'}
|
||||
='Votre dossier est le '
|
||||
%br
|
||||
%span{id: 'dossier_id', style: 'font-weight:bold;', class: 'text-success'}
|
||||
="n°#{@dossier.id}"
|
||||
-else
|
||||
%h2#dossier_id{:class => 'text-info', :style => 'text-align:right'}
|
||||
= "Dossier n°#{@dossier.id}"
|
||||
-else
|
||||
%h2#dossier_id{:class => 'text-info', :style => 'text-align:right'}
|
||||
= "Dossier n°#{@dossier.id}"
|
||||
|
||||
= render partial: '/dossiers/infos_dossier'
|
||||
%br
|
||||
|
||||
= render partial: 'commentaires_flux'
|
25
app/views/users/recapitulatif/show.html_LOCAL_4662.haml
Normal file
25
app/views/users/recapitulatif/show.html_LOCAL_4662.haml
Normal file
|
@ -0,0 +1,25 @@
|
|||
%div.row
|
||||
%div.col-md-2.col-lg-2
|
||||
%h2
|
||||
='Récapitulatif'
|
||||
|
||||
%div.col-md-8.col-lg-8
|
||||
|
||||
%div.col-md-2.col-lg-2
|
||||
%h2#dossier_id{:class => 'text-info', :style => 'text-align:right; margin-bottom:15px'}
|
||||
= "Dossier n°#{@dossier.id}"
|
||||
-#%h3{:class => 'text-success', :style => 'text-align:right'}
|
||||
-# = @dossier.state_fr
|
||||
- unless gestionnaire_signed_in?
|
||||
%button#action_button.btn.btn-success
|
||||
= 'Soumettre mon dossier'
|
||||
|
||||
%div{style: 'text-align:center'}
|
||||
-if (request.referer != nil) && (request.referer.include?'/description') && !(request.referer.include?'back_url=recapitulatif')
|
||||
%h3.text-success Félicitation, votre demande a bien été enregistrée.
|
||||
|
||||
%br
|
||||
|
||||
= render partial: '/dossiers/infos_dossier'
|
||||
%br
|
||||
= render partial: 'commentaires_flux'
|
23
app/views/users/recapitulatif/show.html_REMOTE_4662.haml
Normal file
23
app/views/users/recapitulatif/show.html_REMOTE_4662.haml
Normal file
|
@ -0,0 +1,23 @@
|
|||
%h2#recap_dossier Récapitulatif
|
||||
|
||||
%div{style: 'text-align:center'}
|
||||
-if request.referer != nil
|
||||
-if (request.referer.include?'/description') && !(request.referer.include?'back_url=recapitulatif')
|
||||
%h4.text-success Félicitation, votre demande a bien été enregistrée.
|
||||
|
||||
%h3{style: 'text-align:center; line-height:1.5em'}
|
||||
='Votre dossier est le '
|
||||
%br
|
||||
%span{id: 'dossier_id', style: 'font-weight:bold;', class: 'text-success'}
|
||||
="n°#{@dossier.id}"
|
||||
-else
|
||||
%h2#dossier_id{:class => 'text-info', :style => 'text-align:right'}
|
||||
= "Dossier n°#{@dossier.id}"
|
||||
-else
|
||||
%h2#dossier_id{:class => 'text-info', :style => 'text-align:right'}
|
||||
= "Dossier n°#{@dossier.id}"
|
||||
|
||||
= render partial: '/dossiers/infos_dossier'
|
||||
%br
|
||||
|
||||
= render partial: 'commentaires_flux'
|
|
@ -44,8 +44,8 @@ ActiveRecord::Schema.define(version: 20150923101000) do
|
|||
t.string "montant_aide_demande"
|
||||
t.integer "procedure_id"
|
||||
t.date "date_previsionnelle"
|
||||
t.datetime "created_at", default: '2015-09-22 09:25:29'
|
||||
t.datetime "updated_at", default: '2015-09-22 09:25:29'
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "state"
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
@ -110,7 +110,7 @@ ActiveRecord::Schema.define(version: 20150923101000) do
|
|||
t.integer "type_de_piece_justificative_id"
|
||||
end
|
||||
|
||||
add_index "pieces_justificatives", ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_de_piece_justificative_id", using: :btree
|
||||
add_index "pieces_justificatives", ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_piece_jointe_id", using: :btree
|
||||
|
||||
create_table "procedures", force: :cascade do |t|
|
||||
t.string "libelle"
|
||||
|
|
|
@ -3,8 +3,48 @@ require 'spec_helper'
|
|||
describe DossierDecorator do
|
||||
let(:dossier) { create(:dossier, :with_user) }
|
||||
subject { dossier.decorate }
|
||||
|
||||
describe 'last_update' do
|
||||
subject { Timecop.freeze(Time.new(2015, 12, 24, 14, 10)) { super().last_update } }
|
||||
it { is_expected.to eq('24/12/2015 14:10') }
|
||||
end
|
||||
|
||||
describe 'state_fr' do
|
||||
subject{ super().state_fr }
|
||||
|
||||
it 'draft is brouillon' do
|
||||
dossier.draft!
|
||||
expect(subject).to eq('Brouillon')
|
||||
end
|
||||
|
||||
it 'proposed is propose' do
|
||||
dossier.proposed!
|
||||
expect(subject).to eq('Proposé')
|
||||
end
|
||||
|
||||
it 'reply is repondu' do
|
||||
dossier.reply!
|
||||
expect(subject).to eq('Répondu')
|
||||
end
|
||||
|
||||
it 'updated is mis à jour' do
|
||||
dossier.updated!
|
||||
expect(subject).to eq('Mis à jour')
|
||||
end
|
||||
|
||||
it 'confirmed is valide' do
|
||||
dossier.confirmed!
|
||||
expect(subject).to eq('Validé')
|
||||
end
|
||||
|
||||
it 'deposited is dépose' do
|
||||
dossier.deposited!
|
||||
expect(subject).to eq('Déposé')
|
||||
end
|
||||
|
||||
it 'processed is traité' do
|
||||
dossier.processed!
|
||||
expect(subject).to eq('Traité')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
FactoryGirl.define do
|
||||
factory :dossier do
|
||||
nom_projet "Demande de subvention dans le cadre d'accompagnement d'enfant à l'étranger"
|
||||
state 'draft'
|
||||
trait :with_entreprise do
|
||||
after(:build) do |dossier, _evaluator|
|
||||
etablissement = create(:etablissement)
|
||||
|
|
|
@ -36,13 +36,5 @@ feature 'add commentaire on backoffice' do
|
|||
scenario 'Champs de texte' do
|
||||
expect(page).to have_selector('textarea[id=texte_commentaire][name=texte_commentaire]')
|
||||
end
|
||||
|
||||
scenario 'Champs email' do
|
||||
expect(page).to have_selector('input[id=email_commentaire][name=email_commentaire]')
|
||||
end
|
||||
|
||||
scenario 'Champs email est prérempli' do
|
||||
expect(page).to have_selector("input[id=email_commentaire][value='#{gestionnaire.email}']")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -82,17 +82,17 @@ feature 'Admin/Dossier#Show Page' do
|
|||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
scenario 'la carte est bien présente' do
|
||||
expect(page).to have_selector('#map_qp')
|
||||
end
|
||||
|
||||
scenario 'la page des sources CSS de l\'API cart est chargée' do
|
||||
expect(page).to have_selector('#sources_CSS_api_carto')
|
||||
end
|
||||
|
||||
scenario 'la page des sources JS backend de l\'API cart est chargée' do
|
||||
expect(page).to have_selector('#sources_JS_api_carto_backend')
|
||||
end
|
||||
#
|
||||
# scenario 'la carte est bien présente' do
|
||||
# expect(page).to have_selector('#map_qp')
|
||||
# end
|
||||
#
|
||||
# scenario 'la page des sources CSS de l\'API cart est chargée' do
|
||||
# expect(page).to have_selector('#sources_CSS_api_carto')
|
||||
# end
|
||||
#
|
||||
# scenario 'la page des sources JS backend de l\'API cart est chargée' do
|
||||
# expect(page).to have_selector('#sources_JS_api_carto_backend')
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature '_Commentaires_Flux Recapitulatif#Show Page' do
|
||||
let(:dossier) { create(:dossier, :with_user) }
|
||||
let(:dossier) { create(:dossier, :with_user, :with_procedure) }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:email_commentaire) { 'mon_mail_de_commentaire@test.com' }
|
||||
let!(:commentaire) { create(:commentaire, dossier: dossier, email: email_commentaire, body: 'ma super description') }
|
||||
|
@ -34,13 +34,5 @@ feature '_Commentaires_Flux Recapitulatif#Show Page' do
|
|||
scenario 'Champs de texte' do
|
||||
expect(page).to have_selector('textarea[id=texte_commentaire][name=texte_commentaire]')
|
||||
end
|
||||
|
||||
scenario 'Champs email' do
|
||||
expect(page).to have_selector('input[id=email_commentaire][name=email_commentaire]')
|
||||
end
|
||||
|
||||
scenario 'Champs email est prérempli' do
|
||||
expect(page).to have_content(email_commentaire)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'Recapitulatif#Show Page' do
|
||||
let(:dossier) { create(:dossier, :with_user) }
|
||||
let(:dossier) { create(:dossier, :with_user, :with_procedure) }
|
||||
let(:dossier_id) { dossier.id }
|
||||
|
||||
before do
|
||||
|
@ -27,11 +27,11 @@ feature 'Recapitulatif#Show Page' do
|
|||
context 'les liens de modifications' do
|
||||
context 'lien description' do
|
||||
scenario 'le lien vers description est présent' do
|
||||
expect(page).to have_css('#modif_description')
|
||||
expect(page).to have_css('#maj_infos')
|
||||
end
|
||||
|
||||
scenario 'le lien vers description est correct' do
|
||||
expect(page).to have_selector("a[id=modif_description][href='/dossiers/#{dossier_id}/description?back_url=recapitulatif']")
|
||||
expect(page).to have_selector("a[id=maj_infos][href='/dossiers/#{dossier_id}/description?back_url=recapitulatif']")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -117,5 +117,258 @@ describe Dossier do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
#TODO revoir le nommage
|
||||
describe '#next_step' do
|
||||
let(:dossier) { create(:dossier) }
|
||||
let(:role) { 'user' }
|
||||
let(:action) { 'propose' }
|
||||
|
||||
subject { dossier.next_step! role, action }
|
||||
|
||||
context 'when action is not valid' do
|
||||
let(:action) { 'test' }
|
||||
it { expect{ subject }.to raise_error('action is not valid') }
|
||||
end
|
||||
|
||||
context 'when role is not valid' do
|
||||
let(:role) { 'test' }
|
||||
it { expect{ subject }.to raise_error('role is not valid') }
|
||||
end
|
||||
|
||||
context 'when dossier is at state draft' do
|
||||
before do
|
||||
dossier.draft!
|
||||
end
|
||||
|
||||
context 'when user is connected' do
|
||||
let(:role) { 'user' }
|
||||
|
||||
context 'when he updates dossier informations' do
|
||||
let(:action) {'update'}
|
||||
|
||||
it { is_expected.to eq('draft') }
|
||||
end
|
||||
|
||||
context 'when he posts a comment' do
|
||||
let(:action) {'comment'}
|
||||
|
||||
it { is_expected.to eq('draft') }
|
||||
end
|
||||
|
||||
context 'when he proposes a dossier' do
|
||||
let(:action) { 'propose' }
|
||||
|
||||
it { is_expected.to eq('proposed') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state proposed' do
|
||||
before do
|
||||
dossier.proposed!
|
||||
end
|
||||
|
||||
context 'when user is connect' do
|
||||
let(:role) { 'user' }
|
||||
|
||||
context 'when is update dossier informations' do
|
||||
let(:action) { 'update' }
|
||||
|
||||
it {is_expected.to eq('proposed')}
|
||||
end
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it {is_expected.to eq('proposed')}
|
||||
end
|
||||
end
|
||||
|
||||
context 'when gestionnaire is connect' do
|
||||
let(:role) { 'gestionnaire' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('reply')}
|
||||
end
|
||||
|
||||
context 'when is confirmed the dossier' do
|
||||
let(:action) { 'confirme' }
|
||||
|
||||
it {is_expected.to eq('confirmed')}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state reply' do
|
||||
before do
|
||||
dossier.reply!
|
||||
end
|
||||
|
||||
context 'when user is connect' do
|
||||
let(:role) { 'user' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('updated') }
|
||||
end
|
||||
|
||||
context 'when is updated dossier informations' do
|
||||
let(:action) { 'update' }
|
||||
|
||||
it {
|
||||
|
||||
is_expected.to eq('updated')
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
context 'when gestionnaire is connect' do
|
||||
let(:role) { 'gestionnaire' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('reply')}
|
||||
end
|
||||
|
||||
context 'when is confirmed the dossier' do
|
||||
let(:action) { 'confirme' }
|
||||
|
||||
it {is_expected.to eq('confirmed')}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state updated' do
|
||||
before do
|
||||
dossier.updated!
|
||||
end
|
||||
|
||||
context 'when user is connect' do
|
||||
let(:role) { 'user' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('updated')}
|
||||
end
|
||||
|
||||
context 'when is updated dossier informations' do
|
||||
let(:action) { 'update' }
|
||||
|
||||
it { is_expected.to eq('updated')}
|
||||
end
|
||||
end
|
||||
|
||||
context 'when gestionnaire is connect' do
|
||||
let(:role) { 'gestionnaire' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('reply')}
|
||||
end
|
||||
|
||||
context 'when is confirmed the dossier' do
|
||||
let(:action) { 'confirme' }
|
||||
|
||||
it {is_expected.to eq('confirmed')}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state confirmed' do
|
||||
before do
|
||||
dossier.confirmed!
|
||||
end
|
||||
|
||||
context 'when user is connect' do
|
||||
let(:role) { 'user' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
it { is_expected.to eq('confirmed') }
|
||||
end
|
||||
|
||||
context 'when is deposed the dossier' do
|
||||
let(:action) { 'depose' }
|
||||
|
||||
it { is_expected.to eq('deposited') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when gestionnaire is connect' do
|
||||
let(:role) { 'gestionnaire' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('confirmed')}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state deposited' do
|
||||
before do
|
||||
dossier.deposited!
|
||||
end
|
||||
|
||||
context 'when user is connect' do
|
||||
let(:role) { 'user' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('deposited') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when gestionnaire is connect' do
|
||||
let(:role) { 'gestionnaire' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it {is_expected.to eq('deposited')}
|
||||
end
|
||||
|
||||
context 'when is processed the dossier' do
|
||||
let(:action) { 'process' }
|
||||
|
||||
it {is_expected.to eq('processed')}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state processed' do
|
||||
before do
|
||||
dossier.processed!
|
||||
end
|
||||
|
||||
context 'when user is connect' do
|
||||
let(:role) { 'user' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('processed')}
|
||||
end
|
||||
end
|
||||
|
||||
context 'when gestionnaire is connect' do
|
||||
let(:role) { 'gestionnaire' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('processed')}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -65,6 +65,7 @@ RSpec.configure do |config|
|
|||
|
||||
config.order = 'random'
|
||||
|
||||
config.include Devise::TestHelpers, type: :view
|
||||
config.include Devise::TestHelpers, type: :controller
|
||||
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
|
|
|
@ -1 +1,14 @@
|
|||
# TODO à écrire
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'dossiers/_infos_dossier.html.haml', type: :view do
|
||||
let(:dossier) { create(:dossier, :with_entreprise, :with_procedure) }
|
||||
|
||||
let(:maj_infos) { 'Mettre à jour les informations' }
|
||||
let(:proposer) { 'Soumettre mon dossier' }
|
||||
|
||||
before do
|
||||
assign(:dossier, dossier.decorate)
|
||||
assign(:commentaires, dossier.commentaires)
|
||||
render
|
||||
end
|
||||
end
|
||||
|
|
39
spec/views/users/recapitulatif/_commentaires_flux_spec.rb
Normal file
39
spec/views/users/recapitulatif/_commentaires_flux_spec.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/recapitulatif/_commentaires_flux.html.haml', type: :view do
|
||||
let(:dossier) { create(:dossier, :with_procedure) }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:email_commentaire) { 'mon_mail_de_commentaire@test.com' }
|
||||
let!(:commentaire) { create(:commentaire, dossier: dossier, email: email_commentaire, body: 'ma super description') }
|
||||
let(:body) { 'Commentaire de test' }
|
||||
|
||||
before do
|
||||
assign(:dossier, dossier.decorate)
|
||||
assign(:commentaires, dossier.commentaires.all.decorate)
|
||||
render
|
||||
end
|
||||
|
||||
context 'Affichage du flux de commentaire' do
|
||||
it 'l\'email du contact est présent' do
|
||||
expect(rendered).to have_selector('span[id=email_contact]')
|
||||
end
|
||||
|
||||
it 'la date du commentaire est présent' do
|
||||
expect(rendered).to have_selector('span[id=created_at]')
|
||||
end
|
||||
|
||||
it 'le corps du commentaire est présent' do
|
||||
expect(rendered).to have_selector('div[class=description][id=body]')
|
||||
end
|
||||
end
|
||||
|
||||
context 'Affichage du formulaire de commentaire' do
|
||||
it 'Le formulaire envoie vers /dossiers/:dossier_id/commentaire en #POST' do
|
||||
expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/commentaire'][method=post]")
|
||||
end
|
||||
|
||||
it 'Champs de texte' do
|
||||
expect(rendered).to have_selector('textarea[id=texte_commentaire][name=texte_commentaire]')
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue