2024-07-31 16:20:49 +02:00
|
|
|
= form_for form, url: contact_path, method: :post, multipart: true, class: 'fr-form-group', data: {controller: :contact } do |f|
|
2024-07-24 17:18:02 +02:00
|
|
|
%p.fr-hint-text= t('asterisk_html', scope: [:utils])
|
|
|
|
|
|
|
|
- if form.require_email?
|
|
|
|
= render Dsfr::InputComponent.new(form: f, attribute: :email, input_type: :email_field, opts: { autocomplete: 'email' }) do |c|
|
2024-07-30 19:14:04 +02:00
|
|
|
- c.with_label { ContactForm.human_attribute_name(form.for_admin? ? :email_pro : :email) }
|
2024-07-24 17:18:02 +02:00
|
|
|
|
2024-07-30 19:14:04 +02:00
|
|
|
%fieldset.fr-fieldset{ name: "question_type" }
|
2024-07-24 17:18:02 +02:00
|
|
|
%legend.fr-fieldset__legend.fr-fieldset__legend--regular
|
|
|
|
= t('.your_question')
|
|
|
|
= render EditableChamp::AsteriskMandatoryComponent.new
|
|
|
|
.fr-fieldset__content
|
|
|
|
- form.options.each do |(question, question_type, link)|
|
|
|
|
.fr-radio-group
|
2024-07-31 16:20:49 +02:00
|
|
|
= f.radio_button :question_type, question_type, required: true, data: {"contact-target": "inputRadio" }, checked: question_type == form.question_type
|
2024-07-30 19:14:04 +02:00
|
|
|
= f.label "question_type_#{question_type}", { 'aria-controls': link ? "card-#{question_type}" : nil, class: 'fr-label' } do
|
2024-07-24 17:18:02 +02:00
|
|
|
= question
|
|
|
|
|
|
|
|
- if link.present?
|
|
|
|
.fr-ml-3w{ id: "card-#{question_type}",
|
2024-07-30 19:14:04 +02:00
|
|
|
class: class_names('hidden' => question_type != form.question_type),
|
|
|
|
"aria-hidden": question_type != form.question_type,
|
2024-07-31 16:20:49 +02:00
|
|
|
data: { "contact-target": "content" } }
|
2024-07-24 17:18:02 +02:00
|
|
|
= render Dsfr::CalloutComponent.new(title: t('.our_answer')) do |c|
|
|
|
|
- c.with_html_body do
|
2024-07-31 16:20:49 +02:00
|
|
|
-# i18n-tasks-use t("contact.index.#{question_type}.answer_html")
|
|
|
|
= t('answer_html', scope: [:contact, :index, question_type], base_url: Current.application_base_url, "link_#{question_type}": link)
|
2024-07-24 17:18:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
- if form.for_admin?
|
|
|
|
= render Dsfr::InputComponent.new(form: f, attribute: :phone, required: false)
|
|
|
|
- else
|
|
|
|
= render Dsfr::InputComponent.new(form: f, attribute: :dossier_id, required: false)
|
|
|
|
|
|
|
|
= render Dsfr::InputComponent.new(form: f, attribute: :subject)
|
|
|
|
|
|
|
|
= render Dsfr::InputComponent.new(form: f, attribute: :text, input_type: :text_area, opts: { rows: 6 })
|
|
|
|
|
|
|
|
- if !form.for_admin?
|
|
|
|
.fr-upload-group
|
|
|
|
= f.label :piece_jointe, class: 'fr-label' do
|
|
|
|
= t('pj', scope: [:utils])
|
|
|
|
%span.fr-hint-text
|
|
|
|
= t('.notice_upload_group')
|
|
|
|
|
2024-07-30 19:14:04 +02:00
|
|
|
%p.notice.hidden{ data: { 'contact-type-only': ContactForm::TYPE_AMELIORATION } }
|
2024-07-24 17:18:02 +02:00
|
|
|
= t('.notice_pj_product')
|
2024-07-30 19:14:04 +02:00
|
|
|
%p.notice.hidden{ data: { 'contact-type-only': ContactForm::TYPE_AUTRE } }
|
2024-07-24 17:18:02 +02:00
|
|
|
= t('.notice_pj_other')
|
|
|
|
= f.file_field :piece_jointe, class: 'fr-upload', accept: '.jpg, .jpeg, .png, .pdf'
|
|
|
|
|
2024-07-30 19:14:04 +02:00
|
|
|
- f.object.tags.each_with_index do |tag, index|
|
|
|
|
= f.hidden_field :tags, name: f.field_name(:tags, multiple: true), id: f.field_id(:tag, index), value: tag
|
|
|
|
|
2024-07-24 17:18:02 +02:00
|
|
|
= f.hidden_field :for_admin
|
|
|
|
|
|
|
|
= invisible_captcha
|
|
|
|
|
|
|
|
.fr-input-group.fr-my-3w
|
|
|
|
= f.submit t('send_mail', scope: [:utils]), type: :submit, class: 'fr-btn', data: { disable: true }
|