Merge admin dashboard to new design for procedure details

This commit is contained in:
kara Diaby 2020-07-07 14:53:06 +02:00
parent a084fd199f
commit 7f3b38cfee
13 changed files with 214 additions and 9 deletions

View file

@ -11,6 +11,10 @@
background-color: rgba(0, 0, 0, 0.08); background-color: rgba(0, 0, 0, 0.08);
vertical-align: top; vertical-align: top;
&.baseline {
vertical-align: baseline;
}
&.warning { &.warning {
background-color: $orange; background-color: $orange;
color: #FFFFFF; color: #FFFFFF;

View file

@ -317,3 +317,14 @@
.link { .link {
color: $blue; color: $blue;
} }
.card-admin-action-btn {
width: 90px;
height: 36px;
border-radius: 30px;
border: solid 1px #BBBBBB;
background: #FFFFFF;
cursor: pointer;
padding-left: 10px;
padding-right: 10px;
}

View file

@ -62,3 +62,46 @@
margin-bottom: $default-spacer; margin-bottom: $default-spacer;
} }
} }
.card-admin-list {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(236px, 1fr));
grid-gap: 20px;
margin: auto;
margin-bottom: 20px;
}
.card-admin {
padding-top: 10px;
padding-bottom: 10px;
width: 236px;
height: 200px;
border-radius: 4px;
border: solid 1px $border-grey;
text-align: center;
margin: auto;
display: flex;
flex-direction: column;
.card-admin-status-accept {
color: #50AA75;
}
.card-admin-status-todo {
color: #246AC5;
}
.card-admin-title {
font-weight: bold;
font-size: 18px;
margin-bottom: $default-spacer;
}
.card-admin-subtitle {
font-size: 14px;
}
.card-admin-action {
margin-top: auto;
}
}

View file

@ -12,6 +12,10 @@ module NewAdministrateur
@procedure ||= Procedure.new(for_individual: true) @procedure ||= Procedure.new(for_individual: true)
end end
def show
@procedure = current_administrateur.procedures.find(params[:id])
end
def edit def edit
end end

View file

@ -1,7 +1,7 @@
= render partial: 'new_administrateur/breadcrumbs', = render partial: 'new_administrateur/breadcrumbs',
locals: { steps: [link_to('Démarches', admin_procedures_path), locals: { steps: [link_to('Démarches', admin_procedures_path),
link_to(@procedure.libelle, admin_procedure_path(@procedure)), link_to(@procedure.libelle, admin_procedure_path(@procedure)),
link_to('MonAvis', admin_procedures_path)] } 'MonAvis'] }
.container .container
%h1.page-title %h1.page-title

View file

