feat: 제품 검색 페이지에 재고 컬럼 추가 (초록/빨강 표시)
This commit is contained in:
parent
c1c38c68ac
commit
95d7ebab71
@ -3067,8 +3067,10 @@ def api_products():
|
|||||||
ELSE ''
|
ELSE ''
|
||||||
END as supplier,
|
END as supplier,
|
||||||
CASE WHEN SET_CHK.is_set = 1 THEN 1 ELSE 0 END as is_set,
|
CASE WHEN SET_CHK.is_set = 1 THEN 1 ELSE 0 END as is_set,
|
||||||
G.POS_BOON as pos_boon
|
G.POS_BOON as pos_boon,
|
||||||
|
ISNULL(IT.IM_QT_sale_debit, 0) as stock
|
||||||
FROM CD_GOODS G
|
FROM CD_GOODS G
|
||||||
|
LEFT JOIN IM_total IT ON G.DrugCode = IT.DrugCode
|
||||||
OUTER APPLY (
|
OUTER APPLY (
|
||||||
SELECT TOP 1 CD_CD_BARCODE
|
SELECT TOP 1 CD_CD_BARCODE
|
||||||
FROM CD_ITEM_UNIT_MEMBER
|
FROM CD_ITEM_UNIT_MEMBER
|
||||||
@ -3108,7 +3110,8 @@ def api_products():
|
|||||||
'cost_price': float(row.cost_price) if row.cost_price else 0,
|
'cost_price': float(row.cost_price) if row.cost_price else 0,
|
||||||
'supplier': row.supplier or '',
|
'supplier': row.supplier or '',
|
||||||
'is_set': bool(row.is_set),
|
'is_set': bool(row.is_set),
|
||||||
'is_animal_drug': is_animal
|
'is_animal_drug': is_animal,
|
||||||
|
'stock': int(row.stock) if row.stock else 0
|
||||||
})
|
})
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
|
|||||||
34
backend/scripts/debug_gesidin_match.py
Normal file
34
backend/scripts/debug_gesidin_match.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys, io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# 테스트 AI 응답
|
||||||
|
ai_response = "개시딘은 피부염 치료에 사용하는 겔 형태의 외용약입니다."
|
||||||
|
|
||||||
|
drug_name = "(판)복합개시딘"
|
||||||
|
|
||||||
|
# 현재 매칭 로직
|
||||||
|
base_name = drug_name.split('(')[0].split('/')[0].strip()
|
||||||
|
print(f'제품명: {drug_name}')
|
||||||
|
print(f'괄호 앞: "{base_name}"')
|
||||||
|
|
||||||
|
# suffix 제거
|
||||||
|
for suffix in ['정', '액', 'L', 'M', 'S', 'XL', 'XS', 'SS', 'mini']:
|
||||||
|
if base_name.endswith(suffix):
|
||||||
|
base_name = base_name[:-len(suffix)]
|
||||||
|
base_name = base_name.strip()
|
||||||
|
print(f'suffix 제거 후: "{base_name}"')
|
||||||
|
|
||||||
|
# 매칭 테스트
|
||||||
|
ai_lower = ai_response.lower()
|
||||||
|
ai_nospace = ai_lower.replace(' ', '')
|
||||||
|
base_lower = base_name.lower()
|
||||||
|
base_nospace = base_lower.replace(' ', '')
|
||||||
|
|
||||||
|
print(f'\n매칭 테스트:')
|
||||||
|
print(f' "{base_lower}" in ai_response? {base_lower in ai_lower}')
|
||||||
|
print(f' "{base_nospace}" in ai_nospace? {base_nospace in ai_nospace}')
|
||||||
|
|
||||||
|
# 문제: (판)이 먼저 잘려서 빈 문자열이 됨!
|
||||||
|
print(f'\n문제: split("(")[0] = "{drug_name.split("(")[0]}"')
|
||||||
|
print('→ "(판)"에서 "("로 시작하니까 빈 문자열!')
|
||||||
23
backend/scripts/fix_gesidin_boon.py
Normal file
23
backend/scripts/fix_gesidin_boon.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys, io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.path.insert(0, 'c:\\Users\\청춘약국\\source\\pharmacy-pos-qr-system\\backend')
|
||||||
|
|
||||||
|
from db.dbsetup import get_db_session
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
|
session = get_db_session('PM_DRUG')
|
||||||
|
|
||||||
|
print('업데이트 전:')
|
||||||
|
r = session.execute(text("SELECT GoodsName, POS_BOON FROM CD_GOODS WHERE DrugCode = 'LB000003140'")).fetchone()
|
||||||
|
print(f' {r.GoodsName}: POS_BOON = {r.POS_BOON}')
|
||||||
|
|
||||||
|
session.execute(text("UPDATE CD_GOODS SET POS_BOON = '010103' WHERE DrugCode = 'LB000003140'"))
|
||||||
|
session.commit()
|
||||||
|
|
||||||
|
print('\n업데이트 후:')
|
||||||
|
r2 = session.execute(text("SELECT GoodsName, POS_BOON FROM CD_GOODS WHERE DrugCode = 'LB000003140'")).fetchone()
|
||||||
|
print(f' {r2.GoodsName}: POS_BOON = {r2.POS_BOON}')
|
||||||
|
print(' ✅ 완료!')
|
||||||
|
|
||||||
|
session.close()
|
||||||
36
backend/scripts/list_petfarm.py
Normal file
36
backend/scripts/list_petfarm.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys, io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.path.insert(0, 'c:\\Users\\청춘약국\\source\\pharmacy-pos-qr-system\\backend')
|
||||||
|
|
||||||
|
from db.dbsetup import get_db_session
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
|
session = get_db_session('PM_DRUG')
|
||||||
|
|
||||||
|
print('=== 펫팜 공급 동물약 ===\n')
|
||||||
|
result = session.execute(text("""
|
||||||
|
SELECT
|
||||||
|
G.DrugCode,
|
||||||
|
G.GoodsName,
|
||||||
|
G.POS_BOON,
|
||||||
|
S.SplName,
|
||||||
|
(
|
||||||
|
SELECT TOP 1 U.CD_CD_BARCODE
|
||||||
|
FROM CD_ITEM_UNIT_MEMBER U
|
||||||
|
WHERE U.DRUGCODE = G.DrugCode
|
||||||
|
AND U.CD_CD_BARCODE LIKE '023%'
|
||||||
|
) AS APC_CODE
|
||||||
|
FROM CD_GOODS G
|
||||||
|
LEFT JOIN CD_SALEGOODS S ON G.DrugCode = S.DrugCode
|
||||||
|
WHERE S.SplName LIKE N'%펫팜%'
|
||||||
|
ORDER BY G.GoodsName
|
||||||
|
"""))
|
||||||
|
|
||||||
|
for row in result:
|
||||||
|
apc_status = f'✅ {row.APC_CODE}' if row.APC_CODE else '❌ 없음'
|
||||||
|
boon_status = '🐾' if row.POS_BOON == '010103' else ' '
|
||||||
|
print(f'{boon_status} {row.GoodsName}')
|
||||||
|
print(f' APC: {apc_status}')
|
||||||
|
|
||||||
|
session.close()
|
||||||
16
backend/scripts/test_gestage_api.py
Normal file
16
backend/scripts/test_gestage_api.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys, io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.path.insert(0, 'c:\\Users\\청춘약국\\source\\pharmacy-pos-qr-system\\backend')
|
||||||
|
|
||||||
|
from app import _get_animal_drugs
|
||||||
|
|
||||||
|
drugs = _get_animal_drugs()
|
||||||
|
gestage = [d for d in drugs if '제스타제' in d['name']]
|
||||||
|
|
||||||
|
print('=== 제스타제 API 결과 ===\n')
|
||||||
|
for d in gestage:
|
||||||
|
print(f"name: {d['name']}")
|
||||||
|
print(f"barcode: {d['barcode']}")
|
||||||
|
print(f"apc: {d['apc']}")
|
||||||
|
print(f"image_url: {d['image_url']}")
|
||||||
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>제품 검색 - 청춘약국</title>
|
<title>?<3F>품 검??- <20>?<3F><>?<3F>국</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<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">
|
<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;
|
color: #1e293b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 헤더 ── */
|
/* ?<3F>?<3F> ?<3F>더 ?<3F>?<3F> */
|
||||||
.header {
|
.header {
|
||||||
background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 50%, #a78bfa 100%);
|
background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 50%, #a78bfa 100%);
|
||||||
padding: 28px 32px 24px;
|
padding: 28px 32px 24px;
|
||||||
@ -46,14 +46,14 @@
|
|||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 컨텐츠 ── */
|
/* ?<3F>?<3F> 컨텐<ECBBA8>??<3F>?<3F> */
|
||||||
.content {
|
.content {
|
||||||
max-width: 1100px;
|
max-width: 1100px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 24px 20px 60px;
|
padding: 24px 20px 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 플로팅 챗봇 ── */
|
/* ?<3F>?<3F> ?<3F>로??챗봇 ?<3F>?<3F> */
|
||||||
.chatbot-panel {
|
.chatbot-panel {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 24px;
|
right: 24px;
|
||||||
@ -224,7 +224,7 @@
|
|||||||
30% { transform: translateY(-6px); opacity: 1; }
|
30% { transform: translateY(-6px); opacity: 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 챗봇 토글 버튼 (항상 표시) ── */
|
/* ?<3F>?<3F> 챗봇 ?<3F><>? 버튼 (??<3F><> ?<3F>시) ?<3F>?<3F> */
|
||||||
.chatbot-toggle {
|
.chatbot-toggle {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 24px;
|
bottom: 24px;
|
||||||
@ -253,7 +253,7 @@
|
|||||||
box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
|
box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 모바일 */
|
/* 모바??*/
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.chatbot-panel {
|
.chatbot-panel {
|
||||||
right: 0;
|
right: 0;
|
||||||
@ -266,7 +266,7 @@
|
|||||||
.chatbot-toggle { bottom: 16px; right: 16px; }
|
.chatbot-toggle { bottom: 16px; right: 16px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 검색 영역 ── */
|
/* ?<3F>?<3F> 검???<3F>역 ?<3F>?<3F> */
|
||||||
.search-section {
|
.search-section {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
@ -320,7 +320,7 @@
|
|||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 결과 카운트 ── */
|
/* ?<3F>?<3F> 결과 카운???<3F>?<3F> */
|
||||||
.result-count {
|
.result-count {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@ -331,7 +331,7 @@
|
|||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 테이블 ── */
|
/* ?<3F>?<3F> ?<3F>이<EFBFBD>??<3F>?<3F> */
|
||||||
.table-wrap {
|
.table-wrap {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
@ -362,7 +362,7 @@
|
|||||||
tbody tr:hover { background: #faf5ff; }
|
tbody tr:hover { background: #faf5ff; }
|
||||||
tbody tr:last-child td { border-bottom: none; }
|
tbody tr:last-child td { border-bottom: none; }
|
||||||
|
|
||||||
/* ── 상품 정보 ── */
|
/* ?<3F>?<3F> ?<3F>품 ?<3F>보 ?<3F>?<3F> */
|
||||||
.product-name {
|
.product-name {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #1e293b;
|
color: #1e293b;
|
||||||
@ -377,7 +377,7 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 코드/바코드 ── */
|
/* ?<3F>?<3F> 코드/바코???<3F>?<3F> */
|
||||||
.code {
|
.code {
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@ -398,14 +398,25 @@
|
|||||||
color: #94a3b8;
|
color: #94a3b8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 가격 ── */
|
/* 가격 */
|
||||||
.price {
|
.price {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #1e293b;
|
color: #1e293b;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
/* 재고 */
|
||||||
|
.stock {
|
||||||
|
font-weight: 600;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.stock.in-stock {
|
||||||
|
color: #10b981;
|
||||||
|
}
|
||||||
|
.stock.out-stock {
|
||||||
|
color: #ef4444;
|
||||||
|
}
|
||||||
|
|
||||||
/* ── QR 버튼 ── */
|
/* QR 버튼 */
|
||||||
.btn-qr {
|
.btn-qr {
|
||||||
background: #8b5cf6;
|
background: #8b5cf6;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@ -421,7 +432,7 @@
|
|||||||
.btn-qr:hover { background: #7c3aed; }
|
.btn-qr:hover { background: #7c3aed; }
|
||||||
.btn-qr:active { transform: scale(0.95); }
|
.btn-qr:active { transform: scale(0.95); }
|
||||||
|
|
||||||
/* ── 빈 상태 ── */
|
/* ?<3F>?<3F> <20>??<3F>태 ?<3F>?<3F> */
|
||||||
.empty-state {
|
.empty-state {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 60px 20px;
|
padding: 60px 20px;
|
||||||
@ -435,7 +446,7 @@
|
|||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 모달 ── */
|
/* ?<3F>?<3F> 모달 ?<3F>?<3F> */
|
||||||
.modal-overlay {
|
.modal-overlay {
|
||||||
display: none;
|
display: none;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@ -471,7 +482,7 @@
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 수량 선택기 ── */
|
/* ?<3F>?<3F> ?<3F>량 ?<3F>택<EFBFBD>??<3F>?<3F> */
|
||||||
.qty-selector {
|
.qty-selector {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -539,7 +550,7 @@
|
|||||||
.modal-btn.confirm { background: #8b5cf6; color: #fff; }
|
.modal-btn.confirm { background: #8b5cf6; color: #fff; }
|
||||||
.modal-btn.confirm:hover { background: #7c3aed; }
|
.modal-btn.confirm:hover { background: #7c3aed; }
|
||||||
|
|
||||||
/* ── 반응형 ── */
|
/* ?<3F>?<3F> 반응???<3F>?<3F> */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.search-box { flex-direction: column; }
|
.search-box { flex-direction: column; }
|
||||||
.table-wrap { overflow-x: auto; }
|
.table-wrap { overflow-x: auto; }
|
||||||
@ -550,33 +561,33 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="header-nav">
|
<div class="header-nav">
|
||||||
<a href="/admin">← 관리자 홈</a>
|
<a href="/admin">??관리자 ??/a>
|
||||||
<div>
|
<div>
|
||||||
<a href="/admin/sales-detail" style="margin-right: 16px;">판매 조회</a>
|
<a href="/admin/sales-detail" style="margin-right: 16px;">?<3F>매 조회</a>
|
||||||
<a href="/admin/sales">판매 내역</a>
|
<a href="/admin/sales">?<3F>매 ?<3F>역</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h1>🔍 제품 검색</h1>
|
<h1>?<3F><> ?<3F>품 검??/h1>
|
||||||
<p>전체 제품 검색 · QR 라벨 인쇄 · 🐾 동물약 AI 상담</p>
|
<p>?<3F>체 ?<3F>품 검??· QR ?<3F>벨 ?<3F>쇄 · ?<3F><> ?<3F>물??AI ?<3F>담</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<!-- 검색 -->
|
<!-- 검??-->
|
||||||
<div class="search-section">
|
<div class="search-section">
|
||||||
<div class="search-box">
|
<div class="search-box">
|
||||||
<input type="text" class="search-input" id="searchInput"
|
<input type="text" class="search-input" id="searchInput"
|
||||||
placeholder="상품명, 바코드, 상품코드로 검색..."
|
placeholder="?<3F>품<EFBFBD>? 바코?? ?<3F>품코드<ECBD94>?검??.."
|
||||||
onkeypress="if(event.key==='Enter')searchProducts()">
|
onkeypress="if(event.key==='Enter')searchProducts()">
|
||||||
<button class="search-btn" onclick="searchProducts()">🔍 검색</button>
|
<button class="search-btn" onclick="searchProducts()">?<3F><> 검??/button>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 12px;">
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 12px;">
|
||||||
<div class="search-hint">
|
<div class="search-hint">
|
||||||
<span>예시</span> 타이레놀, 벤포파워, 8806418067510, LB000001423
|
<span>?<3F>시</span> ?<3F>?<3F>레?<3F>, 벤포?<3F>워, 8806418067510, LB000001423
|
||||||
</div>
|
</div>
|
||||||
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: #475569;">
|
<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;">
|
<input type="checkbox" id="animalOnly" style="width: 18px; height: 18px; accent-color: #10b981; cursor: pointer;">
|
||||||
<span style="display: flex; align-items: center; gap: 4px;">
|
<span style="display: flex; align-items: center; gap: 4px;">
|
||||||
🐾 <strong style="color: #10b981;">동물약만</strong> 보기
|
?<3F><> <strong style="color: #10b981;">?<3F>물?<3F>만</strong> 보기
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@ -584,25 +595,25 @@
|
|||||||
|
|
||||||
<!-- 결과 -->
|
<!-- 결과 -->
|
||||||
<div class="result-count" id="resultCount" style="display:none;">
|
<div class="result-count" id="resultCount" style="display:none;">
|
||||||
검색 결과: <strong id="resultNum">0</strong>건
|
검??결과: <strong id="resultNum">0</strong><EFBFBD>? </div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="table-wrap">
|
<div class="table-wrap">
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>상품명</th>
|
<th>?<3F>품<EFBFBD>?/th>
|
||||||
<th>상품코드</th>
|
<th>?<3F>품코드</th>
|
||||||
<th>바코드</th>
|
<th>바코??/th>
|
||||||
<th>판매가</th>
|
<th>?<3F>고</th>
|
||||||
|
<th>?<3F>매가</th>
|
||||||
<th>QR</th>
|
<th>QR</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="productsTableBody">
|
<tbody id="productsTableBody">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5" class="empty-state">
|
<td colspan="6" class="empty-state">
|
||||||
<div class="icon">🔍</div>
|
<div class="icon">?<3F><></div>
|
||||||
<p>상품명, 바코드, 상품코드로 검색하세요</p>
|
<p>?<3F>품<EFBFBD>? 바코?? ?<3F>품코드<ECBD94>?검?<3F>하?<3F>요</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -610,51 +621,51 @@
|
|||||||
</div>
|
</div>
|
||||||
</div><!-- /.content -->
|
</div><!-- /.content -->
|
||||||
|
|
||||||
<!-- 동물약 챗봇 패널 -->
|
<!-- ?<3F>물??챗봇 ?<3F>널 -->
|
||||||
<div class="chatbot-panel" id="chatbotPanel">
|
<div class="chatbot-panel" id="chatbotPanel">
|
||||||
<div class="chatbot-header">
|
<div class="chatbot-header">
|
||||||
<h2>🐾 동물약 AI 상담</h2>
|
<h2>?<3F><> ?<3F>물??AI ?<3F>담</h2>
|
||||||
<p>심장사상충, 외부기생충, 구충제 등 무엇이든 물어보세요</p>
|
<p>?<3F>장?<3F>상<EFBFBD>? ?<3F><>?기생<EAB8B0>? 구충????무엇?<3F>든 물어보세??/p>
|
||||||
</div>
|
</div>
|
||||||
<div class="chatbot-suggestions">
|
<div class="chatbot-suggestions">
|
||||||
<button class="suggestion-chip" onclick="sendSuggestion('강아지 심장사상충 약 추천해줘')">🐕 심장사상충약</button>
|
<button class="suggestion-chip" onclick="sendSuggestion('강아지 ?<3F>장?<3F>상<EFBFBD>???추천?<3F>줘')">?<3F><> ?<3F>장?<3F>상충약</button>
|
||||||
<button class="suggestion-chip" onclick="sendSuggestion('넥스가드랑 브라벡토 차이점')">넥스가드 vs 브라벡토</button>
|
<button class="suggestion-chip" onclick="sendSuggestion('?<3F>스가?<3F>랑 브라벡토 차이??)">?<3F>스가??vs 브라벡토</button>
|
||||||
<button class="suggestion-chip" onclick="sendSuggestion('고양이 벼룩 약 뭐가 좋아?')">🐱 고양이 벼룩약</button>
|
<button class="suggestion-chip" onclick="sendSuggestion('고양??벼룩 ??뭐<>? 좋아?')">?<3F><> 고양??벼룩??/button>
|
||||||
<button class="suggestion-chip" onclick="sendSuggestion('강아지 구충제 추천')">🪱 구충제</button>
|
<button class="suggestion-chip" onclick="sendSuggestion('강아지 구충??추천')">?<3F><> 구충??/button>
|
||||||
</div>
|
</div>
|
||||||
<div class="chatbot-messages" id="chatMessages">
|
<div class="chatbot-messages" id="chatMessages">
|
||||||
<div class="chat-message assistant">
|
<div class="chat-message assistant">
|
||||||
안녕하세요! 🐾 동물약 상담 AI입니다.<br><br>
|
?<3F>녕?<3F>세?? ?<3F><> ?<3F>물???<3F>담 AI?<3F>니??<br><br>
|
||||||
반려동물의 <strong>심장사상충 예방</strong>, <strong>벼룩/진드기 예방</strong>, <strong>구충제</strong> 등에 대해 무엇이든 물어보세요!
|
반려?<3F>물??<strong>?<3F>장?<3F>상<EFBFBD>??<3F>방</strong>, <strong>벼룩/진드<EFBFBD>??<3F>방</strong>, <strong>구충??/strong> ?<3F>에 ?<3F>??무엇?<3F>든 물어보세??
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chatbot-input">
|
<div class="chatbot-input">
|
||||||
<input type="text" id="chatInput" placeholder="예: 5kg 강아지 심장사상충 약 추천해줘"
|
<input type="text" id="chatInput" placeholder="?? 5kg 강아지 ?<3F>장?<3F>상<EFBFBD>???추천?<3F>줘"
|
||||||
onkeypress="if(event.key==='Enter')sendChat()">
|
onkeypress="if(event.key==='Enter')sendChat()">
|
||||||
<button onclick="sendChat()" id="chatSendBtn">➤</button>
|
<button onclick="sendChat()" id="chatSendBtn">??/button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 챗봇 토글 버튼 -->
|
<!-- 챗봇 ?<3F><>? 버튼 -->
|
||||||
<button class="chatbot-toggle" id="chatbotToggle" onclick="toggleChatbot()">🐾</button>
|
<button class="chatbot-toggle" id="chatbotToggle" onclick="toggleChatbot()">?<3F><></button>
|
||||||
|
|
||||||
<!-- QR 인쇄 모달 -->
|
<!-- QR ?<3F>쇄 모달 -->
|
||||||
<div class="modal-overlay" id="qrModal" onclick="if(event.target===this)closeQRModal()">
|
<div class="modal-overlay" id="qrModal" onclick="if(event.target===this)closeQRModal()">
|
||||||
<div class="modal-box">
|
<div class="modal-box">
|
||||||
<div class="modal-title">🏷️ QR 라벨 인쇄</div>
|
<div class="modal-title">?<3F><><EFBFBD>?QR ?<3F>벨 ?<3F>쇄</div>
|
||||||
<div id="qrInfo" style="margin-bottom:12px;"></div>
|
<div id="qrInfo" style="margin-bottom:12px;"></div>
|
||||||
<div class="modal-preview" id="qrPreview">
|
<div class="modal-preview" id="qrPreview">
|
||||||
<p style="color:#64748b;">미리보기 로딩 중...</p>
|
<p style="color:#64748b;">미리보기 로딩 <EFBFBD>?..</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="qty-label">인쇄 매수</div>
|
<div class="qty-label">?<3F>쇄 매수</div>
|
||||||
<div class="qty-selector">
|
<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>
|
<div class="qty-value" id="qtyValue">1</div>
|
||||||
<button class="qty-btn" onclick="adjustQty(1)" id="qtyPlus">+</button>
|
<button class="qty-btn" onclick="adjustQty(1)" id="qtyPlus">+</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-btns">
|
<div class="modal-btns">
|
||||||
<button class="modal-btn cancel" onclick="closeQRModal()">취소</button>
|
<button class="modal-btn cancel" onclick="closeQRModal()">취소</button>
|
||||||
<button class="modal-btn confirm" onclick="confirmPrintQR()" id="printBtn">인쇄</button>
|
<button class="modal-btn confirm" onclick="confirmPrintQR()" id="printBtn">?<3F>쇄</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -668,7 +679,7 @@
|
|||||||
|
|
||||||
function formatPrice(num) {
|
function formatPrice(num) {
|
||||||
if (!num) return '-';
|
if (!num) return '-';
|
||||||
return new Intl.NumberFormat('ko-KR').format(num) + '원';
|
return new Intl.NumberFormat('ko-KR').format(num) + '??;
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeHtml(str) {
|
function escapeHtml(str) {
|
||||||
@ -679,16 +690,16 @@
|
|||||||
function searchProducts() {
|
function searchProducts() {
|
||||||
const search = document.getElementById('searchInput').value.trim();
|
const search = document.getElementById('searchInput').value.trim();
|
||||||
if (!search) {
|
if (!search) {
|
||||||
alert('검색어를 입력하세요');
|
alert('검?<3F>어<EFBFBD>??<3F>력?<3F>세??);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (search.length < 2) {
|
if (search.length < 2) {
|
||||||
alert('2글자 이상 입력하세요');
|
alert('2글???<3F>상 ?<3F>력?<3F>세??);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tbody = document.getElementById('productsTableBody');
|
const tbody = document.getElementById('productsTableBody');
|
||||||
tbody.innerHTML = '<tr><td colspan="5" class="empty-state"><p>검색 중...</p></td></tr>';
|
tbody.innerHTML = '<tr><td colspan="6" class="empty-state"><p>검??<3F>?..</p></td></tr>';
|
||||||
|
|
||||||
const animalOnly = document.getElementById('animalOnly').checked;
|
const animalOnly = document.getElementById('animalOnly').checked;
|
||||||
fetch(`/api/products?search=${encodeURIComponent(search)}${animalOnly ? '&animal_only=1' : ''}`)
|
fetch(`/api/products?search=${encodeURIComponent(search)}${animalOnly ? '&animal_only=1' : ''}`)
|
||||||
@ -700,11 +711,11 @@
|
|||||||
document.getElementById('resultNum').textContent = productsData.length;
|
document.getElementById('resultNum').textContent = productsData.length;
|
||||||
renderTable();
|
renderTable();
|
||||||
} else {
|
} else {
|
||||||
tbody.innerHTML = `<tr><td colspan="5" class="empty-state"><p>오류: ${data.error}</p></td></tr>`;
|
tbody.innerHTML = `<tr><td colspan="6" class="empty-state"><p>?<3F>류: ${data.error}</p></td></tr>`;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
tbody.innerHTML = '<tr><td colspan="5" class="empty-state"><p>검색 실패</p></td></tr>';
|
tbody.innerHTML = '<tr><td colspan="6" class="empty-state"><p>검???<3F>패</p></td></tr>';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,7 +723,7 @@
|
|||||||
const tbody = document.getElementById('productsTableBody');
|
const tbody = document.getElementById('productsTableBody');
|
||||||
|
|
||||||
if (productsData.length === 0) {
|
if (productsData.length === 0) {
|
||||||
tbody.innerHTML = '<tr><td colspan="5" class="empty-state"><div class="icon">📭</div><p>검색 결과가 없습니다</p></td></tr>';
|
tbody.innerHTML = '<tr><td colspan="6" class="empty-state"><div class="icon">?<3F><></div><p>검??결과가 ?<3F>습?<3F>다</p></td></tr>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,23 +732,24 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="product-name">
|
<div class="product-name">
|
||||||
${escapeHtml(item.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;">🐾 동물약</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;">?<3F><> ?<3F>물??/span>' : ''}
|
||||||
</div>
|
</div>
|
||||||
<div class="product-supplier ${item.is_set ? 'set' : ''}">${escapeHtml(item.supplier) || ''}</div>
|
<div class="product-supplier ${item.is_set ? 'set' : ''}">${escapeHtml(item.supplier) || ''}</div>
|
||||||
</td>
|
</td>
|
||||||
<td><span class="code code-drug">${item.drug_code}</span></td>
|
<td><span class="code code-drug">${item.drug_code}</span></td>
|
||||||
<td>${item.barcode
|
<td>${item.barcode
|
||||||
? `<span class="code code-barcode">${item.barcode}</span>`
|
? `<span class="code code-barcode">${item.barcode}</span>`
|
||||||
: `<span class="code code-na">없음</span>`}</td>
|
: `<span class="code code-na">?<3F>음</span>`}</td>
|
||||||
|
<td class="stock ${item.stock > 0 ? 'in-stock' : 'out-stock'}">${item.stock || 0}<7D>?/td>
|
||||||
<td class="price">${formatPrice(item.sale_price)}</td>
|
<td class="price">${formatPrice(item.sale_price)}</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn-qr" onclick="printQR(${idx})">🏷️ QR</button>
|
<button class="btn-qr" onclick="printQR(${idx})">?<3F><><EFBFBD>?QR</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
`).join('');
|
`).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── QR 인쇄 관련 ──
|
// ?<3F>?<3F> QR ?<3F>쇄 관???<3F>?<3F>
|
||||||
function adjustQty(delta) {
|
function adjustQty(delta) {
|
||||||
printQty = Math.max(MIN_QTY, Math.min(MAX_QTY, printQty + delta));
|
printQty = Math.max(MIN_QTY, Math.min(MAX_QTY, printQty + delta));
|
||||||
updateQtyUI();
|
updateQtyUI();
|
||||||
@ -747,7 +759,7 @@
|
|||||||
document.getElementById('qtyValue').textContent = printQty;
|
document.getElementById('qtyValue').textContent = printQty;
|
||||||
document.getElementById('qtyMinus').disabled = printQty <= MIN_QTY;
|
document.getElementById('qtyMinus').disabled = printQty <= MIN_QTY;
|
||||||
document.getElementById('qtyPlus').disabled = printQty >= MAX_QTY;
|
document.getElementById('qtyPlus').disabled = printQty >= MAX_QTY;
|
||||||
document.getElementById('printBtn').textContent = printQty > 1 ? `${printQty}장 인쇄` : '인쇄';
|
document.getElementById('printBtn').textContent = printQty > 1 ? `${printQty}???<3F>쇄` : '?<3F>쇄';
|
||||||
}
|
}
|
||||||
|
|
||||||
function printQR(idx) {
|
function printQR(idx) {
|
||||||
@ -758,12 +770,12 @@
|
|||||||
const preview = document.getElementById('qrPreview');
|
const preview = document.getElementById('qrPreview');
|
||||||
const info = document.getElementById('qrInfo');
|
const info = document.getElementById('qrInfo');
|
||||||
|
|
||||||
preview.innerHTML = '<p style="color:#64748b;">미리보기 로딩 중...</p>';
|
preview.innerHTML = '<p style="color:#64748b;">미리보기 로딩 <EFBFBD>?..</p>';
|
||||||
info.innerHTML = `
|
info.innerHTML = `
|
||||||
<strong>${escapeHtml(selectedItem.product_name)}</strong><br>
|
<strong>${escapeHtml(selectedItem.product_name)}</strong><br>
|
||||||
<span style="color:#64748b;font-size:13px;">
|
<span style="color:#64748b;font-size:13px;">
|
||||||
바코드: ${selectedItem.barcode || selectedItem.drug_code || 'N/A'}<br>
|
바코?? ${selectedItem.barcode || selectedItem.drug_code || 'N/A'}<br>
|
||||||
가격: ${formatPrice(selectedItem.sale_price)}
|
가<EFBFBD>? ${formatPrice(selectedItem.sale_price)}
|
||||||
</span>
|
</span>
|
||||||
`;
|
`;
|
||||||
updateQtyUI();
|
updateQtyUI();
|
||||||
@ -784,11 +796,11 @@
|
|||||||
if (data.success && data.image) {
|
if (data.success && data.image) {
|
||||||
preview.innerHTML = `<img src="${data.image}" alt="QR 미리보기">`;
|
preview.innerHTML = `<img src="${data.image}" alt="QR 미리보기">`;
|
||||||
} else {
|
} else {
|
||||||
preview.innerHTML = '<p style="color:#ef4444;">미리보기 실패</p>';
|
preview.innerHTML = '<p style="color:#ef4444;">미리보기 ?<3F>패</p>';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
preview.innerHTML = '<p style="color:#ef4444;">미리보기 오류</p>';
|
preview.innerHTML = '<p style="color:#ef4444;">미리보기 ?<3F>류</p>';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,7 +821,7 @@
|
|||||||
let errorMsg = '';
|
let errorMsg = '';
|
||||||
|
|
||||||
for (let i = 0; i < totalQty; i++) {
|
for (let i = 0; i < totalQty; i++) {
|
||||||
btn.textContent = `인쇄 중... (${i + 1}/${totalQty})`;
|
btn.textContent = `?<3F>쇄 <20>?.. (${i + 1}/${totalQty})`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/qr-print', {
|
const res = await fetch('/api/qr-print', {
|
||||||
@ -827,7 +839,7 @@
|
|||||||
if (data.success) {
|
if (data.success) {
|
||||||
successCount++;
|
successCount++;
|
||||||
} else {
|
} else {
|
||||||
errorMsg = data.error || '알 수 없는 오류';
|
errorMsg = data.error || '?????<3F>는 ?<3F>류';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,21 +856,20 @@
|
|||||||
updateQtyUI();
|
updateQtyUI();
|
||||||
|
|
||||||
if (successCount === totalQty) {
|
if (successCount === totalQty) {
|
||||||
alert(`✅ QR 라벨 ${totalQty}장 인쇄 완료!`);
|
alert(`??QR ?<3F>벨 ${totalQty}???<3F>쇄 ?<3F>료!`);
|
||||||
closeQRModal();
|
closeQRModal();
|
||||||
} else if (successCount > 0) {
|
} else if (successCount > 0) {
|
||||||
alert(`⚠️ ${successCount}/${totalQty}장 인쇄 완료\n오류: ${errorMsg}`);
|
alert(`?<3F>️ ${successCount}/${totalQty}???<3F>쇄 ?<3F>료\n?<3F>류: ${errorMsg}`);
|
||||||
} else {
|
} else {
|
||||||
alert(`❌ 인쇄 실패: ${errorMsg}`);
|
alert(`???<3F>쇄 ?<3F>패: ${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 chatHistory = [];
|
||||||
let isChatLoading = false;
|
let isChatLoading = false;
|
||||||
|
|
||||||
@ -867,7 +878,7 @@
|
|||||||
const btn = document.getElementById('chatbotToggle');
|
const btn = document.getElementById('chatbotToggle');
|
||||||
const isOpen = panel.classList.toggle('open');
|
const isOpen = panel.classList.toggle('open');
|
||||||
btn.classList.toggle('active', isOpen);
|
btn.classList.toggle('active', isOpen);
|
||||||
btn.innerHTML = isOpen ? '✕' : '🐾';
|
btn.innerHTML = isOpen ? '?? : '?<3F><>';
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
document.getElementById('chatInput').focus();
|
document.getElementById('chatInput').focus();
|
||||||
}
|
}
|
||||||
@ -884,14 +895,14 @@
|
|||||||
|
|
||||||
if (!message || isChatLoading) return;
|
if (!message || isChatLoading) return;
|
||||||
|
|
||||||
// 사용자 메시지 표시
|
// ?<3F>용??메시지 ?<3F>시
|
||||||
addChatMessage('user', message);
|
addChatMessage('user', message);
|
||||||
input.value = '';
|
input.value = '';
|
||||||
|
|
||||||
// 히스토리에 추가
|
// ?<3F>스?<3F>리??추<>?
|
||||||
chatHistory.push({ role: 'user', content: message });
|
chatHistory.push({ role: 'user', content: message });
|
||||||
|
|
||||||
// 로딩 표시
|
// 로딩 ?<3F>시
|
||||||
isChatLoading = true;
|
isChatLoading = true;
|
||||||
document.getElementById('chatSendBtn').disabled = true;
|
document.getElementById('chatSendBtn').disabled = true;
|
||||||
showTypingIndicator();
|
showTypingIndicator();
|
||||||
@ -908,22 +919,22 @@
|
|||||||
hideTypingIndicator();
|
hideTypingIndicator();
|
||||||
|
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
// AI 응답 표시
|
// AI ?<3F>답 ?<3F>시
|
||||||
addChatMessage('assistant', data.message, data.products);
|
addChatMessage('assistant', data.message, data.products);
|
||||||
|
|
||||||
// 히스토리에 추가
|
// ?<3F>스?<3F>리??추<>?
|
||||||
chatHistory.push({ role: 'assistant', content: data.message });
|
chatHistory.push({ role: 'assistant', content: data.message });
|
||||||
|
|
||||||
// 히스토리 길이 제한 (최근 20개)
|
// ?<3F>스?<3F>리 길이 ?<3F>한 (최근 20<32>?
|
||||||
if (chatHistory.length > 20) {
|
if (chatHistory.length > 20) {
|
||||||
chatHistory = chatHistory.slice(-20);
|
chatHistory = chatHistory.slice(-20);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
addChatMessage('system', '⚠️ ' + (data.message || '오류가 발생했습니다'));
|
addChatMessage('system', '?<3F>️ ' + (data.message || '?<3F>류가 발생?<3F>습?<3F>다'));
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
hideTypingIndicator();
|
hideTypingIndicator();
|
||||||
addChatMessage('system', '⚠️ 네트워크 오류가 발생했습니다');
|
addChatMessage('system', '?<3F>️ ?<3F>트?<3F>크 ?<3F>류가 발생?<3F>습?<3F>다');
|
||||||
}
|
}
|
||||||
|
|
||||||
isChatLoading = false;
|
isChatLoading = false;
|
||||||
@ -935,19 +946,19 @@
|
|||||||
const msgDiv = document.createElement('div');
|
const msgDiv = document.createElement('div');
|
||||||
msgDiv.className = `chat-message ${role}`;
|
msgDiv.className = `chat-message ${role}`;
|
||||||
|
|
||||||
// 줄바꿈 처리
|
// 줄바<EFBFBD>?처리
|
||||||
let htmlContent = escapeHtml(content).replace(/\n/g, '<br>');
|
let htmlContent = escapeHtml(content).replace(/\n/g, '<br>');
|
||||||
|
|
||||||
// 마크다운 굵게 처리
|
// 마크?<3F>운 굵게 처리
|
||||||
htmlContent = htmlContent.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>');
|
htmlContent = htmlContent.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>');
|
||||||
|
|
||||||
msgDiv.innerHTML = htmlContent;
|
msgDiv.innerHTML = htmlContent;
|
||||||
|
|
||||||
// 언급된 제품 표시 (이미지 포함)
|
// ?<3F>급???<3F>품 ?<3F>시 (?<3F><>?지 ?<3F>함)
|
||||||
if (products && products.length > 0) {
|
if (products && products.length > 0) {
|
||||||
const productsDiv = document.createElement('div');
|
const productsDiv = document.createElement('div');
|
||||||
productsDiv.className = 'products-mentioned';
|
productsDiv.className = 'products-mentioned';
|
||||||
productsDiv.innerHTML = '<small style="color:#64748b;">📦 관련 제품:</small>';
|
productsDiv.innerHTML = '<small style="color:#64748b;">?<3F><> 관???<3F>품:</small>';
|
||||||
|
|
||||||
const productsGrid = document.createElement('div');
|
const productsGrid = document.createElement('div');
|
||||||
productsGrid.style.cssText = 'display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;';
|
productsGrid.style.cssText = 'display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;';
|
||||||
@ -958,7 +969,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.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);
|
card.onclick = () => searchProductFromChat(p.name);
|
||||||
|
|
||||||
// 이미지 컨테이너
|
// ?<3F><>?지 컨테?<3F>너
|
||||||
const imgContainer = document.createElement('div');
|
const imgContainer = document.createElement('div');
|
||||||
imgContainer.style.cssText = 'width:40px;height:40px;flex-shrink:0;';
|
imgContainer.style.cssText = 'width:40px;height:40px;flex-shrink:0;';
|
||||||
|
|
||||||
@ -968,17 +979,14 @@
|
|||||||
img.src = p.image_url;
|
img.src = p.image_url;
|
||||||
img.alt = p.name;
|
img.alt = p.name;
|
||||||
img.onerror = function() {
|
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);
|
imgContainer.appendChild(img);
|
||||||
} else {
|
} 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>`;
|
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);
|
card.appendChild(imgContainer);
|
||||||
@ -1010,12 +1018,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchProductFromChat(productName) {
|
function searchProductFromChat(productName) {
|
||||||
// 챗봇에서 제품 클릭 시 검색창에 입력하고 검색
|
// 챗봇?<3F>서 ?<3F>품 ?<3F>릭 ??검?<3F>창???<3F>력?<3F>고 검?? document.getElementById('searchInput').value = productName;
|
||||||
document.getElementById('searchInput').value = productName;
|
|
||||||
document.getElementById('animalOnly').checked = true;
|
document.getElementById('animalOnly').checked = true;
|
||||||
searchProducts();
|
searchProducts();
|
||||||
|
|
||||||
// 모바일에서 챗봇 닫기
|
// 모바?<3F>에??챗봇 ?<3F>기
|
||||||
if (window.innerWidth <= 1100) {
|
if (window.innerWidth <= 1100) {
|
||||||
document.getElementById('chatbotPanel').classList.remove('open');
|
document.getElementById('chatbotPanel').classList.remove('open');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user