add AR component and page on admin view

This commit is contained in:
Lisa Durand 2024-03-19 17:26:57 +01:00
parent cb2dd3dd3a
commit ee91f47c5a
10 changed files with 76 additions and 2 deletions

View file

@ -0,0 +1,5 @@
class Procedure::Card::AccuseLectureComponent < ApplicationComponent
def initialize(procedure:)
@procedure = procedure
end
end

View file

@ -0,0 +1,4 @@
---
fr:
title: Accusé de lecture
subtitle: Pour les démarches avec voies de recours

View file

@ -0,0 +1,11 @@
.fr-col-6.fr-col-md-4.fr-col-lg-3
= link_to accuse_lecture_admin_procedure_path(@procedure), class: 'fr-tile fr-enlarge-link' do
.fr-tile__body.flex.column.align-center.justify-between
- if @procedure.accuse_lecture.present?
%p.fr-badge.fr-badge--success Activé
- else
%p.fr-badge.fr-badge--info À configurer
%div
%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')

View file

@ -3,7 +3,7 @@ module Administrateurs
layout 'all', only: [:all, :administrateurs]
respond_to :html, :xlsx
before_action :retrieve_procedure, only: [:champs, :annotations, :modifications, :edit, :zones, :monavis, :update_monavis, :jeton, :update_jeton, :publication, :publish, :transfert, :close, :confirmation, :allow_expert_review, :allow_expert_messaging, :experts_require_administrateur_invitation, :reset_draft, :publish_revision, :check_path]
before_action :retrieve_procedure, only: [:champs, :annotations, :modifications, :edit, :zones, :monavis, :update_monavis, :accuse_lecture, :update_accuse_lecture, :jeton, :update_jeton, :publication, :publish, :transfert, :close, :confirmation, :allow_expert_review, :allow_expert_messaging, :experts_require_administrateur_invitation, :reset_draft, :publish_revision, :check_path]
before_action :draft_valid?, only: [:apercu]
after_action :reset_procedure, only: [:update]
@ -276,6 +276,13 @@ module Administrateurs
render 'monavis'
end
def accuse_lecture
end
def update_accuse_lecture
@procedure.update!(procedure_params)
end
def jeton
end
@ -515,6 +522,7 @@ module Administrateurs
:logo,
:auto_archive_on,
:monavis_embed,
:accuse_lecture,
:api_entreprise_token,
:duree_conservation_dossiers_dans_ds,
{ zone_ids: [] },

View file

@ -0,0 +1,37 @@
= render partial: 'administrateurs/breadcrumbs',
locals: { steps: [['Démarches', admin_procedures_back_path(@procedure)],
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
['Accusé de lecture']] }
.fr-container
.fr-grid-row
.fr-col-12.fr-col-offset-md-2.fr-col-md-8
%h1.page-title
Accusé de lecture
= render Dsfr::AlertComponent.new(state: :info, size: :sm, extra_class_names: 'fr-mb-2w') do |c|
- c.with_body do
%p
Pour les démarches avec voies de recours, il est possible d'activer l'accusé de lecture. L'usager n'a plus accès à la décision finale par mail, mais il doit se connecter sur la plateforme Démarches Simplifiées pour en prendre connaissance et en accuser lecture.
%ul.fr-toggle__list
%li
= form_for @procedure,
method: :patch,
url: update_accuse_lecture_admin_procedure_path(@procedure),
data: { controller: 'autosubmit', turbo: 'true' } do |f|
= render Dsfr::ToggleComponent.new(form: f,
target: :accuse_lecture,
title: "Accusé de lecture de la démarche",
hint: "Laccusé de lecture est à activer uniquement pour les démarches avec voies de recours car il complexifie l'accès à la décision finale pour les usagers",
opt: {"checked" => @procedure.accuse_lecture})
.padded-fixed-footer
.fixed-footer
.fr-container
.fr-grid-row
.fr-col-12.fr-col-offset-md-2.fr-col-md-8
%ul.fr-btns-group.fr-btns-group--inline-md
%li
= link_to 'Enregistrer et revenir à la page de suivi', admin_procedure_path(id: @procedure), class: 'fr-btn'

View file

@ -89,3 +89,4 @@
= render Procedure::Card::MonAvisComponent.new(procedure: @procedure)
= render Procedure::Card::DossierSubmittedMessageComponent.new(procedure: @procedure)
= render Procedure::Card::ChorusComponent.new(procedure: @procedure)
= render Procedure::Card::AccuseLectureComponent.new(procedure: @procedure)

View file

@ -4,4 +4,4 @@ fr:
mail:
initiated_mail:
default_subject: Votre dossier nº %{dossier_number} a bien été déposé (%{procedure_libelle})
proof_of_receipt: Accusé de réception
proof_of_receipt: Accusé de lecture

View file

@ -571,6 +571,8 @@ Rails.application.routes.draw do
get 'modifications'
get 'monavis'
patch 'update_monavis'
get 'accuse_lecture'
patch 'update_accuse_lecture'
get 'jeton'
patch 'update_jeton'
put :allow_expert_review

View file

@ -0,0 +1,5 @@
class AddAccuseLectureToProcedures < ActiveRecord::Migration[7.0]
def change
add_column :procedures, :accuse_lecture, :boolean, default: false, null: false
end
end

View file

@ -856,6 +856,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_11_164502) do
create_table "procedures", id: :serial, force: :cascade do |t|
t.string "aasm_state", default: "brouillon"
t.boolean "accuse_lecture", default: false, null: false
t.boolean "allow_expert_messaging", default: true, null: false
t.boolean "allow_expert_review", default: true, null: false
t.string "api_entreprise_token"