TopSapp: Mudanças na exibição de serviços no ver faturas

Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
rodrigo committed 2026-04-01 15:44:32 -03:00
1 parent b6e898c885
commit 2a939def1d
1 file changed
+24 -2
+24 -2
View File
@@ -4616,10 +4616,32 @@ Digite /help para ver todos os comandos disponíveis!
let message = `📄 **SELECIONE O SERVIÇO**\n\n`;
message += `🆔 **ID Cliente**: ${idCliente}\n`;
message += `📊 Este cliente possui **${faturasPorServico.length} serviços** com faturas.\n\n`;
faturasPorServico.forEach((servicoInfo, index) => {
const s = servicoInfo.servico;
const rawStatus = String(s.status || '').toLowerCase();
let statusText;
if (rawStatus === 'liberado' || rawStatus === '1' || parseInt(s.status) === 1) {
statusText = '🟢 Liberado';
} else if (rawStatus === 'bloqueado' || rawStatus === '2' || parseInt(s.status) === 2) {
statusText = '🔴 Bloqueado';
} else if (rawStatus === 'desativado' || rawStatus === '3' || parseInt(s.status) === 3) {
statusText = '⚫ Desativado';
} else {
statusText = `❓ ${s.status || 'Desconhecido'}`;
}
message += `*${index + 1}. ${s.nome || 'Serviço'}*\n`;
if (s.login) message += ` 👤 Login PPPoE: \`${s.login}\`\n`;
message += ` 📊 Status: ${statusText}\n`;
if (s.endereco) message += ` 📍 Endereço: ${s.endereco}\n`;
message += ` 🧾 ${servicoInfo.faturas.length} fatura(s)\n\n`;
});
message += `Escolha qual serviço deseja ver as faturas:`;
const keyboard = faturasPorServico.map((servicoInfo) => [{
text: `📋 ${servicoInfo.servico.nome || servicoInfo.servico.descricao || 'Serviço'} — ${servicoInfo.faturas.length} fatura(s)`,
const keyboard = faturasPorServico.map((servicoInfo, index) => [{
text: `${index + 1}. ${servicoInfo.servico.login || servicoInfo.servico.nome || 'Serviço'} — ${servicoInfo.faturas.length} fatura(s)`,
callback_data: `faturas_servico_${idCliente}_${servicoInfo.servico.id}_${location}`
}]);