diff --git a/app/controllers/motorista/dashboard_controller.rb b/app/controllers/motorista/dashboard_controller.rb index 5a155e5..5389fa8 100644 --- a/app/controllers/motorista/dashboard_controller.rb +++ b/app/controllers/motorista/dashboard_controller.rb @@ -8,9 +8,11 @@ module Motorista nome = current_user.nome # Card 1 — Valor ESTIMADO (mês atual): entregas pagas × preco_entrega + @estimado_inicio = Date.current.beginning_of_month + @estimado_fim = Date.current entregas_mes = Entrega.pagas.da_conta_gade .do_motorista(nome) - .no_periodo(Date.current.beginning_of_month, Date.current) + .no_periodo(@estimado_inicio, @estimado_fim) .count @valor_estimado = entregas_mes * Configuracao.preco_entrega @entregas_mes = entregas_mes diff --git a/app/views/motorista/dashboard/index.html.erb b/app/views/motorista/dashboard/index.html.erb index 831a4fe..14e3c1f 100644 --- a/app/views/motorista/dashboard/index.html.erb +++ b/app/views/motorista/dashboard/index.html.erb @@ -34,6 +34,7 @@ <%# Card 1 — Valor Estimado (LARANJA) %>

💰 Valor estimado deste mês

+

📅 <%= l @estimado_inicio, format: :short %> a <%= l @estimado_fim, format: :short %>

<%= moeda(@valor_estimado) %>

<%= @entregas_mes %> entregas feitas e confirmadas