Show shared-number badge in the treatment table and lead detail
This commit is contained in:
@@ -620,6 +620,8 @@ tbody tr:hover .acao-col { background: color-mix(in srgb, var(--accent) 6%, var(
|
||||
.badge.prioridade-2 { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--ink); }
|
||||
.badge.prioridade-3 { background: var(--grid); color: var(--ink-2); }
|
||||
.badge.prioridade-4 { background: var(--grid); color: var(--muted); }
|
||||
.badge.numero-compartilhado { background: color-mix(in srgb, var(--critical) 14%, transparent); color: var(--critical); }
|
||||
.badge.numero-compartilhado-liberado { background: var(--grid); color: var(--ink-2); }
|
||||
.produto-cell { font-size: 12.5px; }
|
||||
.estrelas { color: var(--warning); letter-spacing: 1px; white-space: nowrap; }
|
||||
.empresa-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
|
||||
|
||||
@@ -438,9 +438,19 @@ const Tratamento = (() => {
|
||||
if (checkedAt) detalhes.push(`Consultado em ${checkedAt}`);
|
||||
return h('div', { class: 'whatsapp-verification' },
|
||||
h('span', { class: `badge whatsapp-${status}` }, WHATSAPP_STATUS_LABELS[status] || status),
|
||||
numeroCompartilhadoBadge(lead),
|
||||
detalhes.length ? h('div', { class: 'sub' }, detalhes.join(' · ')) : null);
|
||||
}
|
||||
|
||||
function numeroCompartilhadoBadge(lead) {
|
||||
if (!lead.numero_compartilhado) return null;
|
||||
const classe = lead.numero_compartilhado_liberado ? 'numero-compartilhado-liberado' : 'numero-compartilhado';
|
||||
const texto = lead.numero_compartilhado_liberado
|
||||
? `Compartilhado (liberado, ${lead.numero_compartilhado_total} leads)`
|
||||
: `Número compartilhado (${lead.numero_compartilhado_total} leads)`;
|
||||
return h('span', { class: `badge ${classe}` }, texto);
|
||||
}
|
||||
|
||||
function produtoCell(produto, afinidade) {
|
||||
if (!produto) return '—';
|
||||
const label = AFINIDADE_TABELA_LABELS[afinidade];
|
||||
@@ -526,6 +536,9 @@ const Tratamento = (() => {
|
||||
linha('Status WhatsApp', WHATSAPP_STATUS_LABELS[lead.whatsapp_status] || lead.whatsapp_status || 'Não consultado'),
|
||||
linha('Número WhatsApp confirmado', lead.whatsapp_numero_resolvido),
|
||||
linha('WhatsApp consultado em', whatsappCheckedAt(lead.whatsapp_checked_at)),
|
||||
linha('Número compartilhado com outro lead', lead.numero_compartilhado
|
||||
? `${lead.numero_compartilhado_total} leads${lead.numero_compartilhado_liberado ? ' (liberado)' : ''}`
|
||||
: 'Não'),
|
||||
linha('Cidade/UF', `${lead.cidade}/${lead.uf}`),
|
||||
linha('Endereço', lead.endereco),
|
||||
linha('Nicho', lead.segmento_label || lead.segmento),
|
||||
|
||||
@@ -499,6 +499,28 @@ test('status de verificacao mostra numero e data validos sem depender de title',
|
||||
assert.doesNotMatch(nodeText(invalidStatus), /data-invalida/);
|
||||
});
|
||||
|
||||
test('tabela de tratamento sinaliza numero compartilhado por mais de um lead', async () => {
|
||||
const app = await executeApp();
|
||||
const rows = [
|
||||
{
|
||||
id: 1, empresa: 'Contabilidade Cliente A', whatsapp: '5575999091780', whatsapp_status: 'confirmado',
|
||||
cidade: 'Salvador', segmento_label: 'Restaurantes', prioridade: 1, score: 90, classificacao: 'bom',
|
||||
produto_principal: '', afinidade: 'media',
|
||||
numero_compartilhado: true, numero_compartilhado_total: 2, numero_compartilhado_liberado: false
|
||||
},
|
||||
{
|
||||
id: 2, empresa: 'Empresa Unica', whatsapp: '5511999990001', whatsapp_status: 'confirmado',
|
||||
cidade: 'Salvador', segmento_label: 'Restaurantes', prioridade: 1, score: 80, classificacao: 'bom',
|
||||
produto_principal: '', afinidade: 'media',
|
||||
numero_compartilhado: false, numero_compartilhado_total: 0, numero_compartilhado_liberado: false
|
||||
}
|
||||
];
|
||||
const tbody = await renderTreatment(app, rows);
|
||||
const texts = tbody.children.map(nodeText);
|
||||
assert.match(texts[0], /N[uú]mero compartilhado \(2 leads\)/);
|
||||
assert.doesNotMatch(texts[1], /compartilhado/i);
|
||||
});
|
||||
|
||||
test('controle de limpar contexto e um botao acessivel', async () => {
|
||||
const html = await read('public/index.html');
|
||||
assert.match(html, /<button[^>]+id="btn-limpar-lead-manual"[^>]+type="button"[^>]*>\s*Limpar contexto do lead\s*<\/button>/i);
|
||||
|
||||
Reference in New Issue
Block a user