This commit is contained in:
Benito 2025-03-05 08:26:51 -06:00
commit 72e8f86fad
1 changed files with 19 additions and 4 deletions
ventaboletos/src/components/vistas

View File

@ -19,10 +19,11 @@ function Informacion() {
const [open, setOpen] = useState(false);
const [conciertos, setConciertos] = useState([]);
const [selectedConcierto, setSelectedConcierto] = useState(null);
const [seatType, setSeatType] = useState("");
const [tipoAsiento, setTipoAsiento] = useState([]);
useEffect(() => {
fetchConciertos();
fetchTipoAsiento();
}, []);
const fetchConciertos = async () => {
@ -37,10 +38,23 @@ function Informacion() {
}
};
const fetchTipoAsiento = async () => {
let { data: asientos, error } = await supabaseClient
.from("asientos")
.select("categoria");
if (error) {
console.error(error);
} else {
setTipoAsiento(asientos);
console.log(asientos);
}
};
const handleSelect = (concierto) => {
setSelectedConcierto(concierto);
setOpen(true);
};
return (
<>
<div className="space-y-4">
@ -69,13 +83,14 @@ function Informacion() {
</p>
</DialogHeader>
<div className="space-y-4">
<Select onValueChange={setSeatType}>
<Select onValueChange={setTipoAsiento}>
<SelectTrigger>
<SelectValue placeholder="Selecciona un tipo de asiento" />
</SelectTrigger>
<SelectContent>
<SelectItem value="premium">Premium</SelectItem>
<SelectItem value="standard">Standard</SelectItem>
{tipoAsiento?.map((tipo) => {
<SelectItem value={tipo}>{tipo.categoria}</SelectItem>;
})}
</SelectContent>
</Select>
</div>