From d0b33edea83a7f8704cfab85d0cb5daa4f127bb5 Mon Sep 17 00:00:00 2001 From: Taehoon Date: Tue, 17 Mar 2026 14:27:25 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20SQL=20=EC=BF=BC=EB=A6=AC=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20=EB=AA=A8=EB=93=88=ED=99=94=20=EB=B0=8F=20?= =?UTF-8?q?=EB=A9=94=EC=9D=BC=20=EA=B4=80=EB=A6=AC=20UI/UX=20=EA=B3=A0?= =?UTF-8?q?=EB=8F=84=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __pycache__/crawler_service.cpython-312.pyc | Bin 18848 -> 18254 bytes __pycache__/server.cpython-312.pyc | Bin 12696 -> 17417 bytes __pycache__/sql_queries.cpython-312.pyc | Bin 0 -> 2828 bytes backups/crawler_service_v1_dom.py.bak | 141 ----- crawler_service.py | 15 +- js/dashboard.js | 2 +- js/inquiries.js | 186 ++++--- js/mail.js | 389 +++++++------ migrate_db_history.py | 43 -- migrate_normalized.py | 67 --- server.log | Bin 1406 -> 0 bytes server.py | 45 +- sql_queries.py | 67 +++ style/common.css | 17 +- style/dashboard.css | 159 ++---- style/inquiries.css | 285 ++++------ style/mail.css | 586 ++++++-------------- templates/dashboard.html | 38 +- templates/inquiries.html | 46 +- templates/mailTest.html | 3 +- templates/modals/address_book.html | 54 +- templates/modals/path_selector.html | 32 +- 22 files changed, 851 insertions(+), 1324 deletions(-) create mode 100644 __pycache__/sql_queries.cpython-312.pyc delete mode 100644 backups/crawler_service_v1_dom.py.bak delete mode 100644 migrate_db_history.py delete mode 100644 migrate_normalized.py delete mode 100644 server.log create mode 100644 sql_queries.py diff --git a/__pycache__/crawler_service.cpython-312.pyc b/__pycache__/crawler_service.cpython-312.pyc index 676426cc6f4456ee0394682192a49427b0a775d0..df7e01a4fe978f2624297e86ebff6f0f3d906724 100644 GIT binary patch delta 5323 zcmai2dvH_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FqP3p(t&K8kOkmwtu3n=oL5pECC z0Yd9iqy4ENDKa3^V{Vr18W~GHG0Vr2{R6`>xPE?{NNM7uu|!Z!EuH1E^0R6pZ=n=8HH`x1*?EVSCYv4F)Swy3`TYh4DONMBO@0Gd_usE`yL2C z$ad|8JA-tXa0CK%1jr{Vx@(CnAe9g(B|yA#mv0#v6~~7oE2JyXC0~1!JMiZZgs^RO SRsLEvGXHuTXGDc`#{UEQEQe75 diff --git a/__pycache__/server.cpython-312.pyc b/__pycache__/server.cpython-312.pyc index f6b46ae1a7ffd5cca37738e32275576078299a5d..5f2404093dc6232071acff4d3abb4b3225f1731d 100644 GIT binary patch literal 17417 zcmc(H3sfA}m0*4Q&mZv-0vZrVEeQ|^S?C{rl92dG;EynwcB`v}8g)0Qs*wb499!1L z@+UExNg^CeaVzVIrP$eEk7tbMWKSd{pWvCZXS&s7z-4=*Ih)N_Uyf{ zy1JVd5}xcPTbzFH)_wQAdhgY{pLgFa{yrhWK*5#qH)GC!Swm6(1#i@gl)%m1_jrmr zM+uZbyQoejr#oqK&vY^*XFFMvbDbRIjEi^koji@StV`q8c4`UCxpZ!Qr`~PoG?07V zWptZ5O$64s65NTMiSDG%Byz8HCA(8PQwXecrMlBP(+I40rMs7PE+eqPmEq3p%yegU zW|4cNE8D%ibGbXGGY9TX4yvbG9ZWPA61Kq&LqX}5C{~4pL?P*IM!D#)7;x(g3eVBs8bSGXH`s{)eoq%Ipww+m|=4uJKwHp$W4D>z&hM%M1KN#2^aMp=8najf4Vd4V9YuJu5Bvr`aU zjuSS~0aPjNUeRH5J3ZY898zDeM{>xfT~3!ny@N`|cCXFrv?Er6+oZitPmis#!{P38 z!J`qCZu8h&1A`9hVW6?vdp%x<#|w?8iTxg{U9_EWIYg`E5RW_U4mp`1tdh64&+0g? z5GFQyj`cgmf&Kjs(dm%nFhe;&us_E;iw|Q+{O}%!TtE)}y?G|lrsjI^w z0gcV>Ep4qk&;`SgU>}94JRr z@SV(~l!J9}0*&g9Kny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|S`*;}s(=Kx;^I5fg*hPsg*og!Bjfgbd4L zUMg#UdL+JMTz*`D`4fLe;6Dr6KLpy9Qfn)DZ}z$hvpsq^ z8>#p35xYN8zEmri^;c?!Sum{Hv#_Eb?w`zs|OX2TA$u%F0VDeo=5lA z<{LM^LCqh3XneIYcPuSRVoXKPpfgHx5)~YeumfE@Cn_R3F@9ohAgRPf1x;j7xq{+i zIyN`F_ojl5#?i1f_wGJKKU1l=po(qYnIcvZ`9OX3<4nE9*tW>{#ho z*Q$miLd=VsERE|(Yi~m_nEt=T9~o(jKhpSay|s9)xx5ZiHxU+kWMr?Gbc`_%*tCvt~#k%Rl}SS60wSI zsD@RYu`U%MAqPBTvvsozwmJg=qeXzY!2K3Fd3W&n`3t`eJv~3U8RmvwnwK`ip`i%; z^uy0($?W&G?F?uH>b(I?$Y2k|H7oymMKg5|&f~DL@$r1~qov08YmLvAqRfIvjnylt zb#3guwNW2%lv4RI)5w7hE>_+IfR4RU0Ep!(HFsC8Qmz)t)P*C3!?7ef&+bM*C8n0d zGb%ctOvvbg`s7hkhNQgY9meI`mx3IJWc&&_L}i{?c{^MP>6l|Nx4{e_C{sZv#qi>8 zFWT^UMGs}F$BwfSoCPSDEJuuh@&Wb7)riFwgOh_Uok7L>uN!#-gDtJgD~(%UHojPi zQY8@ilU4FmEv%x(mBoAOtF6VWog~&W?es~=X;D#8LROPLI4OXm9y$nCyg5Ni8@VW% z+UP;a!84#t3(}OBM$utw6q?xfuWtuLh)<=YM2vK{3t|S*Cc_*NqWWn75nRtK&2owN zbMw_+w)|*^CwfTc#a)93b{5|S6FF*l5`g?{W5Ma+&Yhk;;8jDFR763B(l@dq3^aaWN$*>Llc9_fv~=z}}>i+0M|z zKn#-%$Kh)cW|6LYYBLl*7=e~M$UXWRQ1l=)-9wSfvdc_jF7sV($95?0c 0: - raw_date = (await page.locator(date_sel).first.inner_text()).strip() - user_name = (await page.locator(user_sel).first.inner_text()).strip() - activity = (await page.locator(act_sel).first.inner_text()).strip() - formatted_date = re.sub(r'[-/]', '.', raw_date)[:10] - recent_log = f"{formatted_date}, {user_name}, {activity}" - yield f"data: {json.dumps({'type': 'log', 'message': f' - [로그] 수집 완료'})}\n\n" - - await page.click("article.archive-modal div.close", timeout=3000) - await asyncio.sleep(1.5) - except: pass - - # 구성 수집 - try: - sitemap_btn_sel = "body > div.footer > div.left > div.wrap.site-map-wrap" - sitemap_btn = page.locator(sitemap_btn_sel).first - if await sitemap_btn.is_visible(timeout=5000): - await sitemap_btn.click(force=True) - - popup_page = None - for _ in range(20): - for p_item in context.pages: - if "composition" in p_item.url: - popup_page = p_item - break - if popup_page: break - await asyncio.sleep(0.5) - - if popup_page: - target_selector = "#composition-list h6:nth-child(3)" - await asyncio.sleep(5) # 로딩 대기 - locators_h6 = popup_page.locator(target_selector) - h6_count = await locators_h6.count() - current_total = 0 - for j in range(h6_count): - text = (await locators_h6.nth(j).inner_text()).strip() - nums = re.findall(r'\d+', text.split('\n')[-1]) - if nums: current_total += int(nums[0]) - file_count = current_total - yield f"data: {json.dumps({'type': 'log', 'message': f' - [구성] {file_count}개 확인'})}\n\n" - await popup_page.close() - except: pass - - results.append({"projectName": project_name, "recentLog": recent_log, "fileCount": file_count}) - - # 홈 복귀 - await page.locator("div.header div.title div").first.click(force=True) - await page.wait_for_selector("h4.list__contents_aria_group_body_list_item_label", timeout=20000) - await asyncio.sleep(2) - - except Exception: - await page.goto("https://overseas.projectmastercloud.com/dashboard", wait_until="domcontentloaded") - - yield f"data: {json.dumps({'type': 'done', 'data': results})}\n\n" - - except GeneratorExit: - # SSE 연결이 클라이언트 측에서 먼저 끊겼을 때 실행 - if browser: await browser.close() - except Exception as e: - yield f"data: {json.dumps({'type': 'log', 'message': f'치명적 오류: {str(e)}'})}\n\n" - finally: - if browser: await browser.close() diff --git a/crawler_service.py b/crawler_service.py index 0316cad..0d9ca37 100644 --- a/crawler_service.py +++ b/crawler_service.py @@ -10,6 +10,7 @@ import pymysql from datetime import datetime from playwright.async_api import async_playwright from dotenv import load_dotenv +from sql_queries import CrawlerQueries load_dotenv(override=True) @@ -108,14 +109,7 @@ def crawler_thread_worker(msg_queue, user_id, password): try: with conn.cursor() as cursor: for p_info in captured_data["project_list"]: - sql = """ - INSERT INTO projects_master (project_id, project_nm, short_nm, master, continent, country) - VALUES (%s, %s, %s, %s, %s, %s) - ON DUPLICATE KEY UPDATE - project_nm = VALUES(project_nm), short_nm = VALUES(short_nm), - master = VALUES(master), continent = VALUES(continent), country = VALUES(country) - """ - cursor.execute(sql, (p_info.get("project_id"), p_info.get("project_nm"), + cursor.execute(CrawlerQueries.UPSERT_MASTER, (p_info.get("project_id"), p_info.get("project_nm"), p_info.get("short_nm", "").strip(), p_info.get("master"), p_info.get("large_class"), p_info.get("mid_class"))) conn.commit() @@ -168,7 +162,7 @@ def crawler_thread_worker(msg_queue, user_id, password): if dept and p_id: with get_db_connection() as conn: with conn.cursor() as cursor: - cursor.execute("UPDATE projects_master SET department = %s WHERE project_id = %s", (dept, p_id)) + cursor.execute(CrawlerQueries.UPDATE_DEPARTMENT, (dept, p_id)) conn.commit() captured_data["last_project_data"] = None # 초기화 @@ -228,8 +222,7 @@ def crawler_thread_worker(msg_queue, user_id, password): if current_p_id: with get_db_connection() as conn: with conn.cursor() as cursor: - sql = "INSERT INTO projects_history (project_id, crawl_date, recent_log, file_count) VALUES (%s, CURRENT_DATE(), %s, %s) ON DUPLICATE KEY UPDATE recent_log=VALUES(recent_log), file_count=VALUES(file_count)" - cursor.execute(sql, (current_p_id, recent_log, file_count)) + cursor.execute(CrawlerQueries.UPSERT_HISTORY, (current_p_id, recent_log, file_count)) conn.commit() msg_queue.put(json.dumps({'type': 'log', 'message': f' - [성공] 로그: {recent_log[:20]}... / 파일: {file_count}개'})) diff --git a/js/dashboard.js b/js/dashboard.js index b5ff1b8..ce399a1 100644 --- a/js/dashboard.js +++ b/js/dashboard.js @@ -197,7 +197,7 @@ function scrollToProject(name) { p = p.parentElement; } target.parentElement.classList.add('active'); - const pos = target.getBoundingClientRect().top + window.pageYOffset - 220; + const pos = target.getBoundingClientRect().top + window.pageYOffset - 260; window.scrollTo({ top: pos, behavior: 'smooth' }); target.style.backgroundColor = 'var(--primary-lv-1)'; setTimeout(() => target.style.backgroundColor = '', 2000); diff --git a/js/inquiries.js b/js/inquiries.js index 228ea56..f1e299e 100644 --- a/js/inquiries.js +++ b/js/inquiries.js @@ -1,15 +1,6 @@ async function loadInquiries() { - // Adjust sticky thead position based on header height - const header = document.getElementById('stickyHeader'); - const thead = document.querySelector('.inquiry-table thead'); - if (header && thead) { - const headerHeight = header.offsetHeight; - const totalOffset = 36 + headerHeight; // topbar(36) + sticky header height - document.querySelectorAll('.inquiry-table thead th').forEach(th => { - th.style.top = totalOffset + 'px'; - }); - } + initStickyHeader(); const pmType = document.getElementById('filterPmType').value; const category = document.getElementById('filterCategory').value; @@ -19,16 +10,42 @@ async function loadInquiries() { const params = new URLSearchParams({ pm_type: pmType, category: category, - status: status, keyword: keyword }); - const response = await fetch(`/api/inquiries?${params}`); - const data = await response.json(); + try { + const response = await fetch(`/api/inquiries?${params}`); + const data = await response.json(); + + updateStats(data); + + const filteredData = status ? data.filter(item => item.status === status) : data; + renderInquiryList(filteredData); + } catch (e) { + console.error("데이터 로딩 중 오류 발생:", e); + } +} + +function initStickyHeader() { + const header = document.getElementById('stickyHeader'); + const thead = document.querySelector('.inquiry-table thead'); + if (header && thead) { + const headerHeight = header.offsetHeight; + const totalOffset = 36 + headerHeight; + document.querySelectorAll('.inquiry-table thead th').forEach(th => { + th.style.top = totalOffset + 'px'; + }); + } +} + +function renderInquiryList(data) { const tbody = document.getElementById('inquiryList'); tbody.innerHTML = data.map(item => ` ${item.no} + + ${item.image_url ? `thumbnail` : '없음'} + ${item.pm_type} ${item.browser || 'Chrome'} ${item.category} @@ -40,7 +57,7 @@ async function loadInquiries() { ${item.status} - +

@@ -50,10 +67,27 @@ async function loadInquiries() {
시스템: ${item.pm_type}
환경: ${item.browser || 'Chrome'} / ${item.device || 'PC'}
+

[질문 내용]

${item.content}
+ + ${item.image_url ? ` +
+
+

+ 🖼️ [첨부 이미지] + (클릭 시 크게 보기) +

+ +
+ +
+ ` : ''} +

[조치 및 답변]

@@ -94,18 +128,15 @@ async function loadInquiries() { function enableEdit(id) { const form = document.getElementById(`reply-form-${id}`); - form.classList.remove('readonly'); - form.classList.add('editable'); + form.classList.replace('readonly', 'editable'); - document.getElementById(`reply-text-${id}`).disabled = false; - document.getElementById(`reply-status-${id}`).disabled = false; - document.getElementById(`reply-handler-${id}`).disabled = false; + const elements = [`reply-text-${id}`, `reply-status-${id}`, `reply-handler-${id}`]; + elements.forEach(elId => document.getElementById(elId).disabled = false); document.getElementById(`reply-text-${id}`).focus(); } async function cancelEdit(id) { try { - // 서버에서 해당 항목의 원래 데이터를 다시 가져옴 const response = await fetch(`/api/inquiries/${id}`); const item = await response.json(); @@ -114,21 +145,14 @@ async function cancelEdit(id) { const status = document.getElementById(`reply-status-${id}`); const handler = document.getElementById(`reply-handler-${id}`); - // 데이터 원복 txt.value = item.reply || ''; status.value = item.status; handler.value = item.handler || ''; - // UI 상태 원복 (비활성화 및 클래스 변경) - txt.disabled = true; - status.disabled = true; - handler.disabled = true; - - form.classList.remove('editable'); - form.classList.add('readonly'); + [txt, status, handler].forEach(el => el.disabled = true); + form.classList.replace('editable', 'readonly'); } catch (e) { - console.error("취소 중 오류 발생:", e); - loadInquiries(); // 오류 시에는 전체 새로고침으로 대응 + loadInquiries(); } } @@ -137,8 +161,7 @@ async function saveReply(id) { const status = document.getElementById(`reply-status-${id}`).value; const handler = document.getElementById(`reply-handler-${id}`).value; - if (!reply.trim()) return alert("답변 내용을 입력해 주세요."); - if (!handler.trim()) return alert("처리자 이름을 입력해 주세요."); + if (!reply.trim() || !handler.trim()) return alert("내용과 처리자를 모두 입력해 주세요."); try { const response = await fetch(`/api/inquiries/${id}/reply`, { @@ -148,30 +171,26 @@ async function saveReply(id) { }); const result = await response.json(); if (result.success) { - alert("답변이 저장되었습니다."); + alert("저장되었습니다."); loadInquiries(); - } else { - alert("저장에 실패했습니다: " + result.error); } } catch (e) { - alert("오류가 발생했습니다."); + alert("저장 중 오류가 발생했습니다."); } } async function deleteReply(id) { - if (!confirm("답변을 삭제하시겠습니까? (처리 상태가 '미확인'으로 초기화됩니다.)")) return; + if (!confirm("답변을 삭제하시겠습니까?")) return; try { const response = await fetch(`/api/inquiries/${id}/reply`, { method: 'DELETE' }); const result = await response.json(); if (result.success) { - alert("답변이 삭제되었습니다."); + alert("삭제되었습니다."); loadInquiries(); - } else { - alert("삭제에 실패했습니다: " + result.error); } } catch (e) { - alert("오류가 발생했습니다."); + alert("삭제 중 오류가 발생했습니다."); } } @@ -181,7 +200,6 @@ function toggleAccordion(id) { const inquiryRow = detailRow.previousElementSibling; const isActive = detailRow.classList.contains('active'); - // Close all other active details and remove their row highlights document.querySelectorAll('.detail-row.active').forEach(row => { if (row.id !== `detail-${id}`) { row.classList.remove('active'); @@ -189,42 +207,72 @@ function toggleAccordion(id) { } }); - // Toggle current if (isActive) { detailRow.classList.remove('active'); inquiryRow.classList.remove('active-row'); } else { detailRow.classList.add('active'); inquiryRow.classList.add('active-row'); - - // [추가] 펼쳐진 항목이 보기 편하도록 스크롤 위치 조정 - setTimeout(() => { - const stickyHeader = document.getElementById('stickyHeader'); - const thead = document.querySelector('.inquiry-table thead'); - const topbarHeight = 36; - const stickyHeaderHeight = stickyHeader ? stickyHeader.offsetHeight : 0; - const theadHeight = thead ? thead.offsetHeight : 0; - - // 모든 고정 영역의 합 (Topbar + 필터영역 + 표 헤더) - const totalOffset = topbarHeight + stickyHeaderHeight + theadHeight; - - const rowPosition = inquiryRow.getBoundingClientRect().top + window.pageYOffset; - const offsetPosition = rowPosition - totalOffset; - - window.scrollTo({ - top: offsetPosition, - behavior: 'smooth' - }); - }, 100); + scrollToRow(inquiryRow); } } -function getStatusClass(status) { - if (status === '완료') return 'status-complete'; - if (status === '작업 중') return 'status-working'; - if (status === '확인 중') return 'status-checking'; - return 'status-pending'; +function scrollToRow(row) { + setTimeout(() => { + const headerHeight = document.getElementById('stickyHeader').offsetHeight; + const totalOffset = 36 + headerHeight + 40; + const offsetPosition = (row.getBoundingClientRect().top + window.pageYOffset) - totalOffset; + window.scrollTo({ top: offsetPosition, behavior: 'smooth' }); + }, 100); } +function getStatusClass(status) { + const map = { '완료': 'status-complete', '작업 중': 'status-working', '확인 중': 'status-checking' }; + return map[status] || 'status-pending'; +} + +function updateStats(data) { + const counts = { + Total: data.length, + Complete: data.filter(i => i.status === '완료').length, + Working: data.filter(i => i.status === '작업 중').length, + Checking: data.filter(i => i.status === '확인 중').length, + Pending: data.filter(i => i.status === '개발예정').length, + Unconfirmed: data.filter(i => i.status === '미확인').length + }; + Object.keys(counts).forEach(k => { + const el = document.getElementById(`count${k}`); + if (el) el.textContent = counts[k].toLocaleString(); + }); +} + +function openImageModal(src) { + const modal = document.getElementById('imageModal'); + if (modal) { + document.getElementById('modalImage').src = src; + modal.style.display = 'flex'; + } +} + +function closeImageModal() { + const modal = document.getElementById('imageModal'); + if (modal) modal.style.display = 'none'; +} + +function toggleImageSection(id) { + const section = document.getElementById(`img-section-${id}`); + const content = document.getElementById(`img-content-${id}`); + const icon = section.querySelector('.toggle-icon'); + const isCollapsed = content.classList.toggle('collapsed'); + section.classList.toggle('active', !isCollapsed); + icon.textContent = isCollapsed ? '▼' : '▲'; +} + +// Global Initialization document.addEventListener('DOMContentLoaded', loadInquiries); -window.addEventListener('resize', loadInquiries); +window.addEventListener('resize', initStickyHeader); + +// Global Key Events (ESC) +document.addEventListener('keydown', (e) => { + if (e.key === 'Escape') closeImageModal(); +}); diff --git a/js/mail.js b/js/mail.js index f4e5d18..55fae3f 100644 --- a/js/mail.js +++ b/js/mail.js @@ -82,6 +82,7 @@ const MAIL_SAMPLES = { let currentMailTab = 'inbound'; let filteredMails = []; +// --- 첨부파일 데이터 로드 및 렌더링 --- async function loadAttachments() { try { const res = await fetch('/attachments'); @@ -116,16 +117,16 @@ function renderFiles() { } item.innerHTML = ` -
- 📄 -
+
+ 📄 +
${file.name}
${file.size}
-
+
${pathText} ${isAiActive ? `` : ''} - +
@@ -136,18 +137,71 @@ function renderFiles() { }); } +// --- 미리보기 제어 --- +function togglePreviewAuto() { + const area = document.getElementById('mailPreviewArea'); + const icon = document.getElementById('previewToggleIcon'); + if (!area) return; + + const isActive = area.classList.toggle('active'); + if (icon) icon.innerText = isActive ? '▶' : '◀'; +} + +function showPreview(index, event) { + // 버튼 클릭 시 미리보기 방지 + if (event && (event.target.closest('.btn-group') || event.target.closest('.path-display'))) return; + + const file = currentFiles[index]; + if (!file) return; + + const previewContainer = document.getElementById('previewContainer'); + const fullViewBtn = document.getElementById('fullViewBtn'); + const previewArea = document.getElementById('mailPreviewArea'); + const toggleIcon = document.getElementById('previewToggleIcon'); + + // UI 활성화 + if (previewArea) { + previewArea.classList.add('active'); + if (toggleIcon) toggleIcon.innerText = '▶'; + } + + // 파일 경로 및 유형 처리 + const isPdf = file.name.toLowerCase().endsWith('.pdf'); + const fileUrl = `/sample_files/${encodeURIComponent(file.name)}`; + + if (fullViewBtn) { + fullViewBtn.style.display = 'block'; + fullViewBtn.onclick = () => window.open(fileUrl, 'PMFullView', 'width=1000,height=800'); + } + + if (isPdf) { + previewContainer.innerHTML = ``; + } else { + previewContainer.innerHTML = ` +
+ +
${file.name}
+
`; + } + + // 아이템 활성화 스타일 + document.querySelectorAll('.attachment-item').forEach(item => item.classList.remove('active')); + if (event && event.currentTarget) event.currentTarget.classList.add('active'); +} + +// --- 메일 리스트 관리 --- function renderMailList(tabType, mailsToShow = null) { currentMailTab = tabType; const container = document.querySelector('.mail-items-container'); if (!container) return; const mails = mailsToShow || MAIL_SAMPLES[tabType] || []; - filteredMails = mails; // 현재 보여지는 리스트 저장 + filteredMails = mails; updateBulkActionBar(); container.innerHTML = mails.map((mail, idx) => `
- +
@@ -166,23 +220,73 @@ function renderMailList(tabType, mailsToShow = null) {
`).join(''); - // 초기 로드 시 active가 있다면 본문도 업데이트 const activeIdx = mails.findIndex(m => m.active); - if (activeIdx !== -1) { - updateMailContent(mails[activeIdx]); - } + if (activeIdx !== -1) updateMailContent(mails[activeIdx]); } -function handleCheckboxClick(event) { - event.stopPropagation(); +function selectMailItem(el, index) { + document.querySelectorAll('.mail-item').forEach(item => { + item.classList.remove('active'); + const nameSpan = item.querySelector('.mail-item-content span:first-child'); + if (nameSpan) nameSpan.style.color = 'var(--text-main)'; + }); + el.classList.add('active'); + const currentNameSpan = el.querySelector('.mail-item-content span:first-child'); + if (currentNameSpan) currentNameSpan.style.color = 'var(--primary-color)'; + + const mail = filteredMails[index]; + if (mail) updateMailContent(mail); } +function updateMailContent(mail) { + const headerTitle = document.querySelector('.mail-content-header h2'); + const senderInfo = document.querySelectorAll('.mail-content-header div')[0]; + const dateInfo = document.querySelectorAll('.mail-content-header div')[1]; + const bodyInfo = document.querySelector('.mail-body'); + + if (headerTitle) headerTitle.innerText = mail.title; + if (senderInfo) senderInfo.innerHTML = `${currentMailTab === 'outbound' ? '받는사람' : '보낸사람'} ${mail.email} (${mail.person})`; + if (dateInfo) dateInfo.innerHTML = `날짜 ${mail.time}`; + if (bodyInfo) bodyInfo.innerHTML = mail.summary.replace(/\n/g, '
') + "

본 내용은 샘플 데이터입니다."; +} + +function switchMailTab(el, tabType) { + document.querySelectorAll('.mail-tab').forEach(tab => tab.classList.remove('active')); + el.classList.add('active'); + MAIL_SAMPLES[tabType].forEach((m, idx) => m.active = (idx === 0)); + renderMailList(tabType); +} + +// --- 검색 및 필터 --- +function searchMails() { + const query = document.querySelector('.search-bar input[type="text"]').value.toLowerCase(); + const startDate = document.getElementById('startDate').value; + const endDate = document.getElementById('endDate').value; + + const results = (MAIL_SAMPLES[currentMailTab] || []).filter(mail => { + const matchQuery = mail.title.toLowerCase().includes(query) || + mail.person.toLowerCase().includes(query) || + mail.summary.toLowerCase().includes(query); + let matchDate = true; + if (startDate) matchDate = matchDate && (mail.time >= startDate); + if (endDate) matchDate = matchDate && (mail.time <= endDate); + return matchQuery && matchDate; + }); + renderMailList(currentMailTab, results); +} + +function resetSearch() { + document.querySelector('.search-bar input[type="text"]').value = ''; + document.getElementById('startDate').value = ''; + document.getElementById('endDate').value = ''; + renderMailList(currentMailTab); +} + +// --- 액션바 관리 --- function updateBulkActionBar() { const checkboxes = document.querySelectorAll('.mail-item-checkbox:checked'); const actionBar = document.getElementById('mailBulkActions'); const selectedCountSpan = document.getElementById('selectedCount'); - const selectAllCheckbox = document.getElementById('selectAllMails'); - if (!actionBar || !selectedCountSpan) return; if (checkboxes.length > 0) { @@ -190,13 +294,13 @@ function updateBulkActionBar() { selectedCountSpan.innerText = `${checkboxes.length}개 선택됨`; } else { actionBar.classList.remove('active'); - if (selectAllCheckbox) selectAllCheckbox.checked = false; + const selectAll = document.getElementById('selectAllMails'); + if (selectAll) selectAll.checked = false; } } function toggleSelectAll(el) { - const checkboxes = document.querySelectorAll('.mail-item-checkbox'); - checkboxes.forEach(cb => cb.checked = el.checked); + document.querySelectorAll('.mail-item-checkbox').forEach(cb => cb.checked = el.checked); updateBulkActionBar(); } @@ -222,145 +326,41 @@ function deleteSelectedMails() { renderMailList(currentMailTab); } -function selectMailItem(el, index) { - // UI 업데이트 - document.querySelectorAll('.mail-item').forEach(item => { - item.classList.remove('active'); - const nameSpan = item.querySelector('.mail-item-content span:first-child'); - if (nameSpan) nameSpan.style.color = 'var(--text-main)'; - }); - el.classList.add('active'); - const currentNameSpan = el.querySelector('.mail-item-content span:first-child'); - if (currentNameSpan) currentNameSpan.style.color = 'var(--primary-color)'; - - // 본문 업데이트 - const mail = filteredMails[index]; - if (mail) { - updateMailContent(mail); - } -} - -function updateMailContent(mail) { - const headerTitle = document.querySelector('.mail-content-header h2'); - const senderInfo = document.querySelectorAll('.mail-content-header div')[0]; - const dateInfo = document.querySelectorAll('.mail-content-header div')[1]; - const bodyInfo = document.querySelector('.mail-body'); - - if (headerTitle) headerTitle.innerText = mail.title; - if (senderInfo) senderInfo.innerHTML = `${currentMailTab === 'outbound' ? '받는사람' : '보낸사람'} ${mail.email} (${mail.person})`; - if (dateInfo) dateInfo.innerHTML = `날짜 ${mail.time}`; - if (bodyInfo) bodyInfo.innerHTML = mail.summary.replace(/\n/g, '
') + "

" + "본 내용은 샘플 데이터입니다."; -} - -function switchMailTab(el, tabType) { - document.querySelectorAll('.mail-tab').forEach(tab => tab.classList.remove('active')); - el.classList.add('active'); - - // 탭 이동 시 active 상태 초기화 (첫 번째 메일만 active 하거나 전부 해제) - MAIL_SAMPLES[tabType].forEach((m, idx) => m.active = (idx === 0)); - - renderMailList(tabType); -} - -// --- 검색 기능 --- -function searchMails() { - const query = document.querySelector('.search-bar input[type="text"]').value.toLowerCase(); - const startDate = document.getElementById('startDate').value; - const endDate = document.getElementById('endDate').value; - - const mails = MAIL_SAMPLES[currentMailTab]; - const results = mails.filter(mail => { - const matchQuery = mail.title.toLowerCase().includes(query) || - mail.person.toLowerCase().includes(query) || - mail.summary.toLowerCase().includes(query); - - let matchDate = true; - if (startDate) matchDate = matchDate && (mail.time >= startDate); - if (endDate) matchDate = matchDate && (mail.time <= endDate); - - return matchQuery && matchDate; - }); - - renderMailList(currentMailTab, results); -} - -function resetSearch() { - document.querySelector('.search-bar input[type="text"]').value = ''; - document.getElementById('startDate').value = ''; - document.getElementById('endDate').value = ''; - document.querySelector('.search-bar select').selectedIndex = 0; - - renderMailList(currentMailTab); -} - -// --- 모달 및 기타 유틸리티 --- -function togglePreview(show) { - const previewArea = document.getElementById('mailPreviewArea'); - if (show) previewArea.classList.add('active'); - else previewArea.classList.remove('active'); -} - -function showPreview(index, event) { - if (event.target.closest('.btn-group') || event.target.closest('.path-display')) return; - const file = currentFiles[index]; - const previewContainer = document.getElementById('previewContainer'); - const fullViewBtn = document.getElementById('fullViewBtn'); - document.querySelectorAll('.attachment-item').forEach(item => item.classList.remove('active')); - event.currentTarget.classList.add('active'); - togglePreview(true); - const isPdf = file.name.toLowerCase().endsWith('.pdf'); - const fileUrl = `/sample_files/${encodeURIComponent(file.name)}`; - if (fullViewBtn) { - fullViewBtn.style.display = 'block'; - fullViewBtn.onclick = () => window.open(fileUrl, 'PMFullView', 'width=1000,height=800'); - } - if (isPdf) { - previewContainer.innerHTML = ``; - } else { - previewContainer.innerHTML = `
${file.name}
`; - } -} - +// --- 경로 선택 모달 --- function openPathModal(index, event) { if (event) event.stopPropagation(); editingIndex = index; const modal = document.getElementById('pathModal'); const tabSelect = document.getElementById('tabSelect'); - if (!tabSelect) return; + if (!modal || !tabSelect) return; + tabSelect.innerHTML = Object.keys(HIERARCHY).map(tab => ``).join(''); updateCategories(); modal.style.display = 'flex'; } function updateCategories() { - const tabSelect = document.getElementById('tabSelect'); + const tab = document.getElementById('tabSelect').value; const catSelect = document.getElementById('categorySelect'); - if (!tabSelect || !catSelect) return; - const tab = tabSelect.value; - const cats = Object.keys(HIERARCHY[tab]); - catSelect.innerHTML = cats.map(cat => ``).join(''); + if (!catSelect) return; + catSelect.innerHTML = Object.keys(HIERARCHY[tab]).map(cat => ``).join(''); updateSubs(); } function updateSubs() { - const tabSelect = document.getElementById('tabSelect'); - const catSelect = document.getElementById('categorySelect'); + const tab = document.getElementById('tabSelect').value; + const cat = document.getElementById('categorySelect').value; const subSelect = document.getElementById('subSelect'); - if (!tabSelect || !catSelect || !subSelect) return; - const tab = tabSelect.value; - const cat = catSelect.value; - const subs = HIERARCHY[tab][cat]; - subSelect.innerHTML = subs.map(sub => ``).join(''); + if (!subSelect) return; + subSelect.innerHTML = HIERARCHY[tab][cat].map(sub => ``).join(''); } function applyPathSelection() { - const tabSelect = document.getElementById('tabSelect'); - const catSelect = document.getElementById('categorySelect'); - const subSelect = document.getElementById('subSelect'); - const tab = tabSelect.value; - const cat = catSelect.value; - const sub = subSelect.value; + const tab = document.getElementById('tabSelect').value; + const cat = document.getElementById('categorySelect').value; + const sub = document.getElementById('subSelect').value; const fullPath = `${tab} > ${cat} > ${sub}`; + if (!currentFiles[editingIndex].analysis) currentFiles[editingIndex].analysis = {}; currentFiles[editingIndex].analysis.suggested_path = fullPath; currentFiles[editingIndex].analysis.isManual = true; @@ -373,6 +373,7 @@ function closeModal() { if (modal) modal.style.display = 'none'; } +// --- AI 분석 및 업로드 --- async function startAnalysis(index, event) { if (event) event.stopPropagation(); const file = currentFiles[index]; @@ -380,20 +381,21 @@ async function startAnalysis(index, event) { const logContent = document.getElementById(`log-content-${index}`); const recLabel = document.getElementById(`recommend-${index}`); if (!logArea || !logContent || !recLabel) return; + logArea.classList.add('active'); - logContent.innerHTML = '
>>> 3중 레이어 AI 분석 엔진 가동...
'; + logContent.innerHTML = '
>>> AI 분석 엔진 가동 중...
'; recLabel.innerText = '분석 중...'; + try { const res = await fetch(`/analyze-file?filename=${encodeURIComponent(file.name)}`); const analysis = await res.json(); const result = analysis.final_result; - const steps = [`1. 파일 포맷 분석: ${file.name.split('.').pop().toUpperCase()} 감지`, `2. 페이지 스캔: 총 ${analysis.total_pages}페이지 분석 완료`, `3. 문맥 추론: ${result.reason}`]; - steps.forEach(step => { - const line = document.createElement('div'); - line.className = 'log-line'; - line.innerText = " " + step; - logContent.appendChild(line); - }); + + logContent.innerHTML = ` +
1. 파일 포맷 분석: ${file.name.split('.').pop().toUpperCase()} 감지
+
2. 페이지 스캔: 총 ${analysis.total_pages}페이지 분석 완료
+
3. 문맥 추론: ${result.reason}
+ `; currentFiles[index].analysis = { suggested_path: result.suggested_path, isManual: false }; renderFiles(); } catch (e) { @@ -406,15 +408,13 @@ function confirmUpload(index, event) { if (event) event.stopPropagation(); const file = currentFiles[index]; if (!file.analysis || !file.analysis.suggested_path) { alert("경로를 설정해주세요."); return; } - if (confirm(`정해진 위치로 업로드하시겠습니까?\n\n위치: ${file.analysis.suggested_path}`)) alert("업로드가 완료되었습니다."); + if (confirm(`업로드하시겠습니까?\n위치: ${file.analysis.suggested_path}`)) alert("완료되었습니다."); } -// --- 주소록 기능 --- +// --- 주소록 --- let addressBookData = [ { name: "이태훈", dept: "PM Overseas / 선임연구원", email: "th.lee@projectmaster.com", phone: "010-1234-5678" }, - { name: "Pany S.", dept: "라오스 농림부 / 국장", email: "pany.s@lao.gov.la", phone: "+856-20-1234-5678" }, - { name: "김철수", dept: "현대건설 / 현장소장", email: "cs.kim@hdec.co.kr", phone: "010-9876-5432" }, - { name: "Nguyen Van A", dept: "베트남 전력청 / 팀장", email: "nva@evn.com.vn", phone: "+84-90-1234-5678" } + { name: "Pany S.", dept: "라오스 농림부 / 국장", email: "pany.s@lao.gov.la", phone: "+856-20-1234-5678" } ]; let contactEditingIndex = -1; @@ -425,33 +425,60 @@ function openAddressBook() { function closeAddressBook() { const modal = document.getElementById('addressBookModal'); - if (modal) { modal.style.display = 'none'; document.getElementById('addContactForm').style.display = 'none'; contactEditingIndex = -1; } + if (modal) { modal.style.display = 'none'; document.getElementById('addContactForm').style.display = 'none'; } +} + +function toggleAddContactForm() { + const form = document.getElementById('addContactForm'); + if (!form) return; + if (form.style.display === 'none') { + form.style.display = 'block'; + } else { + form.style.display = 'none'; + contactEditingIndex = -1; + // 폼 초기화 + document.getElementById('newContactName').value = ''; + document.getElementById('newContactDept').value = ''; + document.getElementById('newContactEmail').value = ''; + document.getElementById('newContactPhone').value = ''; + } +} + +function editContact(index) { + const contact = addressBookData[index]; + if (!contact) return; + contactEditingIndex = index; + + document.getElementById('newContactName').value = contact.name; + document.getElementById('newContactDept').value = contact.dept; + document.getElementById('newContactEmail').value = contact.email; + document.getElementById('newContactPhone').value = contact.phone; + + document.getElementById('addContactForm').style.display = 'block'; +} + +function deleteContact(index) { + if (!addressBookData[index]) return; + if (confirm(`'${addressBookData[index].name}'님을 주소록에서 삭제하시겠습니까?`)) { + addressBookData.splice(index, 1); + renderAddressBook(); + } } function renderAddressBook() { const body = document.getElementById('addressBookBody'); if (!body) return; - body.innerHTML = addressBookData.map((c, idx) => `${c.name}${c.dept}${c.email}${c.phone}`).join(''); -} - -function toggleAddContactForm() { - const form = document.getElementById('addContactForm'); - if (form.style.display === 'none') form.style.display = 'block'; - else { form.style.display = 'none'; contactEditingIndex = -1; } -} - -function editContact(index) { - const contact = addressBookData[index]; - contactEditingIndex = index; - document.getElementById('newContactName').value = contact.name; - document.getElementById('newContactDept').value = contact.dept; - document.getElementById('newContactEmail').value = contact.email; - document.getElementById('newContactPhone').value = contact.phone; - document.getElementById('addContactForm').style.display = 'block'; -} - -function deleteContact(index) { - if (confirm(`'${addressBookData[index].name}'님을 주소록에서 삭제하시겠습니까?`)) { addressBookData.splice(index, 1); renderAddressBook(); } + body.innerHTML = addressBookData.map((c, idx) => ` + + ${c.name} + ${c.dept} + ${c.email} + ${c.phone} + + + + + `).join(''); } function addContact() { @@ -459,21 +486,17 @@ function addContact() { const dept = document.getElementById('newContactDept').value; const email = document.getElementById('newContactEmail').value; const phone = document.getElementById('newContactPhone').value; - if (!name) { alert("이름을 입력해주세요."); return; } - const newData = { name, dept, email, phone }; - if (contactEditingIndex > -1) { addressBookData[contactEditingIndex] = newData; contactEditingIndex = -1; } - else addressBookData.push(newData); + if (!name) return alert("이름을 입력해주세요."); + + if (contactEditingIndex > -1) addressBookData[contactEditingIndex] = { name, dept, email, phone }; + else addressBookData.push({ name, dept, email, phone }); + renderAddressBook(); - toggleAddContactForm(); -} - -function togglePreviewAuto() { - const area = document.getElementById('mailPreviewArea'); - const icon = document.getElementById('previewToggleIcon'); - const isActive = area.classList.toggle('active'); - if (icon) icon.innerText = isActive ? '▶' : '◀'; + document.getElementById('addContactForm').style.display = 'none'; + contactEditingIndex = -1; } +// 초기화 document.addEventListener('DOMContentLoaded', () => { loadAttachments(); renderMailList('inbound'); diff --git a/migrate_db_history.py b/migrate_db_history.py deleted file mode 100644 index b77629e..0000000 --- a/migrate_db_history.py +++ /dev/null @@ -1,43 +0,0 @@ -import pymysql -import os - -def get_db(): - return pymysql.connect( - host='localhost', user='root', password='45278434', - database=os.getenv('DB_NAME', 'PM_proto'), charset='utf8mb4' - ) - -def migrate_to_timeseries(): - conn = get_db() - try: - with conn.cursor() as cursor: - # 1. 기존 고유 제약 조건 제거 (project_id 중복 허용을 위함) - try: - cursor.execute("ALTER TABLE overseas_projects DROP INDEX project_id") - print(">>> 기존 project_id 고유 제약 제거") - except: pass - - # 2. crawl_date 컬럼 추가 (날짜별 데이터 구분을 위함) - cursor.execute("DESCRIBE overseas_projects") - cols = [row[0] for row in cursor.fetchall()] - if 'crawl_date' not in cols: - cursor.execute("ALTER TABLE overseas_projects ADD COLUMN crawl_date DATE AFTER project_id") - print(">>> crawl_date 컬럼 추가") - - # 3. 기존 데이터의 crawl_date를 오늘로 채움 - cursor.execute("UPDATE overseas_projects SET crawl_date = DATE(updated_at) WHERE crawl_date IS NULL") - - # 4. 새로운 복합 고유 제약 추가 (ID + 날짜 조합으로 중복 방지) - # 같은 날짜에 다시 크롤링하면 덮어쓰고, 날짜가 다르면 새로 생성됨 - try: - cursor.execute("ALTER TABLE overseas_projects ADD UNIQUE INDEX idx_project_date (project_id, crawl_date)") - print(">>> 복합 고유 제약(project_id + crawl_date) 추가 완료") - except: pass - - conn.commit() - print(">>> DB 시계열 마이그레이션 성공!") - finally: - conn.close() - -if __name__ == "__main__": - migrate_to_timeseries() diff --git a/migrate_normalized.py b/migrate_normalized.py deleted file mode 100644 index b8cc930..0000000 --- a/migrate_normalized.py +++ /dev/null @@ -1,67 +0,0 @@ -import pymysql -import os - -def get_db(): - return pymysql.connect( - host='localhost', user='root', password='45278434', - database=os.getenv('DB_NAME', 'PM_proto'), charset='utf8mb4', - cursorclass=pymysql.cursors.DictCursor - ) - -def migrate_to_normalized_tables(): - conn = get_db() - try: - with conn.cursor() as cursor: - # 1. 마스터 테이블 생성 (고유 정보) - cursor.execute(""" - CREATE TABLE IF NOT EXISTS projects_master ( - project_id VARCHAR(100) PRIMARY KEY, - project_nm VARCHAR(255) NOT NULL, - short_nm VARCHAR(255), - department VARCHAR(255), - continent VARCHAR(100), - country VARCHAR(100), - master VARCHAR(100), - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - """) - - # 2. 히스토리 테이블 생성 (일일 변동 정보) - cursor.execute(""" - CREATE TABLE IF NOT EXISTS projects_history ( - id INT AUTO_INCREMENT PRIMARY KEY, - project_id VARCHAR(100) NOT NULL, - crawl_date DATE NOT NULL, - recent_log VARCHAR(255), - file_count INT DEFAULT 0, - recorded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UNIQUE KEY idx_proj_date (project_id, crawl_date), - FOREIGN KEY (project_id) REFERENCES projects_master(project_id) ON DELETE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - """) - - # 3. 기존 데이터 이전 - # 3-1. 마스터 정보 이전 - cursor.execute(""" - INSERT IGNORE INTO projects_master (project_id, project_nm, short_nm, department, continent, country, master) - SELECT project_id, project_nm, short_nm, department, continent, country, master - FROM overseas_projects - """) - - # 3-2. 히스토리 정보 이전 - cursor.execute(""" - INSERT IGNORE INTO projects_history (project_id, crawl_date, recent_log, file_count) - SELECT project_id, crawl_date, recent_log, file_count - FROM overseas_projects - """) - - # 4. 기존 단일 테이블 삭제 (성공 후 삭제) - # cursor.execute("DROP TABLE IF EXISTS overseas_projects") - - conn.commit() - print(">>> DB 정규화 마이그레이션 완료 (Master / History 분리)") - finally: - conn.close() - -if __name__ == "__main__": - migrate_to_normalized_tables() diff --git a/server.log b/server.log deleted file mode 100644 index 9a467195d541fb06d173fab31ed4828c781ddbcf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1406 zcmchX!A?_A5QhH+D-+-0?1ZQYVhq&8gj7gO6csg?R2NNqg=?U#EU3+Z8v&ngvoo5lPBGM~e)+H^BUwlhi_}U;&()#C5W3M)} z7N=L)TMkPRp+{6R9uXz!gYNL2t&6i5QY*h3Fd1M;*RcaQm{-yYF(*$x9YnT1UFXb} z_g#xa&f4%#y312@GJi9?$Uf?So0-+D%&-|sDCoL7dP+Zfp@`aN`q!P_!LQO&DrX&( z_*w}U4zw-@ZS1@re_q7CK3q4%pcNd(aKrghV_n;TBaM%0z&gQjE_pS9) zJz>>mHQ~BNe5-N@Uw1C&<%uXm9aiKK=4t4HReNU)zvoTY^O-3eg4@G#CMj4ZlvZH_ zFmGTJrCD{2DSa)*)--n}@mz;+k%OoM(StHhbjaeCvAF q|66&E-QNx#wH^}8>+DD5xqN1oHaQ)HKF+)E|3|CBo<&qNNBje&W$1.continent-body, .active>.country-body { display: block; } -.sync-btn { display: flex; align-items: center; gap: 8px; background-color: var(--primary-color); color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: 0.2s; } .admin-info { font-size: 12px; color: var(--text-sub); margin-left: 16px; padding: 6px 12px; background: #f8f9fa; border-radius: 4px; border: 1px solid var(--border-color); } .admin-info strong { color: var(--primary-color); font-weight: 700; } .base-date-info { font-size: 13px; color: var(--text-sub); background: #fdfdfd; padding: 6px 15px; border-radius: 6px; border: 1px solid var(--border-color); } -.base-date-info strong { color: #333; font-weight: 700; } diff --git a/style/inquiries.css b/style/inquiries.css index 5b33ce3..88f6e9e 100644 --- a/style/inquiries.css +++ b/style/inquiries.css @@ -1,29 +1,68 @@ - +/* 1. Layout & Board Structure */ .inquiry-board { padding: 0 20px 32px 20px; - max-width: 98%; /* Expanded from 1400px to use most of the screen */ - margin: 0 auto; - margin-top: 36px; /* topbar height */ + max-width: 98%; + margin: 36px auto 0; } -/* Sticky Header Wrapper */ .board-sticky-header { position: sticky; top: 36px; background: #fff; z-index: 1000; - padding-top: 15px; - padding-bottom: 10px; + padding: 15px 0 10px; border-bottom: 1px solid #eee; } .board-header { display: flex; justify-content: space-between; - align-items: center; + align-items: flex-end; margin-bottom: 20px; } +/* 2. Stats Dashboard */ +.header-stats { + display: flex; + gap: 12px; +} + +.stat-item { + background: #fff; + border: 1px solid #eee; + padding: 8px 16px; + border-radius: 8px; + display: flex; + flex-direction: column; + align-items: center; + min-width: 80px; + box-shadow: 0 2px 4px rgba(0,0,0,0.02); + transition: transform 0.2s, box-shadow 0.2s; +} + +.stat-item:hover { + transform: translateY(-2px); + box-shadow: 0 4px 8px rgba(0,0,0,0.05); +} + +.stat-label { font-size: 11px; font-weight: 600; color: #888; margin-bottom: 2px; } +.stat-value { font-size: 18px; font-weight: 700; color: #333; } + +/* Status Border Colors */ +.stat-item.total { border-top: 3px solid #1e5149; } +.stat-item.total .stat-value { color: #1e5149; } +.stat-item.complete { border-top: 3px solid #2e7d32; } +.stat-item.complete .stat-value { color: #2e7d32; } +.stat-item.working { border-top: 3px solid #1565c0; } +.stat-item.working .stat-value { color: #1565c0; } +.stat-item.checking { border-top: 3px solid #ef6c00; } +.stat-item.checking .stat-value { color: #ef6c00; } +.stat-item.pending { border-top: 3px solid #673ab7; } +.stat-item.pending .stat-value { color: #673ab7; } +.stat-item.unconfirmed { border-top: 3px solid #9e9e9e; } +.stat-item.unconfirmed .stat-value { color: #9e9e9e; } + +/* 3. Filters & Notice */ .notice-container { background: #fdfdfd; padding: 20px; @@ -42,26 +81,11 @@ margin-top: 15px; } -.filter-group { - display: flex; - flex-direction: column; - gap: 4px; -} - -.filter-group label { - font-size: 12px; - font-weight: 600; - color: #666; -} - -.filter-group select, -.filter-group input { - padding: 8px 12px; - border: 1px solid #ddd; - border-radius: 4px; - font-size: 14px; -} +.filter-group { display: flex; flex-direction: column; gap: 4px; } +.filter-group label { font-size: 12px; font-weight: 600; color: #666; } +.filter-group select, .filter-group input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; } +/* 4. Table Styles */ .inquiry-table { width: 100%; background: #fff; @@ -74,7 +98,6 @@ .inquiry-table thead th { position: sticky; - top: 310px; /* Adjust this value based on header height or use dynamic JS */ background: #f8f9fa; padding: 14px 16px; text-align: left; @@ -93,95 +116,43 @@ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - max-width: 0; /* Necessary for text-overflow to work in table-cells with percentage or flex-like behavior */ } -/* Specific overrides for columns that need more or less space */ +/* Table Row Hover & Active State */ +.inquiry-row:hover { background: #fcfcfc; cursor: pointer; } +.inquiry-row.active-row { background-color: #f0f7f6 !important; } +.inquiry-row.active-row td { font-weight: 600; color: #1e5149; border-bottom-color: transparent; } + +/* Status Badges */ +.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; display: inline-block; } +.status-complete { background: #e8f5e9; color: #2e7d32; } +.status-working { background: #e3f2fd; color: #1565c0; } +.status-checking { background: #fff3e0; color: #ef6c00; } +.status-pending { background: #f5f5f5; color: #616161; } + +/* Table Columns Width & Truncation */ .inquiry-table td:nth-child(1) { max-width: 50px; } /* No */ -.inquiry-table td:nth-child(2) { max-width: 120px; } /* PM Type */ -.inquiry-table td:nth-child(3) { max-width: 100px; } /* Env */ -.inquiry-table td:nth-child(4) { max-width: 150px; } /* Category */ -.inquiry-table td:nth-child(5) { max-width: 200px; } /* Project */ -.inquiry-table td:nth-child(6) { max-width: 400px; } /* Content */ -.inquiry-table td:nth-child(7) { max-width: 400px; } /* Reply */ -.inquiry-table td:nth-child(8) { max-width: 100px; } /* Author */ -.inquiry-table td:nth-child(9) { max-width: 120px; } /* Date */ -.inquiry-table td:nth-child(10) { max-width: 100px; } /* Status */ +.inquiry-table td:nth-child(2) { max-width: 80px; text-align: center; } /* Image */ +.inquiry-table td:nth-child(3) { max-width: 120px; } /* PM Type */ +.inquiry-table td:nth-child(4) { max-width: 100px; } /* Env */ +.inquiry-table td:nth-child(5) { max-width: 150px; } /* Category */ +.inquiry-table td:nth-child(6) { max-width: 200px; } /* Project */ +.inquiry-table td:nth-child(7), .inquiry-table td:nth-child(8) { max-width: 400px; } /* Content & Reply */ +.inquiry-table td:nth-child(9) { max-width: 100px; } /* Author */ +.inquiry-table td:nth-child(10) { max-width: 120px; } /* Date */ +.inquiry-table td:nth-child(11) { max-width: 100px; } /* Status */ -/* Reset max-width for detail row to allow it to span full width */ -.detail-row td { - max-width: none; - white-space: normal; - overflow: visible; -} - -.status-badge { - padding: 4px 10px; - border-radius: 20px; - font-size: 11px; - font-weight: 700; - display: inline-block; -} - -.status-complete { - background: #e8f5e9; - color: #2e7d32; -} - -.status-working { - background: #e3f2fd; - color: #1565c0; -} - -.status-checking { - background: #fff3e0; - color: #ef6c00; -} - -.status-pending { - background: #f5f5f5; - color: #616161; -} - -.inquiry-row:hover { - background: #fcfcfc; - cursor: pointer; -} - -/* Expanded Row Highlight */ -.inquiry-row.active-row { - background-color: #f0f7f6 !important; /* Very light mint gray */ -} - -.inquiry-row.active-row td { - font-weight: 600; - color: #1e5149; - border-bottom-color: transparent; /* Seamless connection with detail */ -} - -.content-preview { - max-width: 500px; /* Increased from 300px */ - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -/* Accordion Detail Row Style */ -.detail-row { - display: none; - background: #fdfdfd; -} - -.detail-row.active { - display: table-row; -} +/* 5. Detail (Accordion) Styles */ +.detail-row { display: none; background: #fdfdfd; } +.detail-row.active { display: table-row; } +.detail-row td { max-width: none; white-space: normal; overflow: visible; } .detail-container { padding: 24px; border-left: 6px solid #1e5149; - background: #f9fafb; /* Slightly different background for grouping */ + background: #f9fafb; box-shadow: inset 0 4px 15px rgba(0,0,0,0.08); - position: relative; /* For positioning the close button */ + position: relative; border-bottom: 2px solid #eee; } @@ -208,86 +179,38 @@ font-weight: 600; color: #666; cursor: pointer; - display: flex; - align-items: center; - gap: 5px; - transition: all 0.2s; z-index: 10; } +.btn-close-accordion::after { content: "▲"; font-size: 10px; margin-left: 5px; } -.btn-close-accordion:hover { - background: #e0e0e0; - color: #333; -} +.detail-meta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 15px; font-size: 13px; color: #666; } +.detail-label { font-weight: 700; color: #888; margin-right: 8px; } -.btn-close-accordion::after { - content: "▲"; - font-size: 10px; -} +.detail-q-section { background: #f8f9fa; padding: 20px; border-radius: 8px; } +.detail-a-section { background: #f1f8f7; padding: 20px; border-radius: 8px; border-left: 5px solid #1e5149; } -.detail-q-section { - background: #f8f9fa; - padding: 20px; - border-radius: 8px; -} +/* 6. Image Preview & Foldable Section */ +.img-thumbnail { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; border: 1px solid #ddd; cursor: pointer; transition: transform 0.2s; } +.img-thumbnail:hover { transform: scale(1.1); } +.no-img { font-size: 10px; color: #ccc; font-style: italic; } -.detail-a-section { - background: #f1f8f7; - padding: 20px; - border-radius: 8px; - border-left: 5px solid #1e5149; -} +.detail-image-section { margin-bottom: 20px; background: #f9fafb; border-radius: 8px; border: 1px solid #e5e7eb; overflow: hidden; } +.image-section-header { padding: 12px 16px; background: #f1f5f9; display: flex; justify-content: space-between; align-items: center; cursor: pointer; } +.image-section-header:hover { background: #e2e8f0; } +.image-section-header h4 { margin: 0; color: #1e5149; display: flex; align-items: center; gap: 8px; } +.image-section-content { padding: 20px; display: flex; justify-content: center; background: #fff; border-top: 1px solid #eee; } +.image-section-content.collapsed { display: none; } +.toggle-icon { font-size: 12px; color: #64748b; transition: transform 0.3s; } +.detail-image-section.active .toggle-icon { transform: rotate(180deg); } -.detail-meta-grid { - display: grid; - grid-template-columns: repeat(4, 1fr); - gap: 15px; - margin-bottom: 15px; - font-size: 13px; - color: #666; -} +.preview-img { max-width: 100%; max-height: 400px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); object-fit: contain; } -.detail-label { - font-weight: 700; - color: #888; - margin-right: 8px; -} - -/* Reply Form Enhancement */ +/* 7. Forms & Reply */ .reply-edit-form textarea { - width: 100%; - height: 120px; /* Fixed height */ - padding: 12px; - border: 1px solid #ddd; - border-radius: 6px; - font-family: inherit; - font-size: 14px; - margin-bottom: 15px; - resize: none; /* Disable resizing */ - background: #fff; - transition: all 0.2s; -} - -.reply-edit-form textarea:disabled, -.reply-edit-form select:disabled, -.reply-edit-form input:disabled { - background: #fcfcfc; - color: #666; - border-color: #eee; - cursor: default; -} - -.reply-edit-form.readonly .btn-save, -.reply-edit-form.readonly .btn-delete, -.reply-edit-form.readonly .btn-cancel { - display: none; -} - -.reply-edit-form.editable .btn-edit { - display: none; -} - -.reply-edit-form.editable textarea { - border-color: #1e5149; - box-shadow: 0 0 0 2px rgba(30, 81, 73, 0.1); + width: 100%; height: 120px; padding: 12px; border: 1px solid #ddd; border-radius: 6px; + font-family: inherit; font-size: 14px; margin-bottom: 15px; resize: none; background: #fff; } +.reply-edit-form textarea:disabled, .reply-edit-form select:disabled, .reply-edit-form input:disabled { background: #fcfcfc; color: #666; border-color: #eee; } +.reply-edit-form.readonly .btn-save, .reply-edit-form.readonly .btn-delete, .reply-edit-form.readonly .btn-cancel { display: none; } +.reply-edit-form.editable .btn-edit { display: none; } +.reply-edit-form.editable textarea { border-color: #1e5149; box-shadow: 0 0 0 2px rgba(30, 81, 73, 0.1); } diff --git a/style/mail.css b/style/mail.css index 6c90462..ff67104 100644 --- a/style/mail.css +++ b/style/mail.css @@ -1,477 +1,219 @@ -/* Mail Manager Layout */ +/* Mail Manager Layout (Vertical Split) */ .mail-wrapper { - display: flex; - height: calc(100vh - 36px); - margin-top: 36px; - background: #fff; - overflow: hidden; -} - -.mail-sidebar { - display: none; /* 사이드바 삭제 */ + display: flex; height: calc(100vh - var(--topbar-h)); + margin-top: var(--topbar-h); background: #fff; overflow: hidden; } .mail-list-area { - width: 400px; - border-right: 1px solid var(--border-color); - display: flex; - flex-direction: column; - height: 100%; - background: #fff; - position: relative; -} - -/* 탭 가로 배치 복구 */ -.mail-tabs { - display: flex; - border-bottom: 1px solid var(--border-color); - background: #f8f9fa; - flex-shrink: 0; - width: 100%; + width: 400px; border-right: 1px solid var(--border-color); + display: flex; flex-direction: column; height: 100%; background: #fff; position: relative; } +/* 1. Tabs & Search */ +.mail-tabs { display: flex; border-bottom: 1px solid var(--border-color); background: #f8f9fa; flex-shrink: 0; } .mail-tab { - flex: 1; - padding: 12px 0; - text-align: center; - cursor: pointer; - font-weight: 700; - color: #a0aec0; - font-size: 11px; - transition: all 0.2s ease; - border-bottom: 2px solid transparent; - display: flex; - align-items: center; - justify-content: center; - gap: 6px; + flex: 1; padding: 12px 0; text-align: center; cursor: pointer; + font-weight: 700; color: #a0aec0; font-size: 11px; transition: all 0.2s ease; + border-bottom: 2px solid transparent; display: flex; align-items: center; justify-content: center; gap: 6px; } +.mail-tab:hover { background: #edf2f7; color: var(--primary-color); } +.mail-tab.active { color: var(--primary-color); border-bottom: 2px solid var(--primary-color); background: #fff; } -.mail-tab:hover { - background: #edf2f7; - color: var(--primary-color); -} +.search-bar { padding: 16px 24px; border-bottom: 1px solid var(--border-color); background: #fff; flex-shrink: 0; } -.mail-tab.active { - color: var(--primary-color); - border-bottom: 2px solid var(--primary-color); - background: #fff; -} - -/* 검색창 여백 및 간격 조정 */ -.search-bar { - padding: 16px 24px; - border-bottom: 1px solid var(--border-color); - background: #fff; - flex-shrink: 0; - margin-bottom: 20px; -} - -/* 상단 선택 액션바 */ .mail-bulk-actions { - display: none; - padding: 8px 16px; - background: #f7fafc; - border-bottom: 1px solid var(--border-color); - align-items: center; - justify-content: space-between; - font-size: 12px; + display: none; padding: 8px 16px; background: #f7fafc; + border-bottom: 1px solid var(--border-color); align-items: center; justify-content: space-between; font-size: 12px; } +.mail-bulk-actions.active { display: flex; } -.mail-bulk-actions.active { - display: flex; -} - -/* 메일리스트 컨테이너 */ -.mail-items-container { - flex: 1; - overflow-y: auto; - padding-bottom: 60px; /* 하단 고정 버튼 공간 확보 */ -} - -/* 메일 아이템 스타일 */ +/* 2. Mail Items */ +.mail-items-container { flex: 1; overflow-y: auto; padding-bottom: 60px; } .mail-item { - padding: 16px; - border-bottom: 1px solid var(--border-color); - cursor: pointer; - transition: 0.2s; - display: flex; - align-items: flex-start; + padding: 16px; border-bottom: 1px solid var(--border-color); cursor: pointer; + display: flex; align-items: flex-start; transition: 0.2s; } +.mail-item:hover { background: var(--bg-muted); } +.mail-item.active { background: var(--primary-lv-0); border-left: 4px solid var(--primary-color); } -.mail-item:hover { - background: var(--bg-muted); -} +.mail-item-checkbox { width: 16px; height: 16px; cursor: pointer; margin-right: 12px; margin-top: 2px; } +.mail-item-content { flex: 1; min-width: 0; } +.mail-item-info { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; } +.mail-date { font-size: 11px; color: var(--text-sub); white-space: nowrap; } -.mail-item.active { - background: #E9EEED; - border-left: 4px solid var(--primary-color); -} - -.mail-item-checkbox { - width: 16px; - height: 16px; - cursor: pointer; - margin-right: 12px; - margin-top: 2px; -} - -.mail-item-content { - flex: 1; - min-width: 0; -} - -.mail-item-info { - display: flex; - align-items: center; - gap: 12px; -} - -.mail-date { - font-size: 11px; - color: var(--text-sub); - white-space: nowrap; -} - -/* 텍스트형 삭제 버튼 스타일 */ .btn-mail-delete { - background: #f7fafc; - border: 1px solid var(--border-color); - color: #718096; - cursor: pointer; - font-size: 10px; - padding: 2px 8px; - transition: all 0.2s; - border-radius: 4px; - font-weight: 600; + background: #f7fafc; border: 1px solid var(--border-color); color: #718096; + font-size: 10px; padding: 2px 8px; border-radius: 4px; font-weight: 600; } +.btn-mail-delete:hover { color: var(--error-color); background: #fff5f5; border-color: #feb2b2; } -.btn-mail-delete:hover { - color: #e53e3e; - background: #fff5f5; - border-color: #feb2b2; -} - -/* 하단 버튼 고정 */ -.address-book-footer { - position: absolute; - bottom: 0; - left: 0; - width: 100%; - padding: 12px 16px; - border-top: 1px solid var(--border-color); - background: #fff; - flex-shrink: 0; - z-index: 5; - display: flex; - gap: 8px; -} - -.mail-content-area { - flex: 1; - display: flex; - flex-direction: column; - overflow-y: auto; - border-right: 1px solid var(--border-color); -} - -/* Mail Preview & Toggle Handle */ -.mail-preview-area { - width: 0; - background: #f1f3f5; - display: flex; - flex-direction: column; - transition: all 0.3s ease; - overflow: visible; - position: relative; - border-left: 0px solid transparent; -} - -.mail-preview-area.active { - width: 500px; - border-left: 1px solid var(--border-color); -} - -.mail-preview-area > *:not(.preview-toggle-handle) { - opacity: 0; - transition: opacity 0.2s; - pointer-events: none; -} - -.mail-preview-area.active > * { - opacity: 1; - pointer-events: auto; -} - -.preview-toggle-handle { - position: absolute; - left: -20px; - top: 50%; - transform: translateY(-50%); - width: 20px; - height: 60px; - background: var(--primary-color); - color: #fff; - display: flex; - align-items: center; - justify-content: center; - cursor: pointer; - border-radius: 8px 0 0 8px; - font-size: 10px; - box-shadow: -2px 0 5px rgba(0,0,0,0.1); - z-index: 10; -} - -.preview-toggle-handle:hover { - background: var(--primary-lv-8); -} - -.preview-header { - padding: 12px 16px; - background: #fff; - border-bottom: 1px solid var(--border-color); - display: flex; - justify-content: space-between; - align-items: center; -} - -.preview-header h3 { - font-size: 14px; - font-weight: 700; - color: var(--primary-color); -} - -.preview-content { - flex: 1; - padding: 20px; - overflow-y: auto; - display: flex; - justify-content: center; - align-items: flex-start; -} - -.a4-container { - width: 100%; - background: #fff; - box-shadow: 0 0 20px rgba(0,0,0,0.1); - position: relative; - aspect-ratio: 1 / 1.414; /* A4 Ratio */ - display: flex; - align-items: center; - justify-content: center; -} - -.preview-placeholder { - color: var(--text-sub); - font-size: 13px; - text-align: center; - padding: 20px; -} - -.preview-image { - max-width: 100%; - max-height: 100%; - object-fit: contain; -} - -.mail-content-header { - padding: var(--space-lg); - border-bottom: 1px solid var(--border-color); -} - -.mail-body { - padding: var(--space-lg); - line-height: 1.6; - min-height: 200px; -} - -/* Attachments & AI Analysis */ -.attachment-area { - padding: var(--space-lg); - border-top: 1px solid var(--border-color); - background: var(--bg-muted); -} +/* 3. Content Area */ +.mail-content-area { flex: 1; display: flex; flex-direction: column; overflow-y: auto; border-right: 1px solid var(--border-color); } +.mail-content-header { padding: var(--space-lg); border-bottom: 1px solid var(--border-color); } +.mail-body { padding: var(--space-lg); line-height: 1.6; min-height: 200px; } +/* 4. Attachments & AI */ +.attachment-area { padding: var(--space-lg); border-top: 1px solid var(--border-color); background: var(--bg-muted); } .attachment-item { - display: flex; - align-items: center; - gap: var(--space-md); - background: #fff; - padding: var(--space-sm) var(--space-md); - border-radius: var(--radius-lg); - border: 1px solid var(--border-color); - margin-bottom: var(--space-sm); - cursor: pointer; + display: flex; align-items: center; gap: var(--space-md); background: #fff; + padding: 12px 20px; border-radius: var(--radius-lg); + border: 1px solid var(--border-color); margin-bottom: var(--space-sm); cursor: pointer; transition: 0.2s; } +.attachment-item:hover { border-color: var(--primary-color); box-shadow: var(--box-shadow); } +.attachment-item.active { background: var(--primary-lv-0); border-color: var(--primary-color); } -.attachment-item:hover { - border-color: var(--primary-color); - box-shadow: var(--box-shadow); -} - -.attachment-item.active { - background: var(--primary-lv-0); - border-color: var(--primary-color); -} - -.file-icon { - font-size: 20px; - flex-shrink: 0; -} - -.file-details { - flex: 1; - overflow: hidden; -} - -.file-name { - font-size: 12px; - font-weight: 700; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.file-size { - font-size: 10px; - color: var(--text-sub); -} +.file-details { flex: 1; min-width: 0; } +.file-name { font-size: 13px; font-weight: 700; max-width: 450px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.file-size { font-size: 11px; color: var(--text-sub); } .btn-group { - display: flex; - gap: var(--space-xs); - flex: 1; - justify-content: flex-end; + display: flex; align-items: center; gap: 12px; flex-shrink: 0; justify-content: flex-end; } .btn-upload { - padding: 6px 12px; - border-radius: 4px; - font-size: 11px; - font-weight: 700; - color: #fff; + padding: 6px 14px; border-radius: 6px; font-size: 11px; font-weight: 700; + color: #fff; border: none; cursor: pointer; transition: 0.2s; height: 32px; } -.btn-ai { - background: var(--ai-gradient); -} +.btn-ai { background: var(--ai-gradient); } +.btn-ai:hover { filter: brightness(1.1); transform: translateY(-1px); } -.btn-normal { - background: var(--primary-color); -} +.btn-normal { background: var(--primary-color); } +.btn-normal:hover { background: var(--primary-hover); transform: translateY(-1px); } .ai-recommend { - font-size: 11px; - padding: 2px 6px; - border-radius: 4px; - font-weight: 700; - margin-left: 10px; + font-size: 11px; padding: 6px 12px; border-radius: 6px; font-weight: 600; + cursor: pointer; transition: 0.2s; display: inline-block; + max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; +} +.ai-recommend.smart-mode { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; } +.ai-recommend.manual-mode { background: #f1f5f9; color: #475569; border: 1px dashed #cbd5e1; } +.ai-recommend:hover { transform: scale(1.02); } + +/* 5. Preview Area */ +.mail-preview-area { + width: 0; background: #f8f9fa; display: flex; flex-direction: column; + transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative; + border-left: 0 solid transparent; } -.ai-recommend.smart-mode { - background: linear-gradient(135deg, #f6f8ff 0%, #f0f4ff 100%); - color: #4a69bd; - border: 1px solid #d1d9ff; +.mail-preview-area.active { + width: 600px; + border-left: 1px solid var(--border-color); + visibility: visible; } -.ai-recommend.manual-mode { - background: var(--hover-bg); - color: var(--text-sub); - border: 1px dashed var(--border-color); - font-weight: 400; +.preview-header { + height: 56px; padding: 0 24px; border-bottom: 1px solid var(--border-color); + display: flex; align-items: center; justify-content: space-between; + background: #fff; flex-shrink: 0; } -.path-display { - cursor: pointer; - padding: 4px 10px; - border-radius: 6px; - transition: all 0.2s ease; +.preview-header h3 { font-size: 15px; font-weight: 800; color: var(--primary-color); margin: 0; } + +#fullViewBtn { + background: var(--primary-lv-0) !important; + color: var(--primary-color) !important; + border: 1px solid var(--primary-lv-1) !important; + font-weight: 700 !important; + padding: 4px 16px !important; + border-radius: 4px !important; + font-size: 11px !important; + transition: 0.2s !important; +} +#fullViewBtn:hover { background: var(--primary-lv-1) !important; } + +.preview-toggle-handle { + position: absolute; left: -20px; top: 50%; transform: translateY(-50%); + width: 20px; height: 60px; background: var(--primary-color); color: #fff; + display: flex; align-items: center; justify-content: center; + border-radius: 8px 0 0 8px; font-size: 10px; cursor: pointer; + box-shadow: -2px 0 5px rgba(0,0,0,0.1); z-index: 100; +} +.preview-toggle-handle:hover { background: var(--primary-hover); } + +.a4-container { + flex: 1; padding: 30px; overflow-y: auto; background: #e9ecef; + display: flex; justify-content: center; +} + +.a4-container iframe, .a4-container .preview-placeholder { + width: 100%; height: 100%; background: #fff; + box-shadow: 0 4px 20px rgba(0,0,0,0.08); border-radius: 4px; +} + +.preview-placeholder { + display: flex; align-items: center; justify-content: center; + text-align: center; color: var(--text-sub); font-size: 13px; line-height: 1.6; +} + +.mail-preview-area.active > * { opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; } +.mail-preview-area > *:not(.preview-toggle-handle) { opacity: 0; visibility: hidden; pointer-events: none; transition: 0.2s; } + +/* 6. Footer & Others */ +.address-book-footer { + position: absolute; bottom: 0; left: 0; width: 100%; padding: 12px 16px; + border-top: 1px solid var(--border-color); background: #fff; display: flex; gap: 8px; z-index: 5; } .file-log-area { - display: none; - width: 100%; - margin-top: 10px; - background: #1a202c; - border-radius: 4px; - padding: 12px; - font-family: monospace; - font-size: 11px; - color: #cbd5e0; -} - -.file-log-area.active { - display: block; -} - -.log-line { - margin-bottom: 2px; -} - -.log-success { - color: #48bb78; - font-weight: 700; -} - -.log-info { - color: #63b3ed; -} - -/* Toggle Switch */ -.switch { - position: relative; - display: inline-block; - width: 34px; - height: 20px; -} - -.switch input { - opacity: 0; - width: 0; - height: 0; + display: none; width: 100%; margin-top: 10px; background: #1a202c; + border-radius: 4px; padding: 12px; font-family: monospace; font-size: 11px; color: #cbd5e0; } +.file-log-area.active { display: block; } +.log-success { color: #48bb78; font-weight: 700; } +.switch { position: relative; display: inline-block; width: 34px; height: 20px; } +.switch input { opacity: 0; width: 0; height: 0; } .slider { - position: absolute; - cursor: pointer; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: #ccc; - transition: .4s; - border-radius: 20px; + position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; + background-color: #ccc; transition: .4s; border-radius: 20px; } - .slider:before { - position: absolute; - content: ""; - height: 14px; - width: 14px; - left: 3px; - bottom: 3px; - background-color: white; - transition: .4s; - border-radius: 50%; + position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; + background-color: white; transition: .4s; border-radius: 50%; } +input:checked+.slider { background: var(--ai-gradient); } +input:checked+.slider:before { transform: translateX(14px); } -input:checked+.slider { - background: var(--ai-gradient); -} - -input:checked+.slider:before { - transform: translateX(14px); -} - -.ai-toggle-wrap { +/* Restore Path Selector Modal Specific Styles */ +.select-group { display: flex; - align-items: center; - gap: var(--space-sm); - font-size: 12px; - font-weight: 600; - color: var(--text-sub); + flex-direction: column; + gap: 8px; } -input:checked~.ai-label { - color: #6d3dc2; +.select-group label { + font-size: 12px; + font-weight: 700; + color: var(--text-main); +} + +.modal-select { + width: 100%; + height: 44px; + padding: 0 15px; + border: 1px solid var(--border-color); + border-radius: 8px; + background-color: #f9f9f9; + font-size: 14px; + color: #333; + outline: none; + transition: all 0.2s; + cursor: pointer; + appearance: none; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L2 4h8L6 8z'/%3E%3C/svg%3E"); + background-repeat: no-repeat; + background-position: right 15px center; +} + +.modal-select:focus { + border-color: var(--primary-color); + background-color: #fff; + box-shadow: 0 0 0 3px rgba(30, 81, 73, 0.1); +} + +.modal-select option { + padding: 10px; } diff --git a/templates/dashboard.html b/templates/dashboard.html index 155a087..ac3ed67 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -60,15 +60,15 @@
- -