feat: 대시보드 및 모달 컴포넌트 최적화, 클라우드 자산 뷰 추가

This commit is contained in:
2026-04-21 09:11:56 +09:00
parent c5d7f4cf67
commit 1ace678c09
10 changed files with 769 additions and 39 deletions

View File

@@ -25,7 +25,7 @@ const SW_MODAL_HTML = `
<div class="form-group">
<label for="sw-법인">법인</label>
<select id="sw-법인" required>
<option value="한맥">한맥 (HM)</option><option value="삼안 (SM)">삼안 (SM)</option><option value="바론 (BR)">바론 (BR)</option>
<option value="한맥">한맥</option><option value="삼안">삼안</option><option value="바론">바론</option>
</select>
</div>
<div class="form-group">
@@ -52,7 +52,7 @@ const SW_MODAL_HTML = `
</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, ',')" />
<input type="text" id="sw-금액" oninput="this.value = this.value.replace(/[^0-9]/g, '') ? Number(this.value.replace(/[^0-9]/g, '')).toLocaleString() : ''" />
</div>
<div class="form-group">
<label for="sw-수량">수량 (보유량)</label>
@@ -122,7 +122,7 @@ const SW_MODAL_HTML = `
</div>
<div class="form-group">
<label>발생 비용</label>
<input type="text" id="sw-update-cost" oninput="this.value = this.value.replace(/[^0-9]/g, '').replace(/\\B(?=(\\d{3})+(?!\d))/g, ',')" placeholder="ex) 500,000" />
<input type="text" id="sw-update-cost" oninput="this.value = this.value.replace(/[^0-9]/g, '') ? Number(this.value.replace(/[^0-9]/g, '')).toLocaleString() : ''" placeholder="ex) 500,000" />
</div>
<div class="form-group">
<label>상세 내용 (메모)</label>
@@ -157,12 +157,14 @@ export function setEditMode(edit: boolean) {
btnSaveSw.textContent = '저장';
btnRevertEdit.classList.remove('hidden');
btnCloseFooter.classList.add('hidden');
Array.from(swForm.elements).forEach((el: any) => el.disabled = false);
} else {
swForm.classList.add('is-view-mode');
swForm.classList.remove('is-edit-mode');
btnSaveSw.textContent = '수정';
btnRevertEdit.classList.add('hidden');
btnCloseFooter.classList.remove('hidden');
Array.from(swForm.elements).forEach((el: any) => el.disabled = true);
if (currentAsset) fillFormData(currentAsset);
}
}
@@ -248,6 +250,16 @@ export function initSwModal(renderContent: () => void, closeModals: () => void)
if(idx !== -1) state.masterData.sw[idx] = newAsset;
} else {
state.masterData.sw.push(newAsset);
const now = new Date();
state.masterData.logs = state.masterData.logs || [];
state.masterData.logs.push({
id: Math.random().toString(36).substring(2, 9),
assetId: newAsset.id,
date: `${now.getFullYear()}-${String(now.getMonth()+1).padStart(2,'0')}-${String(now.getDate()).padStart(2,'0')}`,
user: '관리자',
details: '신규 등록'
});
}
closeModals();
@@ -348,6 +360,7 @@ export function initSwModal(renderContent: () => void, closeModals: () => void)
function renderSwHistory(assetId: string) {
const historyList = document.getElementById('sw-history-list');
if (!historyList) return;
if (!state.masterData.logs) state.masterData.logs = [];
const logs = state.masterData.logs
.filter(l => l.assetId === assetId)