Files
ihaleist/src/components/tools/ResultSearch.jsx
T

78 lines
3.4 KiB
React
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import React, { useState } from 'react';
import { useApp } from '../../context/AppContext';
import { Trophy, Search, Building2, CheckCircle2, Award } from 'lucide-react';
export const ResultSearch = () => {
const { tenders } = useApp();
const [query, setQuery] = useState('');
const completedTenders = tenders.filter(t => t.durum === 'Sonuçlandı' || t.kazananFirma);
const filteredResults = completedTenders.filter(t => {
if (!query) return true;
const q = query.toLowerCase();
return (
(t.baslik || '').toLowerCase().includes(q) ||
(t.ikn || '').toLowerCase().includes(q) ||
(t.kurum || '').toLowerCase().includes(q) ||
(t.kazananFirma && t.kazananFirma.toLowerCase().includes(q))
);
});
return (
<div className="space-y-4 my-4 animate-fade-in">
<div className="bg-white rounded-xl border border-slate-200 p-5 shadow-xs flex flex-col md:flex-row items-center justify-between gap-4">
<div className="flex items-center gap-3">
<div className="w-10 h-10 rounded-xl bg-amber-500 text-white flex items-center justify-center shadow-md">
<Trophy className="w-6 h-6" />
</div>
<div>
<h1 className="text-xl font-black text-slate-900">İhale Sonuç Sorgulama</h1>
<p className="text-xs text-slate-500">Sonuçlanmış ihaleleri, kazanan firmaları ve sözleşme bedellerini sorgulayın.</p>
</div>
</div>
<div className="relative w-full md:w-80">
<input
type="text"
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder="İKN, kurum veya kazanan firma ara..."
className="w-full bg-slate-50 border border-slate-300 rounded-lg pl-9 pr-4 py-2 text-xs font-semibold"
/>
<Search className="w-4 h-4 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2" />
</div>
</div>
<div className="space-y-3">
{filteredResults.map(t => (
<div key={t.id} className="bg-white rounded-xl border border-slate-200 p-4 shadow-xs flex flex-col md:flex-row items-center justify-between gap-4">
<div className="space-y-1 flex-1">
<div className="flex items-center gap-2">
<span className="text-[10px] font-extrabold bg-amber-100 text-amber-900 px-2 py-0.5 rounded">
#{t.ikn}
</span>
<span className="text-xs text-slate-500 font-semibold">{t.tarih}</span>
</div>
<h3 className="font-bold text-sm text-slate-900">{t.baslik}</h3>
<p className="text-xs text-slate-500 flex items-center gap-1">
<Building2 className="w-3.5 h-3.5 text-slate-400" /> {t.kurum} ({t.sehir})
</p>
</div>
<div className="bg-emerald-50 border border-emerald-200 p-3 rounded-xl text-right shrink-0 w-full md:w-64">
<span className="text-[10px] font-bold text-emerald-700 block uppercase tracking-wider">KAZANAN FİRMA</span>
<p className="font-extrabold text-xs text-emerald-950 truncate">{t.kazananFirma || 'Kazanan açıklanmamış'}</p>
<p className="font-black text-sm text-emerald-700 mt-0.5">
₺{(t.sozlesmeBedeli || 57400).toLocaleString('tr-TR')}
</p>
</div>
</div>
))}
</div>
</div>
);
};