add 3rd view for expert - form to ask avis to another expert

This commit is contained in:
Lisa Durand 2023-03-16 10:46:10 +01:00
parent c51e6aa2e6
commit 79552b496b
6 changed files with 23 additions and 12 deletions

View file

@ -6,7 +6,7 @@ module Experts
before_action :authenticate_expert!, except: [:sign_up, :update_expert]
before_action :check_if_avis_revoked, except: [:index, :procedure]
before_action :redirect_if_no_sign_up_needed, only: [:sign_up, :update_expert]
before_action :set_avis_and_dossier, only: [:show, :instruction, :avis_list, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs]
before_action :set_avis_and_dossier, only: [:show, :instruction, :avis_list, :avis_new, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs]
A_DONNER_STATUS = 'a-donner'
DONNES_STATUS = 'donnes'
@ -59,6 +59,10 @@ module Experts
def avis_list
end
def avis_new
@new_avis = Avis.new
end
def create_avis
@procedure = Procedure.find(params[:procedure_id])
@new_avis = create_avis_from_params(avis.dossier, current_expert, avis.confidentiel)

View file

@ -18,5 +18,5 @@
%nav.tabs
%ul
= dynamic_tab_item('Demande', expert_avis_path(avis.procedure, avis))
= dynamic_tab_item('Avis', [instruction_expert_avis_path(avis.procedure, avis), avis_list_expert_avis_path(avis.procedure, avis)], notification: avis.answer.blank?)
= dynamic_tab_item('Avis', [instruction_expert_avis_path(avis.procedure, avis), avis_list_expert_avis_path(avis.procedure, avis), avis_new_expert_avis_path(avis.procedure, avis)], notification: avis.answer.blank?)
= dynamic_tab_item('Messagerie', messagerie_expert_avis_path(avis.procedure, avis))

View file

@ -7,11 +7,12 @@
%li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"}
%a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil, href: instruction_expert_avis_path(@avis.procedure, @avis), target: "_self"} Donner votre avis
- current_page = current_page?(avis_list_expert_avis_path(@avis.procedure, @avis))
- if @dossier.avis_for_expert(current_expert).present?
- current_page = current_page?(avis_list_expert_avis_path(@avis.procedure, @avis))
%li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"}
%a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: avis_list_expert_avis_path(@avis.procedure, @avis), target: "_self"} Voir les avis
-# - if !@dossier.termine?
-# %li.fr-sidemenu__item
-# %a.fr-sidemenu__link{href: "#", target: "_self"} Demander un nouvel avis
- if !@dossier.termine?
- current_page = current_page?(avis_new_expert_avis_path(@avis.procedure, @avis))
%li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"}
%a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: avis_new_expert_avis_path(@avis.procedure, @avis), target: "_self"} Demander un nouvel avis

View file

@ -0,0 +1,11 @@
- content_for(:title, "Avis · Dossier nº #{@dossier.id} (#{@dossier.owner_name})")
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
.container
.fr-grid-row
.fr-col.fr-col-12.fr-col-md-3
= render partial: 'sidemenu'
.fr-col
- if !@dossier.termine?
= render partial: "experts/avis/shared/form", locals: { url: avis_expert_avis_path(@avis.procedure, @avis), linked_dossiers: @dossier.linked_dossiers_for(current_expert), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis }

View file

@ -53,9 +53,3 @@
Cet avis est partagé avec les autres experts
.send-wrapper
= f.submit 'Envoyer votre avis', class: 'fr-btn'
-# - if !@dossier.termine?
-# = render partial: "experts/avis/shared/form", locals: { url: avis_expert_avis_path(@avis.procedure, @avis), linked_dossiers: @dossier.linked_dossiers_for(current_expert), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis }
-# - if @dossier.avis_for_expert(current_expert).present?
-# = render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil }

View file

@ -356,6 +356,7 @@ Rails.application.routes.draw do
member do
get 'instruction'
get 'avis_list'
get 'avis_new'
get 'messagerie'
post 'commentaire' => 'avis#create_commentaire'
post 'avis' => 'avis#create_avis'