@ -0,0 +1,136 @@
= render partial: 'new_administrateur/breadcrumbs',
locals: { steps: [link_to('Démarches', admin_procedures_path),
"#{@procedure.libelle} (crée le #{@procedure.created_at.strftime('%d/%m/%Y')})"] }
.container{ style: "text-align:right; margin-bottom: 20px" }
= button_to 'Publier la démarche', admin_procedure_publication_path(@procedure), method: :get, class: 'button primary',id: 'publish-procedure-link', disabled: @procedure.publiee? ? true : false
.container
%h2.explication-libelle{ style: "font-weight: bold; font-size: 20px; margin-bottom: 20px;" } Indispensable avant publication
.card-admin-list
.card-admin
%div
%span.icon.accept
%p.card-admin-status-accept Validé
%div
%p.card-admin-title Présentation
%p.card-admin-subtitle Logo, nom, description
.card-admin-action
= button_to 'Modifier', edit_admin_procedure_path(@procedure), method: :get, class: 'card-admin-action-btn', id: "presentation"
- if !@procedure.locked?
.card-admin
%div
%span.icon.clock
%p.card-admin-status-todo À faire
%div
%p.card-admin-title Formulaire
%p.card-admin-subtitle Champs à remplir par les usagers
.card-admin-action
= button_to 'Modifier', champs_admin_procedure_path(@procedure), method: :get, class: 'card-admin-action-btn'
.card-admin
- if @procedure.service_id.present?
%div
%span.icon.accept
%p.card-admin-status-accept Validé
- else
%div
%span.icon.clock
%p.card-admin-status-todo À faire
%div
%p.card-admin-title Service
%p.card-admin-subtitle Choix du service de la démarche
.card-admin-action
= button_to 'Modifier', new_admin_service_path, params: { procedure_id: @procedure.id }, method: :get, class: 'card-admin-action-btn'
.card-admin
%div
%span.icon.accept
%p.card-admin-status-accept Validé
%div
%p.card-admin-title
Administrateurs
%span.badge.baseline
= @procedure.administrateurs.count
%p.card-admin-subtitle Gestion de la démarche
.card-admin-action
= button_to 'Modifier', admin_procedure_administrateurs_path(@procedure), method: :get, class: 'card-admin-action-btn', id: "administrateurs"
.card-admin
- if @procedure.instructeurs.count > 1
%div
%span.icon.accept
%p.card-admin-status-accept Validé
- else
%div
%span.icon.clock
%p.card-admin-status-todo À faire
%div
%p.card-admin-title
= feature_enabled?(:administrateur_routage) ? "Groupe Instructeurs" : "Instructeurs"
%span.badge.baseline
= @procedure.instructeurs.count
%p.card-admin-subtitle Suivi des dossiers
.card-admin-action
- if feature_enabled?(:administrateur_routage)
= button_to 'Modifier', admin_procedure_groupe_instructeurs_path(@procedure), method: :get, class: 'card-admin-action-btn', id: "groupe-instructeurs"
- else
= button_to 'Modifier', admin_procedure_groupe_instructeur_path(@procedure, @procedure.defaut_groupe_instructeur), method: :get, class: 'card-admin-action-btn', id: "instructeurs"
%h2.explication-libelle{ style: "font-weight: bold; font-size: 20px; margin-bottom: 20px;" } Pour aller plus loin
.card-admin-list
.card-admin
- if @procedure.attestation_template.present?
%div
%span.icon.accept
%p.card-admin-status-accept Activée
- else
%div
%span.icon.clock
%p.card-admin-status-todo À activer
%div
%p.card-admin-title Attestation
%p.card-admin-subtitle Délivrance automatique pour les dossiers acceptés
.card-admin-action
= button_to 'Modifier', edit_admin_procedure_attestation_template_path(@procedure), method: :get, class: 'card-admin-action-btn'
.card-admin
%div
%span.icon.clock
%p.card-admin-status-todo À configurer
%div
%p.card-admin-title Configuration des emails
%p.card-admin-subtitle Notifications automatiques
.card-admin-action
= button_to 'Modifier', admin_procedure_mail_templates_path(@procedure), method: :get, class: 'card-admin-action-btn'
.card-admin
- if @procedure.api_entreprise_token.present?
%div
%span.icon.accept
%p.card-admin-status-accept Validé
- else
%div
%span.icon.clock
%p.card-admin-status-todo À configurer
%div
%p.card-admin-title Jeton
%p.card-admin-subtitle Configurer le jeton API entreprise
.card-admin-action
= button_to 'Modifier', jeton_admin_procedure_path(@procedure), method: :get, class: 'card-admin-action-btn'
.card-admin
- if @procedure.monavis_embed.present?
%div
%span.icon.accept
%p.card-admin-status-accept Validé
- else
%div
%span.icon.clock
%p.card-admin-status-todo À configurer
%div
%p.card-admin-title MonAvis
%p.card-admin-subtitle Avis des usagers sur votre démarche
.card-admin-action
= button_to 'Modifier', monavis_admin_procedure_path(@procedure), method: :get, class: 'card-admin-action-btn'

View file

@ -176,8 +176,9 @@ Rails.application.routes.draw do
patch 'activate' => '/administrateurs/activate#create' patch 'activate' => '/administrateurs/activate#create'
get 'procedures/archived' => 'procedures#archived' get 'procedures/archived' => 'procedures#archived'
get 'procedures/draft' => 'procedures#draft' get 'procedures/draft' => 'procedures#draft'
get 'procedures/:id/publication' => 'procedures#show', as: :procedure_publication
resources :procedures, only: [:index, :show, :destroy] do resources :procedures, only: [:index, :destroy] do
collection do collection do
get 'new_from_existing' => 'procedures#new_from_existing', as: :new_from_existing get 'new_from_existing' => 'procedures#new_from_existing', as: :new_from_existing
end end
@ -370,7 +371,7 @@ Rails.application.routes.draw do
# #
namespace :admin, module: 'new_administrateur' do namespace :admin, module: 'new_administrateur' do
resources :procedures, except: [:index, :show, :destroy] do resources :procedures, except: [:index, :destroy] do
member do member do
get 'apercu' get 'apercu'
get 'champs' get 'champs'

View file

@ -24,6 +24,7 @@ feature 'As an administrateur I wanna clone a procedure', js: true do
click_on Procedure.last.libelle click_on Procedure.last.libelle
expect(page).to have_current_path(admin_procedure_path(Procedure.last)) expect(page).to have_current_path(admin_procedure_path(Procedure.last))
find('#publish-procedure-link').click
find('#publish-procedure').click find('#publish-procedure').click
within '#publish-modal' do within '#publish-modal' do

View file

