Skip to content

Commit

Permalink
Merge branch 'feature/import-2023-07-11'
Browse files Browse the repository at this point in the history
  • Loading branch information
maatinito committed Oct 10, 2023
2 parents 3fadf2e + 4ba3ced commit 1378bf3
Show file tree
Hide file tree
Showing 93 changed files with 1,834 additions and 91 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
image: postgis/postgis:14-3.3
env:
POSTGRES_USER: tps_test
POSTGRES_DB: tps_test
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
image: postgis/postgis:14-3.3
env:
POSTGRES_USER: tps_test
POSTGRES_DB: tps_test
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
image: postgis/postgis:14-3.3
env:
POSTGRES_USER: tps_test
POSTGRES_DB: tps_test
Expand Down
12 changes: 12 additions & 0 deletions app/assets/stylesheets/badges.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@
vertical-align: baseline;
}
}

.badge-group {
display: flex;

.fr-badge {
margin-right: $default-spacer;
}

.fr-badge:last-child {
margin-right: 0;
}
}
17 changes: 16 additions & 1 deletion app/components/dsfr/radio_button_list_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
class Dsfr::RadioButtonListComponent < ApplicationComponent
def initialize(form:, target:, buttons:)
attr_reader :error

def initialize(form:, target:, buttons:, error: nil)
@form = form
@target = target
@buttons = buttons
@error = error
end

def error?
# TODO: mettre correctement le aria-labelled-by avec l'id du div qui contient les erreurs
# https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/bouton-radio/
@error.present?
end

def each_button
@buttons.each do |button|
yield(*button.values_at(:label, :value, :hint), **button.except(:label, :value, :hint))
end
end
end
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
%fieldset.fr-fieldset{ 'aria-labelledby': 'radio-hint-element-legend radio-hint-element-messages' }
%fieldset{ class: class_names("fr-fieldset": true, "fr-fieldset--error": error?), 'aria-labelledby': 'radio-hint-element-legend radio-hint-element-messages', role: error? ? :group : nil }
%legend.fr-fieldset__legend--regular.fr-fieldset__legend
= content
- @buttons.map { _1.values_at(:label, :value, :hint) }.each do |label, value, hint|
- each_button do |label, value, hint, **button_options|
.fr-fieldset__element
.fr-radio-group
= @form.radio_button @target, value
= @form.radio_button @target, value, **button_options
= @form.label @target, value: value, class: 'fr-label' do
- capture do
= label
%span.fr-hint-text= hint
.fr-messages-group{ 'aria-live': 'assertive' }
= button_options[:after_label] if button_options[:after_label]
%span.fr-hint-text= hint if hint
.fr-messages-group{ 'aria-live': 'assertive' }
- if error?
%p.fr-message.fr-message--error= error
10 changes: 9 additions & 1 deletion app/components/instructeurs/en_construction_menu_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@ def render?
end

def menu_label
if dossier.en_construction?
if !dossier.may_repasser_en_construction?
t('.request_correction')
else
t(".revert_en_construction")
end
end

def sva?
dossier.procedure.sva?
end

def sva_resume_method
dossier.procedure.sva_svr_configuration.resume
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
en:
revert_en_construction: Revert to in progress
request_correction: Request a correction
request_completion: Request to complete
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
fr:
revert_en_construction: Repasser en construction
request_correction: Demander une correction
request_completion: Demander à compléter
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
.dropdown-description
%h4= t('.request_correction')
L’usager sera informé que des modifications sont attendues
L’usager sera informé que des modifications sont attendues.
- if sva?
- if sva_resume_method == :reset
Le délai du SVA sera réinitialisé lorqu’il déclarera avoir complété le dossier.
- else
Le délai du SVA reprendra lorsqu’il déclarera avoir corrigé le dossier.
- menu.with_item(class: "inactive form-inside fr-pt-1v") do
= render partial: 'instructeurs/dossiers/instruction_button_motivation', locals: { dossier:,
Expand All @@ -29,3 +35,24 @@
process_action: nil,
title: 'Marquer en attente de corrections',
confirm: 'Envoyer la demande de corrections ?'}
- if sva?
- menu.with_item do
= link_to('#', onclick: "DS.showMotivation(event, 'pending_completion');", role: 'menuitem') do
%span.fr-icon.fr-icon-error-warning-line.fr-text-default--warning.fr-mt-1v{ "aria-hidden": "true" }
.dropdown-description
%h4= t('.request_completion')
L’usager sera informé que son dossier est incomplet. Le délai du SVA sera réinitialisé lorque il déclarera avoir complété le dossier.
- menu.with_item(class: "inactive form-inside fr-pt-1v") do
= render partial: 'instructeurs/dossiers/instruction_button_motivation', locals: { dossier:,
visible: false,
form_path: pending_correction_instructeur_dossier_path(dossier.procedure, dossier, kind: :incomplete),
placeholder: 'Expliquez au demandeur comment compléter son dossier',
popup_class: 'pending_completion',
button_justificatif_label: "Ajouter une pièce jointe (facultatif)",
process_button: dossier.en_construction? ? 'Valider' : 'Valider et repasser en construction',
process_action: nil,
title: 'Marquer le dossier comme incomplet',
confirm: 'Envoyer la demande de complétion ?'}
56 changes: 56 additions & 0 deletions app/components/instructeurs/sva_svr_decision_badge_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# frozen_string_literal: true

