Adição de mais um preço 'Termo especial'

This commit is contained in:
2026-07-15 16:27:20 -03:00
parent e129e991e4
commit 5af51534be
13 changed files with 158 additions and 62 deletions

View File

@@ -12,14 +12,15 @@
</div>
<%# Resumo por tipo %>
<div class="grid grid-cols-2 md:grid-cols-6 gap-3 mb-6">
<div class="grid grid-cols-2 md:grid-cols-7 gap-3 mb-6">
<% [
['entrega_normal', 'Normal', 'bg-orange-500 text-black'],
['retirada', 'Retirada', 'bg-orange-800 text-white'],
['bonus', 'Bônus', 'bg-white text-black'],
['desconto', 'Desconto', 'bg-black text-white border border-gray-700'],
['extraordinaria', 'Extraordinária', 'bg-purple-600 text-white'],
['termo', 'Termo', 'bg-blue-600 text-white']
['termo', 'Termo', 'bg-blue-600 text-white'],
['termo_especial', 'Termo Especial', 'bg-cyan-600 text-white']
].each do |tipo, label, cores| %>
<div class="<%= cores %> rounded-xl p-4 text-center">
<p class="font-black text-3xl"><%= @resumo[tipo] || 0 %></p>
@@ -67,7 +68,7 @@
<td class="px-4 py-3 text-gray-300 text-xs"><%= c.entrega_original&.address.presence || endereco_manual.presence || '—' %></td>
<td class="px-4 py-3">
<span class="<%= c.tipo_cor[:bg] %> <%= c.tipo_cor[:text] %> px-2 py-1 rounded text-xs font-bold">
<%= c.tipo_cor[:label] %><% if c.termo? && c.quantidade > 1 %> ×<%= c.quantidade %><% end %>
<%= c.tipo_cor[:label] %><% if (c.termo? || c.termo_especial?) && c.quantidade > 1 %> ×<%= c.quantidade %><% end %>
</span>
<% if c.manual? %>
<span class="ml-1 bg-orange-500/15 text-orange-400 border border-orange-500/40 px-2 py-1 rounded text-xs font-bold"> Apontamento</span>

View File

@@ -288,20 +288,14 @@
<button type="button" data-action="apontamento-termo#fechar"
class="text-gray-500 hover:text-white text-2xl leading-none">✕</button>
</div>
<p class="text-gray-400 text-sm mb-4">Entrega sem nota fiscal nem código de rastreio. Informe quantos termos foram entregues.</p>
<p class="text-gray-400 text-sm mb-4">Entrega sem nota fiscal nem código de rastreio. Informe quantos termos de cada tipo foram entregues.</p>
<p data-apontamento-termo-target="erro" class="hidden bg-red-500/10 text-red-400 border border-red-500/30 rounded-lg px-3 py-2 text-sm mb-3"></p>
<%# Motorista (contexto da tela) + preço unitário %>
<div class="flex items-center justify-between bg-[#0a0a0a] border border-[#2a2a2a] rounded-lg px-4 py-3 mb-4">
<div>
<p class="text-gray-500 text-xs">Motorista</p>
<p class="text-white font-semibold">🚚 <%= @motorista %></p>
</div>
<div class="text-right">
<p class="text-gray-500 text-xs">Preço por termo</p>
<p class="text-blue-400 font-semibold"><%= moeda(Configuracao.preco_termo) %></p>
</div>
<%# Motorista (contexto da tela) %>
<div class="bg-[#0a0a0a] border border-[#2a2a2a] rounded-lg px-4 py-3 mb-4">
<p class="text-gray-500 text-xs">Motorista</p>
<p class="text-white font-semibold">🚚 <%= @motorista %></p>
</div>
<%# Veículo (Q3) — a qual carro estes termos pertencem %>
@@ -314,15 +308,32 @@
<% end %>
</select>
<%# Stepper de quantidade %>
<label class="block text-gray-400 text-sm mb-2">Quantidade de termos</label>
<div class="flex items-center justify-center gap-3 mb-5">
<button type="button" data-action="apontamento-termo#menos"
class="w-12 h-12 rounded-lg bg-[#0a0a0a] border border-[#2a2a2a] hover:border-blue-500 text-white text-2xl font-bold leading-none"></button>
<input data-apontamento-termo-target="quantidade" type="text" inputmode="numeric" value="1" readonly
class="w-24 text-center bg-[#0a0a0a] border border-[#2a2a2a] text-white text-2xl font-bold rounded-lg py-2.5 focus:outline-none">
<button type="button" data-action="apontamento-termo#mais"
class="w-12 h-12 rounded-lg bg-[#0a0a0a] border border-[#2a2a2a] hover:border-blue-500 text-white text-2xl font-bold leading-none">+</button>
<%# Steppers de quantidade — termo normal e termo especial %>
<div class="grid grid-cols-2 gap-3 mb-5">
<div class="bg-[#0a0a0a] border border-[#2a2a2a] rounded-lg p-3">
<p class="text-white text-sm font-semibold text-center">📄 Termo Normal</p>
<p class="text-blue-400 text-xs text-center mb-2"><%= moeda(@precos[:termo]) %> cada</p>
<div class="flex items-center justify-center gap-2">
<button type="button" data-action="apontamento-termo#menos"
class="w-10 h-10 rounded-lg bg-[#1a1a1a] border border-[#2a2a2a] hover:border-blue-500 text-white text-xl font-bold leading-none"></button>
<input data-apontamento-termo-target="quantidade" type="text" inputmode="numeric" value="1" readonly
class="w-14 text-center bg-[#1a1a1a] border border-[#2a2a2a] text-white text-xl font-bold rounded-lg py-2 focus:outline-none">
<button type="button" data-action="apontamento-termo#mais"
class="w-10 h-10 rounded-lg bg-[#1a1a1a] border border-[#2a2a2a] hover:border-blue-500 text-white text-xl font-bold leading-none">+</button>
</div>
</div>
<div class="bg-[#0a0a0a] border border-[#2a2a2a] rounded-lg p-3">
<p class="text-white text-sm font-semibold text-center">📋 Termo Especial</p>
<p class="text-cyan-400 text-xs text-center mb-2"><%= moeda(@precos[:termo_especial]) %> cada</p>
<div class="flex items-center justify-center gap-2">
<button type="button" data-action="apontamento-termo#menosEspecial"
class="w-10 h-10 rounded-lg bg-[#1a1a1a] border border-[#2a2a2a] hover:border-cyan-500 text-white text-xl font-bold leading-none"></button>
<input data-apontamento-termo-target="quantidadeEspecial" type="text" inputmode="numeric" value="0" readonly
class="w-14 text-center bg-[#1a1a1a] border border-[#2a2a2a] text-white text-xl font-bold rounded-lg py-2 focus:outline-none">
<button type="button" data-action="apontamento-termo#maisEspecial"
class="w-10 h-10 rounded-lg bg-[#1a1a1a] border border-[#2a2a2a] hover:border-cyan-500 text-white text-xl font-bold leading-none">+</button>
</div>
</div>
</div>
<button type="button" data-action="apontamento-termo#adicionar"
@@ -437,6 +448,10 @@
<span class="flex items-center gap-2"><span class="w-3 h-3 bg-blue-600 rounded-full"></span> Termo</span>
<span class="text-white font-bold" data-validacao-target="qtdTermo">0</span>
</div>
<div class="flex justify-between items-center">
<span class="flex items-center gap-2"><span class="w-3 h-3 bg-cyan-600 rounded-full"></span> Termo Especial</span>
<span class="text-white font-bold" data-validacao-target="qtdTermoEspecial">0</span>
</div>
</div>
<div class="border-t border-[#2a2a2a] pt-4 flex justify-between items-center text-sm">
@@ -456,6 +471,7 @@
<p>⚠️ Desconto: -<%= moeda(@precos[:desconto]) %></p>
<p>✨ Extraordinária: <%= moeda(@precos[:extraordinaria]) %> (valor por entrega)</p>
<p>📄 Termo: <%= moeda(@precos[:termo]) %></p>
<p>📋 Termo Especial: <%= moeda(@precos[:termo_especial]) %></p>
</div>
</div>
</div>

