feat: scraped people are editable inline (name/title/email/biz+personal phone) before adding
This commit is contained in:
parent
7871abf835
commit
fb1a4fdaba
|
|
@ -431,12 +431,27 @@
|
||||||
+ '</div>'
|
+ '</div>'
|
||||||
+ '<div class="space-y-1.5">';
|
+ '<div class="space-y-1.5">';
|
||||||
newPeople.forEach((p, i) => {
|
newPeople.forEach((p, i) => {
|
||||||
html += '<label class="flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer hover:opacity-80" style="background:var(--ds-sf)">'
|
html += '<div class="rounded-lg overflow-hidden" style="background:var(--ds-sf);border:1px solid var(--ds-bd)">'
|
||||||
+ '<input type="checkbox" class="rescrape-cb accent-[#c9a84c]" data-idx="' + i + '" onchange="syncRescrapeSelectAll()">'
|
// checkbox + name row
|
||||||
+ '<div class="min-w-0 flex-1"><div class="text-sm text-white truncate">' + escHtml(p.name || p.email) + '</div>'
|
+ '<div class="flex items-center gap-3 px-3 py-2 cursor-pointer" onclick="toggleScrapeExpand(' + i + ')">'
|
||||||
+ (p.title ? '<div class="text-xs truncate" style="color:var(--ds-tx3)">' + escHtml(p.title) + '</div>' : '') + '</div>'
|
+ '<input type="checkbox" class="rescrape-cb accent-[#c9a84c] shrink-0" data-idx="' + i + '" onchange="syncRescrapeSelectAll();event.stopPropagation();" onclick="event.stopPropagation()">'
|
||||||
+ (p.email ? '<div class="text-xs shrink-0" style="color:var(--ds-tx3)">' + escHtml(p.email) + '</div>' : '')
|
+ '<div class="flex-1 min-w-0">'
|
||||||
+ '</label>';
|
+ '<div class="text-sm text-white truncate">' + escHtml(p.name || p.email || '—') + '</div>'
|
||||||
|
+ '<div class="text-xs truncate" style="color:var(--ds-tx3)">' + [p.title, p.email].filter(Boolean).map(v => escHtml(v)).join(' · ') + '</div>'
|
||||||
|
+ '</div>'
|
||||||
|
+ '<span class="text-xs shrink-0" style="color:var(--ds-tx3)">Edit ▾</span>'
|
||||||
|
+ '</div>'
|
||||||
|
// inline edit panel (hidden by default, shown on click)
|
||||||
|
+ '<div id="scrape-edit-' + i + '" class="hidden px-3 pb-3 pt-1" style="background:var(--ds-bg)">'
|
||||||
|
+ '<div class="grid gap-2" style="grid-template-columns:1fr 1fr">'
|
||||||
|
+ '<div><label class="text-xs mb-1 block" style="color:var(--ds-tx3)">Name</label><input type="text" value="' + escHtml(p.name||'') + '" oninput="updateScrapeNew(' + i + ',\"name\",this.value)" class="w-full px-2 py-1.5 bg-[#0a1628] border border-white/[0.08] rounded text-white text-sm focus:outline-none focus:border-[#c9a84c]"></div>'
|
||||||
|
+ '<div><label class="text-xs mb-1 block" style="color:var(--ds-tx3)">Title</label><input type="text" value="' + escHtml(p.title||'') + '" oninput="updateScrapeNew(' + i + ',\"title\",this.value)" class="w-full px-2 py-1.5 bg-[#0a1628] border border-white/[0.08] rounded text-white text-sm focus:outline-none focus:border-[#c9a84c]"></div>'
|
||||||
|
+ '<div><label class="text-xs mb-1 block" style="color:var(--ds-tx3)">Email</label><input type="email" value="' + escHtml(p.email||'') + '" oninput="updateScrapeNew(' + i + ',\"email\",this.value)" class="w-full px-2 py-1.5 bg-[#0a1628] border border-white/[0.08] rounded text-white text-sm focus:outline-none focus:border-[#c9a84c]"></div>'
|
||||||
|
+ '<div><label class="text-xs mb-1 block" style="color:var(--ds-tx3)">Business phone</label><input type="tel" value="' + escHtml(p.phone_business||p.phone||'') + '" oninput="updateScrapeNew(' + i + ',\"phone_business\",this.value)" class="w-full px-2 py-1.5 bg-[#0a1628] border border-white/[0.08] rounded text-white text-sm focus:outline-none focus:border-[#c9a84c]"></div>'
|
||||||
|
+ '<div><label class="text-xs mb-1 block" style="color:var(--ds-tx3)">Personal phone</label><input type="tel" value="' + escHtml(p.phone_personal||'') + '" oninput="updateScrapeNew(' + i + ',\"phone_personal\",this.value)" class="w-full px-2 py-1.5 bg-[#0a1628] border border-white/[0.08] rounded text-white text-sm focus:outline-none focus:border-[#c9a84c]"></div>'
|
||||||
|
+ '</div>'
|
||||||
|
+ '</div>'
|
||||||
|
+ '</div>';
|
||||||
});
|
});
|
||||||
html += '</div>'
|
html += '</div>'
|
||||||
+ '<button onclick="addRescrapeSelected()" class="mt-2 px-3 py-1.5 bg-[#c9a84c] hover:bg-[#b8973f] text-[#0a1628] font-semibold rounded-lg text-xs transition">Add selected</button>'
|
+ '<button onclick="addRescrapeSelected()" class="mt-2 px-3 py-1.5 bg-[#c9a84c] hover:bg-[#b8973f] text-[#0a1628] font-semibold rounded-lg text-xs transition">Add selected</button>'
|
||||||
|
|
@ -496,6 +511,15 @@
|
||||||
if (window._rescrapeNotFound.length === 0 && nfEl) nfEl.remove();
|
if (window._rescrapeNotFound.length === 0 && nfEl) nfEl.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleScrapeExpand(i) {
|
||||||
|
const el = document.getElementById('scrape-edit-' + i);
|
||||||
|
if (el) el.classList.toggle('hidden');
|
||||||
|
}
|
||||||
|
function updateScrapeNew(i, field, value) {
|
||||||
|
if (window._rescrapeNewPeople && window._rescrapeNewPeople[i]) {
|
||||||
|
window._rescrapeNewPeople[i][field] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
function addRescrapeSelected() {
|
function addRescrapeSelected() {
|
||||||
const people = window._rescrapeNewPeople || [];
|
const people = window._rescrapeNewPeople || [];
|
||||||
const checked = document.querySelectorAll('.rescrape-cb:checked');
|
const checked = document.querySelectorAll('.rescrape-cb:checked');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue