<commit_before>.panel.panel-primary#trip_parameters_panel
  .panel-heading
    %h3.panel-title
      = translate_helper(:trip_parameters)
  .panel-body{style: 'padding: 5px;'}
    - if edit_mode == :show && @trip.is_linked?
      .form-group.col-sm-12
        .col-sm-3
          = label_tag :linked_trip, @trip.is_return? ?  translate_helper("outbound_trip_label") : translate_helper("return_trip_label")
        .col-sm-9
          - if @trip.is_return?
            %a{href: trip_path(@trip.outbound_trip) }
              = @trip.outbound_trip.id
          - else
            %a{href: trip_path(@trip.return_trip) }
              = @trip.return_trip.id
    - if @trip.provider && @trip.provider != current_provider
      .form-group.col-sm-12
        .col-sm-3
          = label_tag :trip_provider, translate_helper("trip_provider")
        .col-sm-9
          = @trip.provider.try(:name)
    .form-group.col-sm-12
      .col-sm-3
        = f.label :pickup_time, translate_helper("pickup_time")
      .col-sm-9
        = f.text_field :pickup_time, :value => @trip.pickup_time.try(:to_s, :form), class: 'datetime-picker form-control', readonly: true

    .form-group.col-sm-12
      .col-sm-3
        = f.label :appointment_time, translate_helper("appointment_time") 
      .col-sm-9
        = f.text_field :appointment_time, :value => @trip.appointment_time.try(:to_s, :form), class: 'datetime-picker form-control', readonly: true

    .form-group.col-sm-12
      .col-sm-3
        = f.label :direction, translate_helper("trip_direction")
      .col-sm-9
        = @trip.is_return? ? translate_helper("return_trip") : translate_helper("outbound_trip")

    .form-group.col-sm-12
      .col-sm-3
        = f.label :pickup_address_label, translate_helper("pickup_address")
      .col-sm-9
        = autocomplete_field_tag "pickup_search_address", @trip.pickup_address.try(:one_line_text), autocomplete_addresses_path(customer_id: @trip.try(:customer_id)), :size => 30, :id_element => "#trip_pickup_address_id", :delay => 500, :class => "nearly-full form-control", "data-original-value" => @trip.pickup_address.try(:text), "data-original-id" => @trip.pickup_address.try(:id) 
        - if edit_mode != :show
          = f.hidden_field :pickup_address_id
          %a{href:"javascript:edit_pickup_address();", class:"pickup_address_details details", style: "display: inline;"}
       
    .form-group.col-sm-12
      = f.fields_for :customer do |c|
        .col-sm-3
          = c.label :phone_number_1, translate_helper("customer_phone")
        .col-sm-9  
          = c.text_field :phone_number_1, :class => :full, class: 'form-control'

      - if @trip.customer.try(:id).blank?
        %input#trip_customer_attributes_id{type:"hidden", name:"trip[customer_attributes][id]"}

    .form-group.col-sm-12
      .col-sm-3
        = f.label :dropoff_address_label, translate_helper("dropoff_address") 
      .col-sm-9
        = autocomplete_field_tag "dropoff_search_address", @trip.dropoff_address.try(:one_line_text), autocomplete_addresses_path(customer_id: @trip.try(:customer_id)), :size => 30, :delay => 500, :update_elements => { :id => '#trip_dropoff_address_id', :default_trip_purpose => '#trip_trip_purpose'},:class => "nearly-full form-control", "data-original-value" => @trip.dropoff_address.try(:text), "data-original-id" => @trip.dropoff_address.try(:id) 
        - if edit_mode != :show
          = f.hidden_field :dropoff_address_id
          %a{href:"javascript:edit_dropoff_address();", class:"dropoff_address_details details", style: "display: inline;"}
       
    .form-group.col-sm-12
      .col-sm-3
        %label{for:"dropoff_phone"}
          = translate_helper("dropoff_phone")
      .col-sm-9
        %input.full.form-control#dropoff_phone{type:"text", size:"30", name:"dropoff_phone", value:"#{@trip.dropoff_address.try(:phone_number)}", readonly:"readonly"}

    .form-group.col-sm-12
      .col-sm-3
        = f.label :trip_purpose, translate_helper("trip_purpose")
      .col-sm-9
        = f.select :trip_purpose_id, @trip_purposes.map { |tp| [tp.name, tp.id] }, {:include_blank => true}, {class: 'form-control'}

    
    - if @customer.try(:id).present?
      .form-group.col-sm-12.passengers.group_size
        - if @customer.group
          .col-sm-3
            = f.label :group_size, translate_helper("group_size")
          .col-sm-9  
            = f.text_field :group_size, class: 'form-control col-sm-6 col-md-3'
        - else 
          .col-sm-3
            = f.label :guest_count, translate_helper("passengers")
          .col-sm-9{style: 'padding: 0px;'}
            .col-sm-6.col-md-3
              %span.nobreak
                = f.text_field :guest_count, class: 'form-control'
                &nbsp;
                =translate_helper("guests") 
                &nbsp;
            .col-sm-6.col-md-3
              %span.nobreak
                = f.text_field :attendant_count, class: 'form-control'
                &nbsp;
                = translate_helper("attendants")
    - else
      .form-group.col-sm-12.passengers.group_size
        = hidden_field_tag "trip_group"
        .col-sm-3
          = f.label :group_size, translate_helper("group_size")
        .col-sm-9
          = f.text_field :group_size, class: 'form-control'
      .form-group.col-sm-12.passengers
        .col-sm-3
          = f.label :guest_count, translate_helper("passengers")
        .col-sm-9{style: 'padding: 0px;'}
          .col-sm-6.col-md-3
            %span.nobreak
              = f.text_field :guest_count, class: 'form-control'
              &nbsp;Guests&nbsp;
          .col-sm-6.col-md-3
            %span.nobreak
              = f.text_field :attendant_count, class: 'form-control'
              &nbsp;
              = translate_helper("attendants")
    - if edit_mode == :show
      .form-group.col-sm-12
        .col-sm-3
          = f.label :drive_distance, translate_helper("drive_distance")
        .col-sm-9
          = @trip.drive_distance ? pluralize(@trip.drive_distance.round(3), 'mile') : ''

    .form-group.col-sm-12
      .col-sm-3
        = f.label :notes, translate_helper("trip_notes")
      .col-sm-9
        = f.text_area :notes, class: 'form-control'

