Instructeur : add overview table with counts for files
- changement du design - tableau visible seulement si plus d'une procédure
This commit is contained in:
parent
a486fe9a2e
commit
0f542527fb
8 changed files with 74 additions and 61 deletions
|
@ -15,4 +15,10 @@
|
|||
background-color: $orange;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
&.procedure-synthese-badge {
|
||||
color: $white;
|
||||
background-color: #6C757D;
|
||||
margin-right: 3px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
@import "mixins";
|
||||
|
||||
.procedure-list {
|
||||
&.synthese {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.procedure-item {
|
||||
border-bottom: 1px solid $border-grey;
|
||||
|
||||
|
@ -55,7 +51,7 @@
|
|||
width: 90px;
|
||||
position: relative;
|
||||
|
||||
&:not(.procedure-synthese):hover {
|
||||
&:hover {
|
||||
background-color: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,15 +32,15 @@ module Instructeurs
|
|||
|
||||
@all_dossiers_counts = {}
|
||||
@all_dossiers_counts['à suivre'] = dossiers.without_followers.en_cours.count
|
||||
@all_dossiers_counts['suivi'] = current_instructeur
|
||||
@all_dossiers_counts['suivis'] = current_instructeur
|
||||
.followed_dossiers
|
||||
.joins(:groupe_instructeur)
|
||||
.en_cours
|
||||
.where(groupe_instructeur_id: groupe_ids)
|
||||
.count
|
||||
@all_dossiers_counts['traité'] = dossiers.termine.count
|
||||
@all_dossiers_counts['dossier'] = dossiers.all_state.count
|
||||
@all_dossiers_counts['archivé'] = dossiers.archived.count
|
||||
@all_dossiers_counts['traités'] = dossiers.termine.count
|
||||
@all_dossiers_counts['dossiers'] = dossiers.all_state.count
|
||||
@all_dossiers_counts['archivés'] = dossiers.archived.count
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
.tab-title
|
||||
Synthèse des dossiers
|
||||
.procedure-list.synthese
|
||||
%ul.procedure-stats.flex
|
||||
- if procedures.length > 1
|
||||
.tab-title
|
||||
%span
|
||||
Synthèse des dossiers
|
||||
- all_dossiers_counts.each_with_index do |(label, dossier_count)|
|
||||
%li.procedure-synthese
|
||||
%object
|
||||
.stats-number
|
||||
= number_with_html_delimiter(dossier_count)
|
||||
.stats-legend
|
||||
= label
|
||||
%span.badge.procedure-synthese-badge= number_with_html_delimiter(dossier_count) + ' ' + label
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
.container
|
||||
%h1.page-title Démarches
|
||||
= render partial: 'instructeurs/procedures/synthese', locals: { all_dossiers_counts: @all_dossiers_counts }
|
||||
= render partial: 'instructeurs/procedures/synthese', locals: { procedures: @procedures, all_dossiers_counts: @all_dossiers_counts }
|
||||
|
||||
= render partial: 'instructeurs/procedures/list', locals: { procedures: @procedures,
|
||||
dossiers_count_per_procedure: @dossiers_count_per_procedure,
|
||||
|
|
|
@ -136,10 +136,10 @@ describe Instructeurs::ProceduresController, type: :controller do
|
|||
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure.id]).to eq(nil) }
|
||||
|
||||
it { expect(assigns(:all_dossiers_counts)['à suivre']).to eq(0) }
|
||||
it { expect(assigns(:all_dossiers_counts)['suivi']).to eq(0) }
|
||||
it { expect(assigns(:all_dossiers_counts)['traité']).to eq(0) }
|
||||
it { expect(assigns(:all_dossiers_counts)['dossier']).to eq(0) }
|
||||
it { expect(assigns(:all_dossiers_counts)['archivé']).to eq(0) }
|
||||
it { expect(assigns(:all_dossiers_counts)['suivis']).to eq(0) }
|
||||
it { expect(assigns(:all_dossiers_counts)['traités']).to eq(0) }
|
||||
it { expect(assigns(:all_dossiers_counts)['dossiers']).to eq(0) }
|
||||
it { expect(assigns(:all_dossiers_counts)['archivés']).to eq(0) }
|
||||
end
|
||||
|
||||
context "with not draft state on multiple procedures" do
|
||||
|
@ -172,10 +172,10 @@ describe Instructeurs::ProceduresController, type: :controller do
|
|||
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure2.id]).to eq(1) }
|
||||
|
||||
it { expect(assigns(:all_dossiers_counts)['à suivre']).to eq(3 + 0) }
|
||||
it { expect(assigns(:all_dossiers_counts)['suivi']).to eq(0 + 1) }
|
||||
it { expect(assigns(:all_dossiers_counts)['traité']).to eq(0 + 1) }
|
||||
it { expect(assigns(:all_dossiers_counts)['dossier']).to eq(3 + 3) }
|
||||
it { expect(assigns(:all_dossiers_counts)['archivé']).to eq(1 + 0) }
|
||||
it { expect(assigns(:all_dossiers_counts)['suivis']).to eq(0 + 1) }
|
||||
it { expect(assigns(:all_dossiers_counts)['traités']).to eq(0 + 1) }
|
||||
it { expect(assigns(:all_dossiers_counts)['dossiers']).to eq(3 + 3) }
|
||||
it { expect(assigns(:all_dossiers_counts)['archivés']).to eq(1 + 0) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -212,10 +212,10 @@ describe Instructeurs::ProceduresController, type: :controller do
|
|||
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(14) }
|
||||
|
||||
it { expect(assigns(:all_dossiers_counts)['à suivre']).to eq(4) }
|
||||
it { expect(assigns(:all_dossiers_counts)['suivi']).to eq(6) }
|
||||
it { expect(assigns(:all_dossiers_counts)['traité']).to eq(10) }
|
||||
it { expect(assigns(:all_dossiers_counts)['dossier']).to eq(4 + 6 + 10) }
|
||||
it { expect(assigns(:all_dossiers_counts)['archivé']).to eq(14) }
|
||||
it { expect(assigns(:all_dossiers_counts)['suivis']).to eq(6) }
|
||||
it { expect(assigns(:all_dossiers_counts)['traités']).to eq(10) }
|
||||
it { expect(assigns(:all_dossiers_counts)['dossiers']).to eq(4 + 6 + 10) }
|
||||
it { expect(assigns(:all_dossiers_counts)['archivés']).to eq(14) }
|
||||
end
|
||||
|
||||
context 'when an instructeur only belongs to one of them gi' do
|
||||
|
@ -233,10 +233,10 @@ describe Instructeurs::ProceduresController, type: :controller do
|
|||
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(7) }
|
||||
|
||||
it { expect(assigns(:all_dossiers_counts)['à suivre']).to eq(2) }
|
||||
it { expect(assigns(:all_dossiers_counts)['suivi']).to eq(3) }
|
||||
it { expect(assigns(:all_dossiers_counts)['traité']).to eq(5) }
|
||||
it { expect(assigns(:all_dossiers_counts)['dossier']).to eq(2 + 3 + 5) }
|
||||
it { expect(assigns(:all_dossiers_counts)['archivé']).to eq(7) }
|
||||
it { expect(assigns(:all_dossiers_counts)['suivis']).to eq(3) }
|
||||
it { expect(assigns(:all_dossiers_counts)['traités']).to eq(5) }
|
||||
it { expect(assigns(:all_dossiers_counts)['dossiers']).to eq(2 + 3 + 5) }
|
||||
it { expect(assigns(:all_dossiers_counts)['archivés']).to eq(7) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -122,9 +122,7 @@ feature 'The routing', js: true do
|
|||
|
||||
## on the procedures list
|
||||
expect(page).to have_current_path(instructeur_procedures_path)
|
||||
within find('.procedure-details') do
|
||||
expect(find('.procedure-stats')).to have_css('span.notifications')
|
||||
end
|
||||
expect(find('.procedure-stats')).to have_css('span.notifications')
|
||||
|
||||
## on the dossiers list
|
||||
click_on procedure.libelle
|
||||
|
@ -144,9 +142,7 @@ feature 'The routing', js: true do
|
|||
sign_in_with marie.user.email, password
|
||||
|
||||
expect(page).to have_current_path(instructeur_procedures_path)
|
||||
within find('.procedure-details') do
|
||||
expect(find('.procedure-stats')).not_to have_css('span.notifications')
|
||||
end
|
||||
expect(find('.procedure-stats')).not_to have_css('span.notifications')
|
||||
log_out
|
||||
|
||||
# the instructeurs who belong to scientifique AND litteraire groups manage scientifique and litterraire dossiers
|
||||
|
@ -172,9 +168,7 @@ feature 'The routing', js: true do
|
|||
sign_in_with superwoman.user.email, password
|
||||
|
||||
expect(page).to have_current_path(instructeur_procedures_path)
|
||||
within find('.procedure-details') do
|
||||
expect(find('.procedure-stats')).to have_css('span.notifications')
|
||||
end
|
||||
expect(find('.procedure-stats')).to have_css('span.notifications')
|
||||
end
|
||||
|
||||
def publish_procedure(procedure)
|
||||
|
|
|
@ -3,23 +3,45 @@ describe 'instructeurs/procedures/_synthese.html.haml', type: :view do
|
|||
let(:procedure) { create(:procedure) }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure) }
|
||||
|
||||
subject {
|
||||
render 'instructeurs/procedures/synthese.html.haml',
|
||||
all_dossiers_counts: {
|
||||
'à suivre': 0,
|
||||
'suivi': 0,
|
||||
'traité': 1,
|
||||
'dossier': 1,
|
||||
'archivé': 0
|
||||
}
|
||||
}
|
||||
context 'when instructeur has 2 procedures and 1 file, table is shown' do
|
||||
let(:procedure2) { create(:procedure) }
|
||||
|
||||
subject {
|
||||
render 'instructeurs/procedures/synthese.html.haml',
|
||||
all_dossiers_counts: {
|
||||
'à suivre': 0,
|
||||
'suivis': 0,
|
||||
'traités': 1,
|
||||
'dossiers': 1,
|
||||
'archivés': 0
|
||||
},
|
||||
procedures: [procedure, procedure2]
|
||||
}
|
||||
|
||||
context 'when instructeur has 1 procedure and has 1 dossier' do
|
||||
it { is_expected.to have_text('Synthèse des dossiers') }
|
||||
it { is_expected.to have_css('.synthese') }
|
||||
it { is_expected.to have_text('suivi') }
|
||||
it { is_expected.to have_text('traité') }
|
||||
it { is_expected.to have_text('dossier') }
|
||||
it { is_expected.to have_text('archivé') }
|
||||
it { is_expected.to have_text('suivis') }
|
||||
it { is_expected.to have_text('traités') }
|
||||
it { is_expected.to have_text('dossiers') }
|
||||
it { is_expected.to have_text('archivés') }
|
||||
end
|
||||
|
||||
context 'when instructeur has 1 procedure and 1 file, table is not shown' do
|
||||
subject {
|
||||
render 'instructeurs/procedures/synthese.html.haml',
|
||||
all_dossiers_counts: {
|
||||
'à suivre': 0,
|
||||
'suivis': 0,
|
||||
'traités': 1,
|
||||
'dossiers': 1,
|
||||
'archivés': 0
|
||||
},
|
||||
procedures: [procedure]
|
||||
}
|
||||
|
||||
it { is_expected.not_to have_text('Synthèse des dossiers') }
|
||||
it { is_expected.not_to have_text('suivis') }
|
||||
it { is_expected.not_to have_text('traités') }
|
||||
it { is_expected.not_to have_text('dossiers') }
|
||||
it { is_expected.not_to have_text('archivés') }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue