diff --git a/src/pages/Adopter/AdopterList.tsx b/src/pages/Adopter/AdopterList.tsx index 52550d3..58bfce7 100644 --- a/src/pages/Adopter/AdopterList.tsx +++ b/src/pages/Adopter/AdopterList.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect, type ChangeEvent } from "react"; +import React, { useState, useEffect, type ChangeEvent } from "react"; import { Plus, X, Trash2 } from "lucide-react"; import { useNavigate } from "react-router-dom"; import toast from "react-hot-toast"; @@ -182,7 +182,7 @@ export default function AdopterList() { className="flex-1 sm:w-64 px-4 py-2 border border-gray-300 rounded-xl shadow-inner focus:outline-none focus:ring-2 focus:ring-blue-500 transition" /> + )} - {/* Modal edição */} {editing && ( - {/* CEP */}
- +
diff --git a/src/pages/Adopter/AdopterRegister.tsx b/src/pages/Adopter/AdopterRegister.tsx index 3e625db..b4cbeea 100644 --- a/src/pages/Adopter/AdopterRegister.tsx +++ b/src/pages/Adopter/AdopterRegister.tsx @@ -146,9 +146,25 @@ export default function AdopterRegister() { } if (id) await updateAdopterById(id, formData); else await registerAdopter(formData); - toast.success(`Adotante ${id ? "atualizado" : "cadastrado"} com sucesso!`); - navigate("/adopterList"); + setFormData({ + name: "", + email: "", + phone: "", + sex: "", + notes: "", + rg: "", + cpf: "", + maritalStatus: "", + state: "", + city: "", + district: "", + street: "", + number: "", + complement: "", + cep: "", + hasPets: false, + }); } catch { toast.error("Erro ao salvar adotante."); } finally { @@ -174,7 +190,7 @@ export default function AdopterRegister() { transition={{ duration: 0.6 }} className="text-2xl md:text-3xl font-extrabold text-gray-800 mb-10 flex items-center gap-2 text-center" > - {" "} + {" "} Cadastro de Adotantes diff --git a/src/pages/Adoption/AdoptionRegister.tsx b/src/pages/Adoption/AdoptionRegister.tsx index 8c9f73f..da2a25e 100644 --- a/src/pages/Adoption/AdoptionRegister.tsx +++ b/src/pages/Adoption/AdoptionRegister.tsx @@ -155,11 +155,9 @@ export default function AdoptionRegister() { transition={{ duration: 0.6 }} className="bg-white w-full max-w-4xl rounded-3xl shadow-xl p-6 md:p-10 space-y-8" > - {/* Informações da Adoção */}

Informações da Adoção

- {/* Adotante */}
{errors.animalId}}
- {/* Funcionário */}
{errors.status}}
- {/* Data da Adoção */}
- {/* Observações */}
diff --git a/src/pages/Animal/AnimalList.tsx b/src/pages/Animal/AnimalList.tsx index 1378a03..35d809f 100644 --- a/src/pages/Animal/AnimalList.tsx +++ b/src/pages/Animal/AnimalList.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import React, { useState } from "react"; import { Plus, X, Trash2 } from "lucide-react"; import { useNavigate } from "react-router-dom"; import toast from "react-hot-toast"; @@ -12,6 +12,7 @@ export default function AnimalList() { const [saving, setSaving] = useState(false); const [selectedFile, setSelectedFile] = useState(); const [searchTerm, setSearchTerm] = useState(""); + const [selectedAnimal, setSelectedAnimal] = useState(null); const navigate = useNavigate(); const { animals, updateAnimalStatus, removeAnimalFromContext } = useAnimals(); @@ -166,7 +167,7 @@ export default function AnimalList() { {calcularIdade(animal.birthDate)} • {animal.breed || "-"}

+ +
+ {selectedAnimal.image ? ( + {selectedAnimal.name} + ) : ( + Sem imagem + )} +
+ +

{selectedAnimal.name}

+
+

Raça: {selectedAnimal.breed || "-"}

+

Espécie: {selectedAnimal.species || "-"}

+

Sexo: {selectedAnimal.sex}

+

Cor: {selectedAnimal.color}

+

Porte: {selectedAnimal.size}

+

Idade: {calcularIdade(selectedAnimal.birthDate)}

+

Status: {selectedAnimal.status}

+

+ Observações: {selectedAnimal.notes || "Nenhuma"} +

+
+ +
+ + +
+ + + )} + {editForm && ( Adotado +
diff --git a/src/pages/Animal/AnimalRegister.tsx b/src/pages/Animal/AnimalRegister.tsx index 940fa98..50c84c6 100644 --- a/src/pages/Animal/AnimalRegister.tsx +++ b/src/pages/Animal/AnimalRegister.tsx @@ -185,6 +185,7 @@ export default function AnimalRegister() { + {errors.status && {errors.status}}
diff --git a/src/pages/Staff/StaffList.tsx b/src/pages/Staff/StaffList.tsx index 3236bdb..7f80aac 100644 --- a/src/pages/Staff/StaffList.tsx +++ b/src/pages/Staff/StaffList.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from "react"; +import React, { useState, useEffect } from "react"; import { Plus, X, Trash2 } from "lucide-react"; import { useNavigate } from "react-router-dom"; import toast from "react-hot-toast"; @@ -11,7 +11,7 @@ export type Staff = { role: string; email: string; phone: string; - sex?: string; + sex: string; notes?: string; image?: string; }; @@ -232,6 +232,12 @@ export default function StaffList() {
+ -
@@ -403,8 +403,18 @@ export default function StaffList() { {deleteStaff && ( -
-
+ +

Confirmar exclusão

Deseja realmente excluir {deleteStaff.name}? @@ -423,8 +433,8 @@ export default function StaffList() { Excluir

-
- + + )} ); diff --git a/src/pages/Staff/StaffRegister.tsx b/src/pages/Staff/StaffRegister.tsx index 3b50c6e..9a92ac0 100644 --- a/src/pages/Staff/StaffRegister.tsx +++ b/src/pages/Staff/StaffRegister.tsx @@ -1,6 +1,6 @@ import React, {useState, useEffect, type ChangeEvent} from "react"; import {motion} from "framer-motion"; -import {UserCheck, Save, Upload} from "lucide-react"; +import {UserStar, Save, Upload} from "lucide-react"; import {useNavigate, useParams} from "react-router-dom"; import toast from "react-hot-toast"; import {registerStaff, getStaff, updateStaffById} from "../../services/staffService.ts"; @@ -39,7 +39,7 @@ export default function StaffRegister() { name: staff.name, email: staff.email, phone: staff.phone, - sex: (staff as any).sex || "", + sex: staff.sex, role: (staff as any).role || "", notes: (staff as any).notes || "", }); @@ -87,7 +87,14 @@ export default function StaffRegister() { else await registerStaff(formData, imageFile || undefined); toast.success(`Funcionário ${id ? "atualizado" : "cadastrado"} com sucesso!`); - navigate("/staffList"); + setFormData({ + name: "", + email: "", + phone: "", + sex: "", + role: "", + notes: "", + }) } catch { toast.error("Erro ao salvar funcionário."); } finally { @@ -123,7 +130,7 @@ export default function StaffRegister() { transition={{duration: 0.6}} className="text-2xl md:text-3xl font-extrabold text-gray-800 mb-10 flex items-center gap-2 text-center" > - Cadastro de Funcionários + Cadastro de Funcionários => { role: data.role || "", email: data.email || "", phone: data.phone || "", + sex: data.sex || "", image: data.image || "", }; });