Refactor: Rename AssetTableView to SW_Table and sync with main
This commit is contained in:
32
src/main.ts
32
src/main.ts
@@ -1,13 +1,14 @@
|
||||
import { state, loadMasterDataFromDB } from './core/state';
|
||||
import { renderNavigation } from './components/Navigation';
|
||||
import { renderDashboard } from './views/DashboardView';
|
||||
import { renderTable } from './views/AssetTableView';
|
||||
import { renderSWTable } from './views/SW_Table';
|
||||
import { downloadTemplate, exportToExcel, parseExcel, HardwareAsset, SoftwareAsset, SWUser } from './core/excelHandler';
|
||||
import { initBaseModal } from './components/Modal/BaseModal';
|
||||
import { initPcModal } from './components/Modal/PCModal';
|
||||
import { initHwModal, openHwModal } from './components/Modal/HWModal';
|
||||
import { initStorageModal } from './components/Modal/StorageModal';
|
||||
import { initSwModal } from './components/Modal/SWModal';
|
||||
import { initSwModal, openSwModal } from './components/Modal/SWModal';
|
||||
import { initCloudModal, openCloudModal } from './components/Modal/CloudModal';
|
||||
import { initSwUserModal } from './components/Modal/SWUserModal';
|
||||
import { initDashboardDetailModal } from './components/Modal/DashboardDetailModal';
|
||||
import { createIcons, Download, Upload, FileSpreadsheet, Plus, X, LayoutDashboard, Monitor, Server, Database, Laptop, CalendarClock, Key, Cpu, Layers, Users, Paperclip, Edit2, History, RefreshCcw } from 'lucide';
|
||||
@@ -69,33 +70,38 @@ function initApp() {
|
||||
if (tab === '대시보드') {
|
||||
renderDashboard(mainContent);
|
||||
} else {
|
||||
renderTable(mainContent);
|
||||
renderSWTable(mainContent);
|
||||
}
|
||||
});
|
||||
|
||||
initPcModal(() => {
|
||||
saveAllHwToDB(state.masterData.hw);
|
||||
renderTable(mainContent);
|
||||
renderSWTable(mainContent);
|
||||
}, closeAllModals);
|
||||
|
||||
initHwModal(() => {
|
||||
saveAllHwToDB(state.masterData.hw);
|
||||
renderTable(mainContent);
|
||||
renderSWTable(mainContent);
|
||||
}, closeAllModals);
|
||||
|
||||
initStorageModal(() => {
|
||||
saveAllHwToDB(state.masterData.hw);
|
||||
renderTable(mainContent);
|
||||
renderSWTable(mainContent);
|
||||
}, closeAllModals);
|
||||
|
||||
initSwModal(() => {
|
||||
saveAllSwToDB(state.masterData.sw);
|
||||
renderTable(mainContent);
|
||||
renderSWTable(mainContent);
|
||||
}, closeAllModals);
|
||||
|
||||
initCloudModal(() => {
|
||||
saveAllSwToDB(state.masterData.sw);
|
||||
renderSWTable(mainContent);
|
||||
}, closeAllModals);
|
||||
|
||||
initSwUserModal(() => {
|
||||
saveAllSwUsersToDB(state.masterData.swUsers);
|
||||
renderTable(mainContent);
|
||||
renderSWTable(mainContent);
|
||||
}, closeAllModals);
|
||||
|
||||
initDashboardDetailModal();
|
||||
@@ -110,7 +116,7 @@ function initApp() {
|
||||
loadMasterDataFromDB().then((success) => {
|
||||
if (success) {
|
||||
if (state.activeSubTab === '대시보드') renderDashboard(mainContent);
|
||||
else renderTable(mainContent);
|
||||
else renderSWTable(mainContent);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -130,17 +136,21 @@ function initApp() {
|
||||
saveAllSwToDB(data.sw),
|
||||
saveAllSwUsersToDB(data.swUsers)
|
||||
]);
|
||||
renderTable(mainContent);
|
||||
renderSWTable(mainContent);
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('btn-add-asset')?.addEventListener('click', () => {
|
||||
if (state.activeSubTab === '서버' || state.activeSubTab === '전산비품' || state.activeSubTab === '스토리지') {
|
||||
if (['개인PC', '서버', '전산비품', '스토리지'].includes(state.activeSubTab)) {
|
||||
openHwModal({
|
||||
id: Math.random().toString(36).substring(2, 9),
|
||||
type: state.activeSubTab,
|
||||
법인: '한맥', 자산코드: '', 명칭: '', 위치: '', 관리자: '', IP주소: '', MACaddress: '', HW사양: '', OS: '', 납품업체: '', 품의서명: ''
|
||||
} as any);
|
||||
} else if (state.activeSubTab === '클라우드') {
|
||||
openCloudModal({ type: '클라우드', 제품명: '', 금액: '', 수량: 1, 계정명: '', 납품업체: '', 비고: '', 법인: '한맥', 플랫폼명: '' } as any);
|
||||
} else if (state.activeSubTab === '구독SW' || state.activeSubTab === '영구SW') {
|
||||
openSwModal({ type: state.activeSubTab, 제품명: '', 금액: '', 수량: 1, 계정명: '', 납품업체: '', 비고: '', 법인: '한맥' } as any);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user