Correções para funcionamento do dash,criar login do motorista senha, e gerar quelátório
This commit is contained in:
@@ -14,10 +14,11 @@
|
||||
</div>
|
||||
|
||||
<%# Filtro de calendário — seleciona uma faixa de datas %>
|
||||
<form id="dashboard-filtro-form" method="get" action="<%= dashboard_path %>" class="flex items-center gap-2">
|
||||
<form id="dashboard-filtro-form" method="get" action="<%= dashboard_path %>" data-turbo="false" class="flex items-center gap-2">
|
||||
<div class="relative">
|
||||
<span class="pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-orange-500">📅</span>
|
||||
<input type="text" id="periodo-range" readonly placeholder="Selecione o período"
|
||||
value="<%= @periodo_inicio.strftime('%d/%m/%Y') %> até <%= @periodo_fim.strftime('%d/%m/%Y') %>"
|
||||
class="cursor-pointer pl-4 pr-10 py-2.5 bg-[#1a1a1a] border border-white/10 rounded-xl
|
||||
text-white text-sm w-[240px] focus:outline-none focus:border-orange-500 placeholder-gray-500">
|
||||
</div>
|
||||
@@ -189,7 +190,11 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
|
||||
|
||||
<script>
|
||||
// IIFE: evita "Identifier already declared" quando o Turbo re-executa o script
|
||||
// ao navegar (o que antes fazia o gráfico não aparecer).
|
||||
(function () {
|
||||
const ctx = document.getElementById('grafico-diario');
|
||||
if (!ctx || typeof Chart === 'undefined') return;
|
||||
|
||||
const labels = <%= raw @grafico_diario[:labels].to_json %>;
|
||||
const valores = <%= raw @grafico_diario[:valores].to_json %>;
|
||||
@@ -254,4 +259,5 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user