:javascript
  // when trip pickup time is changed, update appointment time and displayed week
  $("body").on('change', '#trip_pickup_time', function() {
    var minDiff = 1000 * 60 * #{current_provider.try(:min_trip_time_gap_in_mins)};
    var pickupTimeDate      = ISODateFormatToDateObject( $('#trip_pickup_time').val());
    var appointmentTimeDate      = ISODateFormatToDateObject( $('#trip_appointment_time').val());
    if(!appointmentTimeDate || (appointmentTimeDate.getTime() - pickupTimeDate.getTime()) < minDiff ) {
      var newAppointmentTimeDate = new Date(pickupTimeDate.getTime() + minDiff);
      $('#trip_appointment_time').val( newAppointmentTimeDate.format("ddd yyyy-mm-dd hh:MM tt"));
    }
  });<commit_msg>Remove the influence from pickup time change on appointment time<commit_after>.panel.panel-primary#trip_parameters_panel
  .panel-heading
    %h3.panel-title
      = translate_helper(:trip_parameters)
  .panel-body{style: 'padding: 5px;'}
    - if edit_mode == :show && @trip.is_linked?
      .form-group.col-sm-12
        .col-sm-3
          = label_tag :linked_trip, @trip.is_return? ?  translate_helper("outbound_trip_label") : translate_helper("return_trip_label")
        .col-sm-9
          - if @trip.is_return?
            %a{href: trip_path(@trip.outbound_trip) }
              = @trip.outbound_trip.id
          - else
            %a{href: trip_path(@trip.return_trip) }
              = @trip.return_trip.id
    - if @trip.provider && @trip.provider != current_provider
      .form-group.col-sm-12
        .col-sm-3
          = label_tag :trip_provider, translate_helper("trip_provider")
        .col-sm-9
          = @trip.provider.try(:name)
    .form-group.col-sm-12
      .col-sm-3
        = f.label :pickup_time, translate_helper("pickup_time")
      .col-sm-9
        = f.text_field :pickup_time, :value => @trip.pickup_time.try(:to_s, :form), class: 'datetime-picker form-control', readonly: true

    .form-group.col-sm-12
      .col-sm-3
        = f.label :appointment_time, translate_helper("appointment_time") 
      .col-sm-9
        = f.text_field :appointment_time, :value => @trip.appointment_time.try(:to_s, :form), class: 'datetime-picker form-control', readonly: true

    .form-group.col-sm-12
      .col-sm-3
        = f.label :direction, translate_helper("trip_direction")
      .col-sm-9
        = @trip.is_return? ? translate_helper("return_trip") : translate_helper("outbound_trip")

    .form-group.col-sm-12
      .col-sm-3
        = f.label :pickup_address_label, translate_helper("pickup_address")
      .col-sm-9
        = autocomplete_field_tag "pickup_search_address", @trip.pickup_address.try(:one_line_text), autocomplete_addresses_path(customer_id: @trip.try(:customer_id)), :size => 30, :id_element => "#trip_pickup_address_id", :delay => 500, :class => "nearly-full form-control", "data-original-value" => @trip.pickup_address.try(:text), "data-original-id" => @trip.pickup_address.try(:id) 
        - if edit_mode != :show
          = f.hidden_field :pickup_address_id
          %a{href:"javascript:edit_pickup_address();", class:"pickup_address_details details", style: "display: inline;"}
       
    .form-group.col-sm-12
      = f.fields_for :customer do |c|
        .col-sm-3
          = c.label :phone_number_1, translate_helper("customer_phone")
        .col-sm-9  
          = c.text_field :phone_number_1, :class => :full, class: 'form-control'

      - if @trip.customer.try(:id).blank?
        %input#trip_customer_attributes_id{type:"hidden", name:"trip[customer_attributes][id]"}

    .form-group.col-sm-12
      .col-sm-3
        = f.label :dropoff_address_label, translate_helper("dropoff_address") 
      .col-sm-9
        = autocomplete_field_tag "dropoff_search_address", @trip.dropoff_address.try(:one_line_text), autocomplete_addresses_path(customer_id: @trip.try(:customer_id)), :size => 30, :delay => 500, :update_elements => { :id => '#trip_dropoff_address_id', :default_trip_purpose => '#trip_trip_purpose'},:class => "nearly-full form-control", "data-original-value" => @trip.dropoff_address.try(:text), "data-original-id" => @trip.dropoff_address.try(:id) 
        - if edit_mode != :show
          = f.hidden_field :dropoff_address_id
          %a{href:"javascript:edit_dropoff_address();", class:"dropoff_address_details details", style: "display: inline;"}
       
    .form-group.col-sm-12
      .col-sm-3
        %label{for:"dropoff_phone"}
          = translate_helper("dropoff_phone")
      .col-sm-9
        %input.full.form-control#dropoff_phone{type:"text", size:"30", name:"dropoff_phone", value:"#{@trip.dropoff_address.try(:phone_number)}", readonly:"readonly"}

    .form-group.col-sm-12
      .col-sm-3
        = f.label :trip_purpose, translate_helper("trip_purpose")
      .col-sm-9
        = f.select :trip_purpose_id, @trip_purposes.map { |tp| [tp.name, tp.id] }, {:include_blank => true}, {class: 'form-control'}

    
    - if @customer.try(:id).present?
      .form-group.col-sm-12.passengers.group_size
        - if @customer.group
          .col-sm-3
            = f.label :group_size, translate_helper("group_size")
          .col-sm-9  
            = f.text_field :group_size, class: 'form-control col-sm-6 col-md-3'
        - else 
          .col-sm-3
            = f.label :guest_count, translate_helper("passengers")
          .col-sm-9{style: 'padding: 0px;'}
            .col-sm-6.col-md-3
              %span.nobreak
                = f.text_field :guest_count, class: 'form-control'
                &nbsp;
                =translate_helper("guests") 
                &nbsp;
            .col-sm-6.col-md-3
              %span.nobreak
                = f.text_field :attendant_count, class: 'form-control'
                &nbsp;
                = translate_helper("attendants")
    - else
      .form-group.col-sm-12.passengers.group_size
        = hidden_field_tag "trip_group"
        .col-sm-3
          = f.label :group_size, translate_helper("group_size")
        .col-sm-9
          = f.text_field :group_size, class: 'form-control'
      .form-group.col-sm-12.passengers
        .col-sm-3
          = f.label :guest_count, translate_helper("passengers")
        .col-sm-9{style: 'padding: 0px;'}
          .col-sm-6.col-md-3
            %span.nobreak
              = f.text_field :guest_count, class: 'form-control'
              &nbsp;Guests&nbsp;
          .col-sm-6.col-md-3
            %span.nobreak
              = f.text_field :attendant_count, class: 'form-control'
              &nbsp;
              = translate_helper("attendants")
    - if edit_mode == :show
      .form-group.col-sm-12
        .col-sm-3
          = f.label :drive_distance, translate_helper("drive_distance")
        .col-sm-9
          = @trip.drive_distance ? pluralize(@trip.drive_distance.round(3), 'mile') : ''

    .form-group.col-sm-12
      .col-sm-3
        = f.label :notes, translate_helper("trip_notes")
      .col-sm-9
        = f.text_area :notes, class: 'form-control'

/ :javascript
/   // when trip pickup time is changed, update appointment time and displayed week
/   $("body").on('change', '#trip_pickup_time', function() {
/     var minDiff = 1000 * 60 * #{current_provider.try(:min_trip_time_gap_in_mins)};
/     var pickupTimeDate      = ISODateFormatToDateObject( $('#trip_pickup_time').val());
/     var appointmentTimeDate      = ISODateFormatToDateObject( $('#trip_appointment_time').val());
/     if(!appointmentTimeDate || (appointmentTimeDate.getTime() - pickupTimeDate.getTime()) < minDiff ) {
/       var newAppointmentTimeDate = new Date(pickupTimeDate.getTime() + minDiff);
/       $('#trip_appointment_time').val( newAppointmentTimeDate.format("ddd yyyy-mm-dd hh:MM tt"));
/     }
/   });
{'fraction_non_alphanumeric': 0.14902157551430004, 'fraction_numerical': 0.013905813203354598, 'mean_word_length': 2.5664621676891617, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2487391', 'n_tokens_mistral': 4910, 'n_tokens_neox': 4662, 'n_words': 689}