Skip to content

Commit

Permalink
feat: create add employee page (#228)
Browse files Browse the repository at this point in the history
Refs: closes #86 

## Summary

Create employee add page.
  • Loading branch information
goncalojdias authored Jun 26, 2024
1 parent 3989005 commit d6eb056
Show file tree
Hide file tree
Showing 11 changed files with 468 additions and 48 deletions.
7 changes: 6 additions & 1 deletion web/src/domain/employees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export type EmployeeSortableFields = NonNullable<
components["parameters"]["EmployeeSortQueryParam"]
>;

/**
* Employee roles.
*/
export type EmployeeRole = Employee["role"];

/**
* Paginated employees.
*/
Expand All @@ -26,5 +31,5 @@ export interface EmployeesFilters {
username: string;
sort: EmployeeSortableFields;
order: SortingDirection;
role?: Employee["role"];
role?: EmployeeRole;
}
27 changes: 21 additions & 6 deletions web/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"save": "Save",
"preview": "Preview",
"work": "Work",
"confirm": "Confirm",
"selectLocation": "Select location",
"location": "Location",
"location.placeholder": "Select a location",
Expand Down Expand Up @@ -109,6 +110,7 @@
"employees": "Employees",
"employees.search": "Search by username",
"employees.username": "Username",
"employees.password": "Password",
"employees.firstName": "First name",
"employees.lastName": "Last name",
"employees.schedule": "Schedule",
Expand All @@ -129,7 +131,7 @@
"employees.username.placeholder": "Enter username",
"employees.firstName.placeholder": "Enter first name",
"employees.lastName.placeholder": "Enter last name",
"employees.phone.placeholder": "Enter phone number",
"employees.phone.placeholder": "Enter phone number (XXX XXX XXX)",
"employees.updatePassword.title": "Change password",
"employees.updatePassword.currentPassword.label": "Current password",
"employees.updatePassword.newPassword.label": "New password",
Expand All @@ -138,11 +140,24 @@
"employees.updatePassword.newPassword.placeholder": "Enter the new password",
"employees.updatePassword.confirmPassword.placeholder": "Repeat the new password",
"employees.updatePassword.success": "Password changed successfully",
"employees.updatePassword.error.passwordConstraints.title": "Invalid password",
"employees.updatePassword.error.passwordConstraints.description": "The password must contain at least 14 characters, including one regular character, one special character, and one number",
"employees.updatePassword.error.incorrectPassword.title": "Incorrect credentials",
"employees.updatePassword.error.incorrectPassword.description": "The password entered does not match your current password.",
"employees.password.error.passwordConstraints.title": "Invalid password",
"employees.password.error.passwordConstraints.description": "The password must contain at least 14 characters, including one regular character, one special character, and one number",
"employees.password.error.incorrectPassword.title": "Incorrect credentials",
"employees.password.error.incorrectPassword.description": "The password entered does not match your current password.",
"employees.error.passwordMismatch": "The password doesn't match the new password",
"employees.passwordConstraints": "Password must contain at least 14 characters, including one regular character, one special character, and one number",
"confirm": "Confirm"
"employees.dateOfBirth.placeholder": "Enter birthdate",
"employees.scheduleStart.placeholder": "Enter start time of schedule",
"employees.scheduleEnd.placeholder": "Enter end time of schedule",
"employees.create.title": "Add employee",
"employees.create.success": "Employee added successfully",
"employees.role.placeholder": "Select a role",
"employees.password.placeholder": "Enter password",
"employees.security": "Security",
"employees.password.confirm.placeholder": "Repeat the password",
"employees.password.error.passwordMismatch": "The passwords don't match",
"employees.update.conflict.title": "Conflict",
"employees.update.conflict.description": "The username is already in use.",
"employees.create.conflict.title": "Conflict",
"employees.create.conflict.description": "The username is already in use."
}
33 changes: 24 additions & 9 deletions web/src/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"warehouses.create.title": "Adicionar armazém",
"warehouses.create.success": "Armazém adicionado com sucesso",
"warehouses.update.success": "Armazém atualizado com sucesso",
"warehouses.update.conflict.title": "Conflicto",
"warehouses.update.conflict.title": "Conflito",
"warehouses.update.conflict.description": "O armazém já tem mais camiões do que a nova capacidade.",
"warehouses.notFound.title": "Armazém não encontrado",
"warehouses.notFound.description": "O armazém que procura não existe.",
Expand Down Expand Up @@ -91,8 +91,8 @@
"signin.title": "Iniciar sessão",
"signin.username.label": "Utilizador",
"signin.username.placeholder": "Digite o seu nome de utilizador",
"signin.password.label": "Password",
"signin.password.placeholder": "Digite a sua password",
"signin.password.label": "Palavra-passe",
"signin.password.placeholder": "Digite a sua palavra-passe",
"signin.button": "Iniciar sessão",
"signin.error.incorrectCredentials": "Credenciais inválidas. O nome de utilizador ou a palavra-passe estão incorrectos.",
"signOut.button": "Terminar sessão",
Expand All @@ -109,6 +109,7 @@
"employees": "Colaboradores",
"employees.search": "Pesquise por nome de utilizador",
"employees.username": "Nome de utilizador",
"employees.password": "Palavra-passe",
"employees.firstName": "Primeiro nome",
"employees.lastName": "Último nome",
"employees.schedule": "Horário",
Expand All @@ -128,7 +129,14 @@
"employees.username.placeholder": "Introduza o nome de utilizador",
"employees.firstName.placeholder": "Introduza o primeiro nome",
"employees.lastName.placeholder": "Introduza o último nome",
"employees.phone.placeholder": "Introduza o número de telefone",
"employees.dateOfBirth.placeholder": "Introduza a data de nascimento",
"employees.scheduleStart.placeholder": "Introduza a hora de início",
"employees.scheduleEnd.placeholder": "Introduza a hora de término",
"employees.create.title": "Adicionar colaborador",
"employees.create.success": "Colaborador adicionado com sucesso",
"employees.role.placeholder": "Selecione um cargo",
"employees.password.placeholder": "Introduza a palavra-passe",
"employees.phone.placeholder": "Introduza o número de telefone (XXX XXX XXX)",
"employees.delete.conflict.description": "Este colaborador não pode ser eliminado porque está associado a uma rota.",
"employees.updatePassword.title": "Alterar palavra-passe",
"employees.updatePassword.currentPassword.label": "Palavra-passe atual",
Expand All @@ -138,11 +146,18 @@
"employees.updatePassword.newPassword.placeholder": "Introduza a nova palavra-passe",
"employees.updatePassword.confirmPassword.placeholder": "Repita a nova palavra-passe",
"employees.updatePassword.success": "Palavra-passe alterada com sucesso",
"employees.updatePassword.error.passwordConstraints.title": "Palavra-passe inválida",
"employees.updatePassword.error.passwordConstraints.description": "A palavra-passe deve conter pelo menos 14 caracteres, incluindo um carácter regular, um carácter especial e um número.",
"employees.updatePassword.error.incorrectPassword.title": "Credenciais inválidas",
"employees.updatePassword.error.incorrectPassword.description": "A palavra-passe introduzida não corresponde à sua palavra-passe atual.",
"employees.password.error.passwordConstraints.title": "Palavra-passe inválida",
"employees.password.error.passwordConstraints.description": "A palavra-passe deve conter pelo menos 14 caracteres, incluindo um carácter regular, um carácter especial e um número.",
"employees.password.error.incorrectPassword.title": "Credenciais inválidas",
"employees.password.error.incorrectPassword.description": "A palavra-passe introduzida não corresponde à sua palavra-passe atual.",
"employees.error.passwordMismatch": "A palavra-passe não corresponde à nova palavra-passe",
"employees.passwordConstraints": "A palavra-passe deve conter pelo menos 14 caracteres, incluindo um carácter regular, um carácter especial e um número",
"confirm": "Confirmar"
"confirm": "Confirmar",
"employees.security": "Segurança",
"employees.password.confirm.placeholder": "Introduza a palavra-passe",
"employees.password.error.passwordMismatch": "As palavras-passes não coincidem",
"employees.update.conflict.title": "Conflito",
"employees.update.conflict.description": "O nome de utilizador já está em uso.",
"employees.create.conflict.title": "Conflito",
"employees.create.conflict.description": "O nome de utilizador já está em uso."
}
44 changes: 40 additions & 4 deletions web/src/locales/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@
"employees.username": {
"type": "string"
},
"employees.password": {
"type": "string"
},
"employees.firstName": {
"type": "string"
},
Expand Down Expand Up @@ -415,16 +418,16 @@
"employees.updatePassword.success": {
"type": "string"
},
"employees.updatePassword.error.passwordConstraints.title": {
"employees.password.error.passwordConstraints.title": {
"type": "string"
},
"employees.updatePassword.error.passwordConstraints.description": {
"employees.password.error.passwordConstraints.description": {
"type": "string"
},
"employees.updatePassword.error.incorrectPassword.title": {
"employees.password.error.incorrectPassword.title": {
"type": "string"
},
"employees.updatePassword.error.incorrectPassword.description": {
"employees.password.error.incorrectPassword.description": {
"type": "string"
},
"employees.error.passwordMismatch": {
Expand All @@ -435,6 +438,39 @@
},
"confirm": {
"type": "string"
},
"employees.create.title": {
"type": "string"
},
"employees.create.success": {
"type": "string"
},
"employees.role.placeholder": {
"type": "string"
},
"employees.password.placeholder": {
"type": "string"
},
"employees.security": {
"type": "string"
},
"employees.password.confirm.placeholder": {
"type": "string"
},
"employees.password.error.passwordMismatch": {
"type": "string"
},
"employees.update.conflict.title": {
"type": "string"
},
"employees.update.conflict.description": {
"type": "string"
},
"employees.create.conflict.title": {
"type": "string"
},
"employees.create.conflict.description": {
"type": "string"
}
}
}
4 changes: 4 additions & 0 deletions web/src/routes/backOffice/employees/EmployeesRouter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
import Employees from "./list/Employees.svelte";
import Employee from "./details/Employee.svelte";
import EditEmployee from "./edit/EditEmployee.svelte";
import CreateEmployee from "./create/CreateEmployee.svelte";
</script>

<Router>
<Route path="/create">
<CreateEmployee />
</Route>
<Route path="/:id/edit" let:params>
<EditEmployee id={params.id} />
</Route>
Expand Down
Loading

0 comments on commit d6eb056

Please sign in to comment.