app/views/lines/_form.html.slim
- javascript_additional_packs 'lines/form'
= simple_form_for [@workbench, :line_referential, @line], html: {class: 'form-horizontal', id: 'lines_form'}, wrapper: :horizontal_form do |f|
.row
.col-lg-12 x-data="{ transport_mode: '#{@line.transport_mode}' || 'bus'}"
h2.mb-lg= t("lines.form.sections.identification")
= f.input :name
= f.input :published_name
= f.input :number
= f.input :transport_mode, as: :select, collection: Chouette::Line.sorted_transport_modes, label: Chouette::Line.tmf('transport_mode'), label_method: lambda {|t| ("<span>" + t("enumerize.transport_mode.#{t}") + "</span>").html_safe}, required: true, prompt: '', input_html: { 'x-on:change': 'transport_mode = $event.target.value' }
- Chouette::Line.formatted_submodes_for_transports.each do |mode, submodes|
.transport_mode x-show="transport_mode === '#{mode}'"
= f.input :transport_submode, as: :select, collection: submodes, include_blank: false, input_html: { 'x-bind:disabled': "transport_mode != '#{mode}'" }
= f.input :flexible_service, as: :switchable_checkbox
= f.input :seasonal, as: :switchable_checkbox
.separator.section_separator
.row
.col-lg-12
h2.mb-lg= t("lines.form.sections.hierarchy")
= f.input :company_id, as: :select, :collection => @line_referential.companies.order(Arel.sql('lower(name) asc')), include_blank: true
= f.input :secondary_company_ids, :collection => @line_referential.companies.order(Arel.sql('lower(name) asc')), include_blank: false, input_html: { multiple: true, 'data-select2ed': true }, label: Chouette::Line.tmf(:secondary_companies)
= f.input :network_id, as: :select, :collection => @line_referential.networks.order(Arel.sql('lower(name) asc')), include_blank: true
.separator.section_separator
.row
.col-lg-12 x-data="{ isReferentActivated: #{@line.is_referent} }"
h2.mb-lg= t("stop_areas.form.sections.referent")
= f.input :is_referent, as: :switchable_checkbox, input_html: { checked: @line.is_referent, 'x-on:click': 'isReferentActivated = !isReferentActivated' }
= f.input :referent_id, as: :select, collection: [f.object.referent_id], input_html: { style: 'width: 100%', 'x-bind:disabled': "isReferentActivated", data: { select2ed_placeholder: Chouette::StopArea.tmf('referent'), select2ed_allow_clear: true, select2_ajax: true, url: (autocomplete_workbench_line_referential_lines_path(@workbench)), initvalue: {id: f.object.referent_id, text: f.object.referent.try(:name)}}}, wrapper_html: { id: 'referent_input', class: 'inline-form', 'x-bind:class': "{ 'disabled': isReferentActivated }" }
.separator.section_separator
.row
.col-lg-12
h2.mb-lg= t("lines.form.sections.internals")
= f.association :line_provider, as: :select, collection: candidate_line_providers, include_blank: false
= f.input :comment, as: :text, input_html: { rows: 5, title: t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.comment") }
.separator.section_separator
= render 'codes/form', form: f
.separator.section_separator
- if resource_policy.update_activation_dates?
.row
.col-lg-12
h2.mb-lg= t("lines.form.sections.activation")
= f.input :activated, as: :switchable_checkbox
= f.input :active_from, as: :date_picker
= f.input :active_until, as: :date_picker
.separator.section_separator
.row
.col-lg-12
h2.mb-lg= t("lines.form.sections.publication_data")
= f.input :color, as: :color_picker
= f.input :text_color, as: :color_picker
= f.input :url
.separator.section_separator
.row
.col-lg-12
h2.mb-lg= t("lines.form.sections.accessibility")
= f.input :mobility_impaired_accessibility, as: :select, include_blank: false
.row
.col-md-6
= f.input :wheelchair_accessibility, as: :select, include_blank: false
= f.input :step_free_accessibility, as: :select, include_blank: false
= f.input :escalator_free_accessibility, as: :select, include_blank: false
.col-md-6
= f.input :lift_free_accessibility, as: :select, include_blank: false
= f.input :audible_signals_availability, as: :select, include_blank: false
= f.input :visual_signs_availability, as: :select, include_blank: false
.row
.col-lg-12
= f.input :accessibility_limitation_description
= cancel_button
= f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'lines_form'