import { vars } from '../archive/variable.js'; import { displayFileName, checkDuplicatesFileNameAndExt , restrictToNumber, calculateTotalJointContract, showToolTip, overviewVarsInit } from './overviewCommon.js'; import { makeTaskHistory } from './overviewPageRenderer.js'; import { overviewVars } from './overviewVariable.js'; //๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ Overview ๋ชจ๋‹ฌ ๊ณตํ†ต ์‚ฌ์šฉ ์‹œ์ž‘ ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ // ๋ชจ๋‹ฌCLSOE const modalNames = ['facility-size', 'section-left', 'section-middle', 'schedule-list', 'schedule', 'task-period']; modalNames.forEach(name => { const modal = document.querySelector(`.overview-modal.${name}`); if (!modal) return; const closeBtn = modal.querySelector('.overview-modal-header--end img'); const footerCloseBtn = modal.querySelector('.modal-footer .btn-close'); closeBtn?.addEventListener('click', () => { modal.style.display = 'none'; document.querySelector('.overview-modal-wrapper').style.display = 'none'; // ๋ณ€์ˆ˜ ์ดˆ๊ธฐํ™” overviewVarsInit(); }); footerCloseBtn?.addEventListener('click', () => { modal.style.display = 'none'; document.querySelector('.overview-modal-wrapper').style.display = 'none'; // ๋ณ€์ˆ˜ ์ดˆ๊ธฐํ™” overviewVarsInit(); }); }); // ๋ชจ๋‹ฌ ์˜์—ญ ์™ธ์— ํด๋ฆญํ–ˆ์„๋•Œ ๋ชจ๋‹ฌ ๊บผ์ง€๋Š” ์ด๋ฒคํŠธ // document.querySelector('.overview-modal-wrapper')?.addEventListener('pointerdown', (e) => { // document.querySelector('.overview-modal-wrapper').style.display = 'none'; // document.querySelectorAll('.overview-modal').forEach(modal => { // if (!modal.contains(e.target)) { // modal.style.display = 'none'; // } // }); // }); // ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ Overview ๋ชจ๋‹ฌ ๊ณตํ†ต ์‚ฌ์šฉ ๋ ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ //๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ Secion-Left ๋ชจ๋‹ฌ ์‹œ์ž‘ ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ // ์œ„์น˜๋„/๊ฐœ์š”๋„ ๋“œ๋ž˜๊ทธ์•ค๋“œ๋กญ export function fileDragAndDrop() { const dropbox = document.querySelector('.overview-modal .dropbox'); dropbox.addEventListener('dragenter', (e) => { e.preventDefault(); dropbox.style.background = '#999'; }); dropbox.addEventListener('dragover', (e) => { e.preventDefault(); dropbox.style.background = '#999'; }); dropbox.addEventListener('dragleave', (e) => { e.preventDefault(); dropbox.style.background = '#e6e8ea'; }); dropbox.addEventListener('drop', (e) => { e.preventDefault(); dropbox.style.background = '#e6e8ea'; const files = Array.from(e.dataTransfer.files); // ์ค‘๋ณต ์ด๋ฆ„๊ณผ ํ™•์žฅ์ž ์ฒดํฌ checkDuplicatesFileNameAndExt(files); displayFileName(); }); }; // section-left ๋ชจ๋‹ฌ ์—ด๊ธฐ document.querySelector('.overview .box-header--right.section-left-edit')?.addEventListener('click', () => { const modal = document.querySelector('.overview-modal.section-left'); const modalWrapper = document.querySelector('.overview-modal-wrapper'); modal.querySelector('.business-purpose').value = document.querySelector('.overview .box-body.business-purpose').innerText; modal.querySelector('.performance-area').value = document.querySelector('.overview .box-body.location-map-detail .performance-area').innerText; modal.querySelector('.reference-area').value = document.querySelector('.overview .box-body.location-map-detail .reference-area').innerText; modal.querySelector('.facility-overview').value = document.querySelector('.overview .box-body.facility-size .facility-overview').innerText; //overseas์šฉ ๋ถ„๊ธฐ if(!overviewVars.overseas){ modal.querySelector('.nation').value = document.querySelector('.overview .box-body.location-map-detail .nation-nm').innerText; modal.querySelector('.continent').value = document.querySelector('.overview .box-body.location-map-detail .continent').innerText; } else { modal.querySelector('.nation').innerText = document.querySelector('.overview .box-body.location-map-detail .nation-nm').innerText; modal.querySelector('.continent').innerText = document.querySelector('.overview .box-body.location-map-detail .continent').innerText; } overviewVarsInit(); if(overviewVars.filesNameArr.length > 0) displayFileName(); modal.querySelectorAll('input[type=file]').forEach(input => { input.value = ''; }) makeTabCell(overviewVars.originalSectionTabData); // ํ† ๊ธ€ ์ฒ˜๋ฆฌ if (modal.style.display === 'block') { modal.style.display = 'none'; return; } modal.style.display = 'block'; modalWrapper.style.display = 'block'; }); // section-left ๋ชจ๋‹ฌ ์‹œ์„ค๊ทœ๋ชจ ํƒญ,์…€ ์ƒ์„ฑ ํ•จ์ˆ˜ export function makeTabCell(data) { const tabContainer = document.querySelector('.section-tabs'); const contentContainer = document.querySelector('.section-content'); // ๊ฐ€๋กœ ์Šคํฌ๋กค ์ด๋ฒคํŠธ tabContainer.addEventListener('wheel', (e) => { e.preventDefault(); tabContainer.scrollLeft += e.deltaY; }); tabContainer.innerHTML = ''; contentContainer.innerHTML = ''; // ๋ฐ์ดํ„ฐ ์—†์„ ๋•Œ ๊ธฐ๋ณธ๊ฐ’ if (Object.keys(data).length === 0) { data = { '': [{ key: '', value: '', id: '' }] }; } const titles = Object.keys(data); titles.forEach((title, index) => { const tab = createTab(title, index === 0); bindTabEvents(tab, contentContainer); tabContainer.appendChild(tab); }); // ํƒญ ์ถ”๊ฐ€ ๋ฒ„ํŠผ const addBtn = document.createElement('button'); addBtn.classList.add('xs-btn', 'add'); addBtn.innerHTML = `icon-add`; tabContainer.appendChild(addBtn); addBtn.addEventListener('click', () => { const newTab = createTab('', true); bindTabEvents(newTab, contentContainer, true); tabContainer.insertBefore(newTab, addBtn); newTab.click(); }); // ์ฒซ๋ฒˆ์งธ ํƒญ ํด๋ฆญ if (titles.length > 0) { tabContainer.querySelector('.tab')?.click(); } } // ํƒญ ์ƒ์„ฑ function createTab(title, isActive) { const tab = document.createElement('div'); tab.className = 'tab'; if (isActive) tab.classList.add('click-on'); const input = document.createElement('input'); input.className = 'tab-style-input'; input.type = 'text'; input.value = title; input.placeholder = 'ํƒญ ์ œ๋ชฉ ์ž…๋ ฅ'; const closeBtn = document.createElement('button'); closeBtn.className = 'xs-btn'; closeBtn.innerHTML = ``; tab.appendChild(input); tab.appendChild(closeBtn); return tab; } // ํƒญ ํด๋ฆญ, ์ œ๋ชฉ์ž…๋ ฅ, ์‚ญ์ œ๋ฒ„ํŠผ ์ด๋ฒคํŠธ function bindTabEvents(tab, contentContainer, isNew = false) { const input = tab.querySelector('input'); const closeBtn = tab.querySelector('button'); // ํƒญ ํด๋ฆญ ์ด๋ฒคํŠธ tab.addEventListener('click', () => { document.querySelectorAll('.section-tabs .tab').forEach(t => t.classList.remove('click-on')); tab.classList.add('click-on'); renderCells(input.value.trim(), contentContainer); }); // ํƒญ ์ œ๋ชฉ input ๋ณ€๊ฒฝ ์ด๋ฒคํŠธ let previousSection = input.value.trim(); input.addEventListener('input', () => { const section = String(input.value.trim()); // ํƒญ ์ œ๋ชฉ์ด ๋นˆ๊ฐ’ ์ผ๋•Œ ์‚ญ์ œ ์ฒ˜๋ฆฌ if (section === '') { if (previousSection && overviewVars.sectionTabData[previousSection]) delete overviewVars.sectionTabData[previousSection]; showToolTip(input, 'ํƒญ ์ œ๋ชฉ์ด ์—†์–ด ์…€ ๋‚ด์šฉ์ด ์ดˆ๊ธฐํ™”๋˜์—ˆ์Šต๋‹ˆ๋‹ค.') // ์…€ ์ดˆ๊ธฐํ™” document.querySelectorAll('.section-content .section-content--cell').forEach((cell, index) => { if(index === 0){ cell.querySelectorAll('input').forEach(input => input.value = ''); } else{ // ์…€ ์ถ”๊ฐ€ ๋ฒ„ํŠผ์„ ๊ฑด๋„ˆ๋œ€ if(cell.className === 'section-content--cell add-cell-btn') return; cell.remove(); } }); previousSection = ''; return; } // ํƒญ ์ œ๋ชฉ์ด ๊ฐ™์„๋•Œ ์ฒ˜๋ฆฌ ๋ง‰๊ธฐ if (section !== previousSection && overviewVars.sectionTabData[section]){ showToolTip(input, '์ด๋ฏธ ์กด์žฌํ•˜๋Š” ํƒญ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ์ด๋ฆ„์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.') input.value = previousSection; return; } // ํƒญ ์ด๋ฆ„์ด ๋ณ€๊ฒฝ๋ ๋•Œ if (previousSection && previousSection !== section) { if (overviewVars.sectionTabData[previousSection]) { overviewVars.sectionTabData[section] = overviewVars.sectionTabData[previousSection]; delete overviewVars.sectionTabData[previousSection]; } else { overviewVars.sectionTabData[section] = []; } } else if (!overviewVars.sectionTabData[section]) { overviewVars.sectionTabData[section] = []; } previousSection = section; }); // ํƒญ ์‚ญ์ œ ์ด๋ฒคํŠธ closeBtn.addEventListener('click', async (e) => { e.stopPropagation(); const title = input.value; const tabLength = document.querySelectorAll('.section-tabs .tab').length; const tabInput = document.querySelector('.section-tabs .tab input'); const cell = document.querySelectorAll('.section-content--cell input'); const emptyTab = !tabInput?.value.trim(); const emptyCell = Array.from(cell).every(input => !input.value.trim()); // ํƒญ์ด ํ•œ ๊ฐœ ๋‚จ์•˜๊ณ  ๊ณต๋ฐฑ์ผ ๊ฒฝ์šฐ ์‚ญ์ œ ๋ง‰๊ธฐ if (tabLength === 1 && emptyTab && emptyCell) return; try { if (tabLength === 1) { delete overviewVars.sectionTabData[title]; document.querySelector('.section-tabs .tab input').value = ''; document.querySelectorAll('.section-content .section-content--cell').forEach((cell, index) => { if(index === 0){ cell.querySelectorAll('input').forEach(input => input.value = ''); } else{ // ์…€ ์ถ”๊ฐ€ ๋ฒ„ํŠผ์„ ๊ฑด๋„ˆ๋œ€ if(cell.className === 'section-content--cell add-cell-btn') return; cell.remove(); } }); } else { delete overviewVars.sectionTabData[title]; tab.remove(); const allTabs = document.querySelectorAll('.section-tabs .tab'); const lastTab = allTabs[allTabs.length - 1]; if (lastTab) lastTab.click(); } } catch (err) { console.error(err); } }); } // ์…€ ๋ Œ๋”๋”ฉ function renderCells(title, container) { container.innerHTML = ''; let cells = overviewVars.sectionTabData[title] || [{ key: '', value: '', id: '' }]; // ํƒ€์ดํ‹€๋งŒ ์žˆ๊ณ  ์…€์˜ ๋‚ด์šฉ์ด ์—†์„๋•Œ ๊ธฐ๋ณธ๊ฐ’ ์„ค์ • if(cells.length === 0) cells = [{ key: '', value: '', id: '' }]; cells.forEach(cell => { const row = createCell(cell); bindCellEvents(row, title); container.appendChild(row); }); if (!container._hasInputEvent) { container.addEventListener('input', (e) => { if (!e.target.matches('input')) return; const section = document.querySelector('.tab.click-on input').value.trim(); if (section === '') { container.querySelectorAll('.section-content--cell input').forEach(cell => { cell.value = '' }); showToolTip(e.target, 'ํƒญ์˜ ์ œ๋ชฉ์„ ๋จผ์ € ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”') return } const keyInputs = container.querySelectorAll('input.short-input'); const valueInputs = container.querySelectorAll('input.middle-input'); const keyValueList = []; for (let i = 0; i < keyInputs.length; i++) { const key = keyInputs[i].value; const value = valueInputs[i] ? valueInputs[i].value : ''; const id = keyInputs[i].dataset.id ? parseInt(keyInputs[i].dataset.id) : null; const projectId = vars.project_id; keyValueList.push({ key, value, id, projectId }); } overviewVars.sectionTabData[section] = keyValueList; }); container._hasInputEvent = true; } // ์…€ ์ถ”๊ฐ€ ๋ฒ„ํŠผ const addCell = document.createElement('div'); addCell.className = 'section-content--cell add-cell-btn'; addCell.innerHTML = ` icon-add-primary

