Alteração Para uso dos Usuarios
This commit is contained in:
@@ -36,12 +36,12 @@
|
||||
<p style="text-align: center; margin: 24px 0;">
|
||||
<a href="<%= @link_painel %>"
|
||||
style="background: #0a0a0a; color: #f97316; text-decoration: none; padding: 14px 28px; border-radius: 8px; font-weight: bold; display: inline-block;">
|
||||
Ver meu painel e baixar holerite →
|
||||
Ver meu painel e baixar extrato →
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p style="color: #9ca3af; font-size: 12px; text-align: center;">
|
||||
Entre com seu PIN de 4 números ou escaneie o QR Code do seu holerite.
|
||||
Entre com seu PIN de 4 números ou escaneie o QR Code do seu extrato.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
<p style="text-align: center; margin: 24px 0;">
|
||||
<a href="<%= @link_painel %>"
|
||||
style="background: #0a0a0a; color: #f97316; text-decoration: none; padding: 14px 28px; border-radius: 8px; font-weight: bold; display: inline-block;">
|
||||
Ver meu painel e baixar holerite →
|
||||
Ver meu painel e baixar extrato →
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p style="color: #9ca3af; font-size: 12px; text-align: center;">
|
||||
Entre com seu PIN de 4 números ou escaneie o QR Code do seu holerite.
|
||||
Entre com seu PIN de 4 números ou escaneie o QR Code do seu extrato.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%# app/views/consolidacoes/preview_holerite.html.erb — renderizado sem layout, dentro do modal %>
|
||||
<%# app/views/consolidacoes/preview_extrato.html.erb — renderizado sem layout, dentro do modal %>
|
||||
<div class="bg-white text-black rounded-xl p-6 font-sans">
|
||||
|
||||
<%# Cabeçalho estilo PDF %>
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="w-2 h-12 bg-orange-500 rounded"></div>
|
||||
<div>
|
||||
<p class="text-white font-black text-lg leading-tight">REEM TRANSPORTE</p>
|
||||
<p class="text-orange-500 text-xs">Holerite de Pagamento — Entregas</p>
|
||||
<p class="text-orange-500 text-xs">Extrato de Pagamento — Entregas</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
|
||||
<%# Top motoristas %>
|
||||
<div class="bg-[#1a1a1a] rounded-2xl border border-white/5 p-6">
|
||||
<h2 class="text-lg font-semibold text-white mb-4">🏆 Top Motoristas</h2>
|
||||
<h2 class="text-lg font-semibold text-white mb-4">🏆 Motoristas</h2>
|
||||
|
||||
<% if @motoristas.any? %>
|
||||
<div class="space-y-3">
|
||||
@@ -234,7 +234,7 @@
|
||||
</span>
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-center justify-between mb-1">
|
||||
<span class="text-white text-sm font-medium truncate"><%= m[:nome].split.first %></span>
|
||||
<span class="text-white text-sm font-medium truncate"><%= m[:nome] %></span>
|
||||
<span class="text-[#f97316] text-sm font-semibold ml-2 flex-shrink-0">
|
||||
<%= moeda(m[:valor]) %>
|
||||
</span>
|
||||
@@ -287,7 +287,7 @@
|
||||
<%# Custo por motorista (barra) %>
|
||||
<div class="bg-[#1a1a1a] rounded-2xl border border-white/5 p-6">
|
||||
<h2 class="text-lg font-semibold text-white mb-1">👤 Custo por motorista</h2>
|
||||
<p class="text-gray-400 text-sm mb-4">Top 10 no período</p>
|
||||
<p class="text-gray-400 text-sm mb-4">Por motorista no período</p>
|
||||
<% if @fin_por_motorista.any? %>
|
||||
<div class="relative h-64"><canvas id="grafico-custo-motorista"></canvas></div>
|
||||
<% else %>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<p class="text-gray-300 text-sm">
|
||||
💰 <%= l cm.pago_em.to_date, format: :short %>
|
||||
<% if cm.forma_pagamento.present? %>· <%= cm.forma_pagamento.humanize %><% end %>
|
||||
<% if cm.nota_fiscal.present? %>· 🧾 NF <%= cm.nota_fiscal %><% end %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -78,11 +79,14 @@
|
||||
💰 Pago em <%= l cm.pago_em.to_date, format: :short %>
|
||||
<% if cm.forma_pagamento.present? %>via <%= cm.forma_pagamento.humanize %><% end %>
|
||||
</p>
|
||||
<% if cm.nota_fiscal.present? %>
|
||||
<p class="text-gray-300 text-sm mt-0.5">🧾 Nota Fiscal: <%= cm.nota_fiscal %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if c.finalizada? %>
|
||||
<%= link_to '⬇️ Baixar meu holerite',
|
||||
gerar_pdf_holerite_consolidacao_path(c, motorista: current_user.nome),
|
||||
<%= link_to '⬇️ Baixar meu extrato',
|
||||
gerar_pdf_extrato_consolidacao_path(c, motorista: current_user.nome),
|
||||
data: { turbo: false },
|
||||
class: 'w-full md:w-auto bg-orange-500 hover:bg-orange-600 text-black font-bold text-base px-6 py-4 rounded-xl min-h-[52px] flex items-center justify-center text-center' %>
|
||||
<% else %>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<% end %>
|
||||
|
||||
<p class="text-gray-300 text-base text-center mt-6">
|
||||
💡 Você também pode escanear o QR Code do seu holerite para entrar direto.
|
||||
💡 Você também pode escanear o QR Code do seu extrato para entrar direto.
|
||||
</p>
|
||||
<p class="text-center mt-4">
|
||||
<%= link_to 'Sou administrador/gerente →', new_user_session_path, class: 'text-orange-500 hover:text-orange-400 text-sm' %>
|
||||
|
||||
Reference in New Issue
Block a user