Carry over pre-existing WABA outreach automation WIP
This work already existed uncommitted in the main working tree (not authored by this branch) and is required as a runtime dependency for the campaign outreach port (zpro-client, templates, outreach routes/UI). Copied in as-is, untouched, so this feature branch has a working baseline; the original uncommitted state in the main checkout is left exactly as it was.
This commit is contained in:
+618
-245
@@ -1,323 +1,696 @@
|
||||
/* GTI Máquina Comercial — tokens de design (paleta validada, light/dark) */
|
||||
/* GTI Maquina Comercial - interface principal */
|
||||
:root {
|
||||
--page: #f9f9f7;
|
||||
--surface: #fcfcfb;
|
||||
--ink: #0b0b0b;
|
||||
--ink-2: #52514e;
|
||||
--muted: #898781;
|
||||
--grid: #e1e0d9;
|
||||
--border: rgba(11, 11, 11, 0.10);
|
||||
--accent: #2a78d6; /* series-1 azul */
|
||||
--page: #f5f7fb;
|
||||
--page-2: #eef2f7;
|
||||
--surface: #ffffff;
|
||||
--surface-2: #f9fafc;
|
||||
--ink: #162033;
|
||||
--ink-2: #4c5870;
|
||||
--muted: #7b8495;
|
||||
--grid: #dce2ec;
|
||||
--border: rgba(22, 32, 51, 0.11);
|
||||
--accent: #f06a25;
|
||||
--accent-2: #1f6feb;
|
||||
--accent-ink: #ffffff;
|
||||
--bar: #5598e7; /* sequential 350 — barras de ranking */
|
||||
--good: #0ca30c;
|
||||
--good-text: #006300;
|
||||
--warning: #fab219;
|
||||
--critical: #d03b3b;
|
||||
--shadow: 0 1px 3px rgba(11, 11, 11, 0.08);
|
||||
--bar: #f06a25;
|
||||
--good: #10a66a;
|
||||
--good-text: #057046;
|
||||
--warning: #d99a1f;
|
||||
--critical: #d63d4a;
|
||||
--critical-bg: #fff1f2;
|
||||
--radius-sm: 10px;
|
||||
--radius: 16px;
|
||||
--radius-lg: 24px;
|
||||
--shadow: 0 14px 40px rgba(22, 32, 51, 0.08);
|
||||
--shadow-soft: 0 8px 24px rgba(22, 32, 51, 0.06);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--page: #0d0d0d;
|
||||
--surface: #1a1a19;
|
||||
--ink: #ffffff;
|
||||
--ink-2: #c3c2b7;
|
||||
--muted: #898781;
|
||||
--grid: #2c2c2a;
|
||||
--border: rgba(255, 255, 255, 0.10);
|
||||
--accent: #3987e5;
|
||||
--bar: #3987e5;
|
||||
--good-text: #0ca30c;
|
||||
--shadow: none;
|
||||
--page: #0d1118;
|
||||
--page-2: #111827;
|
||||
--surface: #171c27;
|
||||
--surface-2: #1d2430;
|
||||
--ink: #f5f7fb;
|
||||
--ink-2: #c8d0dd;
|
||||
--muted: #8e98aa;
|
||||
--grid: #2c3443;
|
||||
--border: rgba(255, 255, 255, 0.11);
|
||||
--accent: #ff7a33;
|
||||
--accent-2: #60a5fa;
|
||||
--bar: #ff7a33;
|
||||
--good-text: #55d99c;
|
||||
--critical-bg: rgba(214, 61, 74, 0.12);
|
||||
--shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
|
||||
--shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.22);
|
||||
}
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
html, body { margin: 0; padding: 0; }
|
||||
html, body { margin: 0; padding: 0; min-height: 100%; }
|
||||
body {
|
||||
background: var(--page);
|
||||
color: var(--ink);
|
||||
font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
|
||||
font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
||||
background:
|
||||
radial-gradient(circle at 12% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 34rem),
|
||||
radial-gradient(circle at 86% -6%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 30rem),
|
||||
linear-gradient(180deg, var(--page), var(--page-2));
|
||||
}
|
||||
button, input, select, textarea { font: inherit; }
|
||||
button { color: inherit; }
|
||||
|
||||
/* ---------- topo ---------- */
|
||||
/* topo */
|
||||
.topbar {
|
||||
display: flex; align-items: center; gap: 20px;
|
||||
padding: 10px 20px;
|
||||
background: var(--surface);
|
||||
border-bottom: 1px solid var(--grid);
|
||||
position: sticky; top: 0; z-index: 20;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20;
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(220px, 1fr) auto auto auto auto;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 22px;
|
||||
background: color-mix(in srgb, var(--surface) 88%, transparent);
|
||||
border-bottom: 1px solid var(--border);
|
||||
box-shadow: 0 8px 30px rgba(22, 32, 51, 0.04);
|
||||
backdrop-filter: blur(14px);
|
||||
}
|
||||
.brand { display: flex; align-items: baseline; gap: 8px; }
|
||||
.brand-mark {
|
||||
background: var(--accent); color: var(--accent-ink);
|
||||
font-weight: 800; padding: 3px 9px; border-radius: 6px; letter-spacing: 0.5px;
|
||||
.brand { display: flex; align-items: center; gap: 10px; min-width: max-content; }
|
||||
.brand-mark { height: 32px; width: auto; display: block; border-radius: 8px; }
|
||||
.brand-mark-lg { height: 62px; }
|
||||
.brand-name { font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
|
||||
.tabs {
|
||||
display: inline-flex;
|
||||
gap: 6px;
|
||||
padding: 4px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
background: var(--surface-2);
|
||||
width: fit-content;
|
||||
}
|
||||
.brand-name { font-weight: 600; color: var(--ink-2); }
|
||||
.tabs { display: flex; gap: 4px; flex: 1; }
|
||||
.tab {
|
||||
border: none; background: none; color: var(--ink-2);
|
||||
font: inherit; font-weight: 600; padding: 8px 16px;
|
||||
border-radius: 8px; cursor: pointer;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
background: transparent;
|
||||
color: var(--ink-2);
|
||||
cursor: pointer;
|
||||
font-weight: 750;
|
||||
padding: 8px 14px;
|
||||
transition: 0.18s ease;
|
||||
}
|
||||
.tab:hover { background: var(--grid); }
|
||||
.tab.active { background: var(--accent); color: var(--accent-ink); }
|
||||
.tab:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 9%, transparent); }
|
||||
.tab.active { background: var(--ink); color: var(--page); box-shadow: var(--shadow-soft); }
|
||||
|
||||
main { max-width: 1280px; margin: 0 auto; padding: 16px 20px 60px; }
|
||||
main { max-width: 1320px; margin: 0 auto; padding: 24px 22px 70px; }
|
||||
.tab-panel { display: none; }
|
||||
.tab-panel.active { display: block; }
|
||||
|
||||
/* ---------- cartões e grades ---------- */
|
||||
/* layout */
|
||||
.captura-wrap { max-width: 820px; margin: 0 auto; }
|
||||
.card {
|
||||
background: var(--surface);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: color-mix(in srgb, var(--surface) 96%, transparent);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
padding: 16px 18px;
|
||||
box-shadow: var(--shadow);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.card h2 { margin: 0 0 12px; font-size: 16px; }
|
||||
.captura-wrap { max-width: 720px; margin: 0 auto; }
|
||||
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
|
||||
@media (max-width: 1100px) {
|
||||
.grid-3 { grid-template-columns: 1fr 1fr; }
|
||||
}
|
||||
@media (max-width: 980px) {
|
||||
.grid-3 { grid-template-columns: 1fr; }
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: var(--shadow-soft);
|
||||
padding: 20px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.card h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: -0.02em; }
|
||||
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
|
||||
|
||||
/* ---------- formulários ---------- */
|
||||
/* formularios */
|
||||
.field { margin-bottom: 18px; }
|
||||
.field > label:first-child, .field > summary { font-weight: 600; display: block; margin-bottom: 6px; }
|
||||
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
|
||||
.field > label:first-child,
|
||||
.field > summary,
|
||||
label.settings-title {
|
||||
display: block;
|
||||
margin-bottom: 7px;
|
||||
color: var(--ink);
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
|
||||
.row.space-between { justify-content: space-between; }
|
||||
.row.wrap { flex-wrap: wrap; }
|
||||
.radio { display: flex; align-items: center; gap: 6px; font-weight: 400; cursor: pointer; margin: 4px 0; }
|
||||
select, input, textarea {
|
||||
font: inherit; color: var(--ink);
|
||||
background: var(--page);
|
||||
border: 1px solid var(--grid);
|
||||
border-radius: 8px; padding: 7px 10px;
|
||||
label { color: var(--ink-2); }
|
||||
label > input,
|
||||
label > select,
|
||||
label > textarea { display: block; margin-top: 5px; }
|
||||
.radio {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 4px 0;
|
||||
color: var(--ink-2);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
|
||||
input[type="number"] { width: 90px; }
|
||||
label > input[type="number"] { display: block; margin-top: 4px; }
|
||||
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }
|
||||
select, input, textarea {
|
||||
width: auto;
|
||||
color: var(--ink);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--grid);
|
||||
border-radius: 12px;
|
||||
padding: 10px 12px;
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
|
||||
transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
|
||||
}
|
||||
textarea { width: 100%; resize: vertical; min-height: 84px; }
|
||||
select:hover, input:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 38%, var(--grid)); }
|
||||
select:focus, input:focus, textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
|
||||
}
|
||||
input[type="number"] { width: 96px; }
|
||||
details summary { cursor: pointer; }
|
||||
|
||||
/* botoes */
|
||||
.btn, .btn-ghost, .btn-danger {
|
||||
font: inherit; font-weight: 600; cursor: pointer;
|
||||
border-radius: 8px; padding: 8px 14px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 40px;
|
||||
border-radius: 12px;
|
||||
padding: 9px 15px;
|
||||
border: 1px solid var(--grid);
|
||||
background: var(--surface); color: var(--ink);
|
||||
background: var(--surface);
|
||||
color: var(--ink);
|
||||
cursor: pointer;
|
||||
font-weight: 800;
|
||||
text-decoration: none;
|
||||
transition: 0.18s ease;
|
||||
}
|
||||
.btn:hover, .btn-ghost:hover { border-color: var(--accent); }
|
||||
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
|
||||
.btn-primary:hover { filter: brightness(1.1); }
|
||||
.btn-lg { width: 100%; padding: 12px; font-size: 15px; }
|
||||
.btn-ghost { border-color: transparent; color: var(--ink-2); }
|
||||
.btn-danger { color: var(--critical); border-color: var(--critical); background: none; }
|
||||
.btn-danger:hover { background: var(--critical); color: #fff; }
|
||||
button:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.btn:hover, .btn-ghost:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: var(--shadow-soft); }
|
||||
.btn-primary { background: linear-gradient(135deg, var(--accent), #ff8b47); border-color: transparent; color: var(--accent-ink); }
|
||||
.btn-primary:hover { filter: saturate(1.08); }
|
||||
.btn-lg { width: 100%; min-height: 48px; font-size: 15px; }
|
||||
.btn-sm { min-height: 32px; padding: 6px 10px; font-size: 12.5px; }
|
||||
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
|
||||
.btn-danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, var(--grid)); background: color-mix(in srgb, var(--critical) 6%, transparent); }
|
||||
.btn-danger:hover { background: var(--critical); color: #fff; border-color: var(--critical); }
|
||||
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
|
||||
|
||||
.zona-risco { border: 1px solid var(--critical); border-radius: 10px; padding: 10px 12px; margin-top: 14px; }
|
||||
.zona-risco label { color: var(--critical); font-weight: 700; }
|
||||
/* configuracoes */
|
||||
#modal-settings { max-width: 900px; }
|
||||
#modal-settings .modal-body { max-height: min(86vh, 900px); overflow-y: auto; }
|
||||
.settings-header {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 16px;
|
||||
align-items: start;
|
||||
padding-bottom: 14px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.settings-header h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.03em; }
|
||||
.settings-header p { margin: 0; }
|
||||
#outreach-status { cursor: default; white-space: nowrap; }
|
||||
.settings-card,
|
||||
.settings-section {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface-2);
|
||||
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.34) inset;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.settings-card { padding: 16px; }
|
||||
.settings-principal {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 18px;
|
||||
align-items: center;
|
||||
border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
|
||||
background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface-2));
|
||||
}
|
||||
.settings-controls { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; justify-content: flex-end; }
|
||||
.toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
border: 1px solid var(--grid);
|
||||
border-radius: 999px;
|
||||
padding: 8px 13px;
|
||||
background: var(--surface);
|
||||
color: var(--ink);
|
||||
font-weight: 800;
|
||||
}
|
||||
.settings-section { padding: 0 16px 16px; }
|
||||
.settings-section > summary {
|
||||
position: relative;
|
||||
list-style: none;
|
||||
padding: 15px 30px 15px 0;
|
||||
color: var(--ink);
|
||||
font-weight: 850;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
.settings-section > summary::-webkit-details-marker { display: none; }
|
||||
.settings-section > summary::after {
|
||||
content: "+";
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 13px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
color: var(--ink-2);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--grid);
|
||||
}
|
||||
.settings-section[open] > summary::after { content: "-"; }
|
||||
.settings-section > .muted { margin-top: -4px; }
|
||||
.settings-section .lista { margin-top: 10px; }
|
||||
.settings-section input[type="text"],
|
||||
.settings-section input[type="password"],
|
||||
.settings-section textarea,
|
||||
.settings-section select { min-width: 220px; }
|
||||
|
||||
/* ---------- login ---------- */
|
||||
.login-body { display: flex; min-height: 100vh; }
|
||||
.login-wrap { margin: auto; width: 100%; max-width: 360px; padding: 20px; }
|
||||
.login-card { display: flex; flex-direction: column; gap: 14px; }
|
||||
.login-brand { justify-content: center; margin-bottom: 4px; }
|
||||
.manual-send-card {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
padding: 14px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
}
|
||||
.manual-send-card .full { grid-column: 1 / -1; }
|
||||
.manual-channel {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
.manual-channel .radio {
|
||||
border: 1px solid var(--grid);
|
||||
border-radius: 999px;
|
||||
padding: 8px 12px;
|
||||
background: var(--surface-2);
|
||||
font-weight: 750;
|
||||
}
|
||||
#manual-oficial-campos {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
#manual-oficial-campos.hidden { display: none !important; }
|
||||
#manual-template-nome { min-width: 0; width: 100%; }
|
||||
.template-vars {
|
||||
padding: 12px;
|
||||
border: 1px dashed var(--grid);
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface-2);
|
||||
}
|
||||
.template-vars > label { color: var(--ink); font-weight: 800; }
|
||||
.template-vars p { margin: 2px 0 10px; }
|
||||
.variable-helper {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.variable-helper select, .variable-picker { min-width: min(100%, 320px); }
|
||||
.template-vars-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
.template-vars-grid label:last-child { grid-column: 1 / -1; }
|
||||
.template-preview {
|
||||
margin-top: 12px;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
background: var(--surface);
|
||||
color: var(--ink-2);
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.manual-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding-top: 4px;
|
||||
}
|
||||
#manual-status:not(:empty) {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
border-radius: 12px;
|
||||
background: var(--surface-2);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
#manual-status:not(:empty)::first-letter { font-weight: 900; }
|
||||
#manual-status:not(:empty) { color: var(--ink-2); }
|
||||
#manual-status.status-ok { color: var(--good-text); background: color-mix(in srgb, var(--good) 10%, var(--surface)); border-color: color-mix(in srgb, var(--good) 28%, var(--border)); }
|
||||
#manual-status.status-error { color: var(--critical); background: var(--critical-bg); border-color: color-mix(in srgb, var(--critical) 30%, var(--border)); }
|
||||
#btn-toggle-outreach-log { justify-self: start; margin-top: 2px; }
|
||||
|
||||
.outreach-template { flex-direction: column; align-items: stretch; gap: 8px; }
|
||||
.outreach-template .row.space-between { align-items: center; }
|
||||
.outreach-template textarea { width: 100%; margin-top: 2px; }
|
||||
.outreach-template-oficial { display: flex; flex-direction: column; gap: 8px; }
|
||||
.outreach-template-vars { margin-top: 2px; }
|
||||
.outreach-template-vars .template-vars-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
|
||||
.outreach-template-vars .template-vars-grid label:last-child { grid-column: auto; }
|
||||
.outreach-template-link { color: var(--accent-2); font-size: 12.5px; font-weight: 750; text-decoration: none; }
|
||||
.outreach-template-link:hover { text-decoration: underline; }
|
||||
.outreach-template-aviso { color: var(--critical); font-size: 12.5px; margin: 0; }
|
||||
#outreach-limite { width: 82px; }
|
||||
|
||||
.zona-risco { border-color: color-mix(in srgb, var(--critical) 45%, var(--border)); background: color-mix(in srgb, var(--critical) 5%, var(--surface)); }
|
||||
.zona-risco summary { color: var(--critical); }
|
||||
.template-sync-box {
|
||||
margin-top: 14px;
|
||||
padding-top: 14px;
|
||||
border-top: 1px dashed var(--grid);
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(220px, 0.45fr);
|
||||
gap: 12px;
|
||||
}
|
||||
.template-sync-box .row { grid-column: 1 / -1; }
|
||||
.template-sync-inline {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
margin: 0 0 12px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
}
|
||||
|
||||
/* login */
|
||||
.login-body {
|
||||
display: flex;
|
||||
min-height: 100vh;
|
||||
background:
|
||||
radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 28rem),
|
||||
radial-gradient(circle at 82% 4%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 26rem),
|
||||
linear-gradient(135deg, var(--page), var(--page-2));
|
||||
}
|
||||
.login-wrap { margin: auto; width: 100%; max-width: 410px; padding: 22px; }
|
||||
.login-card { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
|
||||
.login-brand { justify-content: center; margin-bottom: 6px; }
|
||||
.login-erro { color: var(--critical); min-height: 1em; margin: 0; }
|
||||
.erro { color: var(--critical); margin: 4px 0 0; font-weight: 750; }
|
||||
.login-card .field input { width: 100%; }
|
||||
|
||||
/* ---------- usuarios ---------- */
|
||||
#lista-usuarios { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
|
||||
#lista-usuarios > div { padding: 6px 0; border-bottom: 1px solid var(--grid); }
|
||||
#form-novo-usuario select { border: 1px solid var(--grid); border-radius: 8px; padding: 7px 10px; background: var(--surface); color: var(--ink); }
|
||||
|
||||
/* chips, avisos e listas */
|
||||
.chip {
|
||||
font-size: 12px; font-weight: 600;
|
||||
padding: 3px 10px; border-radius: 999px;
|
||||
background: var(--grid); color: var(--ink-2);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
border: 1px solid var(--border);
|
||||
background: var(--surface);
|
||||
color: var(--ink-2);
|
||||
border-radius: 999px;
|
||||
padding: 5px 11px;
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
}
|
||||
.chip.ok { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good-text); }
|
||||
.chip.warn { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--ink); }
|
||||
|
||||
.chip.ok { background: color-mix(in srgb, var(--good) 12%, var(--surface)); color: var(--good-text); border-color: color-mix(in srgb, var(--good) 26%, var(--border)); }
|
||||
.chip.warn { background: color-mix(in srgb, var(--warning) 14%, var(--surface)); color: var(--ink); border-color: color-mix(in srgb, var(--warning) 32%, var(--border)); }
|
||||
.notice {
|
||||
margin-top: 10px; padding: 12px;
|
||||
border: 1px solid var(--warning);
|
||||
border-radius: 8px;
|
||||
background: color-mix(in srgb, var(--warning) 8%, transparent);
|
||||
margin-top: 12px;
|
||||
padding: 14px;
|
||||
border: 1px solid color-mix(in srgb, var(--warning) 42%, var(--border));
|
||||
border-radius: var(--radius);
|
||||
background: color-mix(in srgb, var(--warning) 10%, var(--surface));
|
||||
}
|
||||
.notice p { margin: 0 0 10px; }
|
||||
|
||||
/* pickers de cidade/nicho */
|
||||
.picker { margin-top: 8px; }
|
||||
.picker input[type="search"] { width: 100%; margin-bottom: 6px; }
|
||||
.sugestoes { display: flex; flex-direction: column; gap: 2px; max-height: 180px; overflow-y: auto; }
|
||||
.sugestoes button {
|
||||
text-align: left; font: inherit; border: none; background: none;
|
||||
color: var(--ink); padding: 6px 8px; border-radius: 6px; cursor: pointer;
|
||||
}
|
||||
.sugestoes button:hover { background: var(--grid); }
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
|
||||
.chips .chip { cursor: pointer; }
|
||||
.chips .chip::after { content: " ✕"; color: var(--muted); }
|
||||
.nichos-grid {
|
||||
display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
|
||||
gap: 2px 12px; max-height: 300px; overflow-y: auto; margin-top: 8px;
|
||||
}
|
||||
.nichos-grid label { display: flex; gap: 6px; align-items: center; padding: 3px 4px; border-radius: 6px; cursor: pointer; }
|
||||
.nichos-grid label:hover { background: var(--grid); }
|
||||
|
||||
.cnae-avulso { margin-top: 10px; border-top: 1px dashed var(--grid); padding-top: 10px; }
|
||||
.cnae-avulso summary { cursor: pointer; font-size: 13px; color: var(--ink-2); font-weight: 600; }
|
||||
.cnae-avulso-hint { margin: 6px 0 8px; font-size: 12.5px; }
|
||||
.cnae-avulso input[type="search"] { width: 100%; margin-bottom: 6px; }
|
||||
.cnae-avulso .sugestoes button { display: flex; justify-content: space-between; gap: 8px; }
|
||||
.cnae-avulso .sugestoes .cod { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
|
||||
|
||||
.fontes { display: flex; flex-direction: column; gap: 6px; }
|
||||
.fonte {
|
||||
display: flex; gap: 10px; align-items: flex-start;
|
||||
border: 1px solid var(--grid); border-radius: 8px; padding: 8px 10px; cursor: pointer;
|
||||
}
|
||||
.fonte input { margin-top: 3px; }
|
||||
.fonte .desc { font-size: 12.5px; color: var(--ink-2); }
|
||||
.fonte.indisponivel { opacity: 0.55; }
|
||||
|
||||
/* ---------- progresso ---------- */
|
||||
.progress-bar { height: 8px; border-radius: 999px; background: var(--grid); overflow: hidden; margin: 10px 0 8px; }
|
||||
.progress-fill { height: 100%; width: 3%; background: var(--accent); border-radius: 999px; transition: width 0.4s; }
|
||||
.progress-msg { color: var(--ink-2); margin: 4px 0 10px; min-height: 1.4em; }
|
||||
.stat-row { display: flex; gap: 18px; margin-bottom: 10px; }
|
||||
.stat-row .mini { display: flex; flex-direction: column; }
|
||||
.stat-row .mini b { font-size: 20px; }
|
||||
.stat-row .mini span { font-size: 12px; color: var(--muted); }
|
||||
.log {
|
||||
font: 12px/1.5 ui-monospace, Consolas, monospace;
|
||||
background: var(--page); border: 1px solid var(--grid); border-radius: 8px;
|
||||
padding: 8px 10px; max-height: 160px; overflow-y: auto; white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.lista { display: flex; flex-direction: column; gap: 8px; }
|
||||
.lista .item {
|
||||
display: flex; justify-content: space-between; align-items: center; gap: 10px;
|
||||
border-bottom: 1px solid var(--grid); padding: 8px 2px; flex-wrap: wrap;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
padding: 11px 12px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
background: var(--surface);
|
||||
}
|
||||
.lista .item:last-child { border-bottom: none; }
|
||||
.lista .item .sub { font-size: 12px; color: var(--muted); }
|
||||
.lista .item .sub { color: var(--muted); font-size: 12px; }
|
||||
|
||||
/* ---------- tratamento: tiles e rankings ---------- */
|
||||
.filtros-card { padding: 12px 16px; }
|
||||
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
|
||||
.filtros select, .filtros input { min-width: 130px; }
|
||||
#f-busca { flex: 1; min-width: 200px; }
|
||||
/* pickers */
|
||||
.picker { margin-top: 10px; }
|
||||
.picker input[type="search"], .cnae-avulso input[type="search"] { width: 100%; margin-bottom: 8px; }
|
||||
.sugestoes { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }
|
||||
.sugestoes button {
|
||||
text-align: left;
|
||||
border: 0;
|
||||
border-radius: 10px;
|
||||
background: transparent;
|
||||
color: var(--ink);
|
||||
cursor: pointer;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
.sugestoes button:hover { background: var(--surface-2); }
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 12px; }
|
||||
.chips .chip { cursor: pointer; }
|
||||
.chips .chip::after { content: " x"; color: var(--muted); }
|
||||
.chips .chip:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
|
||||
.nichos-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
|
||||
gap: 4px 12px;
|
||||
max-height: 320px;
|
||||
overflow-y: auto;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.nichos-grid label { display: flex; gap: 7px; align-items: center; padding: 6px 7px; border-radius: 10px; cursor: pointer; }
|
||||
.nichos-grid label:hover { background: var(--surface-2); }
|
||||
.cnae-avulso { margin-top: 14px; border-top: 1px dashed var(--grid); padding-top: 12px; }
|
||||
.cnae-avulso summary { color: var(--ink-2); font-size: 13px; font-weight: 800; }
|
||||
.cnae-avulso-hint { margin: 7px 0 9px; font-size: 12.5px; }
|
||||
.cnae-avulso .sugestoes button { display: flex; justify-content: space-between; gap: 8px; }
|
||||
.cnae-avulso .sugestoes .cod { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
|
||||
.fontes { display: flex; flex-direction: column; gap: 8px; }
|
||||
.fonte {
|
||||
display: flex;
|
||||
gap: 11px;
|
||||
align-items: flex-start;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 11px 12px;
|
||||
background: var(--surface);
|
||||
cursor: pointer;
|
||||
}
|
||||
.fonte:hover { border-color: var(--accent); box-shadow: var(--shadow-soft); }
|
||||
.fonte input { margin-top: 3px; }
|
||||
.fonte .desc { color: var(--ink-2); font-size: 12.5px; }
|
||||
.fonte.indisponivel { opacity: 0.58; }
|
||||
|
||||
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
|
||||
/* progresso */
|
||||
.progress-bar { height: 10px; border-radius: 999px; background: var(--grid); overflow: hidden; margin: 12px 0 9px; }
|
||||
.progress-fill { height: 100%; width: 3%; background: linear-gradient(90deg, var(--accent), #ffb36d); border-radius: 999px; transition: width 0.4s; }
|
||||
.progress-msg { color: var(--ink-2); margin: 4px 0 11px; min-height: 1.4em; }
|
||||
.stat-row { display: flex; gap: 18px; margin-bottom: 12px; flex-wrap: wrap; }
|
||||
.stat-row .mini { display: flex; flex-direction: column; min-width: 96px; }
|
||||
.stat-row .mini b { font-size: 23px; letter-spacing: -0.03em; }
|
||||
.stat-row .mini span { color: var(--muted); font-size: 12px; }
|
||||
.log {
|
||||
max-height: 170px;
|
||||
overflow-y: auto;
|
||||
white-space: pre-wrap;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
background: #0f172a;
|
||||
color: #dbeafe;
|
||||
font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
}
|
||||
|
||||
/* tratamento */
|
||||
.filtros-card { padding: 14px; }
|
||||
.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; align-items: center; }
|
||||
.filtros select, .filtros input { width: 100%; min-width: 0; }
|
||||
#f-busca { grid-column: span 2; }
|
||||
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
|
||||
.tile {
|
||||
background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
|
||||
padding: 14px 16px; box-shadow: var(--shadow);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 16px;
|
||||
box-shadow: var(--shadow-soft);
|
||||
}
|
||||
.tile .valor { font-size: 26px; font-weight: 700; }
|
||||
.tile .rotulo { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
|
||||
.tile .detalhe { font-size: 12px; color: var(--muted); }
|
||||
.tile::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: auto -20px -28px auto;
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
border-radius: 999px;
|
||||
background: color-mix(in srgb, var(--accent) 10%, transparent);
|
||||
}
|
||||
.tile .valor { font-size: 29px; font-weight: 900; letter-spacing: -0.04em; }
|
||||
.tile .rotulo { color: var(--ink-2); font-size: 12.5px; font-weight: 750; margin-top: 2px; }
|
||||
.tile .detalhe { color: var(--muted); font-size: 12px; }
|
||||
.tile.t-good .valor { color: var(--good-text); }
|
||||
.tile.t-warn .valor { color: var(--ink); }
|
||||
.tile.tile-wide { grid-column: span 2; }
|
||||
@media (max-width: 640px) { .tile.tile-wide { grid-column: span 1; } }
|
||||
.meta-input { width: 70px; text-align: right; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
|
||||
.meta-input { width: 78px; text-align: right; padding: 5px 7px; }
|
||||
|
||||
/* ---------- funil comercial ---------- */
|
||||
.funil { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
|
||||
.funil-etapa { display: grid; grid-template-columns: 190px 1fr 70px; align-items: center; gap: 8px; padding: 1px 4px; }
|
||||
.funil-etapa.pendente { opacity: 0.4; }
|
||||
.funil-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.funil-barra { height: 14px; border-radius: 4px; overflow: hidden; background: none; }
|
||||
.funil-fill { height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
|
||||
.funil-valor { font-size: 12.5px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
|
||||
|
||||
/* barras de ranking: magnitude = um matiz (azul), rótulo direto, sem legenda */
|
||||
.ranking { display: flex; flex-direction: column; gap: 7px; }
|
||||
.rank-row { display: grid; grid-template-columns: 150px 1fr 70px; gap: 8px; align-items: center; cursor: pointer; border-radius: 6px; padding: 1px 4px; }
|
||||
.rank-row:hover { background: var(--grid); }
|
||||
.rank-row.ativo { background: color-mix(in srgb, var(--accent) 16%, transparent); font-weight: 600; }
|
||||
.ranking, .funil { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
|
||||
.rank-row, .funil-etapa {
|
||||
display: grid;
|
||||
grid-template-columns: 150px 1fr 70px;
|
||||
align-items: center;
|
||||
gap: 9px;
|
||||
padding: 4px 6px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.funil-etapa { grid-template-columns: 190px 1fr 70px; }
|
||||
.rank-row { cursor: pointer; }
|
||||
.rank-row:hover, .oportunidade-clicavel:hover { background: var(--surface-2); }
|
||||
.rank-row.ativo, .oportunidade-clicavel.ativo { background: color-mix(in srgb, var(--accent) 13%, var(--surface)); font-weight: 800; }
|
||||
.rank-row.nao-clicavel { cursor: default; }
|
||||
.rank-row.nao-clicavel:hover { background: none; }
|
||||
.oportunidade-clicavel { cursor: pointer; border-radius: 8px; padding: 6px 8px; }
|
||||
.oportunidade-clicavel:hover { background: var(--grid); }
|
||||
.oportunidade-clicavel.ativo { background: color-mix(in srgb, var(--accent) 16%, transparent); }
|
||||
.rank-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.rank-track { height: 14px; border-radius: 4px; overflow: hidden; background: none; }
|
||||
.rank-fill { height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
|
||||
.rank-value { font-size: 12.5px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
|
||||
.rank-row.nao-clicavel:hover { background: transparent; }
|
||||
.funil-etapa.pendente { opacity: 0.43; }
|
||||
.rank-label, .funil-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
|
||||
.rank-track, .funil-barra { height: 12px; overflow: hidden; border-radius: 999px; background: var(--grid); }
|
||||
.rank-fill, .funil-fill { height: 100%; min-width: 3px; border-radius: 999px; background: linear-gradient(90deg, var(--bar), #ffb36d); }
|
||||
.rank-value, .funil-valor { color: var(--ink-2); text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }
|
||||
.oportunidade-clicavel { cursor: pointer; border-radius: 12px; padding: 8px 10px; }
|
||||
|
||||
/* ---------- tabela ---------- */
|
||||
.table-wrap { overflow-x: auto; margin: 0 -4px; }
|
||||
table { border-collapse: collapse; width: 100%; }
|
||||
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
|
||||
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
|
||||
/* tabela */
|
||||
.table-wrap { overflow-x: auto; margin: 0 -6px; }
|
||||
table { width: 100%; border-collapse: separate; border-spacing: 0; }
|
||||
th, td { text-align: left; white-space: nowrap; padding: 10px 12px; border-bottom: 1px solid var(--grid); }
|
||||
th {
|
||||
color: var(--muted);
|
||||
background: var(--surface);
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
|
||||
.acao-col {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
z-index: 3;
|
||||
width: 58px;
|
||||
min-width: 58px;
|
||||
text-align: center;
|
||||
background: var(--surface);
|
||||
box-shadow: 10px 0 18px -18px rgba(22, 32, 51, 0.8);
|
||||
}
|
||||
td.acao-col { padding-left: 8px; padding-right: 8px; }
|
||||
tbody tr { cursor: pointer; }
|
||||
tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
|
||||
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
|
||||
/* Escala sequencial ordinal (excelente -> muito baixo), verde -> ambar -> vermelho,
|
||||
construida so com os tokens ja validados (--good/--warning/--critical). */
|
||||
.badge.excelente { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good-text); }
|
||||
tbody tr:hover .acao-col { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
|
||||
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 850; white-space: nowrap; }
|
||||
.badge.excelente { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good-text); }
|
||||
.badge.bom { background: color-mix(in srgb, var(--good) 12%, var(--warning) 8%); color: var(--good-text); }
|
||||
.badge.medio { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--ink); }
|
||||
.badge.baixo { background: color-mix(in srgb, var(--warning) 18%, var(--critical) 12%); color: var(--critical); }
|
||||
.badge.muito_baixo { background: color-mix(in srgb, var(--critical) 16%, transparent); color: var(--critical); }
|
||||
|
||||
.badge.prioridade-1 { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good-text); }
|
||||
.badge.prioridade-2 { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--ink); }
|
||||
.badge.medio { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--ink); }
|
||||
.badge.baixo { background: color-mix(in srgb, var(--warning) 16%, var(--critical) 10%); color: var(--critical); }
|
||||
.badge.muito_baixo { background: color-mix(in srgb, var(--critical) 14%, transparent); color: var(--critical); }
|
||||
.badge.prioridade-1 { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good-text); }
|
||||
.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); }
|
||||
|
||||
.produto-cell { font-size: 12.5px; }
|
||||
.estrelas { color: var(--warning); letter-spacing: 1px; white-space: nowrap; }
|
||||
.pontos-fortes { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
|
||||
.resumo-comercial { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
|
||||
.resumo-comercial h3 { margin: 0 0 8px; font-size: 14px; }
|
||||
.empresa-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
|
||||
|
||||
/* ---------- explicacao de score (v2.1) ---------- */
|
||||
.score-breakdown-wrap { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
|
||||
.score-breakdown { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
|
||||
.score-breakdown li.ok { color: var(--ink); }
|
||||
.whatsapp-action {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
display: inline-grid;
|
||||
place-items: center;
|
||||
border: 1px solid color-mix(in srgb, var(--good) 35%, var(--grid));
|
||||
border-radius: 999px;
|
||||
background: color-mix(in srgb, var(--good) 12%, var(--surface));
|
||||
color: var(--good-text);
|
||||
cursor: pointer;
|
||||
font-size: 17px;
|
||||
line-height: 1;
|
||||
}
|
||||
.whatsapp-action:hover { background: var(--good); color: #fff; }
|
||||
.pontos-fortes, .score-breakdown { list-style: none; margin: 7px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
|
||||
.resumo-comercial, .score-breakdown-wrap { border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; margin-top: 12px; background: var(--surface-2); }
|
||||
.resumo-comercial h3 { margin: 0 0 8px; font-size: 14px; }
|
||||
.score-breakdown li.nok { color: var(--muted); }
|
||||
|
||||
/* ---------- atalhos de exportacao (v2.1) ---------- */
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
|
||||
.chip {
|
||||
border: 1px solid var(--border); background: var(--surface); color: var(--ink);
|
||||
border-radius: 999px; padding: 4px 12px; font-size: 12.5px; cursor: pointer;
|
||||
}
|
||||
.chip:hover { background: var(--grid); border-color: var(--accent); }
|
||||
/* usuarios */
|
||||
#lista-usuarios { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
|
||||
#lista-usuarios > div { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
|
||||
|
||||
/* ---------- modais e toast ---------- */
|
||||
/* modais e toast */
|
||||
dialog {
|
||||
border: 1px solid var(--border); border-radius: 14px;
|
||||
background: var(--surface); color: var(--ink);
|
||||
max-width: 560px; width: calc(100vw - 40px);
|
||||
width: calc(100vw - 40px);
|
||||
max-width: 600px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--surface);
|
||||
color: var(--ink);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
|
||||
.modal-body { padding: 20px 22px; }
|
||||
.modal-body h2 { margin-top: 0; }
|
||||
#modal-historico { max-width: 620px; }
|
||||
dialog::backdrop { background: rgba(8, 13, 22, 0.58); backdrop-filter: blur(4px); }
|
||||
.modal-body { padding: 24px; }
|
||||
.modal-body h2 { margin-top: 0; letter-spacing: -0.03em; }
|
||||
#modal-historico { max-width: 680px; }
|
||||
#modal-historico .lista { max-height: 60vh; overflow-y: auto; margin-top: 10px; }
|
||||
textarea { width: 100%; resize: vertical; }
|
||||
|
||||
.toast {
|
||||
position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
|
||||
background: var(--ink); color: var(--page);
|
||||
padding: 10px 18px; border-radius: 10px; font-weight: 600;
|
||||
z-index: 100; max-width: 80vw;
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 24px;
|
||||
z-index: 100;
|
||||
max-width: min(86vw, 680px);
|
||||
transform: translateX(-50%);
|
||||
padding: 11px 16px;
|
||||
border-radius: 999px;
|
||||
background: var(--ink);
|
||||
color: var(--page);
|
||||
box-shadow: var(--shadow);
|
||||
font-weight: 800;
|
||||
}
|
||||
.hidden { display: none !important; }
|
||||
.muted { color: var(--muted); font-weight: 400; }
|
||||
|
||||
/* detalhe do lead */
|
||||
.detalhe-grid { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; font-size: 13.5px; }
|
||||
.detalhe-grid { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13.5px; }
|
||||
.detalhe-grid dt { color: var(--muted); }
|
||||
.detalhe-grid dd { margin: 0; word-break: break-word; }
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.grid-3 { grid-template-columns: 1fr 1fr; }
|
||||
.topbar { grid-template-columns: 1fr auto auto auto; }
|
||||
.tabs { grid-column: 1 / -1; order: 2; width: 100%; justify-content: center; }
|
||||
#usuario-logado { justify-self: end; }
|
||||
}
|
||||
|
||||
@media (max-width: 780px) {
|
||||
main { padding: 16px 12px 50px; }
|
||||
.topbar { padding: 10px 12px; grid-template-columns: 1fr auto auto; gap: 8px; }
|
||||
.brand-name { display: none; }
|
||||
#usuario-logado { display: none; }
|
||||
.tabs { overflow-x: auto; justify-content: flex-start; }
|
||||
.tab { white-space: nowrap; }
|
||||
.grid-3 { grid-template-columns: 1fr; }
|
||||
.card { border-radius: var(--radius); padding: 16px; }
|
||||
.settings-header, .settings-principal { grid-template-columns: 1fr; }
|
||||
.settings-controls { justify-content: flex-start; }
|
||||
.manual-send-card, #manual-oficial-campos { grid-template-columns: 1fr; }
|
||||
.settings-section input[type="text"],
|
||||
.settings-section input[type="password"],
|
||||
.settings-section textarea,
|
||||
.settings-section select,
|
||||
.manual-send-card input,
|
||||
.manual-send-card select { width: 100%; min-width: 0; }
|
||||
.manual-actions { align-items: stretch; flex-direction: column; }
|
||||
.manual-actions .btn { width: 100%; }
|
||||
#f-busca, .tile.tile-wide { grid-column: span 1; }
|
||||
.rank-row, .funil-etapa { grid-template-columns: 1fr 90px; }
|
||||
.rank-track, .funil-barra { grid-column: 1 / -1; order: 3; }
|
||||
th { top: 107px; }
|
||||
.modal-body { padding: 18px; }
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
+135
-10
@@ -5,12 +5,12 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>GTI Máquina Comercial</title>
|
||||
<link rel="stylesheet" href="/css/app.css">
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🎯</text></svg>">
|
||||
<link rel="icon" href="/img/logo-gti.png">
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar">
|
||||
<div class="brand">
|
||||
<span class="brand-mark">GTI</span>
|
||||
<img class="brand-mark" src="/img/logo-gti.png" alt="GTI">
|
||||
<span class="brand-name">Máquina Comercial</span>
|
||||
</div>
|
||||
<nav class="tabs" role="tablist">
|
||||
@@ -206,7 +206,7 @@
|
||||
<table id="tabela-leads">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Empresa</th><th>WhatsApp</th><th>Cidade</th><th>Nicho</th>
|
||||
<th class="acao-col">Ação</th><th>Empresa</th><th>WhatsApp</th><th>Cidade</th><th>Nicho</th>
|
||||
<th>Prioridade</th><th class="num">Geral</th>
|
||||
<th>Classificação</th><th>Produto</th><th>Exportado</th>
|
||||
</tr>
|
||||
@@ -283,9 +283,131 @@
|
||||
<!-- Modal de configurações -->
|
||||
<dialog id="modal-settings">
|
||||
<form method="dialog" class="modal-body">
|
||||
<h2>Configurações</h2>
|
||||
<div class="field">
|
||||
<label>Padrões Z-PRO (usados nas exportações)</label>
|
||||
<div class="settings-header">
|
||||
<div>
|
||||
<h2>Configurações</h2>
|
||||
<p class="muted">Ajustes de envio, credenciais Z-PRO e preferências comerciais.</p>
|
||||
</div>
|
||||
<span class="chip" id="outreach-status"></span>
|
||||
</div>
|
||||
|
||||
<section class="settings-card settings-principal">
|
||||
<div>
|
||||
<label class="settings-title">Envio WhatsApp</label>
|
||||
<p class="muted">O limite vale para envios manuais e automáticos feitos hoje.</p>
|
||||
</div>
|
||||
<div class="settings-controls">
|
||||
<label class="toggle"><input type="checkbox" id="outreach-ativo"> Automação ativa</label>
|
||||
<label>Limite por dia <input type="number" id="outreach-limite" min="1"></label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<details class="settings-section" open>
|
||||
<summary>Enviar mensagem manual</summary>
|
||||
<p class="muted">Cria ou reutiliza um ticket no painel Z-PRO e respeita o limite diário.</p>
|
||||
<div class="manual-send-card">
|
||||
<label class="full">Número do WhatsApp
|
||||
<input type="text" id="manual-numero" placeholder="5511999999999" inputmode="numeric">
|
||||
</label>
|
||||
<div class="manual-channel full" aria-label="Canal de envio manual">
|
||||
<label class="radio"><input type="radio" name="manual-canal" id="manual-canal-naooficial" value="nao_oficial" checked> Não-oficial (texto livre)</label>
|
||||
<label class="radio"><input type="radio" name="manual-canal" id="manual-canal-oficial" value="oficial"> Oficial (Meta, template aprovado)</label>
|
||||
</div>
|
||||
<label class="full" id="manual-mensagem-wrap">Mensagem
|
||||
<textarea id="manual-mensagem" rows="2" placeholder="Digite a mensagem de texto livre..."></textarea>
|
||||
</label>
|
||||
<div id="manual-oficial-campos" class="hidden full">
|
||||
<label class="full">Escolher modelo salvo
|
||||
<select id="manual-template-biblioteca">
|
||||
<option value="">Selecione um template...</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="row full">
|
||||
<button class="btn-ghost btn-sm" id="btn-testar-template-biblioteca" type="button">Testar modelo selecionado</button>
|
||||
<span class="muted">Usa o número informado acima e variáveis de exemplo.</span>
|
||||
</div>
|
||||
<label>Template aprovado
|
||||
<input type="text" id="manual-template-nome" placeholder="ex.: confirma_suporte">
|
||||
</label>
|
||||
<label>Idioma
|
||||
<input type="text" id="manual-template-idioma" value="pt_BR">
|
||||
</label>
|
||||
<label>Rota Z-PRO
|
||||
<select id="manual-template-rota">
|
||||
<option value="template">Template padrão</option>
|
||||
<option value="templateBody">Utility/Body</option>
|
||||
<option value="templateMarketingBody">Marketing/Body</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="template-vars full">
|
||||
<label>Variáveis do template</label>
|
||||
<p class="muted">Preencha na mesma ordem do template: {{1}}, {{2}}, {{3}}...</p>
|
||||
<div class="variable-helper">
|
||||
<select id="manual-variable-picker">
|
||||
<option value="">Inserir variável da Máquina Comercial...</option>
|
||||
</select>
|
||||
<span class="muted">Clique em um campo abaixo e escolha uma variável.</span>
|
||||
</div>
|
||||
<div class="template-vars-grid">
|
||||
<label class="template-var-field">Variável {{1}} <input type="text" class="manual-template-var" id="manual-template-var1" data-var-index="1" placeholder="Ex.: Gustavo"></label>
|
||||
<label class="template-var-field">Variável {{2}} <input type="text" class="manual-template-var" data-var-index="2" placeholder="Ex.: Suporte GLPI #123"></label>
|
||||
<label class="template-var-field">Variável {{3}} <input type="text" class="manual-template-var" data-var-index="3"></label>
|
||||
<label class="template-var-field">Variável {{4}} <input type="text" class="manual-template-var" data-var-index="4"></label>
|
||||
<label class="template-var-field">Variável {{5}} <input type="text" class="manual-template-var" data-var-index="5"></label>
|
||||
</div>
|
||||
<div class="template-preview" id="manual-template-preview">Selecione um template para ver a pré-visualização.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="manual-actions full">
|
||||
<span class="muted" id="manual-status"></span>
|
||||
<button class="btn btn-primary" id="btn-enviar-manual" type="button">Enviar mensagem</button>
|
||||
</div>
|
||||
<button class="btn-ghost btn-sm" id="btn-toggle-outreach-log" type="button">Ver log de envios</button>
|
||||
<div id="outreach-ultimos" class="lista hidden full"></div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="settings-section">
|
||||
<summary>Templates automáticos</summary>
|
||||
<p class="muted">Mensagens usadas quando a automação estiver ativada. Uma por produto recomendado.</p>
|
||||
<div class="template-sync-inline">
|
||||
<span class="muted" id="waba-template-library-status">Carregando biblioteca de templates...</span>
|
||||
<button class="btn-ghost btn-sm" id="btn-sync-gchat-templates-inline" type="button">Atualizar lista do GChat</button>
|
||||
</div>
|
||||
<div id="outreach-templates" class="lista"></div>
|
||||
<div class="row space-between">
|
||||
<span></span>
|
||||
<button class="btn-ghost" id="btn-salvar-outreach" type="button">Salvar templates</button>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="settings-section">
|
||||
<summary>Credenciais Z-PRO</summary>
|
||||
<p class="muted">Use os dados de Admin > API do Z-PRO. Pode colar a Base URL com ou sem <code>https://</code>.</p>
|
||||
<div class="row">
|
||||
<label>Base URL <input type="text" id="cfg-zpro-baseurl" placeholder="seu-dominio-zpro.com.br"></label>
|
||||
<label>API ID <input type="text" id="cfg-zpro-apiid"></label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Token <input type="password" id="cfg-zpro-token" autocomplete="off"></label>
|
||||
<label>WhatsApp ID <input type="text" id="cfg-zpro-whatsappid"></label>
|
||||
</div>
|
||||
<div class="row space-between">
|
||||
<span class="muted" id="zpro-credenciais-status"></span>
|
||||
<button class="btn-ghost" id="btn-testar-zpro" type="button">Testar conexão</button>
|
||||
</div>
|
||||
<div class="template-sync-box">
|
||||
<label>URL de templates do GChat <input type="text" id="cfg-gchat-templates-url" placeholder="https://apigchat.gtigrupo.com.br/...templates..."></label>
|
||||
<label>Token GChat opcional <input type="password" id="cfg-gchat-token" autocomplete="off"></label>
|
||||
<div class="row space-between">
|
||||
<span class="muted" id="gchat-template-sync-status"></span>
|
||||
<button class="btn-ghost" id="btn-sync-gchat-templates" type="button">Sincronizar templates</button>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="settings-section">
|
||||
<summary>Padrões de exportação e ticket</summary>
|
||||
<div class="row">
|
||||
<label>Pipeline <input type="number" id="cfg-pipeline" min="1"></label>
|
||||
<label>Etapa <input type="number" id="cfg-stage" min="1"></label>
|
||||
@@ -293,13 +415,15 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Previsão de fechamento (dias) <input type="number" id="cfg-forecast" min="1"></label>
|
||||
<label>Fila ticket manual <input type="number" id="cfg-ticket-queue" min="1"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field zona-risco">
|
||||
<label>Zona de risco</label>
|
||||
</details>
|
||||
|
||||
<details class="settings-section zona-risco">
|
||||
<summary>Zona de risco</summary>
|
||||
<p class="muted">Apaga permanentemente todos os leads, exportações, capturas e extrações. Configurações e nichos não são afetados.</p>
|
||||
<button class="btn-danger" id="btn-limpar-base" type="button">🗑️ Limpar toda a base de leads</button>
|
||||
</div>
|
||||
</details>
|
||||
<div class="row space-between">
|
||||
<button class="btn-ghost" value="cancel">Fechar</button>
|
||||
<button class="btn btn-primary" id="btn-salvar-settings" value="default">Salvar</button>
|
||||
@@ -315,6 +439,7 @@
|
||||
<div class="field">
|
||||
<label>Senha de segurança <input type="password" id="reset-base-senha" autocomplete="off"></label>
|
||||
</div>
|
||||
<p class="muted erro hidden" id="reset-base-erro"></p>
|
||||
<div class="row space-between">
|
||||
<button class="btn-ghost" id="btn-cancelar-reset-base" type="button">Cancelar</button>
|
||||
<button class="btn-danger" id="btn-confirmar-reset-base" type="button">Confirmar limpeza</button>
|
||||
|
||||
@@ -79,6 +79,11 @@ function h(tag, attrs = {}, ...children) {
|
||||
}
|
||||
|
||||
let toastTimer = null;
|
||||
// Aviso: um <dialog> aberto via showModal() fica acima de qualquer div normal
|
||||
// (top layer do navegador, z-index nao ajuda — e testamos que nem a Popover
|
||||
// API resolve, o dialog continua por cima). Por isso o toast NAO deve ser a
|
||||
// unica forma de mostrar erro de uma acao disparada de dentro de um modal
|
||||
// aberto: use tambem uma mensagem inline no proprio modal nesses casos.
|
||||
function toast(message, ms = 3500) {
|
||||
const box = el('toast');
|
||||
box.textContent = message;
|
||||
|
||||
+550
-3
@@ -68,15 +68,543 @@
|
||||
}
|
||||
|
||||
// configurações
|
||||
let WABA_TEMPLATE_LIBRARY = [];
|
||||
let COMMERCIAL_VARIABLES = [];
|
||||
let focusedVariableInput = null;
|
||||
let manualLeadContext = null;
|
||||
|
||||
async function carregarVariaveisComerciais() {
|
||||
const { variables } = await API.get('/api/outreach/variables');
|
||||
COMMERCIAL_VARIABLES = variables || [];
|
||||
const picker = el('manual-variable-picker');
|
||||
if (picker) {
|
||||
picker.replaceChildren(
|
||||
h('option', { value: '' }, 'Inserir variável da Máquina Comercial...'),
|
||||
...COMMERCIAL_VARIABLES.map((variable) => h('option', { value: `{{${variable.key}}}` }, `{{${variable.key}}} - ${variable.label}`))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function carregarBibliotecaWaba() {
|
||||
const { templates, lastSync } = await API.get('/api/outreach/waba-templates');
|
||||
WABA_TEMPLATE_LIBRARY = templates || [];
|
||||
const select = el('manual-template-biblioteca');
|
||||
if (select) select.replaceChildren(...templateOptions(select.value));
|
||||
const statusEl = el('waba-template-library-status');
|
||||
if (statusEl) {
|
||||
statusEl.textContent = lastSync
|
||||
? `${WABA_TEMPLATE_LIBRARY.length} templates carregados. Última atualização: ${dataBr(lastSync)}`
|
||||
: `${WABA_TEMPLATE_LIBRARY.length} templates locais carregados. Para trazer todos do GChat, preencha o Token GChat e clique em Atualizar.`;
|
||||
}
|
||||
}
|
||||
|
||||
function templateLabel(template) {
|
||||
return `${template.name} (${template.language})`;
|
||||
}
|
||||
|
||||
function templateOptions(selected = '') {
|
||||
return [h('option', { value: '' }, 'Selecione um template...')].concat(
|
||||
WABA_TEMPLATE_LIBRARY.map((template) => h('option', {
|
||||
value: template.name,
|
||||
selected: template.name === selected ? '' : null
|
||||
}, templateLabel(template)))
|
||||
);
|
||||
}
|
||||
|
||||
function preencherVariaveis(inputs, variables, fallback = []) {
|
||||
inputs.forEach((input, index) => {
|
||||
input.value = variables[index] || fallback[index] || '';
|
||||
});
|
||||
}
|
||||
|
||||
function templateVariableCount(template) {
|
||||
if (!template) return 0;
|
||||
const fromVariables = Array.isArray(template.variables) ? template.variables.length : 0;
|
||||
const matches = String(template.text || '').match(/{{\s*\d+\s*}}/g) || [];
|
||||
const fromText = Math.max(0, ...matches.map((match) => Number(match.replace(/\D/g, ''))));
|
||||
return Math.min(5, Math.max(fromVariables, fromText));
|
||||
}
|
||||
|
||||
function setVariableFields(container, template, inputs, fallback = []) {
|
||||
const count = templateVariableCount(template);
|
||||
inputs.forEach((input, index) => {
|
||||
const field = input.closest('.template-var-field') || input.closest('label');
|
||||
const visible = index < count;
|
||||
if (field) field.classList.toggle('hidden', !visible);
|
||||
if (!visible) input.value = '';
|
||||
else if (!input.value) input.value = template?.variables?.[index] || fallback[index] || '';
|
||||
});
|
||||
const empty = container?.querySelector?.('.template-vars-empty');
|
||||
if (empty) empty.classList.toggle('hidden', count > 0);
|
||||
}
|
||||
|
||||
function previewTemplateText(template, inputs) {
|
||||
const text = String(template?.text || '').trim();
|
||||
if (!template) return 'Selecione um template para ver a pré-visualização.';
|
||||
if (!text) return 'Pré-visualização indisponível para este template local.';
|
||||
return text.replace(/{{\s*(\d+)\s*}}/g, (_, index) => {
|
||||
const input = inputs[Number(index) - 1];
|
||||
const value = resolverVariavelManual(input?.value?.trim());
|
||||
return value ? `[${value}]` : `[Variável ${index}]`;
|
||||
});
|
||||
}
|
||||
|
||||
function atualizarPreview(previewEl, template, inputs) {
|
||||
if (previewEl) previewEl.textContent = previewTemplateText(template, inputs);
|
||||
}
|
||||
|
||||
function collectVisibleVariables(inputs) {
|
||||
return inputs
|
||||
.filter((input) => !(input.closest('.template-var-field') || input.closest('label'))?.classList.contains('hidden'))
|
||||
.map((input) => input.value.trim());
|
||||
}
|
||||
|
||||
function collectVisibleVariablesResolvidas(inputs) {
|
||||
return collectVisibleVariables(inputs).map(resolverVariavelManual);
|
||||
}
|
||||
|
||||
function valoresVariaveisManuais(lead = manualLeadContext) {
|
||||
const empresa = lead?.empresa || lead?.legal_name || lead?.businessName || lead?.name || 'Empresa Teste';
|
||||
const produto = lead?.produto || lead?.produto_principal || lead?.interesse || 'Atendimento comercial';
|
||||
const segmento = lead?.segmento_label || lead?.segmento || 'Suporte';
|
||||
const name = lead?.name || empresa;
|
||||
return {
|
||||
name,
|
||||
empresa,
|
||||
businessName: empresa,
|
||||
firstName: String(name).split(/\s+/).filter(Boolean)[0] || empresa,
|
||||
lastName: lead?.lastName || '',
|
||||
produto,
|
||||
protocol: lead?.protocol || produto,
|
||||
cidade: lead?.cidade || 'Salvador',
|
||||
uf: lead?.uf || 'BA',
|
||||
segmento,
|
||||
cnpj: lead?.cnpj || '00.000.000/0001-00',
|
||||
email: lead?.email || 'cliente@exemplo.com.br',
|
||||
phoneNumber: lead?.whatsapp || '5575999091780',
|
||||
whatsapp: lead?.whatsapp || '5575999091780',
|
||||
kanban: lead?.kanban || produto,
|
||||
user: lead?.user || 'Grupo GTI',
|
||||
userEmail: lead?.userEmail || 'comercial@gtigrupo.com.br',
|
||||
greeting: 'Olá'
|
||||
};
|
||||
}
|
||||
|
||||
function resolverVariavelManual(value) {
|
||||
const values = valoresVariaveisManuais();
|
||||
let output = String(value || 'Informação')
|
||||
.replaceAll('{empresa}', values.empresa)
|
||||
.replaceAll('{produto}', values.produto)
|
||||
.replaceAll('{cidade}', values.cidade)
|
||||
.replaceAll('{segmento}', values.segmento);
|
||||
for (const [key, variableValue] of Object.entries(values)) {
|
||||
output = output.replaceAll(`{{${key}}}`, variableValue);
|
||||
}
|
||||
for (const variable of COMMERCIAL_VARIABLES) {
|
||||
if (!output.includes(`{{${variable.key}}}`)) continue;
|
||||
output = output.replaceAll(`{{${variable.key}}}`, values[variable.key] || variable.label);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
const variavelExemplo = resolverVariavelManual;
|
||||
|
||||
function missingVisibleVariables(inputs) {
|
||||
return inputs
|
||||
.filter((input) => !(input.closest('.template-var-field') || input.closest('label'))?.classList.contains('hidden'))
|
||||
.filter((input) => !input.value.trim());
|
||||
}
|
||||
|
||||
function aplicarTemplateBiblioteca(template, { nomeEl, idiomaEl, routeEl, variableInputs }) {
|
||||
if (!template) return;
|
||||
nomeEl.value = template.name;
|
||||
idiomaEl.value = template.language;
|
||||
if (routeEl) routeEl.value = template.route;
|
||||
preencherVariaveis(variableInputs, template.variables);
|
||||
}
|
||||
|
||||
function variablePickerEl() {
|
||||
return h('select', { class: 'variable-picker' },
|
||||
h('option', { value: '' }, 'Inserir variável da Máquina Comercial...'),
|
||||
...COMMERCIAL_VARIABLES.map((variable) => h('option', { value: `{{${variable.key}}}` }, `{{${variable.key}}} - ${variable.label}`))
|
||||
);
|
||||
}
|
||||
|
||||
async function carregarOutreach() {
|
||||
const { settings } = await API.get('/api/settings');
|
||||
el('outreach-ativo').checked = settings['outreach.ativo'] === 'true';
|
||||
el('outreach-limite').value = settings['outreach.mensagensPorDia'] || 10;
|
||||
|
||||
const [{ templates }, status] = await Promise.all([
|
||||
API.get('/api/outreach/templates'),
|
||||
API.get('/api/outreach/status')
|
||||
]);
|
||||
el('outreach-status').textContent = `Enviado hoje: ${status.enviadosHoje}/${status.mensagensPorDia}`;
|
||||
|
||||
el('outreach-templates').replaceChildren(...templates.map((t) => {
|
||||
const oficial = t.canal === 'oficial';
|
||||
const mensagemEl = h('textarea', {
|
||||
class: 'outreach-template-mensagem', rows: 2,
|
||||
style: oficial ? 'display:none' : ''
|
||||
}, t.mensagem);
|
||||
const nomeEl = h('input', { type: 'text', class: 'outreach-template-waba-nome', value: t.template_waba_nome || '' });
|
||||
const idiomaEl = h('input', { type: 'text', class: 'outreach-template-waba-idioma', value: t.template_waba_idioma || 'pt_BR' });
|
||||
let variaveisSalvas = [];
|
||||
try {
|
||||
variaveisSalvas = JSON.parse(t.template_waba_variaveis_json || '[]');
|
||||
} catch {
|
||||
variaveisSalvas = [];
|
||||
}
|
||||
let templateSelecionado = WABA_TEMPLATE_LIBRARY.find((item) => item.name === t.template_waba_nome) || null;
|
||||
const variaveisEls = Array.from({ length: 5 }, (_, index) => {
|
||||
const input = h('input', {
|
||||
type: 'text',
|
||||
class: 'outreach-template-waba-var',
|
||||
value: variaveisSalvas[index] || (index === 0 ? '{empresa}' : index === 1 ? '{produto}' : ''),
|
||||
placeholder: index === 0 ? '{empresa}' : index === 1 ? '{produto}' : ''
|
||||
});
|
||||
input.addEventListener('focus', () => { focusedVariableInput = input; });
|
||||
return h('label', { class: 'template-var-field' }, `Variável {{${index + 1}}}`, input);
|
||||
});
|
||||
const bibliotecaEl = h('select', { class: 'outreach-template-biblioteca' }, ...templateOptions(t.template_waba_nome || ''));
|
||||
const variablePicker = variablePickerEl();
|
||||
const previewEl = h('div', { class: 'template-preview' }, 'Selecione um template para ver a pré-visualização.');
|
||||
variablePicker.addEventListener('change', () => {
|
||||
if (!focusedVariableInput || !oficialEl.contains(focusedVariableInput) || !variablePicker.value) return;
|
||||
focusedVariableInput.value = variablePicker.value;
|
||||
focusedVariableInput.dispatchEvent(new Event('input'));
|
||||
variablePicker.value = '';
|
||||
});
|
||||
bibliotecaEl.addEventListener('change', () => {
|
||||
templateSelecionado = WABA_TEMPLATE_LIBRARY.find((item) => item.name === bibliotecaEl.value);
|
||||
const inputs = Array.from(oficialEl.querySelectorAll('.outreach-template-waba-var'));
|
||||
aplicarTemplateBiblioteca(templateSelecionado, {
|
||||
nomeEl,
|
||||
idiomaEl,
|
||||
variableInputs: inputs
|
||||
});
|
||||
setVariableFields(oficialEl, templateSelecionado, inputs, ['{empresa}', '{produto}']);
|
||||
atualizarPreview(previewEl, templateSelecionado, inputs);
|
||||
atualizarAviso();
|
||||
});
|
||||
const avisoEl = h('p', { class: 'muted outreach-template-aviso hidden' },
|
||||
'⚠️ Preencha o nome do template pra essa automação funcionar.');
|
||||
const oficialEl = h('div', {
|
||||
class: 'outreach-template-oficial',
|
||||
style: oficial ? '' : 'display:none'
|
||||
},
|
||||
h('label', {}, 'Escolher modelo salvo', bibliotecaEl),
|
||||
h('div', { class: 'row' },
|
||||
h('label', {}, 'Nome do template aprovado', nomeEl),
|
||||
h('label', {}, 'Idioma', idiomaEl)),
|
||||
h('div', { class: 'template-vars outreach-template-vars' },
|
||||
h('label', {}, 'Variáveis automáticas'),
|
||||
h('p', { class: 'muted' }, 'Use placeholders como {empresa}, {produto}, {cidade}, {segmento}.'),
|
||||
h('div', { class: 'variable-helper' },
|
||||
variablePicker,
|
||||
h('span', { class: 'muted' }, 'Clique em um campo abaixo e escolha uma variável.')),
|
||||
h('p', { class: 'muted template-vars-empty hidden' }, 'Este template não exige variáveis.'),
|
||||
h('div', { class: 'template-vars-grid' }, ...variaveisEls),
|
||||
previewEl),
|
||||
h('a', {
|
||||
href: 'https://business.facebook.com/wa/manage/message-templates/',
|
||||
target: '_blank', rel: 'noopener', class: 'outreach-template-link'
|
||||
}, '↗ Ver/criar templates no Meta Business Manager'),
|
||||
avisoEl);
|
||||
|
||||
const atualizarAviso = () => {
|
||||
avisoEl.classList.toggle('hidden', radioOficial.checked ? Boolean(nomeEl.value.trim()) : true);
|
||||
};
|
||||
nomeEl.addEventListener('input', atualizarAviso);
|
||||
for (const input of variaveisEls.map((label) => label.querySelector('input'))) {
|
||||
input.addEventListener('input', () => atualizarPreview(previewEl, templateSelecionado, Array.from(oficialEl.querySelectorAll('.outreach-template-waba-var'))));
|
||||
}
|
||||
|
||||
const radioNaoOficial = h('input', {
|
||||
type: 'radio', name: `canal-${t.produto}`, class: 'outreach-template-canal', value: 'nao_oficial',
|
||||
checked: oficial ? null : ''
|
||||
});
|
||||
const radioOficial = h('input', {
|
||||
type: 'radio', name: `canal-${t.produto}`, class: 'outreach-template-canal', value: 'oficial',
|
||||
checked: oficial ? '' : null
|
||||
});
|
||||
const alternarCanal = () => {
|
||||
const usaOficial = radioOficial.checked;
|
||||
mensagemEl.style.display = usaOficial ? 'none' : '';
|
||||
oficialEl.style.display = usaOficial ? '' : 'none';
|
||||
atualizarAviso();
|
||||
};
|
||||
radioNaoOficial.addEventListener('change', alternarCanal);
|
||||
radioOficial.addEventListener('change', alternarCanal);
|
||||
atualizarAviso();
|
||||
queueMicrotask(() => {
|
||||
const inputs = Array.from(oficialEl.querySelectorAll('.outreach-template-waba-var'));
|
||||
setVariableFields(oficialEl, templateSelecionado, inputs, ['{empresa}', '{produto}']);
|
||||
atualizarPreview(previewEl, templateSelecionado, inputs);
|
||||
});
|
||||
|
||||
return h('div', { class: 'item outreach-template', 'data-produto': t.produto },
|
||||
h('div', { class: 'row space-between' },
|
||||
h('strong', {}, t.produto),
|
||||
h('label', { class: 'radio' },
|
||||
h('input', { type: 'checkbox', class: 'outreach-template-ativo', checked: t.ativo ? '' : null }),
|
||||
' Ativo')),
|
||||
h('div', { class: 'row' },
|
||||
h('label', { class: 'radio' }, radioNaoOficial, ' Não-oficial (texto livre)'),
|
||||
h('label', { class: 'radio' }, radioOficial, ' Oficial (Meta, template aprovado)')),
|
||||
mensagemEl,
|
||||
oficialEl);
|
||||
}));
|
||||
|
||||
el('outreach-ultimos').replaceChildren(...status.ultimos.map((s) => {
|
||||
const quem = s.origem === 'manual' ? (s.numero || 'número avulso') : `${s.empresa || '?'} (${s.cidade || '?'})`;
|
||||
const rotulo = s.origem === 'manual' ? `Manual → ${quem}` : `${s.produto} → ${quem}`;
|
||||
const statusIcone = s.status === 'enviado' ? '✅' : '❌';
|
||||
return h('div', { class: 'item' },
|
||||
h('div', {}, `${statusIcone} ${rotulo}`),
|
||||
h('div', { class: 'sub' }, `${dataBr(s.sent_at)} · canal ${s.canal === 'oficial' ? 'oficial' : 'não-oficial'}${s.erro ? ` · ${s.erro}` : ''}`));
|
||||
}));
|
||||
if (!status.ultimos.length) {
|
||||
el('outreach-ultimos').replaceChildren(h('p', { class: 'muted' }, 'Nenhum envio ainda.'));
|
||||
}
|
||||
}
|
||||
|
||||
el('btn-settings').addEventListener('click', async () => {
|
||||
const { settings } = await API.get('/api/settings');
|
||||
el('cfg-pipeline').value = settings['zpro.pipelineId'] || 1;
|
||||
el('cfg-stage').value = settings['zpro.stageId'] || 1;
|
||||
el('cfg-responsible').value = settings['zpro.responsibleId'] || 15;
|
||||
el('cfg-ticket-queue').value = settings['zpro.ticketQueueId'] || 12;
|
||||
el('cfg-forecast').value = settings['zpro.closingForecastDays'] || 30;
|
||||
el('cfg-zpro-baseurl').value = settings['zpro.baseUrl'] || '';
|
||||
el('cfg-zpro-apiid').value = settings['zpro.apiId'] || '';
|
||||
el('cfg-zpro-token').value = settings['zpro.bearerToken'] || '';
|
||||
el('cfg-zpro-whatsappid').value = settings['zpro.whatsappId'] || '';
|
||||
el('cfg-gchat-templates-url').value = settings['gchat.templatesUrl'] || '';
|
||||
el('cfg-gchat-token').value = settings['gchat.bearerToken'] || '';
|
||||
el('zpro-credenciais-status').textContent = '';
|
||||
el('modal-settings').showModal();
|
||||
try {
|
||||
await carregarBibliotecaWaba();
|
||||
await carregarVariaveisComerciais();
|
||||
await carregarOutreach();
|
||||
} catch (error) {
|
||||
toast(`Erro ao carregar automação: ${error.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
el('btn-testar-zpro').addEventListener('click', async () => {
|
||||
const statusEl = el('zpro-credenciais-status');
|
||||
statusEl.textContent = 'Salvando e testando...';
|
||||
try {
|
||||
await API.put('/api/settings', {
|
||||
'zpro.baseUrl': el('cfg-zpro-baseurl').value.trim(),
|
||||
'zpro.apiId': el('cfg-zpro-apiid').value.trim(),
|
||||
'zpro.bearerToken': el('cfg-zpro-token').value.trim(),
|
||||
'zpro.whatsappId': el('cfg-zpro-whatsappid').value.trim(),
|
||||
'gchat.templatesUrl': el('cfg-gchat-templates-url').value.trim(),
|
||||
'gchat.bearerToken': el('cfg-gchat-token').value.trim(),
|
||||
'outreach.ativo': el('outreach-ativo').checked ? 'true' : 'false',
|
||||
'outreach.mensagensPorDia': el('outreach-limite').value
|
||||
});
|
||||
const resultado = await API.post('/api/outreach/testar-conexao');
|
||||
const diag = resultado.diagnostico
|
||||
? `\nBase: ${resultado.diagnostico.baseUrl || '-'} | API ID: ${resultado.diagnostico.apiId || '-'} | Token: ${resultado.diagnostico.token || '-'} | WhatsApp ID: ${resultado.diagnostico.whatsappId || '-'}`
|
||||
: '';
|
||||
statusEl.textContent = resultado.ok ? `✅ Conexão OK${diag}` : `❌ ${resultado.erro}${diag}`;
|
||||
} catch (error) {
|
||||
statusEl.textContent = `❌ ${error.message}`;
|
||||
}
|
||||
});
|
||||
|
||||
el('btn-sync-gchat-templates').addEventListener('click', async () => {
|
||||
await sincronizarTemplatesGchat();
|
||||
});
|
||||
|
||||
el('btn-sync-gchat-templates-inline').addEventListener('click', async () => {
|
||||
await sincronizarTemplatesGchat();
|
||||
});
|
||||
|
||||
async function sincronizarTemplatesGchat() {
|
||||
const statusEl = el('gchat-template-sync-status');
|
||||
const inlineStatusEl = el('waba-template-library-status');
|
||||
statusEl.textContent = 'Sincronizando...';
|
||||
if (inlineStatusEl) inlineStatusEl.textContent = 'Sincronizando com GChat...';
|
||||
try {
|
||||
await API.put('/api/settings', {
|
||||
'gchat.templatesUrl': el('cfg-gchat-templates-url').value.trim(),
|
||||
'gchat.bearerToken': el('cfg-gchat-token').value.trim()
|
||||
});
|
||||
const result = await API.post('/api/outreach/waba-templates/sync');
|
||||
statusEl.textContent = result.ok ? `✅ ${result.total} templates sincronizados` : `❌ ${result.erro}`;
|
||||
if (inlineStatusEl) inlineStatusEl.textContent = result.ok
|
||||
? `✅ ${result.total} templates sincronizados do GChat`
|
||||
: `❌ ${result.erro}. Preencha o Token GChat opcional em Credenciais Z-PRO.`;
|
||||
await carregarBibliotecaWaba();
|
||||
await carregarOutreach();
|
||||
} catch (error) {
|
||||
statusEl.textContent = `❌ ${error.message}`;
|
||||
if (inlineStatusEl) inlineStatusEl.textContent = `❌ ${error.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
el('btn-salvar-outreach').addEventListener('click', async () => {
|
||||
try {
|
||||
await API.put('/api/settings', {
|
||||
'outreach.ativo': el('outreach-ativo').checked ? 'true' : 'false',
|
||||
'outreach.mensagensPorDia': el('outreach-limite').value
|
||||
});
|
||||
for (const item of el('outreach-templates').children) {
|
||||
const canalEl = item.querySelector('.outreach-template-canal:checked');
|
||||
await API.put(`/api/outreach/templates/${encodeURIComponent(item.dataset.produto)}`, {
|
||||
mensagem: item.querySelector('.outreach-template-mensagem').value,
|
||||
ativo: item.querySelector('.outreach-template-ativo').checked,
|
||||
canal: canalEl ? canalEl.value : 'nao_oficial',
|
||||
templateWabaNome: item.querySelector('.outreach-template-waba-nome').value,
|
||||
templateWabaIdioma: item.querySelector('.outreach-template-waba-idioma').value,
|
||||
templateWabaVariaveis: collectVisibleVariables(Array.from(item.querySelectorAll('.outreach-template-waba-var')))
|
||||
});
|
||||
}
|
||||
await carregarOutreach();
|
||||
toast('Automação salva');
|
||||
} catch (error) {
|
||||
toast(`Erro: ${error.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
function alternarCanalManual() {
|
||||
const oficial = el('manual-canal-oficial').checked;
|
||||
el('manual-mensagem-wrap').classList.toggle('hidden', oficial);
|
||||
el('manual-oficial-campos').classList.toggle('hidden', !oficial);
|
||||
}
|
||||
el('manual-canal-naooficial').addEventListener('change', alternarCanalManual);
|
||||
el('manual-canal-oficial').addEventListener('change', alternarCanalManual);
|
||||
|
||||
el('manual-template-biblioteca').replaceChildren(...templateOptions());
|
||||
el('manual-template-biblioteca').addEventListener('change', () => {
|
||||
const template = WABA_TEMPLATE_LIBRARY.find((item) => item.name === el('manual-template-biblioteca').value);
|
||||
const inputs = Array.from(document.querySelectorAll('.manual-template-var'));
|
||||
aplicarTemplateBiblioteca(template, {
|
||||
nomeEl: el('manual-template-nome'),
|
||||
idiomaEl: el('manual-template-idioma'),
|
||||
routeEl: el('manual-template-rota'),
|
||||
variableInputs: inputs
|
||||
});
|
||||
setVariableFields(el('manual-oficial-campos'), template, inputs);
|
||||
atualizarPreview(el('manual-template-preview'), template, inputs);
|
||||
});
|
||||
|
||||
for (const input of document.querySelectorAll('.manual-template-var')) {
|
||||
input.addEventListener('focus', () => { focusedVariableInput = input; });
|
||||
input.addEventListener('input', () => {
|
||||
const template = WABA_TEMPLATE_LIBRARY.find((item) => item.name === el('manual-template-biblioteca').value);
|
||||
atualizarPreview(el('manual-template-preview'), template, Array.from(document.querySelectorAll('.manual-template-var')));
|
||||
});
|
||||
}
|
||||
el('manual-variable-picker').addEventListener('change', () => {
|
||||
if (!focusedVariableInput || !el('manual-variable-picker').value) return;
|
||||
focusedVariableInput.value = el('manual-variable-picker').value;
|
||||
focusedVariableInput.dispatchEvent(new Event('input'));
|
||||
el('manual-variable-picker').value = '';
|
||||
});
|
||||
setVariableFields(el('manual-oficial-campos'), null, Array.from(document.querySelectorAll('.manual-template-var')));
|
||||
|
||||
el('btn-testar-template-biblioteca').addEventListener('click', async () => {
|
||||
const statusEl = el('manual-status');
|
||||
const template = WABA_TEMPLATE_LIBRARY.find((item) => item.name === el('manual-template-biblioteca').value);
|
||||
const numero = el('manual-numero').value.trim();
|
||||
statusEl.classList.remove('status-ok', 'status-error');
|
||||
if (!template) {
|
||||
statusEl.textContent = '❌ Selecione um modelo salvo primeiro.';
|
||||
statusEl.classList.add('status-error');
|
||||
return;
|
||||
}
|
||||
if (!numero) {
|
||||
statusEl.textContent = '❌ Informe um número de teste acima.';
|
||||
statusEl.classList.add('status-error');
|
||||
return;
|
||||
}
|
||||
aplicarTemplateBiblioteca(template, {
|
||||
nomeEl: el('manual-template-nome'),
|
||||
idiomaEl: el('manual-template-idioma'),
|
||||
routeEl: el('manual-template-rota'),
|
||||
variableInputs: Array.from(document.querySelectorAll('.manual-template-var'))
|
||||
});
|
||||
const variaveis = template.variables.map(resolverVariavelManual);
|
||||
preencherVariaveis(Array.from(document.querySelectorAll('.manual-template-var')), variaveis);
|
||||
setVariableFields(el('manual-oficial-campos'), template, Array.from(document.querySelectorAll('.manual-template-var')));
|
||||
atualizarPreview(el('manual-template-preview'), template, Array.from(document.querySelectorAll('.manual-template-var')));
|
||||
statusEl.textContent = `Testando ${template.name}...`;
|
||||
try {
|
||||
const resultado = await API.post('/api/outreach/enviar-manual', {
|
||||
numero,
|
||||
canal: 'oficial',
|
||||
mensagem: '',
|
||||
templateWabaNome: template.name,
|
||||
templateWabaIdioma: template.language,
|
||||
templateRota: template.route,
|
||||
templateVariaveis: variaveis
|
||||
});
|
||||
statusEl.textContent = resultado.ok
|
||||
? `✅ ${template.name} funcionou${resultado.ticketId ? ` — ticket ${resultado.ticketId}` : ''}`
|
||||
: `❌ ${template.name} falhou: ${resultado.erro}`;
|
||||
statusEl.classList.toggle('status-ok', Boolean(resultado.ok));
|
||||
statusEl.classList.toggle('status-error', !resultado.ok);
|
||||
await carregarOutreach();
|
||||
} catch (error) {
|
||||
statusEl.textContent = `❌ ${template.name} falhou: ${error.message}`;
|
||||
statusEl.classList.add('status-error');
|
||||
}
|
||||
});
|
||||
|
||||
el('btn-toggle-outreach-log').addEventListener('click', () => {
|
||||
const log = el('outreach-ultimos');
|
||||
const hidden = log.classList.toggle('hidden');
|
||||
el('btn-toggle-outreach-log').textContent = hidden ? 'Ver log de envios' : 'Ocultar log de envios';
|
||||
});
|
||||
|
||||
el('btn-enviar-manual').addEventListener('click', async () => {
|
||||
const statusEl = el('manual-status');
|
||||
const oficial = el('manual-canal-oficial').checked;
|
||||
statusEl.classList.remove('status-ok', 'status-error');
|
||||
if (oficial) {
|
||||
const faltando = missingVisibleVariables(Array.from(document.querySelectorAll('.manual-template-var')));
|
||||
if (faltando.length) {
|
||||
statusEl.textContent = `❌ Preencha todas as variáveis do template (${faltando.length} pendente${faltando.length > 1 ? 's' : ''}).`;
|
||||
statusEl.classList.add('status-error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
statusEl.textContent = 'Enviando...';
|
||||
try {
|
||||
const resultado = await API.post('/api/outreach/enviar-manual', {
|
||||
numero: el('manual-numero').value.trim(),
|
||||
canal: oficial ? 'oficial' : 'nao_oficial',
|
||||
mensagem: el('manual-mensagem').value,
|
||||
templateWabaNome: el('manual-template-nome').value.trim(),
|
||||
templateWabaIdioma: el('manual-template-idioma').value.trim(),
|
||||
templateVariaveis: collectVisibleVariablesResolvidas(Array.from(document.querySelectorAll('.manual-template-var'))),
|
||||
templateRota: el('manual-template-rota').value,
|
||||
lead: manualLeadContext
|
||||
});
|
||||
statusEl.textContent = resultado.ok
|
||||
? `✅ Enviado${resultado.ticketId ? ` — ticket ${resultado.ticketId}` : ''}`
|
||||
: `❌ ${resultado.erro}`;
|
||||
statusEl.classList.toggle('status-ok', Boolean(resultado.ok));
|
||||
statusEl.classList.toggle('status-error', !resultado.ok);
|
||||
await carregarOutreach();
|
||||
} catch (error) {
|
||||
statusEl.textContent = `❌ ${error.message}`;
|
||||
statusEl.classList.add('status-error');
|
||||
}
|
||||
});
|
||||
|
||||
window.GTISelecionarLeadManual = (lead) => {
|
||||
manualLeadContext = lead || null;
|
||||
const template = WABA_TEMPLATE_LIBRARY.find((item) => item.name === el('manual-template-biblioteca').value);
|
||||
atualizarPreview(el('manual-template-preview'), template, Array.from(document.querySelectorAll('.manual-template-var')));
|
||||
};
|
||||
|
||||
el('btn-salvar-settings').addEventListener('click', async (event) => {
|
||||
event.preventDefault();
|
||||
try {
|
||||
@@ -84,8 +612,18 @@
|
||||
'zpro.pipelineId': el('cfg-pipeline').value,
|
||||
'zpro.stageId': el('cfg-stage').value,
|
||||
'zpro.responsibleId': el('cfg-responsible').value,
|
||||
'zpro.closingForecastDays': el('cfg-forecast').value
|
||||
'zpro.ticketQueueId': el('cfg-ticket-queue').value,
|
||||
'zpro.closingForecastDays': el('cfg-forecast').value,
|
||||
'zpro.baseUrl': el('cfg-zpro-baseurl').value.trim(),
|
||||
'zpro.apiId': el('cfg-zpro-apiid').value.trim(),
|
||||
'zpro.bearerToken': el('cfg-zpro-token').value.trim(),
|
||||
'zpro.whatsappId': el('cfg-zpro-whatsappid').value.trim(),
|
||||
'gchat.templatesUrl': el('cfg-gchat-templates-url').value.trim(),
|
||||
'gchat.bearerToken': el('cfg-gchat-token').value.trim(),
|
||||
'outreach.ativo': el('outreach-ativo').checked ? 'true' : 'false',
|
||||
'outreach.mensagensPorDia': el('outreach-limite').value
|
||||
});
|
||||
await carregarOutreach();
|
||||
el('modal-settings').close();
|
||||
toast('Configurações salvas');
|
||||
} catch (error) {
|
||||
@@ -96,6 +634,7 @@
|
||||
// limpar toda a base (zona de risco)
|
||||
el('btn-limpar-base').addEventListener('click', () => {
|
||||
el('reset-base-senha').value = '';
|
||||
el('reset-base-erro').classList.add('hidden');
|
||||
el('modal-settings').close();
|
||||
el('modal-reset-base').showModal();
|
||||
});
|
||||
@@ -104,10 +643,17 @@
|
||||
el('modal-reset-base').close();
|
||||
});
|
||||
|
||||
// Erro aqui precisa aparecer DENTRO do modal (nao so no toast): um <dialog>
|
||||
// aberto via showModal() fica na "top layer" do navegador, acima de
|
||||
// qualquer div normal — inclusive do toast, que ficava invisivel atras do
|
||||
// modal quando a senha estava errada, dando a impressao de que nada
|
||||
// acontecia (bug reportado: "limpeza nao foi feita mesmo pondo a senha").
|
||||
el('btn-confirmar-reset-base').addEventListener('click', async () => {
|
||||
const erroEl = el('reset-base-erro');
|
||||
const senha = el('reset-base-senha').value;
|
||||
if (!senha) {
|
||||
toast('Informe a senha de segurança');
|
||||
erroEl.textContent = 'Informe a senha de segurança';
|
||||
erroEl.classList.remove('hidden');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -116,7 +662,8 @@
|
||||
toast('Base de leads limpa com sucesso — recarregando...');
|
||||
setTimeout(() => window.location.reload(), 1200);
|
||||
} catch (error) {
|
||||
toast(`Erro: ${error.message}`);
|
||||
erroEl.textContent = `Erro: ${error.message}`;
|
||||
erroEl.classList.remove('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+30
-1
@@ -367,11 +367,40 @@ const Tratamento = (() => {
|
||||
|
||||
const tbody = document.querySelector('#tabela-leads tbody');
|
||||
if (!data.rows.length) {
|
||||
tbody.replaceChildren(h('tr', {}, h('td', { colspan: '9', class: 'muted' }, 'Nenhum lead com este filtro.')));
|
||||
tbody.replaceChildren(h('tr', {}, h('td', { colspan: '10', class: 'muted' }, 'Nenhum lead com este filtro.')));
|
||||
return;
|
||||
}
|
||||
|
||||
const abrirWhatsAppLead = async (event, lead) => {
|
||||
event.stopPropagation();
|
||||
if (!lead.whatsapp) {
|
||||
toast('Este lead não tem WhatsApp cadastrado');
|
||||
return;
|
||||
}
|
||||
let leadCompleto = lead;
|
||||
try {
|
||||
leadCompleto = await API.get(`/api/leads/${lead.id}`);
|
||||
} catch {
|
||||
leadCompleto = lead;
|
||||
}
|
||||
const settingsButton = el('btn-settings');
|
||||
settingsButton.click();
|
||||
setTimeout(() => {
|
||||
window.GTISelecionarLeadManual?.(leadCompleto);
|
||||
el('manual-numero').value = leadCompleto.whatsapp || lead.whatsapp;
|
||||
el('manual-canal-naooficial').checked = true;
|
||||
el('manual-canal-naooficial').dispatchEvent(new Event('change'));
|
||||
el('manual-mensagem').value = `Olá ${leadCompleto.empresa || lead.empresa}! Somos do Grupo GTI. Podemos conversar?`;
|
||||
el('manual-status').textContent = '';
|
||||
}, 250);
|
||||
};
|
||||
|
||||
tbody.replaceChildren(...data.rows.map((lead) => h('tr', { onclick: () => abrirLead(lead.id) },
|
||||
h('td', { class: 'acao-col' }, h('button', {
|
||||
class: 'whatsapp-action',
|
||||
title: 'Enviar WhatsApp para este lead',
|
||||
onclick: (event) => abrirWhatsAppLead(event, lead)
|
||||
}, '☎')),
|
||||
h('td', { class: 'empresa-cell', title: lead.legal_name || lead.empresa }, lead.empresa),
|
||||
h('td', {}, lead.whatsapp || '—'),
|
||||
h('td', {}, lead.cidade),
|
||||
|
||||
+6
-4
@@ -5,21 +5,23 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>GTI Máquina Comercial — Login</title>
|
||||
<link rel="stylesheet" href="/css/app.css">
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🎯</text></svg>">
|
||||
<link rel="icon" href="/img/logo-gti.png">
|
||||
</head>
|
||||
<body class="login-body">
|
||||
|
||||
<main class="login-wrap">
|
||||
<form class="card login-card" id="form-login">
|
||||
<div class="brand login-brand">
|
||||
<span class="brand-mark">GTI</span>
|
||||
<img class="brand-mark brand-mark-lg" src="/img/logo-gti.png" alt="GTI">
|
||||
<span class="brand-name">Máquina Comercial</span>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Usuário <input type="text" id="login-username" autocomplete="username" required></label>
|
||||
<label for="login-username">Usuário</label>
|
||||
<input type="text" id="login-username" autocomplete="username" required>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Senha <input type="password" id="login-password" autocomplete="current-password" required></label>
|
||||
<label for="login-password">Senha</label>
|
||||
<input type="password" id="login-password" autocomplete="current-password" required>
|
||||
</div>
|
||||
<p class="muted login-erro" id="login-erro"></p>
|
||||
<button class="btn btn-primary btn-lg" type="submit">Entrar</button>
|
||||
|
||||
Reference in New Issue
Block a user