class Instructeurs::SVASVRDecisionBadgeComponent < ApplicationComponent
attr_reader :object
attr_reader :procedure
attr_reader :with_label

def initialize(projection_or_dossier:, procedure:, with_label: false)
@object = projection_or_dossier
@procedure = procedure
@decision = procedure.sva_svr_configuration.decision.to_sym
@with_label = with_label
end

def render?
return false unless procedure.sva_svr_enabled?

[:en_construction, :en_instruction].include? object.state.to_sym
end

def without_date?
object.sva_svr_decision_on.nil?
end

def classes
class_names(
'fr-badge fr-badge--sm': true,
'fr-badge--warning': soon?,
'fr-badge--info': !soon?
)
end

def soon?
object.sva_svr_decision_on < 7.days.from_now.to_date
end

def pending_correction?
object.pending_correction?
end

def days_count
(object.sva_svr_decision_on - Date.current).to_i
end

def sva?
@decision == :sva
end

def svr?
@decision == :svr
end

def label_for_badge
sva? ? "SVA :" : "SVR :"
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
en:
no_sva: Submitted before SVA
no_svr: Submitted before SVR
in_days:
zero: Today
one: Tomorrow
other: in %{count} days
remaining_days_after_correction:
other: "%{count} d. after correction"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
fr:
no_sva: Déposé avant SVA
no_svr: Déposé avant SVR
in_days:
zero: Aujourd’hui
one: Demain
other: dans %{count} jours
remaining_days_after_correction:
other: "%{count} j. après correction"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- if without_date?
%span.fr-badge.fr-badge--sm
= t(sva? ? '.no_sva' : '.no_svr')
- else
%span{ class: classes }
- if with_label.present?
= label_for_badge
- if pending_correction?
= t('.remaining_days_after_correction', count: days_count)
- else
= t('.in_days', count: days_count)
7 changes: 7 additions & 0 deletions app/components/procedure/card/sva_svr_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class Procedure::Card::SVASVRComponent < ApplicationComponent
def initialize(procedure:)
@procedure = procedure
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
en:
ready: "Configuré"
needs_configuration: "À configurer"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fr:
title: "Silence Vaut Accord"
subtitle: "Accepter ou Refuser un dossier après un délai"
ready: "Configuré"
needs_configuration: "À configurer"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.fr-col-6.fr-col-md-4.fr-col-lg-3
= link_to edit_admin_procedure_sva_svr_path(@procedure), class: 'fr-tile fr-enlarge-link', id: 'sva' do
.fr-tile__body.flex.justify-between
- if @procedure.sva_svr_enabled?
%div
%span.icon.accept
%p.fr-tile-status-accept= t('.ready')
- else
%div
%span.icon.clock
%p.fr-tile-status-todo= t('.needs_configuration')
%h3.fr-h6.fr-mt-10v= t('.title')
%p.fr-tile-subtitle= t('.subtitle')
%p.fr-btn.fr-btn--tertiary= t('views.shared.actions.edit')
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- if link?
= link_to url, t(".name"), class: "fr-download__link", title: new_tab_suffix(t(".name")), **external_link_attributes
= link_to url, t(".name"), class: "fr-download__link", title: helpers.new_tab_suffix(t(".name")), **helpers.external_link_attributes
- elsif attachment?
= render Dsfr::DownloadComponent.new(attachment:, name: t(".name"), ephemeral_link: helpers.administrateur_signed_in?)
43 changes: 43 additions & 0 deletions app/components/procedure/sva_svr_form_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# frozen_string_literal: true

class Procedure::SVASVRFormComponent < ApplicationComponent
attr_reader :procedure, :configuration

def initialize(procedure:, configuration:)
@procedure = procedure
@configuration = configuration
end

