Merge pull request #9471 from demarches-simplifiees/feat/9467
ETQ Instructeur, je souhaite avoir un autocomplete lorsque je demande l'avis aux experts
This commit is contained in:
commit
fdb30b9546
3 changed files with 10 additions and 2 deletions
|
@ -21,7 +21,7 @@ class ApplicationController < ActionController::Base
|
|||
around_action :switch_locale
|
||||
|
||||
helper_method :multiple_devise_profile_connect?, :instructeur_signed_in?, :current_instructeur, :current_expert, :expert_signed_in?,
|
||||
:administrateur_signed_in?, :current_administrateur, :current_account, :localization_enabled?, :set_locale
|
||||
:administrateur_signed_in?, :current_administrateur, :current_account, :localization_enabled?, :set_locale, :current_expert_not_instructeur?
|
||||
|
||||
before_action do
|
||||
Current.request_id = request.uuid
|
||||
|
@ -62,6 +62,10 @@ class ApplicationController < ActionController::Base
|
|||
current_user&.expert
|
||||
end
|
||||
|
||||
def current_expert_not_instructeur?
|
||||
current_user&.expert? && !current_user&.instructeur?
|
||||
end
|
||||
|
||||
def expert_signed_in?
|
||||
current_expert.present?
|
||||
end
|
||||
|
|
|
@ -73,6 +73,8 @@ module Instructeurs
|
|||
@avis = Avis.new
|
||||
if @dossier.procedure.experts_require_administrateur_invitation?
|
||||
@experts_emails = dossier.procedure.experts_procedures.where(revoked_at: nil).map(&:expert).map(&:email).sort
|
||||
else
|
||||
@experts_emails = @dossier.procedure.experts.map(&:email).sort
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -81,6 +83,8 @@ module Instructeurs
|
|||
@avis = Avis.new
|
||||
if @dossier.procedure.experts_require_administrateur_invitation?
|
||||
@experts_emails = dossier.procedure.experts_procedures.where(revoked_at: nil).map(&:expert).map(&:email).sort
|
||||
else
|
||||
@experts_emails = @dossier.procedure.experts.map(&:email).sort
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
= hidden_field_tag 'avis[emails]', nil
|
||||
.fr-input-group
|
||||
= react_component("ComboMultiple",
|
||||
options: @dossier.procedure.experts_require_administrateur_invitation ? @experts_emails : [],
|
||||
options: current_expert_not_instructeur? ? [] : @experts_emails,
|
||||
selected: [], disabled: [],
|
||||
label: 'Emails',
|
||||
group: '.ask-avis',
|
||||
|
|
Loading…
Reference in a new issue