feat: 동물약만 보기 체크박스 필터 추가
- 검색창 옆에 '🐾 동물약만 보기' 체크박스
- animal_only 파라미터로 API 필터링
- POS_BOON='010103' 기준 필터
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user