feat(안내문 발송): DM 수동 보내기 + 설정 톱니 아이콘
- [+ 리스트 추가] 오른쪽 [DM 수동 보내기]: 이름 붙여 넣기·.txt/.csv → 왼쪽 이름 목록,
누르면 오른쪽 DM 문구 {이름} 이 그 이름으로 바뀌고 클립보드 복사 + 짧은 안내
(문구 = 설정 DM 문구, 리스트에 저장 안 함)
- 설정 버튼 → 맨 오른쪽 톱니 아이콘(공용 material-symbols)
- 공용 .erp-card display:flex 가 hidden 을 덮어 [리스트 추가] 창이 늘 열려 있던 것 고침
- outreach.js/css 캐시 버전 20261030a, 브라우저 테스트 추가
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+22
-1
@@ -2,7 +2,13 @@
|
||||
.erp-page:has(> .otr) { box-sizing: border-box; } /* 셸 .erp-page width:100% + 여백 → 오른쪽 넘침 방지(실적·휴가와 같음) */
|
||||
.otr { display: flex; flex-direction: column; gap: 14px; }
|
||||
.otr > * { flex-shrink: 0; }
|
||||
.otr-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
|
||||
.otr-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
|
||||
.otr-top .otr-gmail { margin-left: auto; }
|
||||
/* 설정 톱니 — 맨 오른쪽(2026-10-30, 실적 .perf-tab-gear 와 같은 모양) */
|
||||
.otr-gear { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%;
|
||||
color: var(--color-midtone-gray, #6d6e6f); text-decoration: none; flex: none; }
|
||||
.otr-gear .material-symbols-outlined { font-size: 22px; }
|
||||
.otr-gear:hover { color: var(--color-rich-black, #1e1f21); background: var(--color-ghost-gray, #f3f3f3); }
|
||||
.otr-top-main { display: flex; gap: 8px; }
|
||||
.otr-gmail { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
|
||||
.otr-gmail form { margin: 0; }
|
||||
@@ -10,6 +16,7 @@
|
||||
.otr-gmail-off { color: #8a5a00; }
|
||||
.otr-msg { margin: 0; padding: 8px 12px; border-radius: 8px; background: #eef6ff; color: #1a4fa0; font-size: 13px; }
|
||||
.otr .erp-card { padding: 14px 16px; }
|
||||
.otr .erp-card[hidden] { display: none; } /* 공용 .erp-card display:flex 가 hidden 을 덮어 [리스트 추가]·DM 수동 창이 늘 열려 있었다 */
|
||||
.otr-tpl-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: 14px; flex-wrap: wrap; }
|
||||
.otr-tpl-head .erp-muted { font-size: 12px; }
|
||||
.otr-tpl-subject { font-weight: 700; font-size: 15px; }
|
||||
@@ -114,3 +121,17 @@
|
||||
.otr-image-acts form { margin: 0; }
|
||||
.otr-upload { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
|
||||
.otr .erp-btn:disabled { opacity: .45; cursor: default; }
|
||||
|
||||
/* DM 수동 보내기(2026-10-30) — 왼쪽 이름 목록 | 오른쪽 이름이 들어간 DM 문구(이름 누르면 복사) */
|
||||
.otr-dm-file { cursor: pointer; }
|
||||
.otr-dm-split { display: grid; grid-template-columns: minmax(160px, 240px) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
|
||||
.otr-dm-names { list-style: none; margin: 0; padding: 4px; border: 1px solid #e3e5e8; border-radius: 8px; max-height: 420px; overflow: auto; }
|
||||
.otr-dm-name { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; font-size: 13px;
|
||||
padding: 6px 10px; border-radius: 6px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.otr-dm-name:hover { background: #f3f4f6; }
|
||||
.otr-dm-name.is-active { background: #111; color: #fff; }
|
||||
.otr-dm-empty { padding: 8px 10px; font-size: 13px; }
|
||||
.otr-dm-body { border: 1px solid #e3e5e8; border-radius: 8px; padding: 12px 14px; font-size: 13.5px; line-height: 1.6;
|
||||
white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; background: #fafafa; }
|
||||
.otr-dm-body b { color: #c1358a; }
|
||||
@media (max-width: 640px) { .otr-dm-split { grid-template-columns: 1fr; } }
|
||||
|
||||
+59
-2
@@ -18,14 +18,14 @@
|
||||
if (!res.ok) { const e = new Error(data.message || data.detail || ("HTTP " + res.status)); e.status = res.status; e.data = data; throw e; }
|
||||
return data;
|
||||
}
|
||||
function toast(msg, bad) {
|
||||
function toast(msg, bad, ms) {
|
||||
let el = document.getElementById("otr-toast");
|
||||
if (!el) { el = document.createElement("div"); el.id = "otr-toast"; el.className = "otr-toast"; document.body.appendChild(el); }
|
||||
el.textContent = msg;
|
||||
el.classList.toggle("is-bad", !!bad);
|
||||
el.hidden = false;
|
||||
clearTimeout(el._t);
|
||||
el._t = setTimeout(function () { el.hidden = true; }, 4000);
|
||||
el._t = setTimeout(function () { el.hidden = true; }, ms || 4000);
|
||||
}
|
||||
async function copyText(text) {
|
||||
try { await navigator.clipboard.writeText(text); return true; } catch (_) { /* 아래로 */ }
|
||||
@@ -368,5 +368,62 @@
|
||||
} catch (err) { addSave.disabled = false; toast("추가 실패: " + err.message, true); }
|
||||
});
|
||||
|
||||
// DM 수동 보내기(2026-10-30) — 이름만 넣어(붙여 넣기·.txt/.csv) 왼쪽 목록, 이름을 누르면 오른쪽 DM 문구의 {이름} 을 바꾸고 바로 복사.
|
||||
// 문구 = 설정 DM 문구({이름} 그대로, 서버 store.dm_text). 리스트에는 저장하지 않는다(이 화면을 떠나면 사라짐).
|
||||
const dmBox = document.getElementById("otr-dm"), dmText = document.getElementById("otr-dm-text");
|
||||
const dmNames = document.getElementById("otr-dm-names"), dmBody = document.getElementById("otr-dm-body");
|
||||
let dmTemplate = "";
|
||||
try { dmTemplate = JSON.parse(document.getElementById("otr-data").textContent).dm_template || ""; } catch (_) { dmTemplate = ""; }
|
||||
let dmList = [], dmPick = -1;
|
||||
// 줄마다 첫 칸(탭·쉼표 앞) = 이름, 빈 줄·머리글("이름")·같은 이름은 뺀다
|
||||
function parseNames(text) {
|
||||
const out = [];
|
||||
String(text || "").split(/\r?\n/).forEach(function (line) {
|
||||
const n = line.split(/[\t,]/)[0].replace(/^["']|["']$/g, "").trim();
|
||||
if (n && n !== "이름" && out.indexOf(n) < 0) out.push(n);
|
||||
});
|
||||
return out;
|
||||
}
|
||||
function renderDm() {
|
||||
dmNames.innerHTML = dmList.length
|
||||
? dmList.map(function (n, i) {
|
||||
return '<li><button type="button" class="otr-dm-name' + (i === dmPick ? " is-active" : "") + '" data-i="' + i + '">' + esc(n) + "</button></li>";
|
||||
}).join("")
|
||||
: '<li class="erp-muted otr-dm-empty">이름을 넣으면 여기에 나옵니다.</li>';
|
||||
const name = dmPick >= 0 ? dmList[dmPick] : "";
|
||||
// 문구 — 고른 이름은 굵게(화면만), 안 골랐으면 {이름} 그대로
|
||||
dmBody.innerHTML = dmTemplate.split("{이름}").map(esc).join(name ? "<b>" + esc(name) + "</b>" : "<b>{이름}</b>");
|
||||
document.getElementById("otr-dm-sum").textContent = dmList.length ? dmList.length + "명" : "";
|
||||
}
|
||||
function loadNames(text) {
|
||||
dmList = parseNames(text);
|
||||
dmPick = -1;
|
||||
renderDm();
|
||||
if (!dmList.length) toast("넣을 이름이 없습니다.", true);
|
||||
}
|
||||
document.getElementById("otr-dm-open").addEventListener("click", function () {
|
||||
dmBox.hidden = false;
|
||||
renderDm();
|
||||
dmText.focus();
|
||||
if (!dmTemplate.trim()) toast("DM 문구가 비었습니다 — 설정에서 DM 문구를 넣으세요.", true);
|
||||
});
|
||||
document.getElementById("otr-dm-close").addEventListener("click", function () { dmBox.hidden = true; });
|
||||
document.getElementById("otr-dm-load").addEventListener("click", function () { loadNames(dmText.value); });
|
||||
document.getElementById("otr-dm-file").addEventListener("change", async function (e) {
|
||||
const f = e.target.files && e.target.files[0];
|
||||
if (!f) return;
|
||||
try { dmText.value = await f.text(); loadNames(dmText.value); } catch (err) { toast("파일을 읽지 못했습니다: " + err.message, true); }
|
||||
e.target.value = "";
|
||||
});
|
||||
dmNames.addEventListener("click", async function (e) {
|
||||
const b = e.target.closest(".otr-dm-name");
|
||||
if (!b) return;
|
||||
dmPick = +b.dataset.i;
|
||||
renderDm();
|
||||
const name = dmList[dmPick];
|
||||
const ok = await copyText(dmTemplate.split("{이름}").join(name));
|
||||
toast(ok ? name + " 님 문구를 클립보드에 복사했습니다." : "복사하지 못했습니다 — 오른쪽 글을 직접 복사하세요.", !ok, 1600);
|
||||
});
|
||||
|
||||
render();
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user