feat(Procedure.for_tiers_enabled): allow super admin to disable for_tiers
This commit is contained in:
parent
b40cc2a54e
commit
84c1a485e5
7 changed files with 65 additions and 29 deletions
|
@ -46,6 +46,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
|
||||||
max_duree_conservation_dossiers_dans_ds: Field::Number,
|
max_duree_conservation_dossiers_dans_ds: Field::Number,
|
||||||
estimated_duration_visible: Field::Boolean,
|
estimated_duration_visible: Field::Boolean,
|
||||||
piece_justificative_multiple: Field::Boolean,
|
piece_justificative_multiple: Field::Boolean,
|
||||||
|
for_tiers_enabled: Field::Boolean,
|
||||||
replaced_by_procedure_id: Field::String,
|
replaced_by_procedure_id: Field::String,
|
||||||
tags: Field::Text,
|
tags: Field::Text,
|
||||||
template: Field::Boolean
|
template: Field::Boolean
|
||||||
|
@ -109,6 +110,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
|
||||||
:max_duree_conservation_dossiers_dans_ds,
|
:max_duree_conservation_dossiers_dans_ds,
|
||||||
:estimated_duration_visible,
|
:estimated_duration_visible,
|
||||||
:piece_justificative_multiple,
|
:piece_justificative_multiple,
|
||||||
|
:for_tiers_enabled,
|
||||||
:replaced_by_procedure_id
|
:replaced_by_procedure_id
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
|
@ -121,6 +123,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
|
||||||
:max_duree_conservation_dossiers_dans_ds,
|
:max_duree_conservation_dossiers_dans_ds,
|
||||||
:estimated_duration_visible,
|
:estimated_duration_visible,
|
||||||
:piece_justificative_multiple,
|
:piece_justificative_multiple,
|
||||||
|
:for_tiers_enabled,
|
||||||
:replaced_by_procedure_id
|
:replaced_by_procedure_id
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
|
|
|
@ -3,27 +3,28 @@
|
||||||
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: @dossier }
|
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: @dossier }
|
||||||
|
|
||||||
- if !dossier_submission_is_closed?(@dossier)
|
- if !dossier_submission_is_closed?(@dossier)
|
||||||
= form_for @dossier, url: identite_dossier_path(@dossier), method: :patch, html: { class: "form" }, data: {turbo: true, controller: :autosubmit} do |f|
|
- if @dossier.procedure.for_tiers_enabled?
|
||||||
|
= form_for @dossier, url: identite_dossier_path(@dossier), method: :patch, html: { class: "form" }, data: {turbo: true, controller: :autosubmit} do |f|
|
||||||
|
|
||||||
%fieldset#radio-rich-hint.fr-fieldset{ "aria-labelledby" => "radio-rich-hint-legend radio-rich-hint-messages" }
|
%fieldset#radio-rich-hint.fr-fieldset{ "aria-labelledby" => "radio-rich-hint-legend radio-rich-hint-messages" }
|
||||||
%legend#radio-rich-hint-legend.fr-fieldset__legend--regular.fr-fieldset__legend
|
%legend#radio-rich-hint-legend.fr-fieldset__legend--regular.fr-fieldset__legend
|
||||||
= t('views.users.dossiers.identite.legend')
|
= t('views.users.dossiers.identite.legend')
|
||||||
|
|
||||||
.fr-fieldset__element
|
.fr-fieldset__element
|
||||||
.fr-radio-group.fr-radio-rich
|
.fr-radio-group.fr-radio-rich
|
||||||
= f.radio_button :for_tiers, false, required: true, id: "radio-self-manage"
|
= f.radio_button :for_tiers, false, required: true, id: "radio-self-manage"
|
||||||
%label.fr-label{ for: "radio-self-manage" }
|
%label.fr-label{ for: "radio-self-manage" }
|
||||||
= t('activerecord.attributes.dossier.for_tiers.false')
|
= t('activerecord.attributes.dossier.for_tiers.false')
|
||||||
.fr-radio-rich__img
|
.fr-radio-rich__img
|
||||||
%span.fr-icon-user-fill
|
%span.fr-icon-user-fill
|
||||||
.fr-fieldset__element
|
.fr-fieldset__element
|
||||||
.fr-radio-group.fr-radio-rich
|
.fr-radio-group.fr-radio-rich
|
||||||
= f.radio_button :for_tiers, true, required: true, id: "radio-tiers-manage"
|
= f.radio_button :for_tiers, true, required: true, id: "radio-tiers-manage"
|
||||||
%label.fr-label{ for: "radio-tiers-manage" }
|
%label.fr-label{ for: "radio-tiers-manage" }
|
||||||
= t('activerecord.attributes.dossier.for_tiers.true')
|
= t('activerecord.attributes.dossier.for_tiers.true')
|
||||||
.fr-radio-rich__img
|
.fr-radio-rich__img
|
||||||
%span.fr-icon-parent-fill
|
%span.fr-icon-parent-fill
|
||||||
|
|
||||||
= f.submit t('views.users.dossiers.identite.continue'), class: 'visually-hidden'
|
= f.submit t('views.users.dossiers.identite.continue'), class: 'visually-hidden'
|
||||||
|
|
||||||
= render Dossiers::IndividualFormComponent.new(dossier: @dossier)
|
= render Dossiers::IndividualFormComponent.new(dossier: @dossier)
|
||||||
|
|
|
@ -37,6 +37,7 @@ en:
|
||||||
lien_dpo: Link or email to contact the data protection officer (DPO)
|
lien_dpo: Link or email to contact the data protection officer (DPO)
|
||||||
duree_conservation_dossiers_dans_ds: Duration files will be kept
|
duree_conservation_dossiers_dans_ds: Duration files will be kept
|
||||||
max_duree_conservation_dossiers_dans_ds: Max duration allowed to keep files
|
max_duree_conservation_dossiers_dans_ds: Max duration allowed to keep files
|
||||||
|
for_tiers_enabled: Enable a third party to submit a file
|
||||||
aasm_state:
|
aasm_state:
|
||||||
brouillon: Draft
|
brouillon: Draft
|
||||||
publiee: Published
|
publiee: Published
|
||||||
|
|
|
@ -20,6 +20,7 @@ fr:
|
||||||
organisation: Organisme
|
organisation: Organisme
|
||||||
duree_conservation_dossiers_dans_ds: Durée de conservation des dossiers
|
duree_conservation_dossiers_dans_ds: Durée de conservation des dossiers
|
||||||
max_duree_conservation_dossiers_dans_ds: Durée maximale de conservation des dossiers (autorisée par un super admin)
|
max_duree_conservation_dossiers_dans_ds: Durée maximale de conservation des dossiers (autorisée par un super admin)
|
||||||
|
for_tiers_enabled: Activer le dépot par un tiers
|
||||||
id: Id
|
id: Id
|
||||||
libelle: Titre de la démarche
|
libelle: Titre de la démarche
|
||||||
description: Quel est l’objet de la démarche ?
|
description: Quel est l’objet de la démarche ?
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddColumnForTiersEnabledToProcedure < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
add_column :procedures, :for_tiers_enabled, :boolean, default: true, null: false
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2024_04_16_062900) do
|
ActiveRecord::Schema[7.0].define(version: 2024_04_17_053843) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_buffercache"
|
enable_extension "pg_buffercache"
|
||||||
enable_extension "pg_stat_statements"
|
enable_extension "pg_stat_statements"
|
||||||
|
@ -894,6 +894,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_16_062900) do
|
||||||
t.boolean "euro_flag", default: false
|
t.boolean "euro_flag", default: false
|
||||||
t.boolean "experts_require_administrateur_invitation", default: false
|
t.boolean "experts_require_administrateur_invitation", default: false
|
||||||
t.boolean "for_individual", default: false
|
t.boolean "for_individual", default: false
|
||||||
|
t.boolean "for_tiers_enabled", default: true, null: false
|
||||||
t.datetime "hidden_at", precision: nil
|
t.datetime "hidden_at", precision: nil
|
||||||
t.datetime "hidden_at_as_template", precision: nil
|
t.datetime "hidden_at_as_template", precision: nil
|
||||||
t.boolean "instructeurs_self_management_enabled", default: false
|
t.boolean "instructeurs_self_management_enabled", default: false
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
describe 'users/dossiers/identite', type: :view do
|
describe 'users/dossiers/identite', type: :view do
|
||||||
let(:procedure) { create(:simple_procedure, :for_individual) }
|
|
||||||
let(:dossier) { create(:dossier, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
let(:dossier) { create(:dossier, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -9,18 +8,43 @@ describe 'users/dossiers/identite', type: :view do
|
||||||
|
|
||||||
subject! { render }
|
subject! { render }
|
||||||
|
|
||||||
it 'has identity fields' do
|
context 'when procedure has for_tiers_enabled' do
|
||||||
within('.individual-infos') do
|
let(:procedure) { create(:simple_procedure, :for_individual) }
|
||||||
expect(rendered).to have_field(id: 'Prenom')
|
|
||||||
expect(rendered).to have_field(id: 'Nom')
|
it 'has choice for you or a tiers' do
|
||||||
|
expect(rendered).to have_content "Pour vous"
|
||||||
|
expect(rendered).to have_content "Pour un bénéficiaire : membre de la famille, proche, mandant, professionnel en charge du suivi du dossier…"
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'has identity fields' do
|
||||||
|
within('.individual-infos') do
|
||||||
|
expect(rendered).to have_field(id: 'Prenom')
|
||||||
|
expect(rendered).to have_field(id: 'Nom')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when the demarche asks for the birthdate' do
|
||||||
|
let(:procedure) { create(:simple_procedure, for_individual: true, ask_birthday: true) }
|
||||||
|
|
||||||
|
it 'has a birthday field' do
|
||||||
|
expect(rendered).to have_field('Date de naissance')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the demarche asks for the birthdate' do
|
context 'when procedure has for_tiers_enabled' do
|
||||||
let(:procedure) { create(:simple_procedure, for_individual: true, ask_birthday: true) }
|
let(:procedure) { create(:simple_procedure, :for_individual, for_tiers_enabled: false) }
|
||||||
|
|
||||||
it 'has a birthday field' do
|
it 'has choice for you or a tiers' do
|
||||||
expect(rendered).to have_field('Date de naissance')
|
expect(rendered).not_to have_content "Pour vous"
|
||||||
|
expect(rendered).not_to have_content "Pour un bénéficiaire : membre de la famille, proche, mandant, professionnel en charge du suivi du dossier…"
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'has identity fields' do
|
||||||
|
within('.individual-infos') do
|
||||||
|
expect(rendered).to have_field(id: 'Prenom')
|
||||||
|
expect(rendered).to have_field(id: 'Nom')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue