demarches-normaliennes/app/views/prefill_descriptions/_prefillable_entity_card.html.haml
2023-09-07 10:17:19 +02:00

42 lines
1.7 KiB
Text

- form_field = type_de_champ ? :selected_type_de_champ_ids : :identity_items_selected
.fr-col-md-6.fr-col-12
.card
.card-title.flex.justify-between.align-center
= title
= form_for prefill_description, url: prefill_description_path(prefill_description.path), data: { turbo: true } do |f|
- if already_included
= f.hidden_field form_field, value: all_entities - [new_entity]
= f.submit t("views.prefill_descriptions.edit.entity_remove"), class: 'fr-btn fr-btn--secondary fr-btn--md'
- elsif prefillable
= f.hidden_field form_field, value: all_entities + [new_entity]
= f.submit t("views.prefill_descriptions.edit.entity_add"), id: "#{new_entity}_add_button", class: 'fr-btn fr-btn--md'
- else
%button.fr-btn.fr-btn--secondary{ disabled: true }
= t("views.prefill_descriptions.edit.entity_unavailable")
%p
= description
%table.table.vertical
%tbody
- if type_de_champ
%tr
%th
= t("views.prefill_descriptions.edit.champ_id")
%td
= type_de_champ.to_typed_id_for_query
%tr
%th
= t("views.prefill_descriptions.edit.champ_type")
%td
= t("activerecord.attributes.type_de_champ.type_champs.#{type_de_champ.type_champ}")
%tr{ class: prefillable ? "" : "fr-text-mention--grey" }
%th
= t("views.prefill_descriptions.edit.possible_values.title")
%td
= possible_values
%tr{ class: prefillable ? "" : "fr-text-mention--grey" }
%th
= t("views.prefill_descriptions.edit.examples.title")
%td
= example_value