diff --git a/backend/app.py b/backend/app.py index 979b4d0..70e0841 100644 --- a/backend/app.py +++ b/backend/app.py @@ -5070,14 +5070,15 @@ def api_admin_pos_live_detail(order_no): mssql_conn = mssql_engine.raw_connection() cursor = mssql_conn.cursor() - # 품목 상세 조회 + # 품목 상세 조회 (바코드 포함) cursor.execute(""" SELECT S.DrugCode AS drug_code, ISNULL(G.GoodsName, '(약품명 없음)') AS product_name, S.SL_NM_item AS quantity, S.SL_NM_cost_a AS unit_price, - S.SL_TOTAL_PRICE AS total_price + S.SL_TOTAL_PRICE AS total_price, + G.Barcode AS barcode FROM SALE_SUB S LEFT JOIN PM_DRUG.dbo.CD_GOODS G ON S.DrugCode = G.DrugCode WHERE S.SL_NO_order = ? @@ -5092,7 +5093,8 @@ def api_admin_pos_live_detail(order_no): 'product_name': row[1], 'quantity': int(row[2]) if row[2] else 0, 'unit_price': float(row[3]) if row[3] else 0, - 'total_price': float(row[4]) if row[4] else 0 + 'total_price': float(row[4]) if row[4] else 0, + 'barcode': row[5] or '' }) return jsonify({ diff --git a/backend/templates/admin_otc_labels.html b/backend/templates/admin_otc_labels.html index cbef6bb..4951287 100644 --- a/backend/templates/admin_otc_labels.html +++ b/backend/templates/admin_otc_labels.html @@ -401,6 +401,30 @@ debounceTimer = setTimeout(previewLabel, 500); }); }); + + // URL 파라미터로 바코드/이름 전달 시 자동 로드 + const params = new URLSearchParams(window.location.search); + const urlBarcode = params.get('barcode'); + const urlName = params.get('name'); + if (urlBarcode) { + currentBarcode = urlBarcode; + currentDrugName = urlName || urlBarcode; + document.getElementById('barcode').value = urlBarcode; + document.getElementById('searchInput').value = urlName || urlBarcode; + + // 기존 프리셋 확인 + fetch(`/api/admin/otc-labels/${urlBarcode}`) + .then(res => res.json()) + .then(data => { + if (data.exists) { + document.getElementById('displayName').value = data.label.display_name || ''; + document.getElementById('effect').value = data.label.effect || ''; + document.getElementById('dosageInstruction').value = data.label.dosage_instruction || ''; + document.getElementById('usageTip').value = data.label.usage_tip || ''; + } + previewLabel(); + }); + } }); // 약품 검색 (MSSQL) diff --git a/backend/templates/admin_pos_live.html b/backend/templates/admin_pos_live.html index 05ee683..235150a 100644 --- a/backend/templates/admin_pos_live.html +++ b/backend/templates/admin_pos_live.html @@ -400,6 +400,24 @@ font-family: 'JetBrains Mono', monospace; font-weight: 600; } + .item-label-btn { + padding: 4px 8px; + background: linear-gradient(135deg, #f59e0b, #d97706); + border: none; + border-radius: 6px; + font-size: 12px; + cursor: pointer; + margin-left: 8px; + transition: all 0.2s; + } + .item-label-btn:hover { + transform: scale(1.1); + box-shadow: 0 2px 8px rgba(245,158,11,0.4); + } + .item-label-btn:disabled { + opacity: 0.6; + cursor: wait; + } /* ── 오버레이 ── */ .overlay { @@ -1139,6 +1157,7 @@ ${item.product_name} ×${item.quantity} ₩${Math.floor(item.total_price).toLocaleString()} + ${item.barcode ? `` : ''} `).join(''); document.getElementById('itemsList').innerHTML = itemsHtml; @@ -1149,6 +1168,61 @@ document.getElementById('itemsList').innerHTML = `