extract procedure

This commit is contained in:
simon lehericey 2022-04-06 00:20:52 +02:00 committed by Paul Chavard
parent 9c73bf1932
commit b9ad3bbce1
2 changed files with 9 additions and 3 deletions

View file

@ -108,14 +108,19 @@ class PiecesJustificativesService
end
def self.generate_dossier_export(dossiers)
return [] if dossiers.empty?
pdfs = []
procedure = dossiers.first.procedure
dossiers.find_each do |dossier|
pdf = ApplicationController
.render(template: 'dossiers/show', formats: [:pdf],
assigns: {
include_infos_administration: true,
dossier: dossier
dossier: dossier,
procedure: procedure
})
a = FakeAttachment.new(

View file

@ -205,6 +205,7 @@ def add_etats_dossier(pdf, dossier)
end
prawn_document(page_size: "A4") do |pdf|
@procedure ||= @dossier.procedure
pdf.font_families.update( 'marianne' => {
normal: Rails.root.join('lib/prawn/fonts/marianne/marianne-regular.ttf' ),
bold: Rails.root.join('lib/prawn/fonts/marianne/marianne-bold.ttf' ),
@ -216,8 +217,8 @@ prawn_document(page_size: "A4") do |pdf|
end
format_in_2_columns(pdf, 'Dossier Nº', @dossier.id.to_s)
format_in_2_columns(pdf, 'Démarche', @dossier.procedure.libelle)
format_in_2_columns(pdf, 'Organisme', @dossier.procedure.organisation_name)
format_in_2_columns(pdf, 'Démarche', @procedure.libelle)
format_in_2_columns(pdf, 'Organisme', @procedure.organisation_name)
add_etat_dossier(pdf, @dossier)