fix(asset): allow registering a monitor of an already-registered model

Registration was blocked whenever same-model candidates existed, so a
second monitor of the same model (e.g. dual monitors) could not be added.
Now only an existing asset with the same serial blocks a new one; the
UI tells serial and model candidates apart and hides 'register' only
for serial matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 15:14:22 +09:00
parent 133df472d1
commit e9be17faab
5 changed files with 29 additions and 4 deletions
+1 -1
View File
@@ -387,7 +387,7 @@
return `<section class="am-monitor-summary"><h3>모니터 / MONITOR <span class="am-badge">${monitors.length}개</span></h3><div class="am-monitor-grid">${monitors
.map((m) => {
const a = m.asset;
return `<article class="am-monitor-card"><strong>${esc(m.name)}</strong><small>${esc(m.model)}${m.serial ? " · 시리얼 " + esc(m.serial) : " · 시리얼 미기록"}</small>${a ? `<div class="am-linked-overview"><span class="am-badge">등록된 자산</span><h4>${esc(a.name)}</h4><p>${esc(a.tag)} · ${esc(a.location || "위치 미지정")}<br>${esc(userName(a.assignee_email))} · ${esc(statuses[a.status])}<br>구매 ${money(a.purchase_cost)} · 보증 ${esc(a.warranty_until || "미입력")}</p><button class="am-text-btn" data-monitor-open="${esc(a.id)}">자산 개요 보기 ↗</button></div>` : `<p class="am-muted">${m.candidates?.length ? "같은 시리얼 또는 모델의 자산이 있습니다. 실제 장비를 확인하세요." : "연결된 자산이 없습니다."}</p>${current ? (m.candidates || []).map((c) => `<div class="am-monitor-candidate"><span>${esc(c.tag)} · ${esc(c.name)}<small>${esc(c.serial || "시리얼 미기록")} · ${esc(c.location || "위치 미지정")}</small></span><button class="am-text-btn" data-monitor-link="${m.index}" data-target="${esc(c.id)}">이 자산 연결</button></div>`).join("") + `<button class="erp-btn erp-btn-outline" data-monitor-create="${m.index}">+ 모니터 자산으로 등록</button>` : '<p class="am-muted">모니터 등록·연결은 최신 보고서에서 진행하세요.</p>'}`}</article>`;
return `<article class="am-monitor-card"><strong>${esc(m.name)}</strong><small>${esc(m.model)}${m.serial ? " · 시리얼 " + esc(m.serial) : " · 시리얼 미기록"}</small>${a ? `<div class="am-linked-overview"><span class="am-badge">등록된 자산</span><h4>${esc(a.name)}</h4><p>${esc(a.tag)} · ${esc(a.location || "위치 미지정")}<br>${esc(userName(a.assignee_email))} · ${esc(statuses[a.status])}<br>구매 ${money(a.purchase_cost)} · 보증 ${esc(a.warranty_until || "미입력")}</p><button class="am-text-btn" data-monitor-open="${esc(a.id)}">자산 개요 보기 ↗</button></div>` : `<p class="am-muted">${m.candidate_by === "serial" ? "같은 시리얼의 모니터 자산이 이미 있습니다. 같은 장비이므로 아래 자산에 연결하세요." : m.candidates?.length ? "같은 모델의 다른 자산이 있습니다. 같은 장비면 연결하고, 다른 장비(예: 듀얼 모니터)면 새로 등록하세요." : "연결된 자산이 없습니다."}</p>${current ? (m.candidates || []).map((c) => `<div class="am-monitor-candidate"><span>${esc(c.tag)} · ${esc(c.name)}<small>${esc(c.serial || "시리얼 미기록")} · ${esc(c.location || "위치 미지정")}</small></span><button class="am-text-btn" data-monitor-link="${m.index}" data-target="${esc(c.id)}">이 자산 연결</button></div>`).join("") + (m.candidate_by === "serial" ? "" : `<button class="erp-btn erp-btn-outline" data-monitor-create="${m.index}">+ 모니터 자산으로 등록</button>`) : '<p class="am-muted">모니터 등록·연결은 최신 보고서에서 진행하세요.</p>'}`}</article>`;
})
.join("")}</div></section>`;
}