Merge branch 'dev'
This commit is contained in:
commit
4a34b7866e
13 changed files with 77 additions and 30 deletions
|
@ -16,6 +16,7 @@ class ProcedurePresentation < ApplicationRecord
|
|||
def fields
|
||||
fields = [
|
||||
field_hash('Créé le', 'self', 'created_at'),
|
||||
field_hash('En construction le', 'self', 'en_construction_at'),
|
||||
field_hash('Mis à jour le', 'self', 'updated_at'),
|
||||
field_hash('Demandeur', 'user', 'email')
|
||||
]
|
||||
|
|
|
@ -47,11 +47,7 @@
|
|||
.row
|
||||
.col-xs-4.entreprise-label Exercices :
|
||||
.col-xs-8.entreprise-info
|
||||
- @facade.etablissement.exercices.each_with_index do |exercice, index|
|
||||
%strong
|
||||
= "#{exercice.date_fin_exercice.year} : "
|
||||
= number_to_currency(exercice.ca)
|
||||
%br
|
||||
les exercices comptables des trois dernières années sont joints à votre dossier.
|
||||
|
||||
.row.split-row
|
||||
.col-xs-12.split-hr
|
||||
|
|
|
@ -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' }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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' }
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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} :"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -44,10 +44,14 @@
|
|||
%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
|
||||
%th.libelle Numéro RNA :
|
||||
|
|
|
@ -2,6 +2,9 @@ fr:
|
|||
activemodel:
|
||||
models:
|
||||
siret: 'SIRET'
|
||||
exercices_summary:
|
||||
one: L’exercice comptable de l’anné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:
|
||||
|
|
|
@ -58,6 +58,7 @@ describe ProcedurePresentation do
|
|||
let(:expected) {
|
||||
[
|
||||
{ "label" => 'Créé le', "table" => 'self', "column" => 'created_at' },
|
||||
{ "label" => 'En construction le', "table" => 'self', "column" => 'en_construction_at' },
|
||||
{ "label" => 'Mis à jour le', "table" => 'self', "column" => 'updated_at' },
|
||||
{ "label" => 'Demandeur', "table" => 'user', "column" => 'email' },
|
||||
{ "label" => 'SIREN', "table" => 'etablissement', "column" => 'entreprise_siren' },
|
||||
|
@ -129,13 +130,29 @@ describe ProcedurePresentation do
|
|||
|
||||
context 'for self table' do
|
||||
let(:table) { 'self' }
|
||||
let(:column) { 'updated_at' } # All other columns work the same, no extra test required
|
||||
|
||||
let(:dossier) { create(:dossier, procedure: procedure) }
|
||||
context 'for created_at column' do
|
||||
let(:column) { 'created_at' }
|
||||
let(:dossier) { Timecop.freeze(DateTime.new(1992, 3, 22)) { create(:dossier, procedure: procedure) } }
|
||||
|
||||
before { dossier.touch(time: DateTime.new(2018, 9, 25)) }
|
||||
it { is_expected.to eq(DateTime.new(1992, 3, 22)) }
|
||||
end
|
||||
|
||||
it { is_expected.to eq(DateTime.new(2018, 9, 25)) }
|
||||
context 'for en_construction_at column' do
|
||||
let(:column) { 'en_construction_at' }
|
||||
let(:dossier) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: DateTime.new(2018, 10, 17)) }
|
||||
|
||||
it { is_expected.to eq(DateTime.new(2018, 10, 17)) }
|
||||
end
|
||||
|
||||
context 'for updated_at column' do
|
||||
let(:column) { 'updated_at' }
|
||||
let(:dossier) { create(:dossier, procedure: procedure) }
|
||||
|
||||
before { dossier.touch(time: DateTime.new(2018, 9, 25)) }
|
||||
|
||||
it { is_expected.to eq(DateTime.new(2018, 9, 25)) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'for user table' do
|
||||
|
@ -240,18 +257,36 @@ describe ProcedurePresentation do
|
|||
|
||||
context 'for self table' do
|
||||
let(:table) { 'self' }
|
||||
let(:column) { 'updated_at' } # All other columns work the same, no extra test required
|
||||
let(:order) { 'asc' } # Desc works the same, no extra test required
|
||||
|
||||
let(:recent_dossier) { create(:dossier, procedure: procedure) }
|
||||
let(:older_dossier) { create(:dossier, procedure: procedure) }
|
||||
context 'for created_at column' do
|
||||
let(:column) { 'created_at' }
|
||||
let!(:recent_dossier) { Timecop.freeze(DateTime.new(2018, 10, 17)) { create(:dossier, procedure: procedure) } }
|
||||
let!(:older_dossier) { Timecop.freeze(DateTime.new(2003, 11, 11)) { create(:dossier, procedure: procedure) } }
|
||||
|
||||
before do
|
||||
recent_dossier.touch(time: DateTime.new(2018, 9, 25))
|
||||
older_dossier.touch(time: DateTime.new(2018, 5, 13))
|
||||
it { is_expected.to eq([older_dossier, recent_dossier].map(&:id)) }
|
||||
end
|
||||
|
||||
it { is_expected.to eq([older_dossier, recent_dossier].map(&:id)) }
|
||||
context 'for en_construction_at column' do
|
||||
let(:column) { 'en_construction_at' }
|
||||
let!(:recent_dossier) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: DateTime.new(2018, 10, 17)) }
|
||||
let!(:older_dossier) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: DateTime.new(2013, 1, 1)) }
|
||||
|
||||
it { is_expected.to eq([older_dossier, recent_dossier].map(&:id)) }
|
||||
end
|
||||
|
||||
context 'for updated_at column' do
|
||||
let(:column) { 'updated_at' }
|
||||
let(:recent_dossier) { create(:dossier, procedure: procedure) }
|
||||
let(:older_dossier) { create(:dossier, procedure: procedure) }
|
||||
|
||||
before do
|
||||
recent_dossier.touch(time: DateTime.new(2018, 9, 25))
|
||||
older_dossier.touch(time: DateTime.new(2018, 5, 13))
|
||||
end
|
||||
|
||||
it { is_expected.to eq([older_dossier, recent_dossier].map(&:id)) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'for type_de_champ table' do
|
||||
|
@ -341,6 +376,14 @@ describe ProcedurePresentation do
|
|||
it { is_expected.to contain_exactly(kept_dossier.id) }
|
||||
end
|
||||
|
||||
context 'for en_construction_at column' do
|
||||
let!(:kept_dossier) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: DateTime.new(2018, 10, 17)) }
|
||||
let!(:discarded_dossier) { create(:dossier, :en_construction, procedure: procedure, en_construction_at: DateTime.new(2013, 1, 1)) }
|
||||
let(:filter) { [{ 'table' => 'self', 'column' => 'en_construction_at', 'value' => '17/10/2018' }] }
|
||||
|
||||
it { is_expected.to contain_exactly(kept_dossier.id) }
|
||||
end
|
||||
|
||||
context 'for updated_at column' do
|
||||
let(:kept_dossier) { create(:dossier, procedure: procedure) }
|
||||
let(:discarded_dossier) { create(:dossier, procedure: procedure) }
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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) }
|
||||
|
|
Loading…
Reference in a new issue