Avis: show

This commit is contained in:
Simon Lehericey 2017-09-06 11:26:32 +02:00
parent 3cc09c98f9
commit a1f9f7aa75
5 changed files with 76 additions and 1 deletions

View file

@ -18,5 +18,16 @@ module NewGestionnaire
@avis_donnes
end
end
def show
@avis = avis
@dossier = avis.dossier
end
private
def avis
current_gestionnaire.avis.includes(dossier: [:avis]).find(params[:id])
end
end
end

View file

@ -0,0 +1,9 @@
.backoffice-header
.container
%ul.breadcrumbs
%li= link_to('Avis', avis_index_path)
%li= "#{dossier.procedure.libelle}, dossier nº #{dossier.id}"
%ul.tabs
%li{ class: current_page?(avis_path(avis)) ? 'active' : nil }
= link_to 'Demande', avis_path(avis)

View file

@ -0,0 +1,47 @@
#avis-show
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
.container
.card
.card-title Identité du demandeur
- if @dossier.entreprise.present?
= render partial: 'new_gestionnaire/dossiers/identite_entreprise', locals: { entreprise: @dossier.entreprise }
- if @dossier.individual.present?
= render partial: 'new_gestionnaire/dossiers/identite_individual', locals: { individual: @dossier.individual }
.backoffice-title Formulaire
- champs = @dossier.ordered_champs.decorate
- if champs.any?
.card.featured
= render partial: 'new_gestionnaire/dossiers/champs', locals: { champs: champs }
- if @dossier.procedure.use_api_carto
= render partial: 'new_gestionnaire/dossiers/map', locals: { dossier: @dossier }
- if @dossier.procedure.cerfa_flag? || @dossier.types_de_piece_justificative.any?
.card.featured
.card-title Pièces jointes
%table.table.vertical
%tbody
- if @dossier.procedure.cerfa_flag?
%tr
%th Formulaire :
%td
- if @dossier.cerfa_available?
= link_to 'Télécharger', @dossier.cerfa.last.content_url, class: 'button', target: :blank
- else
Pièce non fournie
- @dossier.procedure.types_de_piece_justificative.each do |type_de_piece_justificative|
%tr
%th= "#{type_de_piece_justificative.libelle} :"
%td
- pj = @dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id)
- if pj.present?
Pièce fournie -
= link_to "Consulter", pj.content_url, class: "link", target: :blank
- else
Pièce non fournie

View file

@ -258,7 +258,7 @@ Rails.application.routes.draw do
end
end
end
resources :avis, only: [:index]
resources :avis, only: [:index, :show]
get "recherche" => "recherches#index"
end

View file

@ -26,4 +26,12 @@ describe NewGestionnaire::AvisController, type: :controller do
it { expect(assigns(:statut)).to eq('donnes') }
end
end
describe '#show' do
before { get :show, { id: avis_without_answer.id } }
it { expect(response).to have_http_status(:success) }
it { expect(assigns(:avis)).to eq(avis_without_answer) }
it { expect(assigns(:dossier)).to eq(dossier) }
end
end