Alteração Para uso dos Usuarios
This commit is contained in:
@@ -51,12 +51,14 @@
|
||||
<div class="flex flex-col sm:flex-row sm:items-center gap-2 mt-4 bg-[#1a1a1a] border border-[#2a2a2a] rounded-xl p-4">
|
||||
<span class="text-gray-400 text-sm font-medium mr-1">💵 Operação inteira:</span>
|
||||
<% if @consolidacao.status_pagamento != :pago %>
|
||||
<%# Form único (id) — os inputs de NF e os botões "Marcar pago" de cada
|
||||
linha se associam a ele via atributo HTML5 form=, evitando <form> aninhado. %>
|
||||
<%= form_with url: registrar_pagamento_consolidacao_path(@consolidacao), method: :post,
|
||||
data: { turbo_confirm: 'Marcar TODOS os motoristas pendentes desta consolidação como PAGOS?' },
|
||||
class: 'flex items-center gap-2' do |f| %>
|
||||
id: 'form-pagar-tudo', class: 'flex items-center gap-2' do |f| %>
|
||||
<%= f.select :forma_pagamento, options_for_select(formas_pagamento, 'pix'),
|
||||
{}, class: 'bg-[#0a0a0a] border border-[#2a2a2a] text-white rounded-lg px-3 py-2.5 text-sm' %>
|
||||
<%= f.submit '💰 Marcar tudo como pago',
|
||||
data: { turbo_confirm: 'Marcar TODOS os motoristas pendentes desta consolidação como PAGOS? Confirme que a Nota Fiscal de cada um foi preenchida.' },
|
||||
class: 'bg-green-600 hover:bg-green-700 text-white font-bold px-4 py-2.5 rounded-lg text-sm cursor-pointer min-h-[44px]' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -95,6 +97,9 @@
|
||||
<% if cm.forma_pagamento.present? %>via <%= cm.forma_pagamento.humanize %><% end %>
|
||||
<% if cm.pagador.present? %>por <%= cm.pagador.nome_display %><% end %>
|
||||
</p>
|
||||
<% if cm.nota_fiscal.present? %>
|
||||
<p class="text-gray-300 text-xs mt-0.5">🧾 NF <%= cm.nota_fiscal %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if pode_pagar %>
|
||||
@@ -104,21 +109,23 @@
|
||||
data: { turbo_confirm: "Estornar o pagamento de #{cm.motorista_nome}?" },
|
||||
class: 'text-gray-400 hover:text-white border border-[#2a2a2a] px-3 py-2 rounded-lg text-xs min-h-[40px]' %>
|
||||
<% else %>
|
||||
<%= form_with url: registrar_pagamento_consolidacao_path(@consolidacao, consolidacao_motorista_id: cm.id), method: :post,
|
||||
data: { turbo_confirm: "Marcar #{cm.motorista_nome} como pago?" },
|
||||
class: 'flex items-center gap-2' do |f| %>
|
||||
<%= f.select :forma_pagamento, options_for_select(formas_pagamento, 'pix'),
|
||||
{}, class: 'bg-[#0a0a0a] border border-[#2a2a2a] text-white rounded-lg px-2 py-2 text-xs' %>
|
||||
<%= f.submit '💰 Marcar pago',
|
||||
<%# Inputs/botão associados ao form único #form-pagar-tudo via atributo form=. %>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
<%= text_field_tag "notas_fiscais[#{cm.id}]", nil, form: 'form-pagar-tudo',
|
||||
placeholder: 'Nº Nota Fiscal',
|
||||
class: 'bg-[#0a0a0a] border border-[#2a2a2a] text-white rounded-lg px-2 py-2 text-xs w-36' %>
|
||||
<%= button_tag '💰 Marcar pago', type: :submit, form: 'form-pagar-tudo',
|
||||
name: 'consolidacao_motorista_id', value: cm.id,
|
||||
data: { turbo_confirm: "Marcar #{cm.motorista_nome} como pago?" },
|
||||
class: 'bg-green-600 hover:bg-green-700 text-white font-bold px-3 py-2 rounded-lg text-xs cursor-pointer min-h-[40px]' %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<%# Preview abre modal %>
|
||||
<button onclick="abrirPreview('<%= preview_holerite_consolidacao_path(@consolidacao, motorista: cm.motorista_nome) %>')"
|
||||
<button onclick="abrirPreview('<%= preview_extrato_consolidacao_path(@consolidacao, motorista: cm.motorista_nome) %>')"
|
||||
class="bg-[#0a0a0a] hover:bg-[#2a2a2a] text-white border border-orange-500 font-semibold px-4 py-3 rounded-lg text-sm min-h-[48px]">
|
||||
👁️ Ver antes de gerar
|
||||
</button>
|
||||
@@ -126,8 +133,8 @@
|
||||
gerar_pdf_relatorio_consolidacao_path(@consolidacao, motorista: cm.motorista_nome),
|
||||
data: { turbo: false },
|
||||
class: 'bg-orange-800 hover:bg-orange-700 text-white font-semibold px-4 py-3 rounded-lg text-sm min-h-[48px] flex items-center' %>
|
||||
<%= link_to '🧾 Gerar Holerite',
|
||||
gerar_pdf_holerite_consolidacao_path(@consolidacao, motorista: cm.motorista_nome),
|
||||
<%= link_to '🧾 Gerar Extrato',
|
||||
gerar_pdf_extrato_consolidacao_path(@consolidacao, motorista: cm.motorista_nome),
|
||||
data: { turbo: false },
|
||||
class: 'bg-orange-500 hover:bg-orange-600 text-black font-bold px-4 py-3 rounded-lg text-sm min-h-[48px] flex items-center' %>
|
||||
</div>
|
||||
@@ -188,7 +195,7 @@
|
||||
<div id="modal-preview" class="fixed inset-0 bg-black/80 z-50 hidden items-center justify-center p-4">
|
||||
<div class="bg-[#1a1a1a] border border-[#2a2a2a] rounded-2xl max-w-2xl w-full max-h-[85vh] flex flex-col">
|
||||
<div class="flex items-center justify-between px-6 py-4 border-b border-[#2a2a2a]">
|
||||
<h3 class="text-white font-bold">👁️ Pré-visualização do Holerite</h3>
|
||||
<h3 class="text-white font-bold">👁️ Pré-visualização do Extrato</h3>
|
||||
<button onclick="fecharPreview()" class="text-gray-400 hover:text-white text-2xl min-w-[44px] min-h-[44px]">✕</button>
|
||||
</div>
|
||||
<div id="modal-preview-conteudo" class="overflow-y-auto p-6 flex-1">
|
||||
@@ -220,7 +227,7 @@
|
||||
|
||||
// O link de confirmar aponta para o PDF do mesmo motorista
|
||||
document.getElementById('modal-confirmar').href =
|
||||
url.replace('preview_holerite', 'gerar_pdf_holerite');
|
||||
url.replace('preview_extrato', 'gerar_pdf_extrato');
|
||||
}
|
||||
function fecharPreview() {
|
||||
const modal = document.getElementById('modal-preview');
|
||||
|
||||
Reference in New Issue
Block a user