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 employees page #143

Merged
merged 18 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
1 change: 1 addition & 0 deletions cspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ignoreWords:
- androidx
- appcompat
- Avenir
- birthdate
- buildx
- clazz
- cloudrun
Expand Down
7 changes: 5 additions & 2 deletions web/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Warehouses from "./routes/backOffice/warehouses/Warehouses.svelte";
import Trucks from "./routes/backOffice/trucks/Trucks.svelte";
import Reports from "./routes/backOffice/reports/Reports.svelte";
import Employees from "./routes/backOffice/employees/Employees.svelte";
import EmployeesRouter from "./routes/backOffice/employees/EmployeesRouter.svelte";
import Forbidden from "./routes/clientErrors/Forbidden.svelte";
import NotFound from "./routes/clientErrors/NotFound.svelte";
import BackOfficeLayout from "./routes/backOffice/components/BackOfficeLayout.svelte";
Expand All @@ -33,7 +33,10 @@
<Route path={`/${backOfficeBasename}/*`}>
<Router>
<BackOfficeLayout>
<Route path={BackOfficeRouterPaths.EMPLOYEES} component={Employees} />
<Route
path={BackOfficeRouterPaths.EMPLOYEES}
component={EmployeesRouter}
/>
<Route path={BackOfficeRouterPaths.REPORTS} component={Reports} />
<Route path={BackOfficeRouterPaths.TRUCKS} component={Trucks} />
<Route
Expand Down
30 changes: 30 additions & 0 deletions web/src/domain/employees.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { components } from "../../api/ecomap/http";
import type { SortingDirection } from "../lib/components/table/types";

/**
* Employee.
*/
export type Employee = components["schemas"]["Employee"];

/**
* Sortable fields of a employees.
*/
export type EmployeeSortableFields = NonNullable<
components["parameters"]["EmployeeSortQueryParam"]
>;

/**
* Paginated employees.
*/
export type PaginatedEmployees = components["schemas"]["EmployeesPaginated"];

/**
* Filters of employees.
*/
export interface EmployeesFilters {
pageIndex: number;
username: string;
sort: EmployeeSortableFields;
order: SortingDirection;
role?: Employee["role"];
}
10 changes: 9 additions & 1 deletion web/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,13 @@
"notFound.description": "The page you are looking for does not exist.",
"forbidden.title": "Access forbidden",
"forbidden.description": "You do not have permission to access this page.",
"map.layers": "Layers"
"map.layers": "Layers",
"employees.title": "Employees",
"employees.search": "Search by username",
"employees.username": "Username",
"employees.name": "Name",
"employees.schedule": "Schedule",
"employees.role": "Role",
"employees.role.manager": "Manager",
"employees.role.wasteOperator": "Waste operator"
}
10 changes: 9 additions & 1 deletion web/src/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,13 @@
"notFound.description": "A página que procura não existe.",
"forbidden.title": "Acesso proibido",
"forbidden.description": "Não tem autorização para aceder a esta página.",
"map.layers": "Camadas"
"map.layers": "Camadas",
"employees.title": "Colaboradores",
"employees.search": "Pesquise por nome de utilizador",
"employees.username": "Nome de utilizador",
"employees.name": "Nome",
"employees.schedule": "Horário",
"employees.role": "Categoria",
Goncalo-Marques marked this conversation as resolved.
Show resolved Hide resolved
"employees.role.manager": "Gerente",
"employees.role.wasteOperator": "Operador de resíduos"
}
24 changes: 24 additions & 0 deletions web/src/locales/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,30 @@
},
"map.layers": {
"type": "string"
},
"employees.title": {
"type": "string"
},
"employees.search": {
"type": "string"
},
"employees.username": {
"type": "string"
},
"employees.name": {
"type": "string"
},
"employees.schedule": {
"type": "string"
},
"employees.role": {
"type": "string"
},
"employees.role.manager": {
"type": "string"
},
"employees.role.wasteOperator": {
"type": "string"
}
}
}
162 changes: 0 additions & 162 deletions web/src/routes/backOffice/employees/Employees.svelte

This file was deleted.

9 changes: 9 additions & 0 deletions web/src/routes/backOffice/employees/EmployeesRouter.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script lang="ts">
import { Route, Router } from "svelte-routing";

import Employees from "./list/Employees.svelte";
</script>

<Router>
<Route path="/" component={Employees} />
</Router>
6 changes: 6 additions & 0 deletions web/src/routes/backOffice/employees/constants/roles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { Employee } from "../../../../domain/employees";

/**
* List of employees roles.
*/
export const rolesOptions: Employee["role"][] = ["manager", "wasteOperator"];
18 changes: 18 additions & 0 deletions web/src/routes/backOffice/employees/list/Employees.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script lang="ts">
import { t } from "../../../../lib/utils/i8n";
import Card from "../../components/Card.svelte";
import EmployeesTable from "./EmployeesTable.svelte";
import SearchEmployees from "./SearchEmployees.svelte";
</script>

<Card class="page-layout">
<h1>{$t("sidebar.employees")}</h1>
<SearchEmployees />
<EmployeesTable />
</Card>

<style>
h1 {
font: var(--text-2xl-semibold);
}
</style>
Loading