์…€์ถ”๊ฐ€

`; addCell.addEventListener('click', () => { const newCell = createCell({ key: '', value: '', id: null }); bindCellEvents(newCell, title); container.insertBefore(newCell, addCell); }); container.appendChild(addCell); } // ์…€ ์ƒ์„ฑ function createCell(cell) { const row = document.createElement('div'); row.className = 'section-content--cell'; row.innerHTML = ` `; const btn = document.createElement('button'); btn.classList.add('xs-btn', 'cell-remove'); btn.innerHTML = ``; row.appendChild(btn); return row; } // ์…€ ์‚ญ์ œ ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ์ถ”๊ฐ€ function bindCellEvents(row, title) { const btn = row.querySelector('.cell-remove'); const cellId = row.querySelector('input')?.dataset.id; btn.addEventListener('click', async () => { try { // ๊ธฐ๋ณธ์ƒ์„ฑ๋œ ์…€ ์ด๋ฒคํŠธ์—์„œ title์ด ๋“ค์–ด์˜ค์ง€ ์•Š๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์–ด์„œ ๊ฐ’์„ ์ง์ ‘ ๋„ฃ์–ด์คŒ title = document.querySelector('.section-tabs .tab.click-on input').value; const cells = document.querySelectorAll('.section-content--cell'); if (cellId) { // DB ์‚ญ์ œ ์„ฑ๊ณต ์‹œ sectionTabData ์—…๋ฐ์ดํŠธ const index = overviewVars.sectionTabData[title].findIndex(item => item.id == cellId); if (index !== -1) overviewVars.sectionTabData[title].splice(index, 1); } else { // ํƒญ ์ž…๋ ฅ์ด ๋˜์ง€์•Š๊ณ  sectionTabData์— data๊ฐ€ ์—†์„๋•Œ row ์‚ญ์ œ์ฒ˜๋ฆฌ if(!overviewVars.sectionTabData[title]){ if(cells.length > 2){ return row.remove(); } else { return; } } const index = overviewVars.sectionTabData[title].findIndex(item => item.key === row.querySelector('.short-input')?.value && item.value === row.querySelector('.middle-input')?.value); if(index !== -1) overviewVars.sectionTabData[title].splice(index, 1); } // ์…€์ด ํ•˜๋‚˜๋ฟ์ด๋ฉด value ์ดˆ๊ธฐํ™”, ์•„๋‹ˆ๋ฉด ์‚ญ์ œ if (cells.length === 2) { row.querySelectorAll('input').forEach(input => input.value = ''); } else { row.remove(); } } catch (err) { console.error(err); } }); } // Section-left ์‹œ์„ค๊ทœ๋ชจ ๋ชจ๋‹ฌ OPEN document.querySelector('.overview .box-header--right.facility-size button')?.addEventListener('click', async () => { const modalWrapper = document.querySelector('.overview-modal-wrapper'); const modal = document.querySelector('.overview-modal.facility-size'); //ํ† ๊ธ€ if (modal.style.display === 'block') { modal.style.display = 'none'; modalWrapper.style.display = 'none'; return; } try { const res = await axios.get(`/${vars.project_id}/overview/getFacilitySizeData`, { params: { projectId: vars.project_id } }); if (res.data.message === '200') { const modalBody = modal.querySelector('.overview-modal-body'); modalBody.innerHTML = ''; const dataArr = res.data.data; if (dataArr.length === 0) { modalBody.innerHTML = `` } let currentTitle = ''; for (let i = 0; i < dataArr.length; i++) { if (dataArr[i].title !== currentTitle) { currentTitle = dataArr[i].title; const boxHeader = document.createElement('div'); boxHeader.className = 'box-header'; const h3 = document.createElement('h3'); h3.textContent = currentTitle; boxHeader.appendChild(h3); modalBody.appendChild(boxHeader); } const typeWrap = document.createElement('div'); typeWrap.className = 'type--wrap'; const left = document.createElement('div'); left.className = 'type--wrap-left'; const p = document.createElement('p'); p.textContent = dataArr[i].key; left.appendChild(p); const right = document.createElement('div'); right.className = 'type--wrap-right'; const h4 = document.createElement('h4'); h4.textContent = dataArr[i].value; right.appendChild(h4); typeWrap.appendChild(left); typeWrap.appendChild(right); modalBody.appendChild(typeWrap); } } modal.style.display = 'block'; modalWrapper.style.display = 'block'; } catch (err) { console.log(err); } }); // section-left ์œ„์น˜๋„/๊ฐœ์š”๋„ ์ด๋ฏธ์ง€ ์ €์žฅ document.querySelector('.overview-modal.section-left .overview-img-file-input')?.addEventListener('change', () => { const files = Array.from(document.querySelector('.overview-modal.section-left .overview-img-file-input').files); // ์ค‘๋ณต ์ด๋ฆ„๊ณผ ํ™•์žฅ์ž ์ฒดํฌ checkDuplicatesFileNameAndExt(files); // ๋“ฑ๋ก๋œ ํŒŒ์ผ์˜ ์ด๋ฆ„์„ ์ถ”๊ฐ€ displayFileName(); // ์ดˆ๊ธฐํ™” document.querySelector('.overview-modal.section-left .overview-img-file-input').value = ''; }); // ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ Secion-Left ๋ชจ๋‹ฌ ๋ ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ //๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ Secion-Middle ๋ชจ๋‹ฌ ์‹œ์ž‘ ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ // section-middle ๋ชจ๋‹ฌ ์—ด๊ธฐ document.querySelector('.overview .box-header--right.section-middle-edit')?.addEventListener('click', () => { const modal = document.querySelector('.overview-modal.section-middle'); const modalWrapper = document.querySelector('.overview-modal-wrapper'); modal.querySelector('.abbreviated-name').value = document.querySelector('.overview .abbreviated-name').innerText; modal.querySelector('.task-nm-en').value = document.querySelector('.overview .task-nm-en').innerText; modal.querySelector('.task-purpose').value = document.querySelector('.overview .task-purpose').innerText; modal.querySelector('.order-size-usd').value = document.querySelector('.overview .order-size-usd').innerText; modal.querySelector('.order-size-krw').value = document.querySelector('.overview .order-size-krw').innerText; modal.querySelector('.client-origin').value = document.querySelector('.overview .client-origin').innerText; modal.querySelector('.financial').value = document.querySelector('.financial').innerText; modal.querySelector('.financial-country').value = document.querySelector('.overview .financial-country').innerText; modal.querySelector('.selection-method').value = document.querySelector('.overview .selection-method').innerText; modal.querySelector('.overview-table-container').innerHTML = document.querySelector('.overview .overview-table-container ').innerHTML; modal.querySelector('.support-department').value = document.querySelector('.overview .support-department').innerText; modal.querySelector('.support-manager-nm').value = document.querySelector('.overview .support-manager-nm').innerText; modal.querySelector('.completion-date').value = document.querySelector('.overview .completion-date').innerText; // overseas์šฉ ๋ถ„๊ธฐ if(!overviewVars.overseas){ modal.querySelector('.project-no').value = document.querySelector('.overview .project-no').innerText; modal.querySelector('.task-type').value = document.querySelector('.overview .task-type').innerText; modal.querySelector('.bid').value = document.querySelector('.overview .bid').innerText; modal.querySelector('.client').value = document.querySelector('.overview .client').innerText; modal.querySelector('.department').value = document.querySelector('.overview .department').innerText; modal.querySelector('.currency-code').value = document.querySelector('.overview .currency-code').innerText; modal.querySelector('.task-nm-kr').value = document.querySelector('.overview .task-nm-kr').innerText; modal.querySelector('.contract-period').value = document.querySelector('.overview .contract-period').innerText; modal.querySelector('.projectmanager-nm').value = document.querySelector('.overview .projectmanager-nm').innerText; modal.querySelector('.manager-nm').value = document.querySelector('.overview .manager-nm').innerText; modal.querySelector('.contract-date').value = document.querySelector('.overview .contract-date').innerText; modal.querySelector('.commencement-date').value = document.querySelector('.overview .commencement-date').innerText; modal.querySelector('.scheduled-completion-date').value = document.querySelector('.overview .scheduled-completion-date').innerText; modal.querySelector('.scheuled-commencement-date').value = document.querySelector('.overview .scheuled-commencement-date').innerText; modal.querySelectorAll('.joint-contract-company-name').forEach(company => { company.contentEditable = true; company.style.color = '#FF3D00'; }) // ๊ณต๋™๋„๊ธ‰ ์ˆ˜์ •, ์ƒ‰์ƒ๋ณ€ํ™”, ์ˆซ์ž ์ œํ•œ modal.querySelectorAll('.joint-contract-company-shares, .joint-contract-krw, .joint-contract-usd').forEach(joint => { joint.contentEditable = true; joint.style.color = '#FF3D00'; joint.addEventListener('input', (event) => { restrictToNumber(joint, event); calculateTotalJointContract(joint); }); }); } else { modal.querySelector('.project-no').innerText = document.querySelector('.overview .project-no').innerText; modal.querySelector('.task-type').innerText = document.querySelector('.overview .task-type').innerText; modal.querySelector('.bid').innerText = document.querySelector('.overview .bid').innerText; modal.querySelector('.client').innerText = document.querySelector('.overview .client').innerText; modal.querySelector('.department').innerText = document.querySelector('.overview .department').innerText; modal.querySelector('.currency-code').innerText = document.querySelector('.overview .currency-code').innerText; modal.querySelector('.task-nm-kr').innerText = document.querySelector('.overview .task-nm-kr').innerText; modal.querySelector('.contract-period').innerText = document.querySelector('.overview .contract-period').innerText; modal.querySelector('.projectmanager-nm').innerText = document.querySelector('.overview .projectmanager-nm').innerText; modal.querySelector('.manager-nm').innerText = document.querySelector('.overview .manager-nm').innerText; modal.querySelector('.contract-date').innerText = document.querySelector('.overview .contract-date').innerText; modal.querySelector('.commencement-date').innerText = document.querySelector('.overview .commencement-date').innerText; modal.querySelector('.scheduled-completion-date').innerText = document.querySelector('.overview .scheduled-completion-date').innerText; modal.querySelector('.scheuled-commencement-date').innerText = document.querySelector('.overview .scheuled-commencement-date').innerText; } const jointTable = modal.querySelector('.overview-table-container') // ํƒญ ์ปจํ…Œ์ด๋„ˆ ๊ฐ€๋กœ์Šคํฌ๋กค ํœ  ์ด๋ฒคํŠธ ์ถ”๊ฐ€ jointTable.addEventListener('wheel', (e)=> { e.preventDefault(); jointTable.scrollLeft += e.deltaY; }); // ํ† ๊ธ€ ์ฒ˜๋ฆฌ if (modal.style.display === 'block') { modal.style.display = 'none'; return; } modal.style.display = 'block'; modalWrapper.style.display = 'block'; }); // section-middle ๊ณผ์—…๊ธฐ๊ฐ„ ๋ชจ๋‹ฌ ์—ด๊ธฐ document.querySelector('.overview .box-header--right.task-period')?.addEventListener('click', async () => { const modal = document.querySelector('.overview-modal.task-period'); const modalWrapper = document.querySelector('.overview-modal-wrapper'); modal.querySelector('.contract-date').innerText = document.querySelector('.overview .contract-date').innerText; modal.querySelector('.commencement-date').innerText = document.querySelector('.overview .commencement-date').innerText; modal.querySelector('.scheduled-completion-date').innerText = document.querySelector('.overview .scheduled-completion-date').innerText; modal.querySelector('.completion-date').innerText = document.querySelector('.overview .completion-date').innerText; // ๊ณผ์—… ์ค‘์ง€ ์ด๋ ฅ ์ƒ์„ฑ makeTaskHistory(); // ํ† ๊ธ€ ์ฒ˜๋ฆฌ if (modal.style.display === 'block') { modal.style.display = 'none'; return; } modal.style.display = 'block'; modalWrapper.style.display = 'block'; }); // section-middle ๊ณผ์—…์ค‘์ง€ ์ด๋ ฅ ๋ฆฌ์ŠคํŠธ ์ถ”๊ฐ€ document.querySelector('.overview-modal.task-period .box-header--right button')?.addEventListener('click', () => { const ul = document.querySelector('.overview-modal.task-period .overview-modal-body ul'); const li = document.createElement('li'); // ์ฐจ์ˆ˜ const numberDiv = document.createElement('div'); numberDiv.className = 'work-list-number'; const orderInput = document.createElement('input'); orderInput.type = 'text'; orderInput.className = 'order work-list-number'; numberDiv.appendChild(orderInput); // ์ค‘์ง€์ผ์ž const dateDiv = document.createElement('div'); dateDiv.className = 'work-list-date'; const dateInput = document.createElement('input'); dateInput.className = 'suspension-date work-list-date'; dateInput.type = 'date'; dateDiv.appendChild(dateInput); // ์ค‘์ง€์‚ฌ์œ  const reasonDiv = document.createElement('div'); reasonDiv.className = 'work-list-script'; const reasonInput = document.createElement('input'); reasonInput.className = 'suspension-reason work-list-script'; reasonInput.type = 'text'; reasonDiv.appendChild(reasonInput); // ์žฌ๊ฐœ์ผ์ž const redateDiv = document.createElement('div'); redateDiv.className = 'work-list-redate'; const redateInput = document.createElement('input'); redateInput.className = 'resumption-date work-list-redate'; redateInput.type = 'date'; redateDiv.appendChild(redateInput); // ํ˜‘์˜๋‚ด์šฉ const detailDiv = document.createElement('div'); detailDiv.className = 'work-list-detail'; const consultInput = document.createElement('input'); consultInput.className = 'consuletation-content work-list-detail'; consultInput.type = 'text'; detailDiv.appendChild(consultInput); // ๋ณ€๊ฒฝ ์ผ์ž const changeDiv = document.createElement('div'); changeDiv.className = 'work-list-changedate'; const changeInput = document.createElement('input'); changeInput.className = 'change-date work-list-changedate'; changeInput.type = 'date'; changeDiv.appendChild(changeInput); const btn = document.createElement('button'); btn.className = 'xs-btn-type'; const img = document.createElement('img'); img.className = 'icon'; img.src = '/main/img/overview/icon-close-111.svg'; img.alt = 'icon-close-111'; btn.appendChild(img); // ๊ณผ์—… ์ค‘์ง€์ด๋ ฅ ๋ฆฌ์ŠคํŠธ ๊ฐœ๋ณ„ ์‚ญ์ œ๋ฒ„ํŠผ btn.addEventListener('click', async (e) => { li.remove(); }); li.append(numberDiv, dateDiv, reasonDiv, redateDiv, detailDiv, changeDiv, btn); ul.appendChild(li); }); if(!overviewVars.overseas){ // section-middle ๊ณต๋™๋„๊ธ‰ ์—ด ์ถ”๊ฐ€ document.querySelector('.overview-modal.section-middle .joint-contract-add')?.addEventListener('click', () => { const table = document.querySelector('.overview-modal.section-middle .overview-table-container table'); const headerRow = table.querySelector('thead tr'); const currentCols = headerRow.querySelectorAll('th').length; // ์ด๊ณ„์™€ ์ฃผ๊ด€์‚ฌ const newIndex = currentCols - 1; document.querySelector('.overview-modal .total-joint-contract-company-name').innerText = newIndex; const newTh = document.createElement('th'); if (newIndex < 2) { newTh.innerText = '์ฃผ๊ด€์‚ฌ'; } else { newTh.innerText = `๊ณต๋™๋„๊ธ‰${newIndex - 1}`; } headerRow.appendChild(newTh); const tbodyRows = table.querySelectorAll('tbody tr'); const defaultValues = ['ํšŒ์‚ฌ๋ช…', '0', '0', '0']; const classList = ['joint-contract-company-name', 'joint-contract-company-shares', 'joint-contract-krw', 'joint-contract-usd']; tbodyRows.forEach((row, idx) => { const td = document.createElement('td'); td.className = classList[idx]; td.innerText = defaultValues[idx]; td.contentEditable = true; td.style.color = '#FF3D00'; // ๊ณต๋™๋„๊ธ‰ ์ˆซ์ž ์ œํ•œ if (idx > 0) { td.addEventListener('input', (event) => { restrictToNumber(td, event); calculateTotalJointContract(td); }); } row.appendChild(td); }); }); // section-middle ๊ณต๋™๋„๊ธ‰ ์—ด ์‚ญ์ œ document.querySelector('.overview-modal.section-middle .joint-contract-delete')?.addEventListener('click', () => { const table = document.querySelector('.overview-modal.section-middle .overview-table-container table'); const theadRow = table.querySelector('thead tr'); const ths = theadRow.querySelectorAll('th'); // ์ฃผ๊ด€์‚ฌ๊นŒ์ง€ ์‚ญ์ œํ–ˆ์„๋•Œ ๊ณ„์‚ฐํ•  ๊ฐ’์ด ์—†์œผ๋ฏ€๋กœ ์ดˆ๊ธฐํ™” if (ths.length === 3){ document.querySelector('.overview-modal .total-joint-contract-company-name').innerText = 0; document.querySelectorAll('.overview-modal .total-joint-contract-company-shares, .overview-modal .total-joint-contract-krw, .overview-modal .total-joint-contract-usd').forEach(el => el.innerText = 0); } if (ths.length <= 2) { alert("์‚ญ์ œํ•  ์ˆ˜ ์žˆ๋Š” ์—ด์ด ์—†์Šต๋‹ˆ๋‹ค."); return; } // ๋งˆ์ง€๋ง‰ th ์‚ญ์ œ theadRow.removeChild(ths[ths.length - 1]); // tbody์˜ ๋งˆ์ง€๋ง‰ td ์‚ญ์ œ const tbodyRows = table.querySelectorAll('tbody tr'); tbodyRows.forEach(row => { const tds = row.querySelectorAll('td'); if (tds.length > 2) { row.removeChild(tds[tds.length - 1]); } }); // ์‚ญ์ œ์‹œ์— ์ด๊ณ„ ๊ณ„์‚ฐ document.querySelectorAll('.overview-modal.section-middle .overview-table-container td').forEach(td => { calculateTotalJointContract(td); }); // ์ด ํšŒ์‚ฌ ์ˆ˜ ์—…๋ฐ์ดํŠธ document.querySelector('.overview-modal .total-joint-contract-company-name').innerText = ths.length - 3; }); } // ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ Secion-Middle ๋ชจ๋‹ฌ ๋ ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ //๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ Secion-Right ๋ชจ๋‹ฌ ์‹œ์ž‘ ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ๐Ÿ”ฝ // section-right ์บ˜๋ฆฐ๋” ์ฃผ์š”์ผ์ • ํ•˜๋ฃจ์ข…์ผ ๋ฒ„ํŠผ document.querySelector('.overview-modal.schedule .custom-checkbox.all-day')?.addEventListener('change', () => { const allDay = document.querySelector('.overview-modal.schedule .custom-checkbox.all-day input'); const startTime = document.querySelector('.overview-modal.schedule .startTime'); const endTime = document.querySelector('.overview-modal.schedule .endTime'); const isChecked = allDay.checked; startTime.disabled = isChecked; endTime.disabled = isChecked; if (isChecked) { startTime.value = ''; endTime.value = ''; } else { startTime.value = '00:00'; endTime.value = '23:59'; } }); // section-right ์ฃผ์š”์ผ์ • Color ํด๋ฆญ ํšจ๊ณผ document.querySelectorAll('.overview-modal .color .label-color')?.forEach(btn => { btn.addEventListener('click', (e) => { document.querySelectorAll('.overview-modal .color .label-color').forEach(label => { label.classList.remove('on'); }); e.target.classList.add('on'); }); }); // ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ Secion-Right ๋ชจ๋‹ฌ ๋ ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ๐Ÿ”ผ