Add identité demandeur for entreprise on dossier detail page
This commit is contained in:
parent
1c7d9eaa69
commit
f9f313e990
8 changed files with 139 additions and 46 deletions
|
@ -17,6 +17,6 @@
|
|||
.card-title {
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
margin-bottom: $default-spacer;
|
||||
margin-bottom: $default-spacer * 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,10 @@ module NewGestionnaire
|
|||
send_data(dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf')
|
||||
end
|
||||
|
||||
def show
|
||||
@dossier = dossier
|
||||
end
|
||||
|
||||
def follow
|
||||
current_gestionnaire.followed_dossiers << dossier
|
||||
redirect_back(fallback_location: procedures_url)
|
||||
|
@ -27,7 +31,7 @@ module NewGestionnaire
|
|||
private
|
||||
|
||||
def dossier
|
||||
Dossier.find(params[:dossier_id])
|
||||
current_gestionnaire.dossiers.find(params[:dossier_id])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
- entreprise = entreprise.decorate
|
||||
- etablissement = entreprise.etablissement
|
||||
%h4= entreprise.raison_sociale_or_name
|
||||
|
||||
%table.table
|
||||
%tbody
|
||||
%tr
|
||||
%th SIRET :
|
||||
%td= entreprise.siret_siege_social
|
||||
%tr
|
||||
%th Forme juridique :
|
||||
%td= entreprise.forme_juridique
|
||||
- if etablissement.present?
|
||||
%tr
|
||||
%th Libellé NAF :
|
||||
%td= etablissement.libelle_naf
|
||||
%tr
|
||||
%th Code NAF :
|
||||
%td= etablissement.naf
|
||||
%tr
|
||||
%th Date de création :
|
||||
%td= Time.at(entreprise.date_creation).localtime.strftime("%d/%m/%Y")
|
||||
%tr
|
||||
%th Effectif de l'organisation :
|
||||
%td= entreprise.effectif
|
||||
%tr
|
||||
%th Code effectif :
|
||||
%td= entreprise.code_effectif_entreprise
|
||||
%tr
|
||||
%th Numéro de TVA intracommunautaire :
|
||||
%td= entreprise.numero_tva_intracommunautaire
|
||||
- if etablissement.present?
|
||||
%tr
|
||||
%th Adresse :
|
||||
%td
|
||||
- etablissement.adresse.split("\n").each do |line|
|
||||
= line
|
||||
%br
|
||||
%tr
|
||||
%th Capital social :
|
||||
%td= entreprise.pretty_capital_social
|
||||
- if etablissement.present?
|
||||
%tr
|
||||
%th Exercices :
|
||||
%td
|
||||
- etablissement.exercices.each_with_index do |exercice, index|
|
||||
= "#{exercice.dateFinExercice.year} : "
|
||||
= number_to_currency(exercice.ca)
|
||||
%br
|
5
app/views/new_gestionnaire/dossiers/show.html.haml
Normal file
5
app/views/new_gestionnaire/dossiers/show.html.haml
Normal file
|
@ -0,0 +1,5 @@
|
|||
.container
|
||||
.card
|
||||
.card-title Identité du demandeur
|
||||
- if @dossier.entreprise.present?
|
||||
= render partial: "identite_entreprise", locals: { entreprise: @dossier.entreprise }
|
|
@ -1,19 +1,19 @@
|
|||
- if dossier.en_construction_ou_instruction?
|
||||
- if current_gestionnaire.follow?(dossier)
|
||||
= link_to dossier_unfollow_path(procedure, dossier), method: :patch, class: 'button' do
|
||||
= link_to unfollow_dossier_path(procedure, dossier), method: :patch, class: 'button' do
|
||||
%i.unfollow>
|
||||
ne plus suivre
|
||||
- else
|
||||
= link_to dossier_follow_path(procedure, dossier), method: :patch, class: 'button' do
|
||||
= link_to follow_dossier_path(procedure, dossier), method: :patch, class: 'button' do
|
||||
%i.follow>
|
||||
suivre le dossier
|
||||
|
||||
- elsif dossier.termine?
|
||||
- if dossier.archived
|
||||
= link_to dossier_unarchive_path(procedure, dossier), method: :patch, class: 'button' do
|
||||
= link_to unarchive_dossier_path(procedure, dossier), method: :patch, class: 'button' do
|
||||
%i.unarchive>
|
||||
désarchiver le dossier
|
||||
- else
|
||||
= link_to dossier_archive_path(procedure, dossier), method: :patch, class: 'button' do
|
||||
= link_to archive_dossier_path(procedure, dossier), method: :patch, class: 'button' do
|
||||
%i.archive>
|
||||
archiver le dossier
|
||||
|
|
|
@ -42,10 +42,10 @@
|
|||
%th.follow-col
|
||||
- @dossiers.each do |dossier|
|
||||
%tr
|
||||
%td.number-col= link_to(dossier.id, backoffice_dossier_path(dossier), class: 'big-link')
|
||||
%td= link_to(dossier.user.email, backoffice_dossier_path(dossier), class: 'big-link')
|
||||
%td.number-col= link_to(dossier.id, dossier_path(@procedure, dossier), class: 'big-link')
|
||||
%td= link_to(dossier.user.email, dossier_path(@procedure, dossier), class: 'big-link')
|
||||
%td.status-col
|
||||
= link_to(backoffice_dossier_path(dossier), class: 'big-link') do
|
||||
= link_to(dossier_path(@procedure, dossier), class: 'big-link') do
|
||||
= render partial: 'status', locals: { dossier: dossier }
|
||||
%td.follow-col= render partial: 'dossier_actions', locals: { procedure: @procedure, dossier: dossier }
|
||||
- else
|
||||
|
|
|
@ -240,7 +240,8 @@ Rails.application.routes.draw do
|
|||
scope module: 'new_gestionnaire' do
|
||||
resources :procedures, only: [:index, :show], param: :procedure_id do
|
||||
member do
|
||||
resources :dossiers, only: [] do
|
||||
resources :dossiers, only: [:show], param: :dossier_id do
|
||||
member do
|
||||
get 'attestation'
|
||||
patch 'follow'
|
||||
patch 'unfollow'
|
||||
|
@ -250,6 +251,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
apipie
|
||||
end
|
||||
|
|
|
@ -3,14 +3,16 @@ require 'spec_helper'
|
|||
describe NewGestionnaire::DossiersController, type: :controller do
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
let(:procedure) { create(:procedure, gestionnaires: [gestionnaire]) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure) }
|
||||
|
||||
before { sign_in(gestionnaire) }
|
||||
let(:dossier) { create(:dossier, :replied, procedure: procedure) }
|
||||
|
||||
describe 'attestation' do
|
||||
before { sign_in(gestionnaire) }
|
||||
|
||||
context 'when a dossier has an attestation' do
|
||||
let(:fake_pdf) { double(read: 'pdf content') }
|
||||
let!(:dossier) { create(:dossier, attestation: Attestation.new, procedure: procedure) }
|
||||
let!(:dossier) { create(:dossier, :replied, attestation: Attestation.new, procedure: procedure) }
|
||||
let!(:procedure) { create(:procedure, gestionnaires: [gestionnaire]) }
|
||||
let!(:dossier) { create(:dossier, :replied, attestation: Attestation.new, procedure: procedure) }
|
||||
|
||||
it 'returns the attestation pdf' do
|
||||
allow_any_instance_of(Attestation).to receive(:pdf).and_return(fake_pdf)
|
||||
|
@ -26,6 +28,10 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context "when gestionnaire is signed in" do
|
||||
before { sign_in(gestionnaire) }
|
||||
|
||||
|
||||
describe 'follow' do
|
||||
before { patch :follow, params: { procedure_id: procedure.id, dossier_id: dossier.id } }
|
||||
|
||||
|
@ -65,3 +71,30 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
it { expect(response).to redirect_to(procedures_url) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "#show" do
|
||||
let(:procedure) { create(:procedure, gestionnaires: [gestionnaire]) }
|
||||
let(:dossier){ create(:dossier, :replied, procedure: procedure) }
|
||||
|
||||
subject { get :show, params: { procedure_id: procedure.id, dossier_id: dossier.id } }
|
||||
|
||||
context "when gestionnaire is not logged in" do
|
||||
before { subject }
|
||||
it { expect(response).to redirect_to(new_user_session_path) }
|
||||
end
|
||||
|
||||
context "when gestionnaire is logged in" do
|
||||
before { sign_in(gestionnaire) }
|
||||
|
||||
it do
|
||||
subject
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
context "when gestionnaire is not affected on procedure" do
|
||||
let(:dossier){ create(:dossier, :replied) }
|
||||
it { expect{ subject }.to raise_error(ActiveRecord::RecordNotFound) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue