add cnaf ui

This commit is contained in:
simon lehericey 2021-09-21 14:49:54 +02:00
parent 40d0cfcdc4
commit 57a7f82a8f
10 changed files with 146 additions and 0 deletions

View file

@ -0,0 +1,10 @@
%table.cnaf
%caption #{t("api_particulier.providers.cnaf.scopes.adresse.libelle")} :
- for key in ['identite', 'complementIdentite', 'numeroRue', 'complementIdentiteGeo', 'lieuDit', 'codePostalVille', 'pays'] do
- if adresse[key].present?
%tr
%th= t("api_particulier.providers.cnaf.scopes.adresse.#{key}")
%td= adresse[key]

View file

@ -0,0 +1,19 @@
%table.cnaf.horizontal
%caption #{t("api_particulier.providers.cnaf.scopes.#{scope}.libelle")} :
%thead
%tr
- for key in ['nomPrenom', 'sexe', 'dateDeNaissance'] do
- if personnes.first[key].present?
%th{ class: "#{"text-right" if key == 'dateDeNaissance'}" }= t("api_particulier.providers.cnaf.scopes.personne.#{key}")
%tbody
- personnes.each do |personne|
%tr
- for key in ['nomPrenom', 'sexe', 'dateDeNaissance'] do
- if personne[key].present?
- case key
- when 'dateDeNaissance'
%td.text-right= try_format_datetime(Date.strptime(personne[key], "%d%m%Y"))
- when 'sexe'
%td= t("api_particulier.providers.cnaf.scopes.personne.#{personne[key]}")
- else
%td= personne[key]

View file

@ -0,0 +1,14 @@
%table.cnaf.horizontal
%caption #{t("api_particulier.providers.cnaf.scopes.quotient_familial.libelle")} :
%thead
%tr
- for key in ['quotientFamilial', 'mois', 'annee'] do
- if quotient_familial[key].present?
%th.text-right= t("api_particulier.providers.cnaf.scopes.quotient_familial.#{key}")
%tbody
%tr
- for key in ['quotientFamilial', 'mois', 'annee'] do
- if quotient_familial[key].present?
%td.text-right= quotient_familial[key]
- else
%td

View file

@ -0,0 +1,24 @@
- if champ.blank?
%p= t('.not_filled')
- elsif champ.data.blank?
%p= t('.fetching_data',
numero_allocataire: champ.numero_allocataire,
code_postal: champ.code_postal)
- else
- if profile == 'usager'
%p= t('.data_fetched',
sources: champ.procedure.api_particulier_sources['cnaf'].keys.map(&:to_s).join(', '),
numero_allocataire: champ.numero_allocataire,
code_postal: champ.code_postal)
- if profile == 'instructeur'
%p= t('.data_fetched_title')
- ['adresse', 'quotient_familial', 'enfants', 'allocataires'].each do |scope|
- if champ.data[scope].present?
- if scope == 'quotient_familial'
= render partial: 'shared/champs/cnaf/quotient_familial', locals: { quotient_familial: champ.data[scope] }
- if scope.in? ['enfants', 'allocataires']
= render partial: 'shared/champs/cnaf/personnes', locals: { scope: scope, personnes: champ.data[scope] }
- elsif scope == 'adresse'
= render partial: 'shared/champs/cnaf/adresse', locals: { adresse: champ.data[scope] }