aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/stop_areas/_form.html.slim
blob: 2ac3166329464f43f5f72ef028b4ed61d493652c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
= simple_form_for [@stop_area_referential, @stop_area], html: {class: 'form-horizontal', id: 'stop_area_form'}, wrapper: :horizontal_form do |f|
  .row
    .col-lg-12
      - if !manage_itl
        = f.input :id, as: :hidden
        = f.input :name, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.name")}
        - if has_feature?(:stop_area_localized_names)
          .form-group
            .col-sm-3.col-xs-5
            .col-sm-9.col-xs-7
              - f.object.localized_names.each do |k, v|
                .col-md-6= f.input "localized_names[#{k}]", input_html: {value: v}, label: label_for_country(k)

        = f.input :kind,
            as: :radio_buttons,
            checked: @stop_area.new_record? ? :commercial : @stop_area.kind,
            input_html: { disabled: !@stop_area.new_record? },
            include_blank: false,
            item_wrapper_class: 'radio-inline',
            wrapper: :horizontal_form,
            disabled: !@stop_area.new_record?
        .slave data-master="[name='stop_area[kind]']" data-value="commercial"
          = f.input :parent_id, as: :select, :collection => [f.object.parent_id], input_html: { data: { select2_ajax: 'true', url: autocomplete_stop_area_referential_stop_areas_path(@stop_area_referential), initvalue: {id: f.object.parent_id, text: f.object.parent.try(:full_name)}}}
        - %i(non_commercial commercial).each do |kind|
          .slave data-master="[name='stop_area[kind]']" data-value=kind
            = f.input :area_type, as: :select, :input_html => {id: kind, :disabled => !@stop_area.new_record?}, :collection => Chouette::AreaType.options(kind), :include_blank => false, disabled: !@stop_area.new_record?

        = f.input :status, as: :select, :collection => stop_area_status_options, :include_blank => false

        .location_info
          h3 = t("stop_areas.stop_area.localisation")

            label = t('.geolocalize')
            input.typeahead.form-control.input-lg maxlength="255" type="text" placeholder="#{t('.address')}"

          - unless @stop_area.projection.blank? or @stop_area.projection_type_label.empty?
            = f.input :projection_xy, :label => t("activerecord.attributes.stop_area.projection_xy", :projection => @referential.projection_type_label), :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.projection_xy")}

          = f.input :coordinates, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.coordinates")}
          = f.input :street_name
          = f.input :zip_code, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.zip_code")}
          = f.input :city_name, required: format_restriction_for_locales(@referential) == '.hub', :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.city_name")}
          = f.input :country_code, as: :country, priority: ['FR', 'GB', 'DE', 'ES'], :include_blank => true

        .stop_areas.stop_area.general_info
          h3 = t("stop_areas.stop_area.general")

          - if has_feature?(:stop_area_waiting_time)
            = f.input :waiting_time, input_html: { min: 0 }

          = f.input :registration_number, required: stop_area_registration_number_is_required(f.object), :input_html => {title: stop_area_registration_number_title(f.object), value: stop_area_registration_number_value(f.object)}, hint: stop_area_registration_number_hint
          = f.input :fare_code
          = f.input :nearest_topic_name, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.nearest_topic_name")}
          = f.input :comment, as: :text, :input_html => {:rows => 5, :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.comment")}
          = f.input :time_zone, as: :full_time_zone, include_blank: true
          = f.input :url

        .pmr_info
          h3 = t("stop_areas.stop_area.accessibility")
          - if !manage_itl
            = f.input :mobility_restricted_suitability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true
            = f.input :stairs_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true
            = f.input :lift_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true

        - if resource.custom_fields.present?
          .custom_fields
            h3 = t("stop_areas.stop_area.custom_fields")
            - resource.custom_fields.each do |code, field|
              = field.input(f).to_s

  .separator

  = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'stop_area_form'

= javascript_pack_tag "stop_areas/new"