list export templates for groupes instructeur of current instructeur
This commit is contained in:
parent
2c28d97f3f
commit
43c862ed4d
7 changed files with 20 additions and 14 deletions
|
@ -1,9 +1,9 @@
|
|||
class Dossiers::ExportDropdownComponent < ApplicationComponent
|
||||
include ApplicationHelper
|
||||
|
||||
def initialize(procedure:, statut: nil, count: nil, class_btn: nil, export_url: nil)
|
||||
def initialize(procedure:, export_templates: nil, statut: nil, count: nil, class_btn: nil, export_url: nil)
|
||||
@procedure = procedure
|
||||
@export_templates = procedure.export_templates
|
||||
@export_templates = export_templates
|
||||
@statut = statut
|
||||
@count = count
|
||||
@class_btn = class_btn
|
||||
|
|
|
@ -14,10 +14,12 @@
|
|||
- menu.with_item do
|
||||
= link_to download_export_path(export_format: format), role: 'menuitem', data: { turbo_method: :post, turbo: true } do
|
||||
= t(".everything_#{format}_html")
|
||||
- export_templates.each do |export_template|
|
||||
|
||||
- if export_templates.present?
|
||||
- export_templates.each do |export_template|
|
||||
- menu.with_item do
|
||||
= link_to download_export_path(export_template_id: export_template.id), role: 'menuitem', data: { turbo_method: :post, turbo: true } do
|
||||
= "Exporter à partir du modèle #{export_template.name}"
|
||||
- menu.with_item do
|
||||
= link_to download_export_path(export_template_id: export_template.id), role: 'menuitem', data: { turbo_method: :post, turbo: true } do
|
||||
= "Exporter à partir du modèle #{export_template.name}"
|
||||
- menu.with_item do
|
||||
= link_to new_instructeur_export_template_path(procedure_id: params[:procedure_id]), role: 'menuitem' do
|
||||
Ajouter un modèle d'export
|
||||
= link_to new_instructeur_export_template_path(procedure_id: params[:procedure_id]), role: 'menuitem' do
|
||||
Ajouter un modèle d'export
|
||||
|
|
|
@ -303,6 +303,10 @@ class Instructeur < ApplicationRecord
|
|||
agent_connect_information.order(updated_at: :desc).first
|
||||
end
|
||||
|
||||
def export_templates_for(procedure)
|
||||
procedure.export_templates.where(groupe_instructeur: groupe_instructeurs).order(:name)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def annotations_hash(demande, annotations_privees, avis, messagerie)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-# not renderable as administrateur flagged as manager, so render it anyway
|
||||
- if @can_download_dossiers
|
||||
= turbo_stream.update_all '.procedure-actions' do
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, export_templates: current_instructeur.export_templates, count: @dossiers_count, export_url: method(:admin_procedure_exports_path))
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, count: @dossiers_count, export_url: method(:admin_procedure_exports_path))
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
.procedure-actions
|
||||
- if @can_download_dossiers
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, export_url: method(:download_export_instructeur_procedure_path))
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, export_templates: current_instructeur.export_templates_for(@procedure), export_url: method(:download_export_instructeur_procedure_path))
|
||||
|
||||
.fr-container.flex= render partial: "tabs", locals: { procedure: @procedure,
|
||||
statut: @statut,
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
- if @can_download_dossiers
|
||||
- if @statut.nil?
|
||||
= turbo_stream.update_all '.procedure-actions' do
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, export_url: method(:download_export_instructeur_procedure_path))
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, export_templates: current_instructeur.export_templates_for(@procedure), export_url: method(:download_export_instructeur_procedure_path))
|
||||
- else
|
||||
= turbo_stream.update_all '.dossiers-export' do
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, statut: @statut, count: @dossiers_count, export_url: method(:download_export_instructeur_procedure_path))
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, export_templates: current_instructeur.export_templates_for(@procedure), statut: @statut, count: @dossiers_count, export_url: method(:download_export_instructeur_procedure_path))
|
||||
|
||||
= turbo_stream.update "last-export-alert" do
|
||||
= render partial: "last_export_alert", locals: { export: @last_export, statut: @statut }
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
.procedure-actions
|
||||
- if @can_download_dossiers
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, export_url: method(:download_export_instructeur_procedure_path))
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, export_templates: current_instructeur.export_templates_for(@procedure), export_url: method(:download_export_instructeur_procedure_path))
|
||||
|
||||
.fr-container.flex= render partial: "tabs", locals: { procedure: @procedure,
|
||||
statut: @statut,
|
||||
|
@ -72,7 +72,7 @@
|
|||
|
||||
- if @dossiers_count > 0
|
||||
%span.dossiers-export
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, statut: @statut, count: @dossiers_count, class_btn: 'fr-btn--tertiary', export_url: method(:download_export_instructeur_procedure_path))
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, export_templates: current_instructeur.export_templates_for(@procedure), statut: @statut, count: @dossiers_count, class_btn: 'fr-btn--tertiary', export_url: method(:download_export_instructeur_procedure_path))
|
||||
|
||||
- if @filtered_sorted_paginated_ids.present? || @current_filters.count > 0
|
||||
= render partial: "dossiers_filter_tags", locals: { procedure: @procedure, procedure_presentation: @procedure_presentation, current_filters: @current_filters, statut: @statut }
|
||||
|
|
Loading…
Reference in a new issue