fix: ajustado vinculo de seção ao atualizar pagina
This commit is contained in:
parent
ccb0871388
commit
8515796ae9
2 changed files with 39 additions and 0 deletions
|
|
@ -317,6 +317,10 @@ func (h *Handler) Me(c *gin.Context) {
|
|||
if user.EmpresaNome.Valid {
|
||||
empresaNome = user.EmpresaNome.String
|
||||
}
|
||||
var empresaID string
|
||||
if user.EmpresaID.Valid {
|
||||
empresaID = uuid.UUID(user.EmpresaID.Bytes).String()
|
||||
}
|
||||
|
||||
resp := loginResponse{
|
||||
User: userResponse{
|
||||
|
|
@ -327,6 +331,7 @@ func (h *Handler) Me(c *gin.Context) {
|
|||
Name: user.Nome,
|
||||
Phone: user.Whatsapp,
|
||||
CompanyName: empresaNome,
|
||||
CompanyID: empresaID,
|
||||
},
|
||||
}
|
||||
// Note: We are not returning AccessToken/ExpiresAt here as they are already set/active.
|
||||
|
|
|
|||
|
|
@ -163,6 +163,40 @@ export const EventForm: React.FC<EventFormProps> = ({
|
|||
const [selectedCourseName, setSelectedCourseName] = useState("");
|
||||
const [selectedInstitutionName, setSelectedInstitutionName] = useState("");
|
||||
|
||||
// Populate form with initialData
|
||||
useEffect(() => {
|
||||
if (initialData) {
|
||||
// 1. Populate standard form fields
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
...initialData,
|
||||
startTime: initialData.time || "00:00",
|
||||
locationName: (initialData as any).local_evento || (initialData as any).address?.mapLink?.includes('http') ? "" : (initialData as any).address?.mapLink || "", // Try to recover location name or clear if it's a link
|
||||
fotId: initialData.fotId || "",
|
||||
}));
|
||||
|
||||
// 2. Populate derived dropdowns if data exists
|
||||
if (initialData.curso) {
|
||||
setSelectedCourseName(initialData.curso);
|
||||
}
|
||||
if (initialData.instituicao) {
|
||||
setSelectedInstitutionName(initialData.instituicao);
|
||||
}
|
||||
|
||||
// 3. Populate address if available
|
||||
if (initialData.address) {
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
address: {
|
||||
...prev.address,
|
||||
...initialData.address,
|
||||
mapLink: initialData.address.mapLink || ""
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}, [initialData]);
|
||||
|
||||
// Unique Courses
|
||||
const uniqueCourses = Array.from(new Set(availableFots.map(f => f.curso_nome))).sort();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue