fix: admin_products.html 인코딩 수정 + 재고 컬럼 추가
This commit is contained in:
parent
95d7ebab71
commit
21e07bcca9
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>?<3F>품 검??- <20>?<3F><>?<3F>국</title>
|
||||
<title>제품 검색 - 청춘약국</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
@ -16,7 +16,7 @@
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
/* ?<3F>?<3F> ?<3F>더 ?<3F>?<3F> */
|
||||
/* ── 헤더 ── */
|
||||
.header {
|
||||
background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 50%, #a78bfa 100%);
|
||||
padding: 28px 32px 24px;
|
||||
@ -46,14 +46,14 @@
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
/* ?<3F>?<3F> 컨텐<ECBBA8>??<3F>?<3F> */
|
||||
/* ── 컨텐츠 ── */
|
||||
.content {
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 20px 60px;
|
||||
}
|
||||
|
||||
/* ?<3F>?<3F> ?<3F>로??챗봇 ?<3F>?<3F> */
|
||||
/* ── 플로팅 챗봇 ── */
|
||||
.chatbot-panel {
|
||||
position: fixed;
|
||||
right: 24px;
|
||||
@ -224,7 +224,7 @@
|
||||
30% { transform: translateY(-6px); opacity: 1; }
|
||||
}
|
||||
|
||||
/* ?<3F>?<3F> 챗봇 ?<3F><>? 버튼 (??<3F><> ?<3F>시) ?<3F>?<3F> */
|
||||
/* ── 챗봇 토글 버튼 (항상 표시) ── */
|
||||
.chatbot-toggle {
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
@ -253,7 +253,7 @@
|
||||
box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
|
||||
}
|
||||
|
||||
/* 모바??*/
|
||||
/* 모바일 */
|
||||
@media (max-width: 640px) {
|
||||
.chatbot-panel {
|
||||
right: 0;
|
||||
@ -266,7 +266,7 @@
|
||||
.chatbot-toggle { bottom: 16px; right: 16px; }
|
||||
}
|
||||
|
||||
/* ?<3F>?<3F> 검???<3F>역 ?<3F>?<3F> */
|
||||
/* ── 검색 영역 ── */
|
||||
.search-section {
|
||||
background: #fff;
|
||||
border-radius: 14px;
|
||||
@ -320,7 +320,7 @@
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
/* ?<3F>?<3F> 결과 카운???<3F>?<3F> */
|
||||
/* ── 결과 카운트 ── */
|
||||
.result-count {
|
||||
margin-bottom: 16px;
|
||||
font-size: 14px;
|
||||
@ -331,7 +331,7 @@
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* ?<3F>?<3F> ?<3F>이<EFBFBD>??<3F>?<3F> */
|
||||
/* ── 테이블 ── */
|
||||
.table-wrap {
|
||||
background: #fff;
|
||||
border-radius: 14px;
|
||||
@ -362,7 +362,7 @@
|
||||
tbody tr:hover { background: #faf5ff; }
|
||||
tbody tr:last-child td { border-bottom: none; }
|
||||
|
||||
/* ?<3F>?<3F> ?<3F>품 ?<3F>보 ?<3F>?<3F> */
|
||||
/* ── 상품 정보 ── */
|
||||
.product-name {
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
@ -377,7 +377,7 @@
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* ?<3F>?<3F> 코드/바코???<3F>?<3F> */
|
||||
/* ── 코드/바코드 ── */
|
||||
.code {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 12px;
|
||||
@ -398,25 +398,22 @@
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
/* 가격 */
|
||||
/* ── 가격 ── */
|
||||
.price {
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* 재고 */
|
||||
/* ── 재고 ── */
|
||||
.stock {
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
.stock.in-stock {
|
||||
color: #10b981;
|
||||
}
|
||||
.stock.out-stock {
|
||||
color: #ef4444;
|
||||
}
|
||||
.stock.in-stock { color: #10b981; }
|
||||
.stock.out-stock { color: #ef4444; }
|
||||
|
||||
/* QR 버튼 */
|
||||
/* ── QR 버튼 ── */
|
||||
.btn-qr {
|
||||
background: #8b5cf6;
|
||||
color: #fff;
|
||||
@ -432,7 +429,7 @@
|
||||
.btn-qr:hover { background: #7c3aed; }
|
||||
.btn-qr:active { transform: scale(0.95); }
|
||||
|
||||
/* ?<3F>?<3F> <20>??<3F>태 ?<3F>?<3F> */
|
||||
/* ── 빈 상태 ── */
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 60px 20px;
|
||||
@ -446,7 +443,7 @@
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
/* ?<3F>?<3F> 모달 ?<3F>?<3F> */
|
||||
/* ── 모달 ── */
|
||||
.modal-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
@ -482,7 +479,7 @@
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
/* ?<3F>?<3F> ?<3F>량 ?<3F>택<EFBFBD>??<3F>?<3F> */
|
||||
/* ── 수량 선택기 ── */
|
||||
.qty-selector {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -550,7 +547,7 @@
|
||||
.modal-btn.confirm { background: #8b5cf6; color: #fff; }
|
||||
.modal-btn.confirm:hover { background: #7c3aed; }
|
||||
|
||||
/* ?<3F>?<3F> 반응???<3F>?<3F> */
|
||||
/* ── 반응형 ── */
|
||||
@media (max-width: 768px) {
|
||||
.search-box { flex-direction: column; }
|
||||
.table-wrap { overflow-x: auto; }
|
||||
@ -561,33 +558,33 @@
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="header-nav">
|
||||
<a href="/admin">??관리자 ??/a>
|
||||
<a href="/admin">← 관리자 홈</a>
|
||||
<div>
|
||||
<a href="/admin/sales-detail" style="margin-right: 16px;">?<3F>매 조회</a>
|
||||
<a href="/admin/sales">?<3F>매 ?<3F>역</a>
|
||||
<a href="/admin/sales-detail" style="margin-right: 16px;">판매 조회</a>
|
||||
<a href="/admin/sales">판매 내역</a>
|
||||
</div>
|
||||
</div>
|
||||
<h1>?<3F><> ?<3F>품 검??/h1>
|
||||
<p>?<3F>체 ?<3F>품 검??· QR ?<3F>벨 ?<3F>쇄 · ?<3F><> ?<3F>물??AI ?<3F>담</p>
|
||||
<h1>🔍 제품 검색</h1>
|
||||
<p>전체 제품 검색 · QR 라벨 인쇄 · 🐾 동물약 AI 상담</p>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<!-- 검??-->
|
||||
<!-- 검색 -->
|
||||
<div class="search-section">
|
||||
<div class="search-box">
|
||||
<input type="text" class="search-input" id="searchInput"
|
||||
placeholder="?<3F>품<EFBFBD>? 바코?? ?<3F>품코드<ECBD94>?검??.."
|
||||
placeholder="상품명, 바코드, 상품코드로 검색..."
|
||||
onkeypress="if(event.key==='Enter')searchProducts()">
|
||||
<button class="search-btn" onclick="searchProducts()">?<3F><> 검??/button>
|
||||
<button class="search-btn" onclick="searchProducts()">🔍 검색</button>
|
||||
</div>
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 12px;">
|
||||
<div class="search-hint">
|
||||
<span>?<3F>시</span> ?<3F>?<3F>레?<3F>, 벤포?<3F>워, 8806418067510, LB000001423
|
||||
<span>예시</span> 타이레놀, 벤포파워, 8806418067510, LB000001423
|
||||
</div>
|
||||
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: #475569;">
|
||||
<input type="checkbox" id="animalOnly" style="width: 18px; height: 18px; accent-color: #10b981; cursor: pointer;">
|
||||
<span style="display: flex; align-items: center; gap: 4px;">
|
||||
?<3F><> <strong style="color: #10b981;">?<3F>물?<3F>만</strong> 보기
|
||||
🐾 <strong style="color: #10b981;">동물약만</strong> 보기
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
@ -595,25 +592,26 @@
|
||||
|
||||
<!-- 결과 -->
|
||||
<div class="result-count" id="resultCount" style="display:none;">
|
||||
검??결과: <strong id="resultNum">0</strong><EFBFBD>? </div>
|
||||
검색 결과: <strong id="resultNum">0</strong>건
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>?<3F>품<EFBFBD>?/th>
|
||||
<th>?<3F>품코드</th>
|
||||
<th>바코??/th>
|
||||
<th>?<3F>고</th>
|
||||
<th>?<3F>매가</th>
|
||||
<th>상품명</th>
|
||||
<th>상품코드</th>
|
||||
<th>바코드</th>
|
||||
<th>재고</th>
|
||||
<th>판매가</th>
|
||||
<th>QR</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="productsTableBody">
|
||||
<tr>
|
||||
<td colspan="6" class="empty-state">
|
||||
<div class="icon">?<3F><></div>
|
||||
<p>?<3F>품<EFBFBD>? 바코?? ?<3F>품코드<ECBD94>?검?<3F>하?<3F>요</p>
|
||||
<div class="icon">🔍</div>
|
||||
<p>상품명, 바코드, 상품코드로 검색하세요</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -621,51 +619,51 @@
|
||||
</div>
|
||||
</div><!-- /.content -->
|
||||
|
||||
<!-- ?<3F>물??챗봇 ?<3F>널 -->
|
||||
<!-- 동물약 챗봇 패널 -->
|
||||
<div class="chatbot-panel" id="chatbotPanel">
|
||||
<div class="chatbot-header">
|
||||
<h2>?<3F><> ?<3F>물??AI ?<3F>담</h2>
|
||||
<p>?<3F>장?<3F>상<EFBFBD>? ?<3F><>?기생<EAB8B0>? 구충????무엇?<3F>든 물어보세??/p>
|
||||
<h2>🐾 동물약 AI 상담</h2>
|
||||
<p>심장사상충, 외부기생충, 구충제 등 무엇이든 물어보세요</p>
|
||||
</div>
|
||||
<div class="chatbot-suggestions">
|
||||
<button class="suggestion-chip" onclick="sendSuggestion('강아지 ?<3F>장?<3F>상<EFBFBD>???추천?<3F>줘')">?<3F><> ?<3F>장?<3F>상충약</button>
|
||||
<button class="suggestion-chip" onclick="sendSuggestion('?<3F>스가?<3F>랑 브라벡토 차이??)">?<3F>스가??vs 브라벡토</button>
|
||||
<button class="suggestion-chip" onclick="sendSuggestion('고양??벼룩 ??뭐<>? 좋아?')">?<3F><> 고양??벼룩??/button>
|
||||
<button class="suggestion-chip" onclick="sendSuggestion('강아지 구충??추천')">?<3F><> 구충??/button>
|
||||
<button class="suggestion-chip" onclick="sendSuggestion('강아지 심장사상충 약 추천해줘')">🐕 심장사상충약</button>
|
||||
<button class="suggestion-chip" onclick="sendSuggestion('넥스가드랑 브라벡토 차이점')">넥스가드 vs 브라벡토</button>
|
||||
<button class="suggestion-chip" onclick="sendSuggestion('고양이 벼룩 약 뭐가 좋아?')">🐱 고양이 벼룩약</button>
|
||||
<button class="suggestion-chip" onclick="sendSuggestion('강아지 구충제 추천')">🪱 구충제</button>
|
||||
</div>
|
||||
<div class="chatbot-messages" id="chatMessages">
|
||||
<div class="chat-message assistant">
|
||||
?<3F>녕?<3F>세?? ?<3F><> ?<3F>물???<3F>담 AI?<3F>니??<br><br>
|
||||
반려?<3F>물??<strong>?<3F>장?<3F>상<EFBFBD>??<3F>방</strong>, <strong>벼룩/진드<EFBFBD>??<3F>방</strong>, <strong>구충??/strong> ?<3F>에 ?<3F>??무엇?<3F>든 물어보세??
|
||||
안녕하세요! 🐾 동물약 상담 AI입니다.<br><br>
|
||||
반려동물의 <strong>심장사상충 예방</strong>, <strong>벼룩/진드기 예방</strong>, <strong>구충제</strong> 등에 대해 무엇이든 물어보세요!
|
||||
</div>
|
||||
</div>
|
||||
<div class="chatbot-input">
|
||||
<input type="text" id="chatInput" placeholder="?? 5kg 강아지 ?<3F>장?<3F>상<EFBFBD>???추천?<3F>줘"
|
||||
<input type="text" id="chatInput" placeholder="예: 5kg 강아지 심장사상충 약 추천해줘"
|
||||
onkeypress="if(event.key==='Enter')sendChat()">
|
||||
<button onclick="sendChat()" id="chatSendBtn">??/button>
|
||||
<button onclick="sendChat()" id="chatSendBtn">➤</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 챗봇 ?<3F><>? 버튼 -->
|
||||
<button class="chatbot-toggle" id="chatbotToggle" onclick="toggleChatbot()">?<3F><></button>
|
||||
<!-- 챗봇 토글 버튼 -->
|
||||
<button class="chatbot-toggle" id="chatbotToggle" onclick="toggleChatbot()">🐾</button>
|
||||
|
||||
<!-- QR ?<3F>쇄 모달 -->
|
||||
<!-- QR 인쇄 모달 -->
|
||||
<div class="modal-overlay" id="qrModal" onclick="if(event.target===this)closeQRModal()">
|
||||
<div class="modal-box">
|
||||
<div class="modal-title">?<3F><><EFBFBD>?QR ?<3F>벨 ?<3F>쇄</div>
|
||||
<div class="modal-title">🏷️ QR 라벨 인쇄</div>
|
||||
<div id="qrInfo" style="margin-bottom:12px;"></div>
|
||||
<div class="modal-preview" id="qrPreview">
|
||||
<p style="color:#64748b;">미리보기 로딩 <EFBFBD>?..</p>
|
||||
<p style="color:#64748b;">미리보기 로딩 중...</p>
|
||||
</div>
|
||||
<div class="qty-label">?<3F>쇄 매수</div>
|
||||
<div class="qty-label">인쇄 매수</div>
|
||||
<div class="qty-selector">
|
||||
<button class="qty-btn" onclick="adjustQty(-1)" id="qtyMinus">??/button>
|
||||
<button class="qty-btn" onclick="adjustQty(-1)" id="qtyMinus">−</button>
|
||||
<div class="qty-value" id="qtyValue">1</div>
|
||||
<button class="qty-btn" onclick="adjustQty(1)" id="qtyPlus">+</button>
|
||||
</div>
|
||||
<div class="modal-btns">
|
||||
<button class="modal-btn cancel" onclick="closeQRModal()">취소</button>
|
||||
<button class="modal-btn confirm" onclick="confirmPrintQR()" id="printBtn">?<3F>쇄</button>
|
||||
<button class="modal-btn confirm" onclick="confirmPrintQR()" id="printBtn">인쇄</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -679,7 +677,7 @@
|
||||
|
||||
function formatPrice(num) {
|
||||
if (!num) return '-';
|
||||
return new Intl.NumberFormat('ko-KR').format(num) + '??;
|
||||
return new Intl.NumberFormat('ko-KR').format(num) + '원';
|
||||
}
|
||||
|
||||
function escapeHtml(str) {
|
||||
@ -690,16 +688,16 @@
|
||||
function searchProducts() {
|
||||
const search = document.getElementById('searchInput').value.trim();
|
||||
if (!search) {
|
||||
alert('검?<3F>어<EFBFBD>??<3F>력?<3F>세??);
|
||||
alert('검색어를 입력하세요');
|
||||
return;
|
||||
}
|
||||
if (search.length < 2) {
|
||||
alert('2글???<3F>상 ?<3F>력?<3F>세??);
|
||||
alert('2글자 이상 입력하세요');
|
||||
return;
|
||||
}
|
||||
|
||||
const tbody = document.getElementById('productsTableBody');
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="empty-state"><p>검??<3F>?..</p></td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="empty-state"><p>검색 중...</p></td></tr>';
|
||||
|
||||
const animalOnly = document.getElementById('animalOnly').checked;
|
||||
fetch(`/api/products?search=${encodeURIComponent(search)}${animalOnly ? '&animal_only=1' : ''}`)
|
||||
@ -711,11 +709,11 @@
|
||||
document.getElementById('resultNum').textContent = productsData.length;
|
||||
renderTable();
|
||||
} else {
|
||||
tbody.innerHTML = `<tr><td colspan="6" class="empty-state"><p>?<3F>류: ${data.error}</p></td></tr>`;
|
||||
tbody.innerHTML = `<tr><td colspan="6" class="empty-state"><p>오류: ${data.error}</p></td></tr>`;
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="empty-state"><p>검???<3F>패</p></td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="empty-state"><p>검색 실패</p></td></tr>';
|
||||
});
|
||||
}
|
||||
|
||||
@ -723,7 +721,7 @@
|
||||
const tbody = document.getElementById('productsTableBody');
|
||||
|
||||
if (productsData.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="empty-state"><div class="icon">?<3F><></div><p>검??결과가 ?<3F>습?<3F>다</p></td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="6" class="empty-state"><div class="icon">📭</div><p>검색 결과가 없습니다</p></td></tr>';
|
||||
return;
|
||||
}
|
||||
|
||||
@ -732,24 +730,24 @@
|
||||
<td>
|
||||
<div class="product-name">
|
||||
${escapeHtml(item.product_name)}
|
||||
${item.is_animal_drug ? '<span style="display:inline-block;background:#10b981;color:#fff;font-size:11px;padding:2px 6px;border-radius:4px;margin-left:6px;">?<3F><> ?<3F>물??/span>' : ''}
|
||||
${item.is_animal_drug ? '<span style="display:inline-block;background:#10b981;color:#fff;font-size:11px;padding:2px 6px;border-radius:4px;margin-left:6px;">🐾 동물약</span>' : ''}
|
||||
</div>
|
||||
<div class="product-supplier ${item.is_set ? 'set' : ''}">${escapeHtml(item.supplier) || ''}</div>
|
||||
</td>
|
||||
<td><span class="code code-drug">${item.drug_code}</span></td>
|
||||
<td>${item.barcode
|
||||
? `<span class="code code-barcode">${item.barcode}</span>`
|
||||
: `<span class="code code-na">?<3F>음</span>`}</td>
|
||||
<td class="stock ${item.stock > 0 ? 'in-stock' : 'out-stock'}">${item.stock || 0}<EFBFBD>?/td>
|
||||
: `<span class="code code-na">없음</span>`}</td>
|
||||
<td class="stock ${(item.stock || 0) > 0 ? 'in-stock' : 'out-stock'}">${item.stock || 0}</td>
|
||||
<td class="price">${formatPrice(item.sale_price)}</td>
|
||||
<td>
|
||||
<button class="btn-qr" onclick="printQR(${idx})">?<3F><><EFBFBD>?QR</button>
|
||||
<button class="btn-qr" onclick="printQR(${idx})">🏷️ QR</button>
|
||||
</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
// ?<3F>?<3F> QR ?<3F>쇄 관???<3F>?<3F>
|
||||
// ── QR 인쇄 관련 ──
|
||||
function adjustQty(delta) {
|
||||
printQty = Math.max(MIN_QTY, Math.min(MAX_QTY, printQty + delta));
|
||||
updateQtyUI();
|
||||
@ -759,7 +757,7 @@
|
||||
document.getElementById('qtyValue').textContent = printQty;
|
||||
document.getElementById('qtyMinus').disabled = printQty <= MIN_QTY;
|
||||
document.getElementById('qtyPlus').disabled = printQty >= MAX_QTY;
|
||||
document.getElementById('printBtn').textContent = printQty > 1 ? `${printQty}???<3F>쇄` : '?<3F>쇄';
|
||||
document.getElementById('printBtn').textContent = printQty > 1 ? `${printQty}장 인쇄` : '인쇄';
|
||||
}
|
||||
|
||||
function printQR(idx) {
|
||||
@ -770,12 +768,12 @@
|
||||
const preview = document.getElementById('qrPreview');
|
||||
const info = document.getElementById('qrInfo');
|
||||
|
||||
preview.innerHTML = '<p style="color:#64748b;">미리보기 로딩 <EFBFBD>?..</p>';
|
||||
preview.innerHTML = '<p style="color:#64748b;">미리보기 로딩 중...</p>';
|
||||
info.innerHTML = `
|
||||
<strong>${escapeHtml(selectedItem.product_name)}</strong><br>
|
||||
<span style="color:#64748b;font-size:13px;">
|
||||
바코?? ${selectedItem.barcode || selectedItem.drug_code || 'N/A'}<br>
|
||||
가<EFBFBD>? ${formatPrice(selectedItem.sale_price)}
|
||||
바코드: ${selectedItem.barcode || selectedItem.drug_code || 'N/A'}<br>
|
||||
가격: ${formatPrice(selectedItem.sale_price)}
|
||||
</span>
|
||||
`;
|
||||
updateQtyUI();
|
||||
@ -796,11 +794,11 @@
|
||||
if (data.success && data.image) {
|
||||
preview.innerHTML = `<img src="${data.image}" alt="QR 미리보기">`;
|
||||
} else {
|
||||
preview.innerHTML = '<p style="color:#ef4444;">미리보기 ?<3F>패</p>';
|
||||
preview.innerHTML = '<p style="color:#ef4444;">미리보기 실패</p>';
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
preview.innerHTML = '<p style="color:#ef4444;">미리보기 ?<3F>류</p>';
|
||||
preview.innerHTML = '<p style="color:#ef4444;">미리보기 오류</p>';
|
||||
});
|
||||
}
|
||||
|
||||
@ -821,7 +819,7 @@
|
||||
let errorMsg = '';
|
||||
|
||||
for (let i = 0; i < totalQty; i++) {
|
||||
btn.textContent = `?<3F>쇄 <20>?.. (${i + 1}/${totalQty})`;
|
||||
btn.textContent = `인쇄 중... (${i + 1}/${totalQty})`;
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/qr-print', {
|
||||
@ -839,7 +837,7 @@
|
||||
if (data.success) {
|
||||
successCount++;
|
||||
} else {
|
||||
errorMsg = data.error || '?????<3F>는 ?<3F>류';
|
||||
errorMsg = data.error || '알 수 없는 오류';
|
||||
break;
|
||||
}
|
||||
|
||||
@ -856,20 +854,21 @@
|
||||
updateQtyUI();
|
||||
|
||||
if (successCount === totalQty) {
|
||||
alert(`??QR ?<3F>벨 ${totalQty}???<3F>쇄 ?<3F>료!`);
|
||||
alert(`✅ QR 라벨 ${totalQty}장 인쇄 완료!`);
|
||||
closeQRModal();
|
||||
} else if (successCount > 0) {
|
||||
alert(`?<3F>️ ${successCount}/${totalQty}???<3F>쇄 ?<3F>료\n?<3F>류: ${errorMsg}`);
|
||||
alert(`⚠️ ${successCount}/${totalQty}장 인쇄 완료\n오류: ${errorMsg}`);
|
||||
} else {
|
||||
alert(`???<3F>쇄 ?<3F>패: ${errorMsg}`);
|
||||
alert(`❌ 인쇄 실패: ${errorMsg}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ?<3F>이지 로드 ??검?<3F>창 ?<3F>커?? document.getElementById('searchInput').focus();
|
||||
// 페이지 로드 시 검색창 포커스
|
||||
document.getElementById('searchInput').focus();
|
||||
|
||||
// ?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═
|
||||
// ?<3F>물??챗봇
|
||||
// ?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═?<3F>═
|
||||
// ══════════════════════════════════════════════════════════════════
|
||||
// 동물약 챗봇
|
||||
// ══════════════════════════════════════════════════════════════════
|
||||
let chatHistory = [];
|
||||
let isChatLoading = false;
|
||||
|
||||
@ -878,7 +877,7 @@
|
||||
const btn = document.getElementById('chatbotToggle');
|
||||
const isOpen = panel.classList.toggle('open');
|
||||
btn.classList.toggle('active', isOpen);
|
||||
btn.innerHTML = isOpen ? '?? : '?<3F><>';
|
||||
btn.innerHTML = isOpen ? '✕' : '🐾';
|
||||
if (isOpen) {
|
||||
document.getElementById('chatInput').focus();
|
||||
}
|
||||
@ -895,14 +894,14 @@
|
||||
|
||||
if (!message || isChatLoading) return;
|
||||
|
||||
// ?<3F>용??메시지 ?<3F>시
|
||||
// 사용자 메시지 표시
|
||||
addChatMessage('user', message);
|
||||
input.value = '';
|
||||
|
||||
// ?<3F>스?<3F>리??추<>?
|
||||
// 히스토리에 추가
|
||||
chatHistory.push({ role: 'user', content: message });
|
||||
|
||||
// 로딩 ?<3F>시
|
||||
// 로딩 표시
|
||||
isChatLoading = true;
|
||||
document.getElementById('chatSendBtn').disabled = true;
|
||||
showTypingIndicator();
|
||||
@ -919,22 +918,22 @@
|
||||
hideTypingIndicator();
|
||||
|
||||
if (data.success) {
|
||||
// AI ?<3F>답 ?<3F>시
|
||||
// AI 응답 표시
|
||||
addChatMessage('assistant', data.message, data.products);
|
||||
|
||||
// ?<3F>스?<3F>리??추<>?
|
||||
// 히스토리에 추가
|
||||
chatHistory.push({ role: 'assistant', content: data.message });
|
||||
|
||||
// ?<3F>스?<3F>리 길이 ?<3F>한 (최근 20<32>?
|
||||
// 히스토리 길이 제한 (최근 20개)
|
||||
if (chatHistory.length > 20) {
|
||||
chatHistory = chatHistory.slice(-20);
|
||||
}
|
||||
} else {
|
||||
addChatMessage('system', '?<3F>️ ' + (data.message || '?<3F>류가 발생?<3F>습?<3F>다'));
|
||||
addChatMessage('system', '⚠️ ' + (data.message || '오류가 발생했습니다'));
|
||||
}
|
||||
} catch (error) {
|
||||
hideTypingIndicator();
|
||||
addChatMessage('system', '?<3F>️ ?<3F>트?<3F>크 ?<3F>류가 발생?<3F>습?<3F>다');
|
||||
addChatMessage('system', '⚠️ 네트워크 오류가 발생했습니다');
|
||||
}
|
||||
|
||||
isChatLoading = false;
|
||||
@ -946,19 +945,19 @@
|
||||
const msgDiv = document.createElement('div');
|
||||
msgDiv.className = `chat-message ${role}`;
|
||||
|
||||
// 줄바<EFBFBD>?처리
|
||||
// 줄바꿈 처리
|
||||
let htmlContent = escapeHtml(content).replace(/\n/g, '<br>');
|
||||
|
||||
// 마크?<3F>운 굵게 처리
|
||||
// 마크다운 굵게 처리
|
||||
htmlContent = htmlContent.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>');
|
||||
|
||||
msgDiv.innerHTML = htmlContent;
|
||||
|
||||
// ?<3F>급???<3F>품 ?<3F>시 (?<3F><>?지 ?<3F>함)
|
||||
// 언급된 제품 표시 (이미지 포함)
|
||||
if (products && products.length > 0) {
|
||||
const productsDiv = document.createElement('div');
|
||||
productsDiv.className = 'products-mentioned';
|
||||
productsDiv.innerHTML = '<small style="color:#64748b;">?<3F><> 관???<3F>품:</small>';
|
||||
productsDiv.innerHTML = '<small style="color:#64748b;">📦 관련 제품:</small>';
|
||||
|
||||
const productsGrid = document.createElement('div');
|
||||
productsGrid.style.cssText = 'display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;';
|
||||
@ -969,7 +968,7 @@
|
||||
card.style.cssText = 'display:flex;align-items:center;gap:8px;padding:8px;background:#f8fafc;border-radius:8px;cursor:pointer;border:1px solid #e2e8f0;';
|
||||
card.onclick = () => searchProductFromChat(p.name);
|
||||
|
||||
// ?<3F><>?지 컨테?<3F>너
|
||||
// 이미지 컨테이너
|
||||
const imgContainer = document.createElement('div');
|
||||
imgContainer.style.cssText = 'width:40px;height:40px;flex-shrink:0;';
|
||||
|
||||
@ -979,14 +978,17 @@
|
||||
img.src = p.image_url;
|
||||
img.alt = p.name;
|
||||
img.onerror = function() {
|
||||
// ?<3F><>?지 로드 ?<3F>패 ???<3F>이콘으<ECBD98>??<3F><>? imgContainer.innerHTML = '<div style="width:40px;height:40px;background:#f1f5f9;border-radius:4px;display:flex;align-items:center;justify-content:center;font-size:20px;">?<3F><></div>';
|
||||
// 이미지 로드 실패 시 아이콘으로 대체
|
||||
imgContainer.innerHTML = '<div style="width:40px;height:40px;background:#f1f5f9;border-radius:4px;display:flex;align-items:center;justify-content:center;font-size:20px;">💊</div>';
|
||||
};
|
||||
imgContainer.appendChild(img);
|
||||
} else {
|
||||
// ?<3F><>?지 ?<3F>으<EFBFBD>??<3F>이<EFBFBD>? imgContainer.innerHTML = '<div style="width:40px;height:40px;background:#f1f5f9;border-radius:4px;display:flex;align-items:center;justify-content:center;font-size:20px;">?<3F><></div>';
|
||||
// 이미지 없으면 아이콘
|
||||
imgContainer.innerHTML = '<div style="width:40px;height:40px;background:#f1f5f9;border-radius:4px;display:flex;align-items:center;justify-content:center;font-size:20px;">💊</div>';
|
||||
}
|
||||
|
||||
// ?<3F>스?? const textDiv = document.createElement('div');
|
||||
// 텍스트
|
||||
const textDiv = document.createElement('div');
|
||||
textDiv.innerHTML = `<div style="font-size:13px;font-weight:500;color:#334155;">${p.name}</div><div style="font-size:12px;color:#10b981;">${formatPrice(p.price)}</div>`;
|
||||
|
||||
card.appendChild(imgContainer);
|
||||
@ -1018,11 +1020,12 @@
|
||||
}
|
||||
|
||||
function searchProductFromChat(productName) {
|
||||
// 챗봇?<3F>서 ?<3F>품 ?<3F>릭 ??검?<3F>창???<3F>력?<3F>고 검?? document.getElementById('searchInput').value = productName;
|
||||
// 챗봇에서 제품 클릭 시 검색창에 입력하고 검색
|
||||
document.getElementById('searchInput').value = productName;
|
||||
document.getElementById('animalOnly').checked = true;
|
||||
searchProducts();
|
||||
|
||||
// 모바?<3F>에??챗봇 ?<3F>기
|
||||
// 모바일에서 챗봇 닫기
|
||||
if (window.innerWidth <= 1100) {
|
||||
document.getElementById('chatbotPanel').classList.remove('open');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user