Alteração do Mapa com os pontos da onde foi entreque

This commit is contained in:
2026-06-29 21:16:22 -03:00
parent 7d6c79f878
commit 4c035d4a4c
2 changed files with 51 additions and 11 deletions

View File

@@ -181,7 +181,8 @@ module Analytics
endereco: r['endereco_completo'].presence || r['address'].presence,
unidade: r['contact_name'],
motorista: r['driver'],
checkout: data_de(r['checkout'])&.strftime('%d/%m/%Y')
checkout: data_de(r['checkout'])&.strftime('%d/%m/%Y'),
foto: foto_url(r['foto_da_fachada'])
}
end.first(MAX_PONTOS)
end
@@ -218,6 +219,12 @@ module Analytics
nil
end
# Só aceita URL http(s) — evita injetar lixo no <img src> do popup.
def foto_url(valor)
url = valor.to_s.strip
url.match?(%r{\Ahttps?://}i) ? url : nil
end
def carregar
return [] if @tabelas.empty?
@@ -229,7 +236,7 @@ module Analytics
<<~SQL.strip
SELECT #{label} AS operacao,
r.reference_id, r.driver, r.status, r.observation, r.contact_name, r.address,
r.checkout, r.planned_date,
r.checkout, r.planned_date, r.foto_da_fachada,
r.latitude, r.longitude,
r.checkout_latitude, r.checkout_longitude,
#{selects_gade(conn, tabela)}