Merge branch 'develop' of ssh://37.187.249.111:2200/opt/git/tps into develop

This commit is contained in:
Tanguy PATTE 2015-09-24 11:17:29 +02:00
commit 40310da378
27 changed files with 679 additions and 164 deletions

View file

@ -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 {

View 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%;
}

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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'

View file

@ -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 => " ")
!='&euro;'
.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 => " ")
!='&euro;'
%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 => " ")
!='&euro;'
.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'

View 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'

View file

@ -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

View file

@ -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'

View 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'

View 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'

View 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'

View 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'