Fases 7 e 8 — PDFs Prawn + QR + Painel Motorista + Notificações

This commit is contained in:
2026-06-11 18:31:38 -03:00
parent 90ed705ed8
commit 8b3d4bc87f
21 changed files with 942 additions and 23 deletions

View File

@@ -0,0 +1,73 @@
<%# app/views/motorista/dashboard/index.html.erb — Painel do Motorista %>
<% content_for :title, 'Meu Painel' %>
<div class="max-w-2xl mx-auto">
<h1 class="text-2xl font-bold text-white mb-1">Olá, <%= current_user.nome.split.first %>! 👋</h1>
<p class="text-gray-400 mb-6">Aqui estão seus valores de entregas.</p>
<%# ── 2 Cards grandes ─────────────────────────────────── %>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-8">
<%# Card 1 — Valor Estimado (LARANJA) %>
<div class="bg-orange-500 rounded-2xl p-6">
<p class="text-black/70 font-bold text-sm uppercase tracking-wide">💰 Valor estimado deste mês</p>
<p class="text-black font-black text-4xl mt-2"><%= moeda(@valor_estimado) %></p>
<p class="text-black/70 text-sm mt-2">
<%= @entregas_mes %> entregas feitas e confirmadas
</p>
<p class="text-black/50 text-xs mt-3">
⚠️ Valor aproximado. O valor certo sai quando a empresa fechar o pagamento.
</p>
</div>
<%# Card 2 — Valor Consolidado (BRANCO) %>
<div class="bg-white rounded-2xl p-6">
<p class="text-gray-500 font-bold text-sm uppercase tracking-wide">✅ Valor fechado para pagamento</p>
<p class="text-black font-black text-4xl mt-2"><%= moeda(@valor_consolidado) %></p>
<p class="text-gray-500 text-sm mt-2">
Soma dos pagamentos já confirmados pela empresa
</p>
</div>
</div>
<%# ── Lista de consolidações ──────────────────────────── %>
<h2 class="text-white font-bold text-lg mb-3">📋 Meus pagamentos</h2>
<% if @minhas_consolidacoes.any? %>
<div class="space-y-3">
<% @minhas_consolidacoes.each do |c| %>
<% cm = c.consolidacao_motoristas.find_by(motorista_nome: current_user.nome) %>
<div class="bg-[#1a1a1a] border border-[#2a2a2a] rounded-xl p-5">
<div class="flex flex-col md:flex-row md:items-center md:justify-between gap-3">
<div>
<div class="flex items-center gap-2">
<p class="text-white font-bold"><%= c.nome %></p>
<%= badge_status(c.status) %>
</div>
<p class="text-gray-400 text-sm mt-1">
📅 <%= l c.data_inicio, format: :short %> a <%= l c.data_fim, format: :short %>
</p>
<p class="text-orange-500 font-black text-xl mt-1"><%= moeda(cm&.valor_total || 0) %></p>
</div>
<% if c.finalizada? %>
<%= link_to '⬇️ Baixar meu holerite',
gerar_pdf_holerite_consolidacao_path(c, motorista: current_user.nome),
class: 'bg-orange-500 hover:bg-orange-600 text-black font-bold px-5 py-3.5 rounded-lg min-h-[48px] flex items-center justify-center text-center' %>
<% else %>
<span class="text-gray-500 text-sm px-4 py-3 border border-[#2a2a2a] rounded-lg text-center">
⏳ Aguardando fechamento
</span>
<% end %>
</div>
</div>
<% end %>
</div>
<% else %>
<div class="bg-[#1a1a1a] border border-[#2a2a2a] rounded-xl p-10 text-center">
<p class="text-4xl mb-3">📭</p>
<p class="text-gray-400">Você ainda não aparece em nenhum pagamento.</p>
<p class="text-gray-500 text-sm mt-1">Quando a empresa fechar um período com suas entregas, ele aparece aqui.</p>
</div>
<% end %>
</div>