def form_disabled?
return false if procedure.brouillon?

procedure.sva_svr_enabled?
end

def decision_buttons
scope = ".decision_buttons"

[
{ label: t("disabled", scope:), value: "disabled", disabled: form_disabled? },
{ label: t("sva", scope:), value: "sva", hint: t("sva_hint", scope:) },
{ label: t("svr", scope:), value: "svr", hint: t("svr_hint", scope:), disabled: true, after_label: tag.span("Disponible prochainement", class: "fr-badge fr-badge--sm fr-ml-1w") }
]
end

def resume_buttons
scope = ".resume_buttons"

[
{
value: "continue",
label: t("continue_label", scope: scope),
hint: t("continue_hint", scope: scope)
},
{
value: "reset",
label: t("reset_label", scope: scope),
hint: t("reset_hint", scope: scope)
}
]
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
en:
rule: Rule to apply
delay: Configuration of the delay before decision
unit_labels:
months: months
weeks: weeks
days: days
resume_method: How to calculate the delay when the applicant resubmits their corrected file?
resume_intro: |
When an instructor asks for a file to be corrected, the countdown of the delay is interrupted.
The delay resumes when the applicant resubmits their file stating that they have made the requested corrections.
If the file has been declared incomplete, the delay will be reset, regardless of the configuration below.
submit: Apply SVA/SVR configuration
cancel: Cancel
decision_buttons:
disabled: "Disabled"
sva: "Silence Equals Acceptation (SVA)"
sva_hint: "A file is automatically accepted if no instructor has pronounced before the allotted time"
svr: "Silence Equals Rejection (SVR)"
svr_hint: "A file is automatically rejected if no instructor has pronounced before the allotted time"
resume_buttons:
continue_label: "Resume countdown from where it stopped"
continue_hint: "Example: if the instructor requests corrections to a complete file with 10 days to go before the automatic decision, and the file is resubmitted on April 15, it will be automatically accepted on April 25, unless the instructor makes a decision by then or requests corrections again. On the other hand, if the inspector asks for the file to be completed, the deadline will be reset."
reset_label: "Reset the delay"
reset_hint: "Example: if the file is resubmitted on April 15 and the delay is 2 months, the decision will be automatically made on June 15, unless the instructor pronounces in the meantime or asks for corrections again."
notice_new_files_only: "Information: if you activate this rule, only the newly submitted files will be subject to it."
notice_edit_denied: "Warning: SVA/SVR cannot be changed or disabled."
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
fr:
rule: Règle à appliquer
delay: Configuration du délai avant décision
unit_labels:
months: mois
weeks: semaines
days: jours
resume_method: Comment calculer le délai lorsque le demandeur re-dépose son dossier corrigé ?
resume_intro: |
Lorsqu’un instructeur demande de corriger un dossier, le décompte du délai est interrompu.
Le délai reprend lorsque le demandeur redépose son dossier en déclarant avoir effectué les corrections demandées.
Si le dossier avait été déclaré incomplet, le délai sera réinitialisé, quelle que soit la configuration ci-dessous.
submit: Appliquer la configuration SVA/SVR
cancel: Annuler
decision_buttons:
disabled: "Désactivé"
sva: "Silence Vaut Accord"
sva_hint: "Un dossier est automatiquement accepté si aucun n’instructeur ne s’est prononcé avant le délai imparti"
svr: "Silence Vaut Rejet"
svr_hint: "Un dossier est automatiquement refusé si aucun n’instructeur ne s’est prononcé avant le délai imparti"
resume_buttons:
continue_label: "Reprendre le décompte depuis le moment où il s’était arrêté"
continue_hint: "Exemple: si l’instructeur demande des corrections d’un dossier complet alors qu’il reste 10 jours avant la décision automatique, et que le dossier est re-déposé le 15 avril, il sera automatiquement accepté le 25 avril, sauf à ce que l’instructeur se prononce d’ici là ou demande à nouveau des corrections. En revanche si l’instructeur demande à compléter le dossier, le délai sera réinitialisé."
reset_label: "Réinitialiser le délai"
reset_hint: "Exemple: si le dossier est re-déposé le 15 avril et que le délai est de 2 mois, la décision sera automatiquement prise le 15 juin, sauf à ce que l’instructeur se prononce d’ici là ou demande à nouveau des corrections."
notice_new_files_only: "Information : si vous activez cette règle, seuls les nouveaux dossiers déposés y seront soumis."
notice_edit_denied: "Avertissement : le changement ou la désactivation du SVA/SVR est impossible."
Loading

0 comments on commit 1378bf3

Please sign in to comment.