feat: Add Complex (단지선택) filter to Carmodoo search
- Added complex_code parameter to search_cars method - Added /api/carmodoo/complexes endpoint with list of Korean auto complexes - Added Complex dropdown as first filter in admin Cars search - Passes complex_code to Carmodoo API as c_danji parameter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,7 @@ interface LocalCar {
|
||||
}
|
||||
|
||||
interface SearchFilters {
|
||||
complex_code: string; // 단지 코드
|
||||
maker_code: string;
|
||||
model_code: string;
|
||||
grade: string;
|
||||
@@ -99,6 +100,11 @@ interface SearchFilters {
|
||||
displacement_max: string;
|
||||
}
|
||||
|
||||
interface CarmodooComplex {
|
||||
code: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
const FUEL_TYPES = [
|
||||
{ value: '', label: 'All' },
|
||||
{ value: '가솔린', label: 'Gasoline' },
|
||||
@@ -166,6 +172,7 @@ export default function CarsAdminPage() {
|
||||
const [totalCount, setTotalCount] = useState(0);
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [filters, setFilters] = useState<SearchFilters>({
|
||||
complex_code: '',
|
||||
maker_code: '',
|
||||
model_code: '',
|
||||
grade: '',
|
||||
@@ -178,6 +185,7 @@ export default function CarsAdminPage() {
|
||||
displacement_min: '',
|
||||
displacement_max: '',
|
||||
});
|
||||
const [complexes, setComplexes] = useState<CarmodooComplex[]>([]);
|
||||
const [importResult, setImportResult] = useState<{
|
||||
imported: number;
|
||||
skipped: number;
|
||||
@@ -585,8 +593,12 @@ export default function CarsAdminPage() {
|
||||
|
||||
const loadInitialData = async () => {
|
||||
try {
|
||||
const makersRes = await api.get('/carmodoo/makers');
|
||||
const [makersRes, complexesRes] = await Promise.all([
|
||||
api.get('/carmodoo/makers'),
|
||||
api.get('/carmodoo/complexes'),
|
||||
]);
|
||||
setMakers(makersRes.data);
|
||||
setComplexes(complexesRes.data);
|
||||
} catch (err) {
|
||||
console.error('Failed to load initial data:', err);
|
||||
}
|
||||
@@ -623,6 +635,7 @@ export default function CarsAdminPage() {
|
||||
try {
|
||||
const params: Record<string, any> = { page, page_size: 20 };
|
||||
|
||||
if (filters.complex_code) params.complex_code = filters.complex_code;
|
||||
if (filters.maker_code) params.maker_code = filters.maker_code;
|
||||
if (filters.model_code) params.model_code = filters.model_code;
|
||||
if (filters.grade) params.grade = filters.grade;
|
||||
@@ -1953,8 +1966,26 @@ export default function CarsAdminPage() {
|
||||
<div className="bg-white rounded-xl shadow-sm p-6 mb-6">
|
||||
<h2 className="text-lg font-semibold text-gray-800 mb-4">Search from Carmodoo</h2>
|
||||
|
||||
{/* First Row: Maker, Model, Car Type, Grade */}
|
||||
{/* First Row: Complex, Maker, Model, Grade */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-4">
|
||||
{/* Complex (단지선택) */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Complex (단지선택)
|
||||
</label>
|
||||
<select
|
||||
value={filters.complex_code}
|
||||
onChange={(e) => handleFilterChange('complex_code', e.target.value)}
|
||||
className="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
|
||||
>
|
||||
{complexes.map((complex) => (
|
||||
<option key={complex.code} value={complex.code}>
|
||||
{complex.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{/* Maker (제조사) */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
|
||||
Reference in New Issue
Block a user