Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/javascripts/customers.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ const customers_edit = function (params) {
zIndexOffset: 1000
});

$('#customer_destination_duration, #customer_visit_duration').timeEntry({
$('#customer_destination_duration, #customer_visit_duration, #customer_store_reload_duration').timeEntry({
show24Hours: true,
showSeconds: true,
initialField: 1,
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/customers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def customer_params
:test,
:destination_duration,
:visit_duration,
:store_reload_duration,
:default_country,
:with_state,
:max_vehicles,
Expand Down Expand Up @@ -269,6 +270,7 @@ def customer_params
:vehicle_max_upper_bound,
:destination_duration,
:visit_duration,
:store_reload_duration,
:default_country,
:with_state,
:print_planning_annotating,
Expand Down
5 changes: 3 additions & 2 deletions app/models/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ class Customer < ApplicationRecord
include TimeAttr
attribute :visit_duration, ScheduleType.new
attribute :destination_duration, ScheduleType.new
attribute :store_reload_duration, ScheduleType.new
attribute :stop_max_upper_bound, ScheduleType.new
attribute :vehicle_max_upper_bound, ScheduleType.new
time_attr :visit_duration, :destination_duration, :stop_max_upper_bound, :vehicle_max_upper_bound
time_attr :visit_duration, :destination_duration, :stop_max_upper_bound, :store_reload_duration, :vehicle_max_upper_bound

attr_reader :layer_id # used for importation

Expand Down Expand Up @@ -496,7 +497,7 @@ def create_default_deliverable_unit
end

def update_outdated
if optimization_force_start_changed? || visit_duration_changed? || destination_duration_changed? || router_id_changed? || router_dimension_changed? || router_options_changed? || speed_multiplier_changed? || @deliverable_units_updated
if optimization_force_start_changed? || visit_duration_changed? || destination_duration_changed? || store_reload_duration_changed? || router_id_changed? || router_dimension_changed? || router_options_changed? || speed_multiplier_changed? || @deliverable_units_updated
plannings.each { |planning|
planning.routes.each { |route|
route.outdated = true
Expand Down
4 changes: 2 additions & 2 deletions app/models/store_reload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ def position
end

def default_duration
duration || store.customer.visit_duration
duration || store.customer.store_reload_duration
end

def default_duration_time_with_seconds
duration_time_with_seconds || store.customer.visit_duration_time_with_seconds
duration_time_with_seconds || store.customer.store_reload_duration_time_with_seconds
end

def base_id
Expand Down
1 change: 1 addition & 0 deletions app/views/customers/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@

<%= f.text_field :destination_duration, {help: t('.destination_duration_help'), placeholder: t('all.unit.hour_minute_second'), value: @customer.destination_duration_time_with_seconds, append: content_tag('i', '', class: 'fa fa-map-marker fa-fw')} %>
<%= f.text_field :visit_duration, {help: t('.visit_duration_help'), placeholder: t('all.unit.hour_minute_second'), value: @customer.visit_duration_time_with_seconds, append: content_tag('i', '', class: 'fa fa-stopwatch fa-fw')} %>
<%= f.text_field :store_reload_duration, {help: t('.store_reload_duration_help'), placeholder: t('all.unit.hour_minute_second'), value: @customer.store_reload_duration_time_with_seconds, append: content_tag('i', '', class: 'fa fa-stopwatch fa-fw')} %>
<%= f.text_field :default_country, required: true %>
<%= render partial: 'shared/check_box', locals: { form: f, field: :with_state, label: t('activerecord.attributes.customer.with_state') } %>

Expand Down
2 changes: 1 addition & 1 deletion app/views/store_reloads/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
%p.help-block= t '.ref_help'
= f.text_field :duration,
value: store_reload.default_duration_time_with_seconds,
placeholder: store_reload.store.customer.visit_duration ? "#{store_reload.store.customer.visit_duration_time_with_seconds} (#{t('.duration_default')})" : t('all.unit.hour_minute_second'),
placeholder: store_reload.store.customer.store_reload_duration ? "#{store_reload.store.customer.store_reload_duration_time_with_seconds} (#{t('.duration_default')})" : t('all.unit.hour_minute_second'),
append: content_tag('i', '', class: 'fa fa-stopwatch fa-fw'),
help: t('.duration_help')

Expand Down
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ en:
max_vehicle_usage_sets: Max vehicles base settings
visit_duration: Visit duration
destination_duration: Destination duration
store_reload_duration: Store reload duration
default_country: Default country
with_state: Add State field in addresses
optimization_max_split_size: Optimization split size
Expand Down Expand Up @@ -1064,6 +1065,7 @@ en:
<strong>%{profile}</strong>
visit_duration_help: Average time per account
destination_duration_help: Average time per destination
store_reload_duration_help: Average time per store reload
value_default: '%{n} (default value)'
max_plannings_help: Maximum number of allowed plans into the account.
max_zonings_help: Maximum number of allowed sectorisations into the account.
Expand Down Expand Up @@ -1938,6 +1940,7 @@ en:
total_cost_help: Total cost
driving_time_help: Total driving time
visit_duration_help: Total visits duration
store_reload_duration_help: Total store reload duration
wait_time_help: Total waiting time
speed_help: Speed average for the whole planning
vehicles_used_help: Vehicles used / Total
Expand Down
3 changes: 3 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ fr:
max_vehicle_usage_sets: Max configurations des véhicules
visit_duration: Durée de visite
destination_duration: Durée de visite par destination
store_reload_duration: Durée de rechargement moyenne par site
default_country: Pays par défaut
with_state: Ajouter champ État dans les adresses
optimization_max_split_size: Découper le problème
Expand Down Expand Up @@ -1091,6 +1092,7 @@ fr:
value_default: '%{n} (valeur par défaut)'
visit_duration_help: Durée de visite moyenne par client
destination_duration_help: Durée de visite par destination
store_reload_duration_help: Durée de rechargement moyenne par site
max_plannings_help: Nombre maximal de plans autorisés dans le compte.
max_zonings_help: Nombre maximal de sectorisations autorisés dans le compte.
max_destinations_help: Nombre maximal d'adresses autorisés dans le compte.
Expand Down Expand Up @@ -2030,6 +2032,7 @@ fr:
total_cost_help: Somme des coûts
driving_time_help: Somme des durées de conduite
visit_duration_help: Somme des durées des visites
store_reload_duration_help: Somme des durées des rechargements
wait_time_help: Somme des temps d'attentes
speed_help: Vitesse moyenne pour l'ensemble des tournées
vehicles_used_help: Nombre de véhicules utilisés / total
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddCustomerStoreReloadDuration < ActiveRecord::Migration[6.1]
def change
add_column :customers, :store_reload_duration, :integer
end
end
6 changes: 4 additions & 2 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ CREATE TABLE public.customers (
vehicles_count integer DEFAULT 0 NOT NULL,
enable_sms_intransit boolean DEFAULT false,
enable_store_stops boolean DEFAULT false,
enable_vehicle_costs boolean DEFAULT false NOT NULL
enable_vehicle_costs boolean DEFAULT false NOT NULL,
store_reload_duration integer
);


Expand Down Expand Up @@ -3570,6 +3571,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20251002141623'),
('20251013080039'),
('20251114122111'),
('20251208090000');
('20251208090000'),
('20251212122356');


Loading