From b5d18f1d159e56ec20e2b02f25b9db54c883fad1 Mon Sep 17 00:00:00 2001 From: furkanyigit34 <134547018+furkanyigit34@users.noreply.github.com> Date: Fri, 27 Mar 2026 15:25:03 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20"T=C3=BCm=C3=BCn=C3=BC=20Se=C3=A7"=20t?= =?UTF-8?q?=C3=BCm=20alt=20kategorileri=20se=C3=A7meli,=20sadece=20filtrel?= =?UTF-8?q?enenleri=20de=C4=9Fil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ne yaptık: - "Tümünü Seç" artık arama filtresi aktifken bile tüm alt kategorileri seçiyor - Tüm alt kategoriler seçiliyse subcategory_ids gönderilmiyor (backend zaten tümünü tarıyor) - URL uzunluk limitine takılma riski ortadan kalktı - Label'a seçili/toplam sayacı eklendi (ör: 45/105) Neden yaptık: - Kozmetik gibi 105 alt kategorili ana kategoride "Tümünü Seç" sadece filtrelenmiş kategorileri seçiyordu, bu yüzden raporda 1 kategori (~100 ürün) taranıyordu. Şimdi 105 kategori (~10.500 ürün) taranacak. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/components/ReportGeneration.jsx | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/admin-panel/src/components/ReportGeneration.jsx b/admin-panel/src/components/ReportGeneration.jsx index 092cf6d..fc868a5 100644 --- a/admin-panel/src/components/ReportGeneration.jsx +++ b/admin-panel/src/components/ReportGeneration.jsx @@ -148,7 +148,10 @@ function ReportGeneration() { category_id: selectedCategory.id } - if (selectedSubCategories.length > 0) { + // Tüm alt kategoriler seçiliyse subcategory_ids gönderme — backend zaten tümünü tarar + const allSelected = selectedSubCategories.length > 0 && + selectedSubCategories.length === subCategories.length + if (selectedSubCategories.length > 0 && !allSelected) { requestBody.subcategory_ids = selectedSubCategories.map(cat => cat.id) } @@ -426,27 +429,28 @@ function ReportGeneration() { onClick={() => { if (generating) return const allIds = new Set(selectedSubCategories.map(c => c.id)) - const allSelected = filteredSubCategories.every(c => allIds.has(c.id)) + const allSelected = subCategories.every(c => allIds.has(c.id)) if (allSelected) { - const filterIds = new Set(filteredSubCategories.map(c => c.id)) - setSelectedSubCategories(prev => prev.filter(c => !filterIds.has(c.id))) + setSelectedSubCategories([]) } else { - const newOnes = filteredSubCategories.filter(c => !allIds.has(c.id)) + const newOnes = subCategories.filter(c => !allIds.has(c.id)) setSelectedSubCategories(prev => [...prev, ...newOnes]) } }} className={`flex items-center px-5 py-2.5 border-b border-slate-100 cursor-pointer hover:bg-slate-50 transition-colors ${generating ? 'opacity-50 cursor-not-allowed' : ''}`} >
0 && filteredSubCategories.every(c => selectedSubCategories.some(s => s.id === c.id)) + subCategories.length > 0 && subCategories.every(c => selectedSubCategories.some(s => s.id === c.id)) ? 'bg-orange-500 border-orange-500' : 'border-slate-300' }`}> - {filteredSubCategories.length > 0 && filteredSubCategories.every(c => selectedSubCategories.some(s => s.id === c.id)) && ( + {subCategories.length > 0 && subCategories.every(c => selectedSubCategories.some(s => s.id === c.id)) && ( )}
- Tümünü seç + + Tümünü seç ({selectedSubCategories.length}/{subCategories.length}) + {filteredSubCategories.length > 0 ? (