feat: add dependents management to employee registration

- Introduced functionality to manage dependents during employee registration, allowing users to add details such as relationship, name, CPF, and birth date.
- Updated the backend schema and mutation to support optional dependents, enhancing the employee data model.
- Enhanced the frontend form to include fields for dependents, improving the user experience in the employee registration process.
This commit is contained in:
2025-11-04 05:05:13 -03:00
parent 90eee27ba7
commit d5c01aabab
3 changed files with 1592 additions and 1366 deletions

View File

@@ -174,6 +174,23 @@ export const create = mutation({
declaracaoIdoneidade: v.optional(v.id("_storage")),
termoNepotismo: v.optional(v.id("_storage")),
termoOpcaoRemuneracao: v.optional(v.id("_storage")),
// Dependentes (opcional)
dependentes: v.optional(
v.array(
v.object({
parentesco: v.union(
v.literal("filho"),
v.literal("filha"),
v.literal("conjuge"),
v.literal("outro")
),
nome: v.string(),
cpf: v.string(),
nascimento: v.string(),
documentoId: v.optional(v.id("_storage")),
})
)
),
},
returns: v.id("funcionarios"),
handler: async (ctx, args) => {
@@ -303,6 +320,23 @@ export const update = mutation({
declaracaoIdoneidade: v.optional(v.id("_storage")),
termoNepotismo: v.optional(v.id("_storage")),
termoOpcaoRemuneracao: v.optional(v.id("_storage")),
// Dependentes (opcional)
dependentes: v.optional(
v.array(
v.object({
parentesco: v.union(
v.literal("filho"),
v.literal("filha"),
v.literal("conjuge"),
v.literal("outro")
),
nome: v.string(),
cpf: v.string(),
nascimento: v.string(),
documentoId: v.optional(v.id("_storage")),
})
)
),
},
returns: v.null(),
handler: async (ctx, args) => {