ipoe: usa nome ou cpf para identificar
This commit is contained in:
1 parent
468a15845a
commit
dc704d3f3c
1 file changed
+24
-9
+24
-9
@@ -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) {
|
async _mostrarServicosParaIPoE(chatId, idCliente, location) {
|
||||||
|
await this.bot.sendMessage(chatId, '📋 Carregando serviços do cliente...');
|
||||||
|
|
||||||
const servicosResult = await this.topsapp.obterServicosCliente(idCliente, location);
|
const servicosResult = await this.topsapp.obterServicosCliente(idCliente, location);
|
||||||
|
|
||||||
if (!servicosResult.success) {
|
if (!servicosResult.success) {
|
||||||
@@ -8251,24 +8253,37 @@ Digite /help para ver todos os comandos disponíveis!
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (servicos.length === 1) {
|
let message = `🔗 *Mudar para IPoE — Serviços do cliente:*\n\n`;
|
||||||
await this._confirmarMudarIPoE(chatId, idCliente, servicos[0], location);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let message = `🔗 *Mudar para IPoE — Selecione o serviço:*\n\n`;
|
|
||||||
const keyboard = [];
|
const keyboard = [];
|
||||||
|
|
||||||
servicos.forEach((s, i) => {
|
servicos.forEach((s, i) => {
|
||||||
const nome = s.descricao || s.nome || `Serviço ${i + 1}`;
|
const nome = s.descricao || s.nome || `Serviço ${i + 1}`;
|
||||||
const serial = s.serial || s.mac || 'sem serial';
|
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([{
|
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}`
|
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, {
|
await this.bot.sendMessage(chatId, message, {
|
||||||
parse_mode: 'Markdown',
|
parse_mode: 'Markdown',
|
||||||
reply_markup: { inline_keyboard: keyboard }
|
reply_markup: { inline_keyboard: keyboard }
|
||||||
|
|||||||
Reference in new issue
Block a user