Merge all feature branches into main and optimize core architecture
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { state } from '../../core/state';
|
||||
import { state, saveSoftwareAsset, deleteSoftwareAsset } from '../../core/state';
|
||||
import { SoftwareAsset } from '../../core/excelHandler';
|
||||
import { closeModals } from './BaseModal';
|
||||
import { openSwUserModal } from './SWUserModal';
|
||||
import { createIcons, History, Plus, X, Save, Edit2, RotateCcw } from 'lucide';
|
||||
import { CORP_LIST, TYPE_PREFIX_MAP } from './SharedData';
|
||||
import { openModal, closeModals } from './BaseModal';
|
||||
import { createIcons, History, Plus, X, Save, Edit2, RotateCcw, UserPlus } from 'lucide';
|
||||
import { CORP_LIST, ORG_LIST } from './SharedData';
|
||||
import {
|
||||
generateOptionsHTML,
|
||||
setFieldValue,
|
||||
@@ -13,273 +12,198 @@ import {
|
||||
autoFillForm,
|
||||
autoExtractForm
|
||||
} from './ModalUtils';
|
||||
import { openSwUserModal } from './SWUserModal';
|
||||
|
||||
let currentSwAsset: SoftwareAsset | null = null;
|
||||
let currentAsset: SoftwareAsset | null = null;
|
||||
let isEditMode = false;
|
||||
|
||||
const SW_FIELD_MAP: Record<string, string> = {
|
||||
'유형': 'type',
|
||||
'법인': '법인',
|
||||
'자산번호': '자산번호',
|
||||
'제품명': '제품명',
|
||||
'부서': '부서',
|
||||
'제품명': '소프트웨어명',
|
||||
'구매일': '구매일',
|
||||
'만료일': '만료일',
|
||||
'수량': '수량',
|
||||
'금액': '금액',
|
||||
'구매일': '구매일',
|
||||
'납품업체': '납품업체',
|
||||
'비고': '비고',
|
||||
'플랫폼명': '플랫폼명',
|
||||
'부서': '부서',
|
||||
'계정명': '계정명',
|
||||
'결제수단': '결제수단',
|
||||
'연결카드번호': '연결카드번호',
|
||||
'결제일': '결제일',
|
||||
'당월청구액': '당월청구액',
|
||||
'라이선스유형': '라이선스유형',
|
||||
'만료일': '만료일',
|
||||
'라이선스키': '라이선스키'
|
||||
'자산번호': '자산번호'
|
||||
};
|
||||
|
||||
const SW_FORM_HTML = `
|
||||
<!-- Group 1: 기본 정보 -->
|
||||
<div class="form-section-title">기본 정보 (Identity)</div>
|
||||
<div class="form-section-title">소프트웨어 기본 정보</div>
|
||||
<div class="form-group">
|
||||
<label for="sw-유형">라이선스 유형</label>
|
||||
<select id="sw-유형">
|
||||
<option value="구독SW">구독 라이선스</option>
|
||||
<option value="영구SW">영구 라이선스</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sw-법인">구매법인</label>
|
||||
<select id="sw-법인" required>${generateOptionsHTML(CORP_LIST)}</select>
|
||||
<select id="sw-법인">${generateOptionsHTML(CORP_LIST)}</select>
|
||||
</div>
|
||||
<div class="form-group sw-standard-field">
|
||||
<label for="sw-자산번호">자산번호</label>
|
||||
<div class="input-with-btn">
|
||||
<input type="text" id="sw-자산번호" readonly class="is-readonly-field" placeholder="번호 생성을 클릭하세요" />
|
||||
<button type="button" id="btn-generate-sw-code" class="btn btn-outline btn-sm">생성</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sw-부서">관리부서</label>
|
||||
<select id="sw-부서">${generateOptionsHTML(ORG_LIST)}</select>
|
||||
</div>
|
||||
<div class="form-group full-width">
|
||||
<label for="sw-제품명">제품명 / 서비스명</label>
|
||||
<div class="form-group">
|
||||
<label for="sw-제품명">제품명 (S/W명)</label>
|
||||
<input type="text" id="sw-제품명" required />
|
||||
</div>
|
||||
<div class="form-group cloud-only"><label for="sw-플랫폼명">플랫폼명</label><input type="text" id="sw-플랫폼명" placeholder="예: AWS, Cafe24" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-부서">담당부서</label><input type="text" id="sw-부서" /></div>
|
||||
<div class="form-group">
|
||||
<label for="sw-자산번호">자산번호</label>
|
||||
<input type="text" id="sw-자산번호" placeholder="관리번호 입력" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sw-수량">총 라이선스 수량</label>
|
||||
<input type="number" id="sw-수량" value="1" />
|
||||
</div>
|
||||
|
||||
<div class="form-section-title">계약 및 금액</div>
|
||||
<div class="form-group">
|
||||
<label for="sw-구매일">구매일 (계약시작)</label>
|
||||
<input type="date" id="sw-구매일" />
|
||||
</div>
|
||||
<div class="form-group sw-sub-only">
|
||||
<label for="sw-만료일">만료일 (계약종료)</label>
|
||||
<input type="date" id="sw-만료일" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sw-금액">금액 (단가/총액)</label>
|
||||
<input type="text" id="sw-금액" oninput="this.value = this.value.replace(/[^0-9]/g, '').replace(/\\B(?=(\\d{3})+(?!\d))/g, ',')" />
|
||||
</div>
|
||||
<div class="form-group full-width">
|
||||
<label for="sw-비고">비고 (특이사항)</label>
|
||||
<textarea id="sw-비고" rows="2"></textarea>
|
||||
</div>
|
||||
|
||||
<!-- Group 2: 라이선스 및 계약 -->
|
||||
<div class="form-section-title">라이선스 및 계약 정보</div>
|
||||
<div class="form-group sw-standard-field" id="sw-license-type-group"><label for="sw-라이선스유형">라이선스 유형</label><input type="text" id="sw-라이선스유형" /></div>
|
||||
<div class="form-group sw-standard-field" id="sw-license-key-group"><label for="sw-라이선스키">라이선스 키</label><input type="text" id="sw-라이선스키" /></div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-수량">보유 수량</label><input type="number" id="sw-수량" min="0" /></div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-금액">도입 금액</label><input type="text" id="sw-금액" oninput="this.value=this.value.replace(/[^0-9]/g,'').replace(/\\\\B(?=(\\\\d{3})+(?!\\\\d))/g,',')" /></div>
|
||||
|
||||
<div class="form-group cloud-only"><label for="sw-계정명">계정명 (이메일)</label><input type="text" id="sw-계정명" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-결제수단">결제수단</label><select id="sw-결제수단"><option value="">선택안함</option><option value="법인카드">법인카드</option><option value="인보이스">인보이스</option></select></div>
|
||||
<div class="form-group cloud-only"><label for="sw-연결카드번호">연결카드번호(뒷4자리)</label><input type="text" id="sw-연결카드번호" maxlength="4" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-결제일">결제일 (기준일)</label><input type="number" id="sw-결제일" min="1" max="31" /></div>
|
||||
<div class="form-group cloud-only"><label for="sw-당월청구액">당월 청구액(원)</label><input type="text" id="sw-당월청구액" oninput="this.value=this.value.replace(/[^0-9]/g,'').replace(/\\\\B(?=(\\\\d{3})+(?!\\\\d))/g,',')" /></div>
|
||||
|
||||
<!-- Group 4: 관리 정보 -->
|
||||
<div class="form-section-title">관리 및 비고</div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-구매일">구매연월</label><input type="text" id="sw-구매일" placeholder="YYYYMM" maxlength="6" /></div>
|
||||
<div class="form-group sw-standard-field" id="sw-expiry-group"><label for="sw-만료일">만료일 (구독)</label><input type="text" id="sw-만료일" /></div>
|
||||
<div class="form-group sw-standard-field"><label for="sw-납품업체">납품업체</label><input type="text" id="sw-납품업체" /></div>
|
||||
<div class="form-group full-width"><label for="sw-비고">비고</label><textarea id="sw-비고" rows="2"></textarea></div>
|
||||
|
||||
<div id="sw-user-section" class="user-management-section" style="margin-top: 2rem;">
|
||||
<div class="section-header" style="display:flex; justify-content:space-between; align-items:center; margin-bottom:1rem;">
|
||||
<h3 style="font-size:1rem; font-weight:600;">사용자 할당 현황</h3>
|
||||
<button type="button" id="btn-open-sw-update" class="btn btn-outline btn-sm">할당 관리 <i data-lucide="plus" style="width:14px; height:14px;"></i></button>
|
||||
<div class="form-section-title">
|
||||
사용자 할당 현황
|
||||
<button type="button" id="btn-add-sw-user" class="btn btn-outline btn-xs" style="margin-left: 0.5rem;">
|
||||
<i data-lucide="user-plus" style="width:12px; height:12px;"></i> 할당 추가
|
||||
</button>
|
||||
</div>
|
||||
<div class="full-width">
|
||||
<div id="sw-user-list-container" class="mini-table-container">
|
||||
<table class="itam-table mini">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>부서</th>
|
||||
<th>이름</th>
|
||||
<th>사번</th>
|
||||
<th>사용기간</th>
|
||||
<th>삭제</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="sw-user-list-body"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="sw-assigned-users-summary" class="user-summary-grid"></div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
function renderSwHistory(swId: string) {
|
||||
const container = document.getElementById('sw-history-list');
|
||||
if (!container) return;
|
||||
const logs = (state.masterData.logs || []).filter(l => l.assetId === swId).sort((a,b) => new Date(b.date).getTime() - new Date(a.date).getTime());
|
||||
if (logs.length === 0) { container.innerHTML = '<div class="empty-history">수정 이력이 없습니다.</div>'; return; }
|
||||
container.innerHTML = logs.map(l => `
|
||||
<div class="history-item">
|
||||
<div class="history-date">${l.date}</div>
|
||||
<div class="history-user">${l.user}</div>
|
||||
<div class="history-details">${l.details.replace(/\n/g, '<br>')}</div>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
function renderUserSummary(swId: string) {
|
||||
const container = document.getElementById('sw-assigned-users-summary');
|
||||
if (!container) return;
|
||||
const userMapping = state.masterData.swUsers.find(u => u.sw_id === swId);
|
||||
if (!userMapping || !userMapping.userData || userMapping.userData.length === 0) {
|
||||
container.innerHTML = '<div class="empty-summary">할당된 사용자가 없습니다.</div>';
|
||||
function renderSwUsers(swId: string) {
|
||||
const body = document.getElementById('sw-user-list-body');
|
||||
if (!body) return;
|
||||
const users = (state.masterData.swUsers || []).filter(u => u.swId === swId || u.sw_id === swId);
|
||||
|
||||
if (users.length === 0) {
|
||||
body.innerHTML = '<tr><td colspan="5" class="empty-row">할당된 사용자가 없습니다.</td></tr>';
|
||||
return;
|
||||
}
|
||||
container.innerHTML = userMapping.userData.map(u => `
|
||||
<div class="user-badge-item"><span class="u-name">${u[3] || '이름없음'}</span><span class="u-dept">${u[1] || '부서없음'}</span></div>
|
||||
|
||||
body.innerHTML = users.map(u => `
|
||||
<tr>
|
||||
<td>${u.부서 || '-'}</td>
|
||||
<td>${u.이름 || '-'}</td>
|
||||
<td>${u.사번 || '-'}</td>
|
||||
<td><small>${u.사용기간 || '-'}</small></td>
|
||||
<td><button class="btn-icon text-danger btn-delete-user" data-id="${u.id}"><i data-lucide="x" style="width:14px; height:14px;"></i></button></td>
|
||||
</tr>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
createIcons({ icons: { X } });
|
||||
|
||||
function applySwTypeUI(type: string) {
|
||||
const cloudFields = document.querySelectorAll('.cloud-only');
|
||||
const swFields = document.querySelectorAll('.sw-standard-field');
|
||||
const userSection = document.getElementById('sw-user-section');
|
||||
const keyGroup = document.getElementById('sw-license-key-group');
|
||||
const typeGroup = document.getElementById('sw-license-type-group');
|
||||
const expiryGroup = document.getElementById('sw-expiry-group');
|
||||
|
||||
if (type === '클라우드') {
|
||||
cloudFields.forEach(el => (el as HTMLElement).style.display = 'flex');
|
||||
swFields.forEach(el => (el as HTMLElement).style.display = 'none');
|
||||
if (userSection) userSection.style.display = 'none';
|
||||
} else {
|
||||
cloudFields.forEach(el => (el as HTMLElement).style.display = 'none');
|
||||
swFields.forEach(el => (el as HTMLElement).style.display = 'flex');
|
||||
if (userSection) userSection.style.display = 'block';
|
||||
if (type === '구독SW') {
|
||||
if (keyGroup) keyGroup.style.display = 'none';
|
||||
if (typeGroup) typeGroup.style.display = 'flex';
|
||||
if (expiryGroup) expiryGroup.style.display = 'flex';
|
||||
} else {
|
||||
if (keyGroup) keyGroup.style.display = 'flex';
|
||||
if (typeGroup) typeGroup.style.display = 'none';
|
||||
if (expiryGroup) expiryGroup.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function openSwModal(asset: SoftwareAsset, mode: 'view' | 'add' = 'view') {
|
||||
currentSwAsset = asset;
|
||||
const modal = document.getElementById('sw-asset-modal')!;
|
||||
setEditLock('sw-asset-form', mode, {
|
||||
saveBtnId: 'btn-save-sw-asset',
|
||||
revertBtnId: 'btn-revert-sw-edit',
|
||||
generateBtnId: 'btn-generate-sw-code',
|
||||
addLogBtnId: 'btn-add-sw-log'
|
||||
body.querySelectorAll('.btn-delete-user').forEach(btn => {
|
||||
btn.addEventListener('click', () => {
|
||||
const id = btn.getAttribute('data-id');
|
||||
state.masterData.swUsers = state.masterData.swUsers.filter(u => u.id !== id);
|
||||
renderSwUsers(swId);
|
||||
});
|
||||
});
|
||||
isEditMode = (mode === 'add');
|
||||
}
|
||||
|
||||
export function openSwModal(asset: SoftwareAsset) {
|
||||
currentAsset = asset;
|
||||
const modal = document.getElementById('sw-asset-modal')!;
|
||||
|
||||
setEditLock('sw-asset-form', 'view', {
|
||||
saveBtnId: 'btn-save-sw-asset',
|
||||
revertBtnId: 'btn-revert-sw-edit'
|
||||
});
|
||||
|
||||
isEditMode = false;
|
||||
autoFillForm('sw', asset, SW_FIELD_MAP);
|
||||
applySwTypeUI(asset.type);
|
||||
renderUserSummary(asset.id);
|
||||
renderSwHistory(asset.id);
|
||||
|
||||
const subOnly = document.querySelectorAll('.sw-sub-only');
|
||||
subOnly.forEach(el => (el as HTMLElement).style.display = asset.type === '구독SW' ? 'block' : 'none');
|
||||
|
||||
renderSwUsers(asset.id);
|
||||
|
||||
modal.classList.remove('hidden');
|
||||
createIcons({ icons: { X, History, Plus } });
|
||||
createIcons({ icons: { X, Save, Edit2, RotateCcw, UserPlus } });
|
||||
}
|
||||
|
||||
export function initSwModal(onSave: () => void, closeModalsCb: () => void) {
|
||||
if (!document.getElementById('sw-asset-modal')) {
|
||||
const html = createModalFrameHTML('sw', '소프트웨어 상세 정보', SW_FORM_HTML, {
|
||||
historyTitle: '업데이트 내역',
|
||||
historyTitle: '라이선스 변경 이력',
|
||||
addLogBtnId: 'btn-add-sw-log'
|
||||
});
|
||||
document.body.insertAdjacentHTML('beforeend', html);
|
||||
const logModalHTML = `
|
||||
<div id="sw-log-modal" class="modal-overlay hidden" style="z-index: 1100;">
|
||||
<div class="modal-content" style="max-width: 400px;">
|
||||
<div class="modal-header"><h2>업데이트 내역 추가</h2><button id="btn-close-sw-log" class="btn-icon"><i data-lucide="x"></i></button></div>
|
||||
<div class="modal-body"><div class="grid-form" style="grid-template-columns: 1fr;"><div class="form-group"><label>날짜</label><input type="date" id="new-log-date" /></div><div class="form-group"><label>상세 내용</label><textarea id="new-log-details" rows="3"></textarea></div></div></div>
|
||||
<div class="modal-footer"><div></div><div class="footer-actions"><button id="btn-cancel-sw-log" class="btn btn-outline">취소</button><button id="btn-confirm-sw-log" class="btn btn-primary">추가</button></div></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
document.body.insertAdjacentHTML('beforeend', logModalHTML);
|
||||
}
|
||||
|
||||
const form = document.getElementById('sw-asset-form') as HTMLFormElement;
|
||||
const saveBtn = document.getElementById('btn-save-sw-asset')!;
|
||||
const revertBtn = document.getElementById('btn-revert-sw-edit')!;
|
||||
const deleteBtn = document.getElementById('btn-delete-sw-asset')!;
|
||||
const userUpdateBtn = document.getElementById('btn-open-sw-update')!;
|
||||
const logAddBtn = document.getElementById('btn-add-sw-log')!;
|
||||
const logModal = document.getElementById('sw-log-modal')!;
|
||||
const typeSelect = document.getElementById('sw-유형') as HTMLSelectElement;
|
||||
|
||||
const closeModalAction = () => { closeModalsCb(); isEditMode = false; };
|
||||
document.getElementById('btn-close-sw-modal')?.addEventListener('click', closeModalAction);
|
||||
document.getElementById('btn-cancel-sw-modal')?.addEventListener('click', closeModalAction);
|
||||
|
||||
revertBtn.addEventListener('click', () => {
|
||||
setEditLock('sw-asset-form', 'view', {
|
||||
saveBtnId: 'btn-save-sw-asset',
|
||||
revertBtnId: 'btn-revert-sw-edit',
|
||||
generateBtnId: 'btn-generate-sw-code',
|
||||
addLogBtnId: 'btn-add-sw-log'
|
||||
});
|
||||
isEditMode = false;
|
||||
if (currentSwAsset) openSwModal(currentSwAsset, 'view');
|
||||
typeSelect?.addEventListener('change', () => {
|
||||
const subOnly = document.querySelectorAll('.sw-sub-only');
|
||||
subOnly.forEach(el => (el as HTMLElement).style.display = typeSelect.value === '구독SW' ? 'block' : 'none');
|
||||
});
|
||||
|
||||
document.getElementById('btn-generate-sw-code')?.addEventListener('click', async () => {
|
||||
const typeValue = getFieldValue('sw-asset-type');
|
||||
const purchaseDate = getFieldValue('sw-구매일');
|
||||
const typeCode = TYPE_PREFIX_MAP[typeValue] || 'SW';
|
||||
const dateStr = purchaseDate.replace(/[^0-9]/g, '');
|
||||
if (dateStr.length < 6) { alert('올바른 구매연월(YYYYMM)을 입력해주세요.'); return; }
|
||||
const prefix = `${typeCode}-${dateStr.substring(0, 6)}-`;
|
||||
try {
|
||||
const res = await fetch(`http://localhost:3000/api/generate-asset-code?prefix=${prefix}`);
|
||||
const data = await res.json();
|
||||
if (data.nextCode) setFieldValue('sw-자산번호', data.nextCode);
|
||||
} catch (err) { alert('자산번호 생성에 실패했습니다.'); }
|
||||
});
|
||||
|
||||
// YYYYMM 입력 제한 로직 (숫자 6자리)
|
||||
document.getElementById('sw-구매일')?.addEventListener('input', (e) => {
|
||||
const target = e.target as HTMLInputElement;
|
||||
target.value = target.value.replace(/[^0-9]/g, '').substring(0, 6);
|
||||
});
|
||||
const handleClose = () => { closeModalsCb(); isEditMode = false; };
|
||||
document.getElementById('btn-close-sw-modal')?.addEventListener('click', handleClose);
|
||||
document.getElementById('btn-cancel-sw-modal')?.addEventListener('click', handleClose);
|
||||
|
||||
saveBtn.addEventListener('click', () => {
|
||||
if (!currentSwAsset) return;
|
||||
if (!currentAsset) return;
|
||||
if (!isEditMode) {
|
||||
setEditLock('sw-asset-form', 'edit', {
|
||||
saveBtnId: 'btn-save-sw-asset',
|
||||
revertBtnId: 'btn-revert-sw-edit',
|
||||
generateBtnId: 'btn-generate-sw-code',
|
||||
addLogBtnId: 'btn-add-sw-log'
|
||||
});
|
||||
setEditLock('sw-asset-form', 'edit', { saveBtnId: 'btn-save-sw-asset', revertBtnId: 'btn-revert-sw-edit' });
|
||||
isEditMode = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const extracted = autoExtractForm('sw', SW_FIELD_MAP);
|
||||
const updated = { ...currentSwAsset, ...extracted, 수량: parseInt(extracted.수량 || '0') };
|
||||
|
||||
let targetList: SoftwareAsset[] = [];
|
||||
if (updated.type === '구독SW') targetList = state.masterData.subSw;
|
||||
else if (updated.type === '영구SW') targetList = state.masterData.permSw;
|
||||
else targetList = (state.masterData as any).cloud || [];
|
||||
|
||||
const idx = targetList.findIndex(a => a.id === updated.id);
|
||||
if (idx > -1) targetList[idx] = updated; else targetList.push(updated);
|
||||
const updated = { ...currentAsset, ...extracted };
|
||||
|
||||
saveSoftwareAsset(updated);
|
||||
onSave();
|
||||
setEditLock('sw-asset-form', 'view', {
|
||||
saveBtnId: 'btn-save-sw-asset',
|
||||
revertBtnId: 'btn-revert-sw-edit',
|
||||
generateBtnId: 'btn-generate-sw-code',
|
||||
addLogBtnId: 'btn-add-sw-log'
|
||||
});
|
||||
isEditMode = false;
|
||||
setEditLock('sw-asset-form', 'view', { saveBtnId: 'btn-save-sw-asset', revertBtnId: 'btn-revert-sw-edit' });
|
||||
});
|
||||
|
||||
deleteBtn.addEventListener('click', () => {
|
||||
if (currentSwAsset && confirm('삭제하시겠습니까?')) {
|
||||
const type = currentSwAsset.type;
|
||||
if (type === '구독SW') state.masterData.subSw = state.masterData.subSw.filter(a => a.id !== currentSwAsset!.id);
|
||||
else if (type === '영구SW') state.masterData.permSw = state.masterData.permSw.filter(a => a.id !== currentSwAsset!.id);
|
||||
onSave(); closeModalAction();
|
||||
if (currentAsset && confirm('이 소프트웨어 자산을 삭제하시겠습니까?')) {
|
||||
deleteSoftwareAsset(currentAsset.id, currentAsset.type);
|
||||
onSave();
|
||||
handleClose();
|
||||
}
|
||||
});
|
||||
|
||||
userUpdateBtn.addEventListener('click', () => { if (currentSwAsset) openSwUserModal(currentSwAsset); });
|
||||
logAddBtn.addEventListener('click', () => {
|
||||
logModal.classList.remove('hidden');
|
||||
(document.getElementById('new-log-date') as HTMLInputElement).value = new Date().toISOString().split('T')[0];
|
||||
(document.getElementById('new-log-details') as HTMLTextAreaElement).value = '';
|
||||
});
|
||||
document.getElementById('btn-close-sw-log')?.addEventListener('click', () => logModal.classList.add('hidden'));
|
||||
document.getElementById('btn-cancel-sw-log')?.addEventListener('click', () => logModal.classList.add('hidden'));
|
||||
document.getElementById('btn-confirm-sw-log')?.addEventListener('click', () => {
|
||||
if (!currentSwAsset) return;
|
||||
const date = (document.getElementById('new-log-date') as HTMLInputElement).value;
|
||||
const details = (document.getElementById('new-log-details') as HTMLTextAreaElement).value;
|
||||
if (!date || !details) return;
|
||||
state.masterData.logs = state.masterData.logs || [];
|
||||
state.masterData.logs.push({ id: Math.random().toString(36).substring(2, 9), assetId: currentSwAsset.id, date, user: '관리자', details });
|
||||
logModal.classList.add('hidden'); renderSwHistory(currentSwAsset.id);
|
||||
document.getElementById('btn-add-sw-user')?.addEventListener('click', () => {
|
||||
if (!currentAsset) return;
|
||||
openSwUserModal(currentAsset.id, () => renderSwUsers(currentAsset!.id));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user