@ -77,6 +77,7 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
expect(page).to have_selector('#champ-1-libelle') expect(page).to have_selector('#champ-1-libelle')
click_on Procedure.last.libelle click_on Procedure.last.libelle
find('#publish-procedure-link').click
preview_window = window_opened_by { click_on 'onglet-preview' } preview_window = window_opened_by { click_on 'onglet-preview' }
within_window(preview_window) do within_window(preview_window) do
@ -95,7 +96,7 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
click_on Procedure.last.libelle click_on Procedure.last.libelle
expect(page).to have_current_path(admin_procedure_path(Procedure.last)) expect(page).to have_current_path(admin_procedure_path(Procedure.last))
find('#publish-procedure-link').click
expect(page).to have_content('en test') expect(page).to have_content('en test')
# Only check the path even though the link is the complete URL # Only check the path even though the link is the complete URL
# (Capybara runs the app on an arbitrary host/port.) # (Capybara runs the app on an arbitrary host/port.)

View file

@ -3,7 +3,7 @@ feature 'procedure locked' do
before do before do
login_as administrateur.user, scope: :user login_as administrateur.user, scope: :user
visit admin_procedure_path(procedure) visit admin_procedure_publication_path(procedure)
end end
context 'when procedure is not published' do context 'when procedure is not published' do

View file

@ -22,6 +22,7 @@ feature 'Publication de démarches', js: true do
scenario 'un administrateur peut la publier' do scenario 'un administrateur peut la publier' do
visit admin_procedures_draft_path visit admin_procedures_draft_path
click_on procedure.libelle click_on procedure.libelle
find('#publish-procedure-link').click
within "#procedure_show" do within "#procedure_show" do
click_on "Publier" click_on "Publier"
end end
@ -51,6 +52,7 @@ feature 'Publication de démarches', js: true do
scenario 'un administrateur peut la publier' do scenario 'un administrateur peut la publier' do
visit admin_procedures_archived_path visit admin_procedures_archived_path
click_on procedure.libelle click_on procedure.libelle
find('#publish-procedure-link').click
within "#procedure_show" do within "#procedure_show" do
click_on "Réactiver" click_on "Réactiver"
end end
@ -80,6 +82,7 @@ feature 'Publication de démarches', js: true do
scenario 'un administrateur peut la publier' do scenario 'un administrateur peut la publier' do
visit admin_procedures_archived_path visit admin_procedures_archived_path
click_on procedure.libelle click_on procedure.libelle
find('#publish-procedure-link').click
within "#procedure_show" do within "#procedure_show" do
click_on "Réactiver" click_on "Réactiver"
end end

View file

@ -27,7 +27,7 @@ feature 'Administrateurs can edit procedures', js: true do
scenario 'the administrator can edit the libelle' do scenario 'the administrator can edit the libelle' do
visit admin_procedures_draft_path visit admin_procedures_draft_path
click_on procedure.libelle click_on procedure.libelle
click_on 'Description' find('#presentation').click
expect(page).to have_field('procedure_libelle', with: procedure.libelle) expect(page).to have_field('procedure_libelle', with: procedure.libelle)
@ -46,7 +46,7 @@ feature 'Administrateurs can edit procedures', js: true do
scenario 'the administrator can edit the libellé, but cant change the path' do scenario 'the administrator can edit the libellé, but cant change the path' do
visit root_path visit root_path
click_on procedure.libelle click_on procedure.libelle
click_on 'Description' find('#presentation').click
expect(page).to have_field('procedure_libelle', with: procedure.libelle) expect(page).to have_field('procedure_libelle', with: procedure.libelle)
expect(page).not_to have_field('procedure_path') expect(page).not_to have_field('procedure_path')
@ -62,7 +62,7 @@ feature 'Administrateurs can edit procedures', js: true do
scenario 'the administrator can add another administrator' do scenario 'the administrator can add another administrator' do
another_administrateur = create(:administrateur) another_administrateur = create(:administrateur)
visit admin_procedure_path(procedure) visit admin_procedure_path(procedure)
click_on 'Administrateurs' find('#administrateurs').click
fill_in('administrateur_email', with: another_administrateur.email) fill_in('administrateur_email', with: another_administrateur.email)

View file

@ -14,7 +14,7 @@ feature 'The routing', js: true do
login_as administrateur.user, scope: :user login_as administrateur.user, scope: :user
visit admin_procedure_path(procedure.id) visit admin_procedure_path(procedure.id)
click_on "Groupe d'instructeurs" find('#groupe-instructeurs').click
# rename routing criteria to spécialité # rename routing criteria to spécialité
fill_in 'Libellé du routage', with: 'spécialité' fill_in 'Libellé du routage', with: 'spécialité'
@ -173,6 +173,7 @@ feature 'The routing', js: true do
def publish_procedure(procedure) def publish_procedure(procedure)
click_on procedure.libelle click_on procedure.libelle
find('#publish-procedure-link').click
find('#publish-procedure').click find('#publish-procedure').click
within '#publish-modal' do within '#publish-modal' do
fill_in 'lien_site_web', with: 'http://some.website' fill_in 'lien_site_web', with: 'http://some.website'