Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create edit employee page #205

Merged
merged 43 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1381906
feat: create employees page
goncalojdias Apr 26, 2024
a009760
Merge branch 'main' into 81-create-employees-page
goncalojdias May 1, 2024
4bcc37b
feat: create employees page
goncalojdias May 4, 2024
21f43b2
Merge branch 'main' into 81-create-employees-page
goncalojdias May 4, 2024
0532352
chore: fix cspell order
goncalojdias May 4, 2024
74110d9
refactor: rename category to roles
goncalojdias May 4, 2024
da3ab53
refactor: suggestions in code review
goncalojdias May 4, 2024
0be3dee
reafactor: fix lint
goncalojdias May 4, 2024
2edea9e
Merge branch 'main' into 81-create-employees-page
goncalojdias May 5, 2024
e2f70f5
fix: Employees Router
goncalojdias May 5, 2024
4e6f5a4
feat: create employee details page
goncalojdias May 5, 2024
099e770
Merge branch 'main' into 81-create-employees-page
goncalojdias May 6, 2024
37c1374
refactor: suggestions in code review
goncalojdias May 6, 2024
caf5a32
refactor: remove h24
goncalojdias May 6, 2024
a484bbc
Merge branch '81-create-employees-page' into 82-create-employee-detai…
goncalojdias May 6, 2024
b25782a
refactor: remove edit button, update formats
goncalojdias May 6, 2024
f801f53
fix: lint
goncalojdias May 6, 2024
b6f584c
Merge branch 'main' into 81-create-employees-page
goncalojdias May 10, 2024
a2154aa
refactor: suggestions in code review
goncalojdias May 10, 2024
ea0b32f
refactor: rename scheduleEnd to scheduleStart
goncalojdias May 10, 2024
633947b
Merge branch '81-create-employees-page' into 82-create-employee-detai…
goncalojdias May 10, 2024
1ebb25a
refactor: default sort createdAt desc
goncalojdias May 10, 2024
75c5769
Merge branch '81-create-employees-page' into 82-create-employee-detai…
goncalojdias May 10, 2024
20ce9d6
refactor: rename Função to Cargo
goncalojdias May 10, 2024
a0a23b4
Merge branch '81-create-employees-page' into 82-create-employee-detai…
goncalojdias May 10, 2024
504ec8f
feat: formatTime helper
goncalojdias May 10, 2024
7162c7b
Merge branch 'main' into 82-create-employee-details-page
goncalojdias May 10, 2024
661ac97
Merge branch 'main' into 82-create-employee-details-page
goncalojdias May 16, 2024
e92cde8
refactor: suggestions in code review
goncalojdias May 16, 2024
b85e5f7
feat: employee edit page
goncalojdias May 17, 2024
e83dd93
feat: employee update schedule
goncalojdias May 18, 2024
3c8338b
Merge branch 'main' into 82-create-employee-details-page
goncalojdias May 18, 2024
9497684
Merge branch '82-create-employee-details-page' into 87-create-edit-em…
goncalojdias May 18, 2024
e1910e8
Merge branch 'main' into 87-create-edit-employee-page
goncalojdias May 20, 2024
69c5213
fix: lint errors
goncalojdias May 20, 2024
cc4f4b9
refactor: changes in code review
goncalojdias May 20, 2024
c96b66e
refactor: removing country code from phone pattern
goncalojdias May 21, 2024
b7fe858
Merge branch 'main' into 87-create-edit-employee-page
goncalojdias May 22, 2024
3bb4df1
Merge branch 'main' into 87-create-edit-employee-page
goncalojdias May 27, 2024
754d76c
refactor: changes in code review
goncalojdias May 27, 2024
6f9cf18
refactor: changes in code review
goncalojdias May 31, 2024
de72cd5
refactor: changes in code review
goncalojdias Jun 5, 2024
0036743
refactor: changes in code review
goncalojdias Jun 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion web/src/lib/constants/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Date format.
* Used as the key names for {@link DateFormats}.
*/
type DateFormat = "shortDateTime" | "shortDate" | "shortTime";
type DateFormat = "shortDateTime" | "shortDate" | "shortTime" | "shortTime24H";

