commit
bc48d7043f
20 changed files with 276 additions and 282 deletions
134
Gemfile.lock
134
Gemfile.lock
|
@ -23,40 +23,40 @@ GEM
|
|||
specs:
|
||||
aasm (5.1.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
actioncable (6.1.3)
|
||||
actionpack (= 6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
actioncable (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.1.3)
|
||||
actionpack (= 6.1.3)
|
||||
activejob (= 6.1.3)
|
||||
activerecord (= 6.1.3)
|
||||
activestorage (= 6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
actionmailbox (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
activejob (= 6.1.3.1)
|
||||
activerecord (= 6.1.3.1)
|
||||
activestorage (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.1.3)
|
||||
actionpack (= 6.1.3)
|
||||
actionview (= 6.1.3)
|
||||
activejob (= 6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
actionmailer (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
actionview (= 6.1.3.1)
|
||||
activejob (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.1.3)
|
||||
actionview (= 6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
actionpack (6.1.3.1)
|
||||
actionview (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
rack (~> 2.0, >= 2.0.9)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.1.3)
|
||||
actionpack (= 6.1.3)
|
||||
activerecord (= 6.1.3)
|
||||
activestorage (= 6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
actiontext (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
activerecord (= 6.1.3.1)
|
||||
activestorage (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
actionview (6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
|
@ -71,26 +71,26 @@ GEM
|
|||
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
||||
active_storage_validations (0.9.2)
|
||||
rails (>= 5.2.0)
|
||||
activejob (6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
activejob (6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
activerecord (6.1.3)
|
||||
activemodel (= 6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
activestorage (6.1.3)
|
||||
actionpack (= 6.1.3)
|
||||
activejob (= 6.1.3)
|
||||
activerecord (= 6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
marcel (~> 0.3.1)
|
||||
mimemagic (~> 0.3.2)
|
||||
activemodel (6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
activerecord (6.1.3.1)
|
||||
activemodel (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
activestorage (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
activejob (= 6.1.3.1)
|
||||
activerecord (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
marcel (~> 1.0.0)
|
||||
mini_mime (~> 1.0.2)
|
||||
activestorage-openstack (1.5.1)
|
||||
fog-openstack (~> 1.0)
|
||||
marcel
|
||||
rails (>= 5.2.2)
|
||||
activesupport (6.1.3)
|
||||
activesupport (6.1.3.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
|
@ -163,9 +163,9 @@ GEM
|
|||
selenium-webdriver
|
||||
case_transform (0.2)
|
||||
activesupport
|
||||
caxlsx (3.0.4)
|
||||
caxlsx (3.1.0)
|
||||
htmlentities (~> 4.3, >= 4.3.4)
|
||||
mimemagic (~> 0.3)
|
||||
marcel (~> 1.0)
|
||||
nokogiri (~> 1.10, >= 1.10.4)
|
||||
rubyzip (>= 1.3.0, < 3)
|
||||
chartkick (3.4.2)
|
||||
|
@ -340,7 +340,7 @@ GEM
|
|||
domain_name (~> 0.5)
|
||||
http_accept_language (2.1.1)
|
||||
httpclient (2.8.3)
|
||||
i18n (1.8.9)
|
||||
i18n (1.8.10)
|
||||
concurrent-ruby (~> 1.0)
|
||||
i18n-tasks (0.9.33)
|
||||
activesupport (>= 4.0.2)
|
||||
|
@ -412,17 +412,13 @@ GEM
|
|||
activesupport (>= 3.1.0)
|
||||
rack (>= 1.4.0)
|
||||
rest-client (>= 2.0.0)
|
||||
marcel (0.3.3)
|
||||
mimemagic (~> 0.3.2)
|
||||
marcel (1.0.0)
|
||||
method_source (1.0.0)
|
||||
mime-types (3.3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2021.0212)
|
||||
mimemagic (0.3.10)
|
||||
nokogiri (~> 1)
|
||||
rake
|
||||
mini_magick (4.11.0)
|
||||
mini_mime (1.0.2)
|
||||
mini_mime (1.0.3)
|
||||
mini_portile2 (2.5.0)
|
||||
minitest (5.14.4)
|
||||
momentjs-rails (2.20.1)
|
||||
|
@ -433,8 +429,8 @@ GEM
|
|||
mustermann (1.1.1)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
netrc (0.11.0)
|
||||
nio4r (2.5.5)
|
||||
nokogiri (1.11.1)
|
||||
nio4r (2.5.7)
|
||||
nokogiri (1.11.2)
|
||||
mini_portile2 (~> 2.5.0)
|
||||
racc (~> 1.4)
|
||||
open4 (1.3.4)
|
||||
|
@ -505,20 +501,20 @@ GEM
|
|||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (6.1.3)
|
||||
actioncable (= 6.1.3)
|
||||
actionmailbox (= 6.1.3)
|
||||
actionmailer (= 6.1.3)
|
||||
actionpack (= 6.1.3)
|
||||
actiontext (= 6.1.3)
|
||||
actionview (= 6.1.3)
|
||||
activejob (= 6.1.3)
|
||||
activemodel (= 6.1.3)
|
||||
activerecord (= 6.1.3)
|
||||
activestorage (= 6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
rails (6.1.3.1)
|
||||
actioncable (= 6.1.3.1)
|
||||
actionmailbox (= 6.1.3.1)
|
||||
actionmailer (= 6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
actiontext (= 6.1.3.1)
|
||||
actionview (= 6.1.3.1)
|
||||
activejob (= 6.1.3.1)
|
||||
activemodel (= 6.1.3.1)
|
||||
activerecord (= 6.1.3.1)
|
||||
activestorage (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 6.1.3)
|
||||
railties (= 6.1.3.1)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
|
@ -537,9 +533,9 @@ GEM
|
|||
rails-i18n (6.0.0)
|
||||
i18n (>= 0.7, < 2)
|
||||
railties (>= 6.0.0, < 7)
|
||||
railties (6.1.3)
|
||||
actionpack (= 6.1.3)
|
||||
activesupport (= 6.1.3)
|
||||
railties (6.1.3.1)
|
||||
actionpack (= 6.1.3.1)
|
||||
activesupport (= 6.1.3.1)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (~> 1.0)
|
||||
|
@ -683,10 +679,8 @@ GEM
|
|||
rack (~> 2.2)
|
||||
rack-protection (= 2.1.0)
|
||||
tilt (~> 2.0)
|
||||
skylight (4.3.2)
|
||||
skylight-core (= 4.3.2)
|
||||
skylight-core (4.3.2)
|
||||
activesupport (>= 4.2.0)
|
||||
skylight (5.0.1)
|
||||
activesupport (>= 5.2.0)
|
||||
smart_listing (1.2.3)
|
||||
coffee-rails
|
||||
jquery-rails
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
$default-space: 15px;
|
||||
$new-p-margin-bottom: 3 * $default-space;
|
||||
|
||||
.accessibilite {
|
||||
width: 1040px;
|
||||
margin: 0 auto;
|
||||
padding-top: $default-space * 2;
|
||||
padding-bottom: $default-space * 2;
|
||||
|
||||
ul {
|
||||
list-style-type: disc;
|
||||
margin-top: -($default-space * 2);
|
||||
}
|
||||
}
|
||||
|
||||
.new-p {
|
||||
margin-bottom: $new-p-margin-bottom;
|
||||
}
|
||||
|
||||
// A class to make elements only accessible to screen-readers
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
opacity: 0;
|
||||
padding: 0;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap;
|
||||
border: none;
|
||||
}
|
|
@ -76,9 +76,6 @@ class RootController < ApplicationController
|
|||
@dossier = Dossier.new(champs: all_champs)
|
||||
end
|
||||
|
||||
def accessibilite
|
||||
end
|
||||
|
||||
def suivi
|
||||
end
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# dossier_id :integer
|
||||
# entreprise_id :integer
|
||||
#
|
||||
class Etablissement < ApplicationRecord
|
||||
self.ignored_columns = [:entreprise_id]
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#
|
||||
# id :bigint not null, primary key
|
||||
# format :string not null
|
||||
# key :text
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
|
@ -20,9 +21,9 @@ class Export < ApplicationRecord
|
|||
|
||||
has_one_attached :file
|
||||
|
||||
validates :format, :groupe_instructeurs, presence: true
|
||||
validates :format, :groupe_instructeurs, :key, presence: true
|
||||
|
||||
scope :stale, -> { where('updated_at < ?', (Time.zone.now - MAX_DUREE_CONSERVATION_EXPORT)) }
|
||||
scope :stale, -> { where('exports.updated_at < ?', (Time.zone.now - MAX_DUREE_CONSERVATION_EXPORT)) }
|
||||
|
||||
after_create_commit :compute_async
|
||||
|
||||
|
@ -45,35 +46,22 @@ class Export < ApplicationRecord
|
|||
end
|
||||
|
||||
def self.find_or_create_export(format, groupe_instructeurs)
|
||||
export = Export.find_for_format_and_groupe_instructeurs(format, groupe_instructeurs)
|
||||
|
||||
if export.nil?
|
||||
export = Export.create(
|
||||
format: format,
|
||||
groupe_instructeurs: groupe_instructeurs
|
||||
)
|
||||
end
|
||||
|
||||
export
|
||||
create_with(groupe_instructeurs: groupe_instructeurs)
|
||||
.create_or_find_by(format: format, key: generate_cache_key(groupe_instructeurs))
|
||||
end
|
||||
|
||||
def self.find_for_format_and_groupe_instructeurs(format, groupe_instructeurs)
|
||||
export_including_gis = Export
|
||||
.joins(:exports_groupe_instructeurs)
|
||||
.where(
|
||||
format: format,
|
||||
exports_groupe_instructeurs: { groupe_instructeur: groupe_instructeurs }
|
||||
)
|
||||
find_by(format: format, key: generate_cache_key(groupe_instructeurs))
|
||||
end
|
||||
|
||||
export_including_gis.find do |export|
|
||||
export.groupe_instructeurs.pluck(:id).sort == groupe_instructeurs.map(&:id).sort
|
||||
end
|
||||
def self.generate_cache_key(groupe_instructeurs)
|
||||
groupe_instructeurs.map(&:id).sort.join('-')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def filename
|
||||
procedure_identifier = procedure.path || "procedure-#{id}"
|
||||
procedure_identifier = procedure.path || "procedure-#{procedure.id}"
|
||||
"dossiers_#{procedure_identifier}_#{Time.zone.now.strftime('%Y-%m-%d_%H-%M')}.#{format}"
|
||||
end
|
||||
|
||||
|
|
|
@ -1,114 +1,157 @@
|
|||
require 'prawn/measurement_extensions'
|
||||
|
||||
def format_in_2_lines(pdf, label, text)
|
||||
pdf.font 'marianne', style: :bold, size: 10 do
|
||||
pdf.text label
|
||||
end
|
||||
pdf.text text, size: 9
|
||||
pdf.text "\n", size: 9
|
||||
def default_margin
|
||||
10
|
||||
end
|
||||
|
||||
def render_box(pdf, text, x, width)
|
||||
box = ::Prawn::Text::Box.new(text.to_s, { document: pdf, width: width, overflow: :expand, at: [x, pdf.cursor] })
|
||||
def maybe_start_new_page(pdf, size)
|
||||
if pdf.cursor < size + default_margin
|
||||
pdf.start_new_page
|
||||
end
|
||||
end
|
||||
|
||||
def text_box(pdf, text, x, width)
|
||||
box = ::Prawn::Text::Box.new(text.to_s,
|
||||
document: pdf,
|
||||
width: width,
|
||||
overflow: :expand,
|
||||
at: [x, pdf.cursor])
|
||||
|
||||
box.render
|
||||
box.height
|
||||
end
|
||||
|
||||
def format_in_2_lines(pdf, label, text)
|
||||
min_height = [
|
||||
label.present? ? pdf.height_of_formatted([{ text: label, style: :bold, size: 12 }]) : nil,
|
||||
text.present? ? pdf.height_of_formatted([{ text: text }]) : nil
|
||||
].compact.sum
|
||||
maybe_start_new_page(pdf, min_height)
|
||||
|
||||
pdf.pad_bottom(2) do
|
||||
pdf.font 'marianne', style: :bold, size: 12 do
|
||||
pdf.text label
|
||||
end
|
||||
end
|
||||
pdf.pad_bottom(default_margin) do
|
||||
pdf.text text
|
||||
end
|
||||
end
|
||||
|
||||
def format_in_2_columns(pdf, label, text)
|
||||
h1 = render_box(pdf, label, 0, 100)
|
||||
h2 = render_box(pdf, ':', 100, 10)
|
||||
h3 = render_box(pdf, text, 110, pdf.bounds.width - 110)
|
||||
pdf.move_down 5 + [h1,h2,h3].max
|
||||
min_height = [
|
||||
label.present? ? pdf.height_of_formatted([{ text: label }]) : nil,
|
||||
text.present? ? pdf.height_of_formatted([{ text: text }]) : nil
|
||||
].compact.max
|
||||
maybe_start_new_page(pdf, min_height)
|
||||
|
||||
pdf.pad_bottom(default_margin) do
|
||||
height = [
|
||||
text_box(pdf, label, 0, 150),
|
||||
text_box(pdf, ':', 150, 10),
|
||||
text_box(pdf, text, 160, pdf.bounds.width - 160)
|
||||
].max
|
||||
pdf.move_down height
|
||||
end
|
||||
end
|
||||
|
||||
def add_title(pdf, title)
|
||||
title_style = {style: :bold, size: 20}
|
||||
pdf.font 'marianne', title_style do
|
||||
pdf.text title
|
||||
end
|
||||
pdf.text "\n"
|
||||
end
|
||||
maybe_start_new_page(pdf, 100)
|
||||
|
||||
def format_date(date)
|
||||
I18n.l(date, format: :message_date_with_year)
|
||||
end
|
||||
|
||||
def add_identite_individual(pdf, dossier)
|
||||
format_in_2_columns(pdf, "Civilité", dossier.individual.gender)
|
||||
format_in_2_columns(pdf, "Nom", dossier.individual.nom)
|
||||
format_in_2_columns(pdf, "Prénom", dossier.individual.prenom)
|
||||
|
||||
if dossier.individual.birthdate.present?
|
||||
format_in_2_columns(pdf, "Date de naissance", try_format_date(dossier.individual.birthdate))
|
||||
pdf.pad(default_margin) do
|
||||
pdf.font 'marianne', style: :bold, size: 20 do
|
||||
pdf.text title
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def render_siret_info(pdf, etablissement)
|
||||
pdf.text " - Dénomination : #{raison_sociale_or_name(etablissement)}"
|
||||
pdf.text " - Forme juridique : #{etablissement.entreprise_forme_juridique}"
|
||||
if etablissement.entreprise_capital_social.present?
|
||||
pdf.text " - Capital social : #{pretty_currency(etablissement.entreprise_capital_social)}"
|
||||
end
|
||||
pdf.text "\n"
|
||||
end
|
||||
def add_section_title(pdf, title)
|
||||
maybe_start_new_page(pdf, 100)
|
||||
|
||||
def render_identite_etablissement(pdf, etablissement)
|
||||
format_in_2_columns(pdf, "SIRET", etablissement.siret)
|
||||
format_in_2_columns(pdf, "SIRET du siège social", etablissement.entreprise.siret_siege_social) if etablissement.entreprise.siret_siege_social.present?
|
||||
format_in_2_columns(pdf, "Dénomination", raison_sociale_or_name(etablissement))
|
||||
format_in_2_columns(pdf, "Forme juridique ", etablissement.entreprise_forme_juridique)
|
||||
if etablissement.entreprise_capital_social.present?
|
||||
format_in_2_columns(pdf, "Capital social ", pretty_currency(etablissement.entreprise_capital_social))
|
||||
end
|
||||
format_in_2_columns(pdf, "Libellé NAF ", etablissement.libelle_naf)
|
||||
format_in_2_columns(pdf, "Code NAF ", etablissement.naf)
|
||||
format_in_2_columns(pdf, "Date de création ", try_format_date(etablissement.entreprise.date_creation))
|
||||
if @include_infos_administration
|
||||
format_in_2_columns(pdf, "Effectif mensuel #{try_format_mois_effectif(etablissement)} (URSSAF) ", etablissement.entreprise_effectif_mensuel)
|
||||
format_in_2_columns(pdf, "Effectif moyen annuel #{etablissement.entreprise_effectif_annuel_annee} (URSSAF) ", etablissement.entreprise_effectif_annuel)
|
||||
end
|
||||
format_in_2_columns(pdf, "Effectif (ISPF) ", effectif(etablissement))
|
||||
format_in_2_columns(pdf, "Code effectif ", etablissement.entreprise.code_effectif_entreprise)
|
||||
format_in_2_columns(pdf, "Numéro de TVA intracommunautaire ", etablissement.entreprise.numero_tva_intracommunautaire) if etablissement.entreprise.numero_tva_intracommunautaire.present?
|
||||
format_in_2_columns(pdf, "Adresse ", etablissement.adresse)
|
||||
if etablissement.association?
|
||||
format_in_2_columns(pdf, "Numéro RNA ", etablissement.association_rna)
|
||||
format_in_2_columns(pdf, "Titre ", etablissement.association_titre)
|
||||
format_in_2_columns(pdf, "Objet ", etablissement.association_objet)
|
||||
format_in_2_columns(pdf, "Date de création ", try_format_date(etablissement.association_date_creation))
|
||||
format_in_2_columns(pdf, "Date de publication ", try_format_date(etablissement.association_date_publication))
|
||||
format_in_2_columns(pdf, "Date de déclaration ", try_format_date(etablissement.association_date_declaration))
|
||||
pdf.pad_bottom(default_margin) do
|
||||
pdf.font 'marianne', style: :bold, size: 14 do
|
||||
pdf.text title
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def render_single_champ(pdf, champ)
|
||||
def add_identite_individual(pdf, individual)
|
||||
pdf.pad_bottom(default_margin) do
|
||||
format_in_2_columns(pdf, "Civilité", individual.gender)
|
||||
format_in_2_columns(pdf, "Nom", individual.nom)
|
||||
format_in_2_columns(pdf, "Prénom", individual.prenom)
|
||||
|
||||
if individual.birthdate.present?
|
||||
format_in_2_columns(pdf, "Date de naissance", try_format_date(individual.birthdate))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def add_identite_etablissement(pdf, etablissement)
|
||||
pdf.pad_bottom(default_margin) do
|
||||
format_in_2_columns(pdf, "SIRET", etablissement.siret)
|
||||
format_in_2_columns(pdf, "SIRET du siège social", etablissement.entreprise.siret_siege_social) if etablissement.entreprise.siret_siege_social.present?
|
||||
format_in_2_columns(pdf, "Dénomination", raison_sociale_or_name(etablissement))
|
||||
format_in_2_columns(pdf, "Forme juridique ", etablissement.entreprise_forme_juridique)
|
||||
|
||||
if etablissement.entreprise_capital_social.present?
|
||||
format_in_2_columns(pdf, "Capital social ", pretty_currency(etablissement.entreprise_capital_social))
|
||||
end
|
||||
|
||||
format_in_2_columns(pdf, "Libellé NAF ", etablissement.libelle_naf)
|
||||
format_in_2_columns(pdf, "Code NAF ", etablissement.naf)
|
||||
format_in_2_columns(pdf, "Date de création ", try_format_date(etablissement.entreprise.date_creation))
|
||||
|
||||
if @include_infos_administration
|
||||
if etablissement.entreprise_effectif_mensuel.present?
|
||||
format_in_2_columns(pdf, "Effectif mensuel #{try_format_mois_effectif(etablissement)} (URSSAF) ", number_with_delimiter(etablissement.entreprise_effectif_mensuel.to_s))
|
||||
end
|
||||
if etablissement.entreprise_effectif_annuel_annee.present?
|
||||
format_in_2_columns(pdf, "Effectif moyen annuel #{etablissement.entreprise_effectif_annuel_annee} (URSSAF) ", number_with_delimiter(etablissement.entreprise_effectif_annuel.to_s))
|
||||
end
|
||||
end
|
||||
|
||||
format_in_2_columns(pdf, "Effectif (ISPF) ", effectif(etablissement))
|
||||
format_in_2_columns(pdf, "Code effectif ", etablissement.entreprise.code_effectif_entreprise)
|
||||
if etablissement.entreprise.numero_tva_intracommunautaire.present?
|
||||
format_in_2_columns(pdf, "Numéro de TVA intracommunautaire ", etablissement.entreprise.numero_tva_intracommunautaire)
|
||||
end
|
||||
format_in_2_columns(pdf, "Adresse ", etablissement.adresse)
|
||||
|
||||
if etablissement.association?
|
||||
format_in_2_columns(pdf, "Numéro RNA ", etablissement.association_rna)
|
||||
format_in_2_columns(pdf, "Titre ", etablissement.association_titre)
|
||||
format_in_2_columns(pdf, "Objet ", etablissement.association_objet)
|
||||
format_in_2_columns(pdf, "Date de création ", try_format_date(etablissement.association_date_creation))
|
||||
format_in_2_columns(pdf, "Date de publication ", try_format_date(etablissement.association_date_publication))
|
||||
format_in_2_columns(pdf, "Date de déclaration ", try_format_date(etablissement.association_date_declaration))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def add_single_champ(pdf, champ)
|
||||
case champ.type
|
||||
when 'Champs::RepetitionChamp'
|
||||
raise 'There should not be a RepetitionChamp here !'
|
||||
when 'Champs::PieceJustificativeChamp'
|
||||
when 'Champs::PieceJustificativeChamp', 'Champs::TitreIdentiteChamp'
|
||||
return
|
||||
when 'Champs::HeaderSectionChamp'
|
||||
pdf.font 'marianne', style: :bold, size: 14 do
|
||||
pdf.text champ.libelle
|
||||
end
|
||||
pdf.text "\n"
|
||||
add_section_title(pdf, champ.libelle)
|
||||
when 'Champs::ExplicationChamp'
|
||||
format_in_2_columns(pdf, champ.libelle, champ.description)
|
||||
format_in_2_lines(pdf, champ.libelle, champ.description)
|
||||
when 'Champs::CarteChamp'
|
||||
format_in_2_columns(pdf, champ.libelle, champ.to_feature_collection.to_json)
|
||||
format_in_2_lines(pdf, champ.libelle, champ.to_feature_collection.to_json)
|
||||
when 'Champs::SiretChamp'
|
||||
pdf.font 'marianne', style: :bold, size: 9 do
|
||||
pdf.font 'marianne', style: :bold do
|
||||
pdf.text champ.libelle
|
||||
end
|
||||
pdf.text " - SIRET: #{champ.to_s}"
|
||||
render_identite_etablissement(pdf, champ.etablissement) if champ.etablissement.present?
|
||||
pdf.text "\n"
|
||||
if champ.etablissement.present?
|
||||
add_identite_etablissement(pdf, champ.etablissement)
|
||||
end
|
||||
when 'Champs::NumberChamp'
|
||||
value = number_with_delimiter(champ.to_s)
|
||||
format_in_2_columns(pdf, champ.libelle, value)
|
||||
value = champ.to_s.empty? ? 'Non communiqué' : number_with_delimiter(champ.to_s)
|
||||
format_in_2_lines(pdf, champ.libelle, value)
|
||||
else
|
||||
value = champ.to_s.empty? ? 'Non communiqué' : champ.to_s
|
||||
format_in_2_columns(pdf, champ.libelle, value)
|
||||
format_in_2_lines(pdf, champ.libelle, value)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -117,11 +160,11 @@ def add_champs(pdf, champs)
|
|||
if champ.type == 'Champs::RepetitionChamp'
|
||||
champ.rows.each do |row|
|
||||
row.each do |inner_champ|
|
||||
render_single_champ(pdf, inner_champ)
|
||||
add_single_champ(pdf, inner_champ)
|
||||
end
|
||||
end
|
||||
else
|
||||
render_single_champ(pdf, champ)
|
||||
add_single_champ(pdf, champ)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -134,19 +177,19 @@ def add_message(pdf, message)
|
|||
sender = @dossier.user.email
|
||||
end
|
||||
|
||||
pdf.text "#{sender}, #{format_date(message.created_at)}", style: :bold
|
||||
pdf.text ActionView::Base.full_sanitizer.sanitize(message.body), size: 9
|
||||
pdf.text "\n", size: 9
|
||||
format_in_2_lines(pdf, "#{sender}, #{try_format_date(message.created_at)}",
|
||||
ActionView::Base.full_sanitizer.sanitize(message.body))
|
||||
end
|
||||
|
||||
def add_avis(pdf, avis)
|
||||
pdf.text "Avis de #{avis.email_to_display}", style: :bold
|
||||
if avis.confidentiel?
|
||||
pdf.text "(confidentiel)", style: :bold
|
||||
format_in_2_lines(pdf, "Avis de #{avis.email_to_display}#{avis.confidentiel? ? ' (confidentiel)' : ''}",
|
||||
avis.answer || 'En attente de réponse')
|
||||
end
|
||||
|
||||
def add_etat_dossier(pdf, dossier)
|
||||
pdf.pad_bottom(default_margin) do
|
||||
pdf.text "Ce dossier est <b>#{dossier_display_state(dossier, lower: true)}</b>.", inline_format: true
|
||||
end
|
||||
text = avis.answer || 'En attente de réponse'
|
||||
pdf.text text
|
||||
pdf.text "\n"
|
||||
end
|
||||
|
||||
def add_etats_dossier(pdf, dossier)
|
||||
|
@ -159,8 +202,6 @@ def add_etats_dossier(pdf, dossier)
|
|||
if dossier.processed_at.present?
|
||||
format_in_2_columns(pdf, "Décision le", try_format_date(dossier.processed_at))
|
||||
end
|
||||
|
||||
pdf.text "\n"
|
||||
end
|
||||
|
||||
prawn_document(page_size: "A4") do |pdf|
|
||||
|
@ -170,16 +211,16 @@ prawn_document(page_size: "A4") do |pdf|
|
|||
})
|
||||
pdf.font 'marianne'
|
||||
|
||||
pdf.svg IO.read(DOSSIER_PDF_EXPORT_LOGO_SRC), width: 300, position: :center
|
||||
pdf.move_down(40)
|
||||
pdf.pad_bottom(40) do
|
||||
pdf.svg IO.read(DOSSIER_PDF_EXPORT_LOGO_SRC), width: 300, position: :center
|
||||
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)
|
||||
pdf.text "\n"
|
||||
|
||||
pdf.text "Ce dossier est <b>#{dossier_display_state(@dossier, lower: true)}</b>.", inline_format: true
|
||||
pdf.text "\n"
|
||||
add_etat_dossier(pdf, @dossier)
|
||||
|
||||
if @dossier.motivation.present?
|
||||
format_in_2_columns(pdf, "Motif de la décision", @dossier.motivation)
|
||||
end
|
||||
|
@ -191,15 +232,19 @@ prawn_document(page_size: "A4") do |pdf|
|
|||
if @dossier.france_connect_information.present?
|
||||
format_in_2_columns(pdf, 'Informations France Connect', "Le dossier a été déposé par le compte de #{@dossier.france_connect_information.given_name} #{@dossier.france_connect_information.family_name}, authentifié par France Connect le #{@dossier.france_connect_information.updated_at.strftime('%d/%m/%Y')}")
|
||||
end
|
||||
|
||||
format_in_2_columns(pdf, "Email", @dossier.user.email)
|
||||
add_identite_individual(pdf, @dossier) if @dossier.individual.present?
|
||||
render_identite_etablissement(pdf, @dossier.etablissement) if @dossier.etablissement.present?
|
||||
pdf.text "\n"
|
||||
|
||||
if @dossier.individual.present?
|
||||
add_identite_individual(pdf, @dossier.individual)
|
||||
elsif @dossier.etablissement.present?
|
||||
add_identite_etablissement(pdf, @dossier.etablissement)
|
||||
end
|
||||
|
||||
add_title(pdf, 'Formulaire')
|
||||
add_champs(pdf, @dossier.champs)
|
||||
|
||||
if @include_infos_administration && @dossier.champs_private&.size > 0
|
||||
if @include_infos_administration && @dossier.champs_private.present?
|
||||
add_title(pdf, "Annotations privées")
|
||||
add_champs(pdf, @dossier.champs_private)
|
||||
end
|
||||
|
@ -211,8 +256,12 @@ prawn_document(page_size: "A4") do |pdf|
|
|||
end
|
||||
end
|
||||
|
||||
add_title(pdf, 'Messagerie')
|
||||
@dossier.commentaires.each do |commentaire|
|
||||
add_message(pdf, commentaire)
|
||||
if @dossier.commentaires.present?
|
||||
add_title(pdf, 'Messagerie')
|
||||
@dossier.commentaires.each do |commentaire|
|
||||
add_message(pdf, commentaire)
|
||||
end
|
||||
end
|
||||
|
||||
pdf.number_pages '<page> / <total>', at: [pdf.bounds.right - 80, pdf.bounds.bottom], align: :right, size: 10
|
||||
end
|
||||
|
|
|
@ -45,6 +45,6 @@
|
|||
%li.footer-link
|
||||
= link_to "FAQ", FAQ_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
|
||||
%li.footer-link
|
||||
= link_to "Accessibilité", accessibilite_path, :class => "footer-link"
|
||||
= link_to "Accessibilité", ACCESSIBILITE_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
|
||||
%li.footer-link
|
||||
= link_to "Disponibilité", STATUS_PAGE_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
- content_for(:title, 'Accessibilité')
|
||||
- content_for :footer do
|
||||
= render partial: "root/footer"
|
||||
|
||||
.accessibilite
|
||||
|
||||
%h1.new-h1 Accessibilité
|
||||
|
||||
%p.new-p
|
||||
Nous travaillons continuellement à améliorer le niveau d'accessibilité du site et sa conformité avec les normes en la matière.
|
||||
|
||||
%h2.new-h2 Signaler un dysfonctionnement
|
||||
%p.new-p
|
||||
Si, malgré notre vigilance, vous rencontriez le moindre problème d’accessibilité sur notre site, n’hésitez pas à #{contact_link('nous écrire', tags: 'accessibilite')}.
|
||||
|
||||
%h2.new-h2 Défenseur des droits
|
||||
%p.new-p
|
||||
Si vous constatez un défaut d'accessibilité vous empêchant d'accéder à un contenu ou une fonctionnalité du site, que vous nous le signalez et que vous ne parvenez pas à obtenir une réponse rapide de notre part, vous êtes en droit de faire parvenir vos doléances ou une demande de saisine au Défenseur des droits. Plusieurs moyens sont à votre disposition :
|
||||
%ul
|
||||
%li un <a href="http://www.defenseurdesdroits.fr/contact" target="_blank" rel="noopener">formulaire de contact</a> ;
|
||||
%li la <a href="http://www.defenseurdesdroits.fr/office/" target="_blank" rel="noopener">liste du ou des délégués de votre région</a> avec leurs informations de contact direct ;
|
||||
%li une adresse postale : Le Défenseur des droits - 7 rue Saint-Florentin - 75409 Paris Cedex 08.
|
|
@ -1,5 +1,5 @@
|
|||
%ul.footer-row.footer-bottom-line.footer-site-links
|
||||
%li.footer-link-accessibilite>= link_to "Accessibilité", accessibilite_path
|
||||
%li.footer-link-accessibilite>= link_to "Accessibilité", ACCESSIBILITE_URL, target: "_blank", rel: "noopener noreferrer"
|
||||
%li.footer-link-cgu>= link_to "CGU", CGU_URL, target: "_blank", rel: "noopener noreferrer"
|
||||
%li.footer-link-mentions-legales>= link_to "Mentions légales", MENTIONS_LEGALES_URL, target: "_blank", rel: "noopener noreferrer"
|
||||
%li.footer-link-doc>= link_to 'Documentation', DOC_URL
|
||||
|
|
|
@ -25,6 +25,7 @@ CADRE_JURIDIQUE_URL = [DOC_URL, "tutoriels/video-le-cadre-juridique"].join("/")
|
|||
LISTE_DES_DEMARCHES_URL = [DOC_URL, "listes-des-demarches"].join("/")
|
||||
CGU_URL = ENV.fetch("CGU_URL", [DOC_URL, "cgu"].join("/"))
|
||||
MENTIONS_LEGALES_URL = ENV.fetch("MENTIONS_LEGALES_URL", [DOC_URL, "mentions-legales"].join("/"))
|
||||
ACCESSIBILITE_URL = ENV.fetch("ACCESSIBILITE_URL", [DOC_URL, "declaration-daccessibilite"].join("/"))
|
||||
API_DOC_URL = [DOC_URL, "pour-aller-plus-loin", "api"].join("/")
|
||||
WEBHOOK_DOC_URL = [DOC_URL, "pour-aller-plus-loin", "webhook"].join("/")
|
||||
ARCHIVAGE_DOC_URL = [DOC_URL, "pour-aller-plus-loin", "archivage-longue-duree-des-demarches"].join("/")
|
||||
|
|
|
@ -146,7 +146,6 @@ Rails.application.routes.draw do
|
|||
resources :attachments, only: [:show, :destroy]
|
||||
|
||||
get "patron" => "root#patron"
|
||||
get "accessibilite" => "root#accessibilite"
|
||||
get "suivi" => "root#suivi"
|
||||
post "dismiss_outdated_browser" => "root#dismiss_outdated_browser"
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
class AddNotNullServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
unless column_exists?(:active_storage_blobs, :service_name, null: false)
|
||||
if (configured_service = ActiveStorage::Blob.service.name)
|
||||
# First backfill the remaining data.
|
||||
# (It should be fast, because the previous migration already backfilled almost all of it.)
|
||||
say_with_time('fill missings ActiveStorage::Blob.service_name. This could take a while…') do
|
||||
# rubocop:disable DS/Unscoped
|
||||
ActiveStorage::Blob.unscoped.where(service_name: nil).update_all service_name: configured_service
|
||||
# rubocop:enable DS/Unscoped
|
||||
end
|
||||
end
|
||||
|
||||
change_column :active_storage_blobs, :service_name, :string, null: false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :active_storage_blobs, :service_name, :string, null: true
|
||||
end
|
||||
end
|
6
db/migrate/20210331123709_add_cache_key_to_exports.rb
Normal file
6
db/migrate/20210331123709_add_cache_key_to_exports.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class AddCacheKeyToExports < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :exports, :key, :text
|
||||
add_index :exports, [:format, :key], unique: true
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_03_18_090001) do
|
||||
ActiveRecord::Schema.define(version: 2021_03_31_123709) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -44,7 +44,7 @@ ActiveRecord::Schema.define(version: 2021_03_18_090001) do
|
|||
t.bigint "byte_size", null: false
|
||||
t.string "checksum", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.string "service_name"
|
||||
t.string "service_name", null: false
|
||||
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
||||
end
|
||||
|
||||
|
@ -258,9 +258,9 @@ ActiveRecord::Schema.define(version: 2021_03_18_090001) do
|
|||
t.datetime "last_champ_private_updated_at"
|
||||
t.datetime "last_avis_updated_at"
|
||||
t.datetime "last_commentaire_updated_at"
|
||||
t.string "api_entreprise_job_exceptions", array: true
|
||||
t.index "to_tsvector('french'::regconfig, (search_terms || private_search_terms))", name: "index_dossiers_on_search_terms_private_search_terms", using: :gin
|
||||
t.index "to_tsvector('french'::regconfig, search_terms)", name: "index_dossiers_on_search_terms", using: :gin
|
||||
t.string "api_entreprise_job_exceptions", array: true
|
||||
t.index ["archived"], name: "index_dossiers_on_archived"
|
||||
t.index ["groupe_instructeur_id"], name: "index_dossiers_on_groupe_instructeur_id"
|
||||
t.index ["hidden_at"], name: "index_dossiers_on_hidden_at"
|
||||
|
@ -354,6 +354,8 @@ ActiveRecord::Schema.define(version: 2021_03_18_090001) do
|
|||
t.string "format", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.text "key"
|
||||
t.index ["format", "key"], name: "index_exports_on_format_and_key", unique: true
|
||||
end
|
||||
|
||||
create_table "exports_groupe_instructeurs", force: :cascade do |t|
|
||||
|
|
|
@ -41,8 +41,6 @@ describe ApplicationController, type: :controller do
|
|||
payload.delete(key)
|
||||
end
|
||||
expect(payload).to eq({
|
||||
sk_rendered_format: :text,
|
||||
sk_variant: [],
|
||||
user_agent: 'Rails Testing',
|
||||
user_roles: 'Guest'
|
||||
})
|
||||
|
@ -62,8 +60,6 @@ describe ApplicationController, type: :controller do
|
|||
payload.delete(key)
|
||||
end
|
||||
expect(payload).to eq({
|
||||
sk_rendered_format: :text,
|
||||
sk_variant: [],
|
||||
user_agent: 'Rails Testing',
|
||||
user_id: current_user.id,
|
||||
user_email: current_user.email,
|
||||
|
@ -88,8 +84,6 @@ describe ApplicationController, type: :controller do
|
|||
payload.delete(key)
|
||||
end
|
||||
expect(payload).to eq({
|
||||
sk_rendered_format: :text,
|
||||
sk_variant: [],
|
||||
user_agent: 'Rails Testing',
|
||||
user_id: current_user.id,
|
||||
user_email: current_user.email,
|
||||
|
|
|
@ -441,7 +441,7 @@ describe Instructeurs::ProceduresController, type: :controller do
|
|||
|
||||
context 'when the export is not ready' do
|
||||
before do
|
||||
Export.create(format: :csv, groupe_instructeurs: [gi_1])
|
||||
create(:export, groupe_instructeurs: [gi_1])
|
||||
end
|
||||
|
||||
it 'displays an notice' do
|
||||
|
@ -451,9 +451,7 @@ describe Instructeurs::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when the export is ready' do
|
||||
let!(:export) do
|
||||
Export.create(format: :csv, groupe_instructeurs: [gi_1])
|
||||
end
|
||||
let!(:export) { create(:export, groupe_instructeurs: [gi_1]) }
|
||||
|
||||
before do
|
||||
export.file.attach(io: StringIO.new('export'), filename: 'file.csv')
|
||||
|
@ -466,9 +464,7 @@ describe Instructeurs::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when another export is ready' do
|
||||
let!(:export) do
|
||||
Export.create(format: :csv, groupe_instructeurs: [gi_0, gi_1])
|
||||
end
|
||||
let!(:export) { create(:export, groupe_instructeurs: [gi_0, gi_1]) }
|
||||
|
||||
before do
|
||||
export.file.attach(io: StringIO.new('export'), filename: 'file.csv')
|
||||
|
|
|
@ -14,8 +14,6 @@ describe Manager::ApplicationController, type: :controller do
|
|||
payload.delete(key)
|
||||
end
|
||||
expect(payload).to eq({
|
||||
sk_rendered_format: :text,
|
||||
sk_variant: [],
|
||||
user_agent: 'Rails Testing',
|
||||
user_id: current_user.id,
|
||||
user_email: current_user.email
|
||||
|
|
|
@ -2,5 +2,9 @@ FactoryBot.define do
|
|||
factory :export do
|
||||
format { :csv }
|
||||
groupe_instructeurs { [association(:groupe_instructeur)] }
|
||||
|
||||
after(:build) do |export, _evaluator|
|
||||
export.key = Export.generate_cache_key(export.groupe_instructeurs)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ RSpec.describe Export, type: :model do
|
|||
let(:groupe_instructeur) { create(:groupe_instructeur) }
|
||||
|
||||
context 'when everything is ok' do
|
||||
let(:export) { build(:export) }
|
||||
let(:export) { build(:export, groupe_instructeurs: [groupe_instructeur]) }
|
||||
|
||||
it { expect(export.save).to be true }
|
||||
end
|
||||
|
@ -15,7 +15,7 @@ RSpec.describe Export, type: :model do
|
|||
end
|
||||
|
||||
context 'when format is missing' do
|
||||
let(:export) { build(:export, format: nil) }
|
||||
let(:export) { build(:export, format: nil, groupe_instructeurs: [groupe_instructeur]) }
|
||||
|
||||
it { expect(export.save).to be false }
|
||||
end
|
||||
|
@ -46,7 +46,7 @@ RSpec.describe Export, type: :model do
|
|||
let!(:gi_3) { create(:groupe_instructeur, procedure: procedure) }
|
||||
|
||||
context 'when an export is made for one groupe instructeur' do
|
||||
let!(:export) { Export.create(format: :csv, groupe_instructeurs: [gi_1, gi_2]) }
|
||||
let!(:export) { create(:export, groupe_instructeurs: [gi_1, gi_2]) }
|
||||
|
||||
it { expect(Export.find_for_format_and_groupe_instructeurs(:csv, [gi_1])).to eq(nil) }
|
||||
it { expect(Export.find_for_format_and_groupe_instructeurs(:csv, [gi_2, gi_1])).to eq(export) }
|
||||
|
|
|
@ -13233,9 +13233,9 @@ xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0, xtend@~4.0.1:
|
|||
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==
|
||||
|
||||
y18n@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
|
||||
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
|
||||
integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==
|
||||
|
||||
yallist@^2.1.2:
|
||||
version "2.1.2"
|
||||
|
|
Loading…
Reference in a new issue