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) {