/**
* Date formats.
Expand All @@ -24,4 +24,9 @@ export const DateFormats: Record<DateFormat, Intl.DateTimeFormatOptions> = {
hour: "2-digit",
minute: "2-digit",
},
shortTime24H: {
hour: "2-digit",
minute: "2-digit",
hourCycle: "h24",
},
};
9 changes: 9 additions & 0 deletions web/src/lib/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ export function formatDate(
export function formatTime(time: string): string {
return formatDate(`${UNIX_TIME_0_DATE} ${time}`, DateFormats.shortTime);
}

/**
* Formats times to 2-digit hour and 2-digit minutes. In 24 hours format.
* @param time Time to be formatted.
* @returns Formatted time.
*/
export function formatTime24H(time: string): string {
return formatDate(`${UNIX_TIME_0_DATE} ${time}`, DateFormats.shortTime24H);
}
7 changes: 6 additions & 1 deletion web/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"employees.role": "Role",
"employees.role.manager": "Manager",
"employees.role.wasteOperator": "Waste operator",
"employees.birthdate": "Birthdate",
"employees.dateOfBirth": "Birthdate",
"employees.phone": "Phone",
"employees.location": "Location",
"employees.scheduleStart": "Schedule start",
Expand All @@ -125,6 +125,11 @@
"employees.delete.success": "Employee deleted successfully",
"employees.delete.conflict.title": "Conflict",
"employees.delete.conflict.description": "This employee cannot be deleted because it's associated with a route.",
"employees.update.success": "Employee updated successfully",
"employees.username.placeholder": "Enter username",
"employees.firstName.placeholder": "Enter first name",
"employees.lastName.placeholder": "Enter last name",
"employees.phone.placeholder": "Enter phone number",
"employees.updatePassword.title": "Change password",
"employees.updatePassword.currentPassword.label": "Current password",
"employees.updatePassword.newPassword.label": "New password",
Expand Down
7 changes: 6 additions & 1 deletion web/src/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"employees.role": "Cargo",
"employees.role.manager": "Gerente",
"employees.role.wasteOperator": "Operador de resíduos",
"employees.birthdate": "Data de nascimento",
"employees.dateOfBirth": "Data de nascimento",
"employees.phone": "Telefone",
"employees.location": "Localização",
"employees.scheduleStart": "Hora de início",
Expand All @@ -124,6 +124,11 @@
"employees.notFound.description": "O colaborador que procura não existe.",
"employees.delete.success": "Colaborador eliminado com sucesso",
"employees.delete.conflict.title": "Conflito",
"employees.update.success": "Colaborador atualizado com sucesso",
"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.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 Down
17 changes: 16 additions & 1 deletion web/src/locales/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@
"employees.role.wasteOperator": {
"type": "string"
},
"employees.birthdate": {
"employees.dateOfBirth": {
"type": "string"
},
"employees.phone": {
Expand Down Expand Up @@ -376,6 +376,21 @@
"employees.delete.conflict.description": {
"type": "string"
},
"employees.update.success": {
"type": "string"
},
"employees.username.placeholder": {
"type": "string"
},
"employees.firstName.placeholder": {
"type": "string"
},
"employees.lastName.placeholder": {
"type": "string"
},
"employees.phone.placeholder": {
"type": "string"
},
"employees.updatePassword.title": {
"type": "string"
},
Expand Down
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 @@ -2,9 +2,13 @@
import { Route, Router } from "svelte-routing";
import Employees from "./list/Employees.svelte";
import Employee from "./details/Employee.svelte";
import EditEmployee from "./edit/EditEmployee.svelte";
</script>

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