[Ref #2738] Hide exercices if not gestionnaire

This commit is contained in:
gregoirenovel 2018-10-17 12:12:32 +02:00
parent da4037b2fd
commit 3a973999a3
10 changed files with 20 additions and 14 deletions

View file

@ -2,4 +2,4 @@
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
= render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil }
= render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil, profile: 'instructeur' }

View file

@ -6,7 +6,7 @@
= render partial: "shared/dossiers/user_infos", locals: { user: @dossier.user }
- if @dossier.etablissement.present?
= render partial: "shared/dossiers/identite_entreprise", locals: { etablissement: @dossier.etablissement }
= render partial: "shared/dossiers/identite_entreprise", locals: { etablissement: @dossier.etablissement, profile: 'instructeur' }
- if @dossier.individual.present?
= render partial: "shared/dossiers/identite_individual", locals: { individual: @dossier.individual }
@ -15,7 +15,7 @@
- champs = @dossier.champs.decorate
- if champs.any?
= render partial: "shared/dossiers/champs", locals: { champs: champs, dossier: @dossier, demande_seen_at: nil }
= render partial: "shared/dossiers/champs", locals: { champs: champs, dossier: @dossier, demande_seen_at: nil, profile: 'instructeur' }
- if @dossier.procedure.use_api_carto
%h3 Cartographie

View file

@ -2,4 +2,4 @@
= render partial: "header", locals: { dossier: @dossier }
= render partial: "shared/dossiers/demande", locals: { dossier: @dossier, demande_seen_at: @demande_seen_at }
= render partial: "shared/dossiers/demande", locals: { dossier: @dossier, demande_seen_at: @demande_seen_at, profile: 'instructeur' }

View file

@ -6,7 +6,7 @@
#dossier-show
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
= render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil }
= render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil, profile: 'usager' }
.container
- if !@dossier.read_only?

View file

@ -55,7 +55,7 @@
%td.rich-text
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
- if c.etablissement.present?
= render partial: "shared/dossiers/identite_entreprise", locals: { etablissement: c.etablissement }
= render partial: "shared/dossiers/identite_entreprise", locals: { etablissement: c.etablissement, profile: profile }
- else
%th.libelle
= "#{c.libelle} :"

View file

@ -4,7 +4,7 @@
= render partial: "shared/dossiers/user_infos", locals: { user: dossier.user }
- if dossier.etablissement.present?
= render partial: "shared/dossiers/identite_entreprise", locals: { etablissement: dossier.etablissement }
= render partial: "shared/dossiers/identite_entreprise", locals: { etablissement: dossier.etablissement, profile: profile }
- if dossier.individual.present?
= render partial: "shared/dossiers/identite_individual", locals: { individual: dossier.individual }
@ -13,7 +13,7 @@
- champs = dossier.champs.includes(:type_de_champ).decorate
- if champs.any?
.card
= render partial: "shared/dossiers/champs", locals: { champs: champs, demande_seen_at: demande_seen_at }
= render partial: "shared/dossiers/champs", locals: { champs: champs, demande_seen_at: demande_seen_at, profile: profile }
- if dossier.procedure.use_api_carto
.tab-title Cartographie

View file

@ -44,10 +44,13 @@
%tr
%th.libelle Exercices :
%td
- etablissement.exercices.each_with_index do |exercice, index|
= "#{exercice.date_fin_exercice.year} : "
= pretty_currency(exercice.ca)
%br
- if profile == 'instructeur'
- etablissement.exercices.each_with_index do |exercice, index|
= "#{exercice.date_fin_exercice.year} : "
= pretty_currency(exercice.ca)
%br
- elsif etablissement.exercices.present?
= t('activemodel.models.exercices_summary', count: etablissement.exercices.count)
- if etablissement.association?
%tr

View file

@ -2,6 +2,9 @@ fr:
activemodel:
models:
siret: 'SIRET'
exercices_summary:
one: Lexercice comptable de lannée dernière a été joint à votre dossier.
other: "Les exercices comptables des %{count} dernières années ont été joints à votre dossier."
errors:
models:
siret:

View file

@ -9,7 +9,7 @@ describe 'shared/dossiers/demande.html.haml', type: :view do
sign_in current_gestionnaire
end
subject! { render 'shared/dossiers/demande.html.haml', dossier: dossier, demande_seen_at: nil }
subject! { render 'shared/dossiers/demande.html.haml', dossier: dossier, demande_seen_at: nil, profile: 'usager' }
context 'when dossier was created by an etablissement' do
let(:etablissement) { create(:etablissement) }

View file

@ -1,5 +1,5 @@
describe 'shared/dossiers/identite_entreprise.html.haml', type: :view do
before { render 'shared/dossiers/identite_entreprise.html.haml', etablissement: etablissement }
before { render 'shared/dossiers/identite_entreprise.html.haml', etablissement: etablissement, profile: 'usager' }
context "there is an association" do
let(:etablissement) { create(:etablissement, :is_association) }