Atualização da função de adicionar entregas por fora da operação
This commit is contained in:
@@ -132,6 +132,53 @@
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%# ── Apontamentos manuais (notas que chegaram por fora) ─────────────── %>
|
||||
<% if @apontamentos.present? %>
|
||||
<% pode_editar = !(@consolidacao.finalizada? && current_user.operador?) %>
|
||||
<h2 class="text-white font-bold text-lg mt-8 mb-3">➕ Apontamentos manuais</h2>
|
||||
<div class="bg-[#1a1a1a] border border-[#2a2a2a] rounded-xl overflow-hidden">
|
||||
<table class="w-full text-sm">
|
||||
<thead class="bg-[#0a0a0a] text-gray-400">
|
||||
<tr>
|
||||
<th class="text-left px-4 py-3">Nota / Motorista</th>
|
||||
<th class="text-left px-4 py-3">Classificações</th>
|
||||
<th class="text-right px-4 py-3">Valor</th>
|
||||
<% if pode_editar %><th class="px-4 py-3"></th><% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-[#2a2a2a]">
|
||||
<% @apontamentos.each do |(motorista, _tracking), pilares| %>
|
||||
<% entrega = pilares.first.entrega_original %>
|
||||
<% 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">NF <%= entrega&.numero_nf || '—' %></p>
|
||||
<p class="text-gray-400 text-xs"><%= motorista %><% if entrega&.vehicle.present? %> · <%= entrega.vehicle %><% end %></p>
|
||||
</td>
|
||||
<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] %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-right font-bold <%= total.negative? ? 'text-red-400' : 'text-white' %>"><%= moeda(total) %></td>
|
||||
<% if pode_editar %>
|
||||
<td class="px-4 py-3 text-right">
|
||||
<%= button_to '✕ Remover',
|
||||
remover_apontamento_consolidacao_consolidacao_entregas_path(@consolidacao, tracking_id: pilares.first.tracking_id, motorista: motorista),
|
||||
method: :delete,
|
||||
form: { data: { turbo_confirm: "Remover o apontamento da NF #{entrega&.numero_nf} de #{motorista}?" } },
|
||||
class: 'text-gray-400 hover:text-red-400 border border-[#2a2a2a] hover:border-red-500/50 px-3 py-2 rounded-lg text-xs min-h-[40px]' %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%# ── Modal de Preview ─────────────────────────────────── %>
|
||||
|
||||
Reference in New Issue
Block a user