demarches-normaliennes/app/views/users/description/show.html.haml
Xavier J 27dbd3a878 Add auto champs objects at a dossier (same as PJ)
Add dynamic of Champs on the description page
Rename model 'Champs' to 'Champ'
2015-11-03 15:27:49 +01:00

90 lines
No EOL
3.5 KiB
Text

.container#description_page
%h2 Description de votre projet
%br
= form_tag(url_for({controller: :description, action: :create, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST', multipart: true) do
%div
.row
.col-md-12
%h4 Nom de votre projet *
= text_field_tag :nom_projet, @dossier.nom_projet, placeholder: 'Nom du projet', class: 'form-control'
%br
.row
.col-md-12
%h4 Description de votre projet *
= text_area_tag :description, @dossier.description, rows: '6', placeholder: 'Description du projet', class: 'form-control'
%br
#liste_champs.row
-@dossier.champs.each do |champ|
%div{class: "type_champs-#{champ.type_champs}"}
%h4
= champ.libelle
-if champ.type_champs == 'textarea'
%textarea.form-control{name:"champs[#{champ.id}]",
placeholder: champ.libelle,
id: "champs_#{champ.id}"}
=champ.value
-else
%input.form-control{name:"champs[#{champ.id}]",
value: champ.value,
placeholder: champ.libelle,
id: "champs_#{champ.id}",
type:"#{champ.type_champs}",
'data-provide' => ('datepicker' if champ.type_champs == 'datetime'),
'data-date-format' => ('dd/mm/yyyy' if champ.type_champs == 'datetime')}
%h3 Documents administratifs
%br
//TODO a refactorer
%table{class:'table', style:'width:55%; margin-left:5%'}
%tr
%th{class:'col-lg-6'}
='Charger votre CERFA (.pdf)'
-if @procedure.lien_demarche != nil
%a{style:'font-size:0.9em; padding-left:3px', id: 'lien_cerfa' ,href: "#{@procedure.lien_demarche}", :target => '_blank'} Lien CERFA
%td{class:'col-lg-5'}
-if !@dossier.cerfa.empty?
%span.btn.btn-sm.btn-file.btn-success
Modifier
%input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: ".pdf"}
-else
%input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: ".pdf"}
- @dossier.pieces_justificatives.each do |piece_justificative|
%tr
%th.col-lg-6
= piece_justificative.libelle
%td.col-lg-5
-if piece_justificative.api_entreprise
%span.text-success{ id: "piece_justificative_#{piece_justificative.type}" } Nous l'avons récupéré pour vous.
-else
-if piece_justificative.empty?
= file_field_tag "piece_justificative_#{piece_justificative.type}", accept: '.pdf'
-else
%span.btn.btn-sm.btn-file.btn-success
Modifier
= file_field_tag "piece_justificative_#{piece_justificative.type}", accept: '.pdf'
- if (user_signed_in? && current_user.loged_in_with_france_connect) || gestionnaire_signed_in?
%tr
%th.col-lg-6
Attestation fiscale
%td.col-lg-6.col-md-6
%a{ href: "/attestation_fiscale_octo.pdf", target: '_blank'} Nous l'avons récupéré pour vous.
//END
%div{style: 'text-align:right'}
%h6 Tous les champs portant un * sont obligatoires.
-if !@dossier.draft?
=render partial: '/layouts/modifications_terminees'
-else
= submit_tag 'Soumettre mon dossier', id: 'suivant', class: %w(btn btn btn-success), style: 'float:right', data: { disable_with: 'Soumettre votre dossier', submit: true}
%br
%br