View File

@@ -171,14 +171,20 @@
</thead>
<tbody class="divide-y divide-[#2a2a2a]">
<% @apontamentos.each do |(motorista, _tracking), pilares| %>
<% eh_termo = pilares.first.termo? %>
<% eh_termo = pilares.first.termo? || pilares.first.termo_especial? %>
<% entrega = eh_termo ? nil : pilares.first.entrega_original %>
<% nf_exibida = entrega&.numero_nf || pilares.first.nf_manual %>
<% obs_manual = pilares.first.obs_manual %>
<% total = pilares.sum { |p| p.desconto? ? -p.valor_aplicado : p.valor_aplicado } %>
<tr>
<td class="px-4 py-3">
<p class="text-white font-bold"><%= eh_termo ? '📄 Entrega de termo' : "NF #{nf_exibida.presence || '—'}" %></p>
<p class="text-white font-bold"><%= if pilares.first.termo?
'📄 Entrega de termo'
elsif pilares.first.termo_especial?
'📋 Entrega de termo especial'
else
"NF #{nf_exibida.presence || '—'}"
end %></p>
<p class="text-gray-400 text-xs">
<%= motorista %><% if entrega&.vehicle.present? %> · <%= entrega.vehicle %><% end %>
<% if entrega.nil? && obs_manual.present? %> · <%= obs_manual %><% end %>
@@ -187,7 +193,7 @@
<td class="px-4 py-3">
<div class="flex flex-wrap gap-1">
<% pilares.each do |p| %>
<span class="<%= p.tipo_cor[:bg] %> <%= p.tipo_cor[:text] %> px-2 py-1 rounded text-xs font-bold"><%= p.tipo_cor[:label] %><% if p.termo? && p.quantidade > 1 %> ×<%= p.quantidade %><% end %></span>
<span class="<%= p.tipo_cor[:bg] %> <%= p.tipo_cor[:text] %> px-2 py-1 rounded text-xs font-bold"><%= p.tipo_cor[:label] %><% if (p.termo? || p.termo_especial?) && p.quantidade > 1 %> ×<%= p.quantidade %><% end %></span>
<% end %>
</div>
</td>