Fases 4, 5 e 6 — Job 1h + Auditoria + Consolidação + Wizard de validação
This commit is contained in:
91
app/views/consolidacoes/wizard.html.erb
Normal file
91
app/views/consolidacoes/wizard.html.erb
Normal file
@@ -0,0 +1,91 @@
|
||||
<%# app/views/consolidacoes/wizard.html.erb — PASSO 1: Selecionar motorista %>
|
||||
<% content_for :title, "Wizard — #{@consolidacao.nome}" %>
|
||||
|
||||
<div class="max-w-3xl mx-auto">
|
||||
|
||||
<%# Header do wizard %>
|
||||
<div class="mb-6">
|
||||
<%= link_to '← Voltar para consolidações', consolidacoes_path, class: 'text-gray-500 hover:text-orange-500 text-sm' %>
|
||||
<h1 class="text-2xl font-bold text-white mt-2"><%= @consolidacao.nome %></h1>
|
||||
<p class="text-gray-400 text-sm">
|
||||
📅 <%= l @consolidacao.data_inicio, format: :short %> → <%= l @consolidacao.data_fim, format: :short %>
|
||||
· <%= badge_status(@consolidacao.status) %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<%# Indicador de passos %>
|
||||
<div class="flex items-center gap-2 mb-8">
|
||||
<div class="flex items-center gap-2 text-orange-500 font-bold">
|
||||
<span class="w-8 h-8 bg-orange-500 text-black rounded-full flex items-center justify-center">1</span>
|
||||
Selecionar motorista
|
||||
</div>
|
||||
<div class="flex-1 h-px bg-[#2a2a2a]"></div>
|
||||
<div class="flex items-center gap-2 text-gray-600">
|
||||
<span class="w-8 h-8 bg-[#1a1a1a] border border-[#2a2a2a] rounded-full flex items-center justify-center">2</span>
|
||||
Validar entregas
|
||||
</div>
|
||||
<div class="flex-1 h-px bg-[#2a2a2a]"></div>
|
||||
<div class="flex items-center gap-2 text-gray-600">
|
||||
<span class="w-8 h-8 bg-[#1a1a1a] border border-[#2a2a2a] rounded-full flex items-center justify-center">3</span>
|
||||
Revisar
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%# Lista de motoristas %>
|
||||
<div class="space-y-3">
|
||||
<% @motoristas.each do |m| %>
|
||||
<%= link_to validar_consolidacao_consolidacao_entregas_path(@consolidacao, motorista: m[:registro].motorista_nome),
|
||||
class: "block bg-[#1a1a1a] border rounded-xl p-5 transition-colors
|
||||
#{m[:completo] ? 'border-green-600 hover:border-green-500' : 'border-[#2a2a2a] hover:border-orange-500'}" do %>
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="w-12 h-12 rounded-full flex items-center justify-center text-xl font-black
|
||||
<%= m[:completo] ? 'bg-green-600 text-white' : 'bg-orange-500 text-black' %>">
|
||||
<%= m[:completo] ? '✓' : m[:registro].motorista_nome.first.upcase %>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-white font-bold text-lg"><%= m[:registro].motorista_nome %></p>
|
||||
<p class="text-gray-400 text-sm">
|
||||
<%= m[:total] %> entregas pagas no período
|
||||
· <span class="<%= m[:completo] ? 'text-green-400' : 'text-orange-400' %>">
|
||||
<%= m[:classificadas] %>/<%= m[:total] %> classificadas
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<p class="text-orange-500 font-bold"><%= moeda(m[:registro].valor_total) %></p>
|
||||
<span class="text-gray-600 text-2xl">→</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<% pct = m[:total].zero? ? 0 : (m[:classificadas] * 100 / m[:total]) %>
|
||||
<div class="w-full bg-[#0a0a0a] rounded-full h-2">
|
||||
<div class="h-2 rounded-full <%= m[:completo] ? 'bg-green-500' : 'bg-orange-500' %> transition-all"
|
||||
style="width: <%= pct %>%"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%# Finalizar — só habilita se tudo classificado %>
|
||||
<% tudo_completo = @motoristas.all? { |m| m[:completo] } && @motoristas.any? %>
|
||||
<div class="mt-8 bg-[#1a1a1a] border border-[#2a2a2a] rounded-xl p-5 flex items-center justify-between">
|
||||
<div>
|
||||
<p class="text-white font-bold">Total da consolidação</p>
|
||||
<p class="text-orange-500 font-black text-3xl"><%= moeda(@consolidacao.valor_total) %></p>
|
||||
</div>
|
||||
<% if @consolidacao.rascunho? %>
|
||||
<%= button_to 'Finalizar consolidação ✓', finalizar_consolidacao_path(@consolidacao),
|
||||
method: :post,
|
||||
disabled: !tudo_completo,
|
||||
data: { turbo_confirm: 'Finalizar? Após finalizada, a consolidação não poderá ser editada por operadores.' },
|
||||
class: "font-bold px-6 py-3.5 rounded-lg min-h-[48px] transition-colors
|
||||
#{tudo_completo ? 'bg-green-600 hover:bg-green-500 text-white cursor-pointer' : 'bg-[#2a2a2a] text-gray-600 cursor-not-allowed'}" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% unless tudo_completo %>
|
||||
<p class="text-gray-500 text-sm mt-2 text-center">⚠️ Classifique todas as entregas de todos os motoristas para poder finalizar.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
Reference in New Issue
Block a user