From d106db64f3cbf4afddecdb8163ef94ed7f277815 Mon Sep 17 00:00:00 2001 From: thug0bin Date: Fri, 27 Feb 2026 17:58:08 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=8F=99=EB=AC=BC=EC=95=BD=EB=A7=8C=20?= =?UTF-8?q?=EB=B3=B4=EA=B8=B0=20=EC=B2=B4=ED=81=AC=EB=B0=95=EC=8A=A4=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 검색창 옆에 '🐾 동물약만 보기' 체크박스 - animal_only 파라미터로 API 필터링 - POS_BOON='010103' 기준 필터 --- backend/app.py | 9 ++++++++- backend/templates/admin_products.html | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/backend/app.py b/backend/app.py index 57f40b0..33139d0 100644 --- a/backend/app.py +++ b/backend/app.py @@ -2650,6 +2650,7 @@ def api_products(): """ search = request.args.get('search', '').strip() limit = int(request.args.get('limit', 100)) + animal_only = request.args.get('animal_only', '0') == '1' if not search or len(search) < 2: return jsonify({'success': False, 'error': '검색어는 2글자 이상 입력하세요'}) @@ -2700,6 +2701,12 @@ def api_products(): items = [] for row in rows: + is_animal = row.pos_boon == '010103' + + # 동물약만 필터링 + if animal_only and not is_animal: + continue + items.append({ 'drug_code': row.drug_code or '', 'product_name': row.product_name or '', @@ -2708,7 +2715,7 @@ def api_products(): 'cost_price': float(row.cost_price) if row.cost_price else 0, 'supplier': row.supplier or '', 'is_set': bool(row.is_set), - 'is_animal_drug': row.pos_boon == '010103' + 'is_animal_drug': is_animal }) return jsonify({ diff --git a/backend/templates/admin_products.html b/backend/templates/admin_products.html index dcd6144..dcd9857 100644 --- a/backend/templates/admin_products.html +++ b/backend/templates/admin_products.html @@ -356,8 +356,16 @@ onkeypress="if(event.key==='Enter')searchProducts()"> -
- 예시 타이레놀, 벤포파워, 8806418067510, LB000001423 +
+
+ 예시 타이레놀, 벤포파워, 8806418067510, LB000001423 +
+
@@ -441,7 +449,8 @@ const tbody = document.getElementById('productsTableBody'); tbody.innerHTML = '

검색 중...

'; - fetch(`/api/products?search=${encodeURIComponent(search)}`) + const animalOnly = document.getElementById('animalOnly').checked; + fetch(`/api/products?search=${encodeURIComponent(search)}${animalOnly ? '&animal_only=1' : ''}`) .then(res => res.json()) .then(data => { if (data.success) {