amelioration(users/dossiers#demande): passage a la nouvelle ui/ux

wip
This commit is contained in:
Martin 2023-04-28 10:33:01 +02:00
parent dc0eaed2f0
commit 43c6f03d10
31 changed files with 487 additions and 349 deletions

View file

@ -0,0 +1,21 @@
class Dossiers::ChampRowShowComponent < ApplicationComponent
include ChampHelper
include DossierHelper
include ApplicationHelper
def initialize(champs:, demande_seen_at:, profile:, repetition:)
@repetition = repetition
@champs = champs
@demande_seen_at = demande_seen_at
@profile = profile
end
def updated_after_deposer?(champ)
return false if champ.dossier.depose_at.blank?
champ.updated_at > champ.dossier.depose_at
end
def number_with_html_delimiter(num)
# we are using the span delimiter that doesn't insert spaces when copying and pasting the number
number_with_delimiter(num, delimiter: tag.span(class: 'numbers-delimiter'))
end
end

View file

@ -0,0 +1,3 @@
---
en:
blank: "blank (optional)"

View file

@ -0,0 +1,3 @@
---
fr:
blank: "non saisi (facultatif)"

View file

@ -0,0 +1,64 @@
- @champs.each do |champ|
.fr-px-4v.fr-my-2v
- if champ.repetition?
= champ.libelle
- champ.rows.each do |row|
= render Dossiers::ChampRowShowComponent.new(champs: row, demande_seen_at: @demande_seen_at, profile: @profile, repetition: true)
- else
.flex.d-block-sm
%p.flex-grow.fr-text-action-high--grey.fr-mb-0= "#{champ.libelle} :"
%p.champ-updated-at.fr-mb-0.fr-text--sm
- if updated_after_deposer?(champ)
%span{ class: highlight_if_unseen_class(@demande_seen_at, champ.updated_at) }
modifié le
= try_format_datetime(champ.updated_at)
- if champ.blank?
.champ-content.fr-text-mention--grey{ class: [highlight_if_unseen_class(@demande_seen_at, champ.updated_at), champ.type_champ] }
%p= t('.blank')
- else
.champ-content.fr-text-action-high--grey{ class: [highlight_if_unseen_class(@demande_seen_at, champ.updated_at), champ.type_champ] }
- case champ.type_champ
- when TypeDeChamp.type_champs.fetch(:carte)
= render partial: "shared/champs/carte/show", locals: { champ: champ }
- when TypeDeChamp.type_champs.fetch(:dossier_link)
= render partial: "shared/champs/dossier_link/show", locals: { champ: champ }
- when TypeDeChamp.type_champs.fetch(:multiple_drop_down_list)
= render partial: "shared/champs/multiple_drop_down_list/show", locals: { champ: champ }
- when TypeDeChamp.type_champs.fetch(:piece_justificative), TypeDeChamp.type_champs.fetch(:titre_identite)
= render partial: "shared/champs/piece_justificative/show", locals: { champ: champ }
- when TypeDeChamp.type_champs.fetch(:siret)
= render partial: "shared/champs/siret/show", locals: { champ: champ, profile: @profile }
- when TypeDeChamp.type_champs.fetch(:iban)
= render partial: "shared/champs/iban/show", locals: { champ: champ }
- when TypeDeChamp.type_champs.fetch(:textarea)
= render partial: "shared/champs/textarea/show", locals: { champ: champ }
- when TypeDeChamp.type_champs.fetch(:annuaire_education)
= render partial: "shared/champs/annuaire_education/show", locals: { champ: champ }
- when TypeDeChamp.type_champs.fetch(:cnaf)
= render partial: "shared/champs/cnaf/show", locals: { champ: champ, profile: @profile }
- when TypeDeChamp.type_champs.fetch(:dgfip)
= render partial: "shared/champs/dgfip/show", locals: { champ: champ, profile: @profile }
- when TypeDeChamp.type_champs.fetch(:pole_emploi)
= render partial: "shared/champs/pole_emploi/show", locals: { champ: champ, profile: @profile }
- when TypeDeChamp.type_champs.fetch(:mesri)
= render partial: "shared/champs/mesri/show", locals: { champ: champ, profile: @profile }
- when TypeDeChamp.type_champs.fetch(:address)
= render partial: "shared/champs/address/show", locals: { champ: champ }
- when TypeDeChamp.type_champs.fetch(:communes)
= render partial: "shared/champs/communes/show", locals: { champ: champ }
- when TypeDeChamp.type_champs.fetch(:regions)
= render partial: "shared/champs/regions/show", locals: { champ: champ }
- when TypeDeChamp.type_champs.fetch(:rna)
= render partial: "shared/champs/rna/show", locals: { champ: champ, profile: @profile }
- when TypeDeChamp.type_champs.fetch(:epci)
= render partial: "shared/champs/epci/show", locals: { champ: champ }
- when TypeDeChamp.type_champs.fetch(:date)
%p= champ.to_s
- when TypeDeChamp.type_champs.fetch(:datetime)
%p= champ.to_s
- when TypeDeChamp.type_champs.fetch(:number)
%p= number_with_html_delimiter(champ.to_s)
- else
%p= format_text_value(champ.to_s.strip) unless champ.blank?