From 8c1aa51f2840d657a09732d81bd4d12afbc32d5f Mon Sep 17 00:00:00 2001 From: tamfrr Date: Wed, 27 Nov 2024 13:00:55 -0800 Subject: [PATCH] Atualizar src/app/admin/cars/[id]/page.jsx --- src/app/admin/cars/[id]/page.jsx | 251 +++++++++++++++++-------------- 1 file changed, 139 insertions(+), 112 deletions(-) diff --git a/src/app/admin/cars/[id]/page.jsx b/src/app/admin/cars/[id]/page.jsx index 2721c05..486c593 100644 --- a/src/app/admin/cars/[id]/page.jsx +++ b/src/app/admin/cars/[id]/page.jsx @@ -1,139 +1,166 @@ -import React from 'react'; -import { X } from 'lucide-react'; +"use client"; +import { useState } from 'react'; +import { Save, ArrowLeft } from 'lucide-react'; + +export default function CarForm({ params }) { + const [car, setCar] = useState({ + name: '', + year: '', + price: '', + isSpecial: false, + specs: { + consumption: '', + transmission: '', + mileage: '' + } + }); + + const handleSubmit = async (e) => { + e.preventDefault(); + // Aqui virá a integração com a API + console.log('Car data:', car); + }; -const CarForm = () => { return (
-
-
-
- LOGO +
+
+
+ +

+ {params.id === 'new' ? 'Add New Car' : 'Edit Car'} +

- Add/Edit Car
-
-
- {/* Basic Information */} -
-

Basic Information

-
+
+
+ + {/* Basic Information */} +
- - Name + setCar({...car, name: e.target.value})} + className="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-2 border" + required />
+
- - Year + setCar({...car, year: e.target.value})} + className="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-2 border" + required />
-
- -
-
-
- {/* Technical Specifications */} -
-

Technical Specifications

-
- - Price + setCar({...car, price: e.target.value})} + className="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-2 border" + required />
-
- - -
-
- - -
-
- - -
-
-
- {/* Features/Extras */} -
-

Features & Extras

-
- {['ABS', 'Bluetooth', 'ESP', 'LED Headlights'].map((feature) => ( -
- - {/* Images */} -
-

Images

-
- {[1, 2, 3, 4].map((n) => ( -
-
- + Add Image -
- +
+ setCar({...car, isSpecial: e.target.checked})} + className="rounded border-gray-300 text-blue-600 shadow-sm mt-2" + />
- ))} +
-
- {/* Submit Buttons */} -
- - -
- + {/* Specifications */} +
+

Specifications

+
+
+ + setCar({ + ...car, + specs: {...car.specs, consumption: e.target.value} + })} + className="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-2 border" + /> +
+ +
+ + +
+ +
+ + setCar({ + ...car, + specs: {...car.specs, mileage: e.target.value} + })} + className="mt-1 block w-full rounded-md border-gray-300 shadow-sm p-2 border" + /> +
+
+
+ + {/* Images - será implementado depois */} +
+

Images

+
+ Image upload coming soon... +
+
+ + {/* Submit Button */} +
+ +
+ +
); -}; - -export default CarForm; +} \ No newline at end of file