Correções de integração Fases 2/3 ↔ 4-8 + Auditoria UI + README final

This commit is contained in:
2026-06-11 18:48:44 -03:00
parent 8b3d4bc87f
commit 3b07e72d6e
19 changed files with 879 additions and 37 deletions

View File

@@ -44,6 +44,45 @@ class Configuracao < ApplicationRecord
valor('preco_desconto').to_f
end
# Mapa usado pelo DashboardController (Fase 3)
def self.mapa_de_precos
{
entrega: preco_entrega,
retirada: preco_retirada,
bonus: preco_bonus,
desconto: preco_desconto
}
end
LABELS = {
'preco_entrega' => 'Entrega Normal',
'preco_retirada' => 'Retirada',
'preco_bonus' => 'Bônus',
'preco_desconto' => 'Desconto',
'notificacao_whatsapp' => 'Notificação WhatsApp',
'notificacao_email' => 'Notificação E-mail',
'empresa_nome' => 'Nome da Empresa'
}.freeze
ICONES = {
'preco_entrega' => '🚚',
'preco_retirada' => '📦',
'preco_bonus' => '⭐',
'preco_desconto' => '⚠️',
'notificacao_whatsapp' => '💬',
'notificacao_email' => '✉️',
'empresa_nome' => '🏢'
}.freeze
# Usados pelas views admin/configuracoes (Fase 2)
def tipo_label
LABELS[chave] || chave.humanize
end
def icone
ICONES[chave] || '⚙️'
end
def moeda?
CHAVES_MOEDA.include?(chave)
end

View File

@@ -31,6 +31,10 @@ class Entrega < ApplicationRecord
where(route_id: route_id)
}
scope :do_mes, ->(data = Date.current) {
where(planned_date: data.beginning_of_month..data.end_of_month)
}
scope :da_conta_gade, -> {
where(account_id: ENV.fetch('DB_EXISTING_ACCOUNT_ID', 95907).to_i)
}