diff --git a/src/bot/handler.js b/src/bot/handler.js index 90f0d41..ad03c20 100644 --- a/src/bot/handler.js +++ b/src/bot/handler.js @@ -8231,9 +8231,11 @@ Digite /help para ver todos os comandos disponíveis! } /** - * Exibe serviços ativos do cliente para seleção (IPoE) + * Exibe serviços ativos do cliente com endereço e login para seleção (IPoE) */ async _mostrarServicosParaIPoE(chatId, idCliente, location) { + await this.bot.sendMessage(chatId, '📋 Carregando serviços do cliente...'); + const servicosResult = await this.topsapp.obterServicosCliente(idCliente, location); if (!servicosResult.success) { @@ -8251,24 +8253,37 @@ Digite /help para ver todos os comandos disponíveis! return; } - if (servicos.length === 1) { - await this._confirmarMudarIPoE(chatId, idCliente, servicos[0], location); - return; - } - - let message = `🔗 *Mudar para IPoE — Selecione o serviço:*\n\n`; + let message = `🔗 *Mudar para IPoE — Serviços do cliente:*\n\n`; const keyboard = []; servicos.forEach((s, i) => { const nome = s.descricao || s.nome || `Serviço ${i + 1}`; const serial = s.serial || s.mac || 'sem serial'; - message += `*${i + 1}.* ${nome} — Serial: \`${serial}\`\n`; + const login = s.usuario || s.pppoe_login || s.login || 'sem login'; + const endereco = s.instalacao_endereco || ''; + const numero = s.instalacao_numero || ''; + const bairro = s.instalacao_bairro || ''; + const cidade = s.instalacao_cidade || ''; + + message += `📦 *${i + 1}. ${nome}*\n`; + message += ` 👤 Login: \`${login}\`\n`; + message += ` 📟 Serial: \`${serial}\`\n`; + if (endereco) { + message += ` 📍 ${endereco}${numero ? `, ${numero}` : ''}`; + if (bairro) message += ` — ${bairro}`; + if (cidade) message += `, ${cidade}`; + message += `\n`; + } + message += `\n`; + keyboard.push([{ - text: `🔗 ${nome.substring(0, 35)}`, + text: `🔗 ${(i + 1)}. ${nome.substring(0, 30)}`, callback_data: `ipoe_servico_${idCliente}_${s.id_servico || s.id}_${location}` }]); }); + message += `💡 Selecione o serviço para configurar IPoE:`; + await this.bot.sendMessage(chatId, message, { parse_mode: 'Markdown', reply_markup: { inline_keyboard: keyboard }