Skip to content

Commit e9f87c6

Browse files
committed
Merge branch 'main' into feature/#37-Front-End_Build-layout-reset-password-on-Editar-Usuario
2 parents 3b564ba + 09f73b8 commit e9f87c6

File tree

82 files changed

+1029
-210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1029
-210
lines changed

src/common/components/sidebar-menu/sidebar-menu.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const SidebarMenu: React.FC<Props> = props => {
2121
return (
2222
<List className={classes.list(theme, isDrawerOpen)}>
2323
<Item text="Principal" IconComponent={HomeIcon} linkPath={'/'} />
24-
<Item text="Expedientes" IconComponent={FolderIcon} linkPath={'/records'} />
24+
<Item text="Expedientes" IconComponent={FolderIcon} linkPath={'/expedientes'} />
2525
<Item text="Empresas" IconComponent={ApartmentIcon} linkPath={'/'} />
2626
<Item text="Informes" IconComponent={LeaderboardIcon} linkPath={'/'} />
2727
<Divider variant="middle" />
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { Lookup } from '#common/models';
2+
3+
export interface UnidadRolList {
4+
roles: Lookup[];
5+
unidades: Lookup[];
6+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import axios from 'axios';
2+
import { UnidadRolList } from './unidad-rol.api-model';
3+
4+
export const getUnidadRolList = async (): Promise<UnidadRolList> => {
5+
const response = await axios.get<UnidadRolList>('/api/lookup/unidad-rol');
6+
return response.data;
7+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from './unidad-rol-vm';
2+
export * from './unidad-rol.mapper';
3+
export * from './unidad-rol.repository';
4+
export * from './use-unidad_rol-list.hook';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Lookup } from '#common/models';
2+
3+
export interface UnidadRolList {
4+
roles: Lookup[];
5+
unidades: Lookup[];
6+
}
7+
8+
export const createEmptyUnidadRolList = (): UnidadRolList => ({
9+
roles: [],
10+
unidades: [],
11+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { mapToCollection } from '#common/mappers/collection.mapper.ts';
2+
import { Lookup } from '#common/models/lookup.model.ts';
3+
import * as apiModel from './api/unidad-rol.api-model';
4+
5+
import * as viewModel from './unidad-rol-vm';
6+
7+
export const mapUnidadFromApiToVm = (unidad: Lookup): Lookup => ({
8+
id: unidad.id,
9+
nombre: unidad.nombre,
10+
code: unidad.code,
11+
});
12+
13+
export const mapRolFromApiToVm = (rol: Lookup): Lookup => ({
14+
id: rol.id,
15+
nombre: rol.nombre,
16+
});
17+
18+
export const mapUnidadRolListFromApiToVm = (unidadRolList: apiModel.UnidadRolList): viewModel.UnidadRolList => ({
19+
unidades: mapToCollection(unidadRolList.unidades, mapUnidadFromApiToVm),
20+
roles: mapToCollection(unidadRolList.roles, mapRolFromApiToVm),
21+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { mapUnidadRolListFromApiToVm } from './unidad-rol.mapper';
2+
import * as vm from './unidad-rol-vm';
3+
import * as api from './api/unidad-rol.api';
4+
5+
export const getUnidadRolListRepository = async (): Promise<vm.UnidadRolList> => {
6+
const unidadRolListApi = await api.getUnidadRolList();
7+
8+
const unidadRolListVm: vm.UnidadRolList = mapUnidadRolListFromApiToVm(unidadRolListApi);
9+
10+
return unidadRolListVm;
11+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { useQuery } from '@tanstack/react-query';
2+
import { commonQueryKeys } from '#core/react-query';
3+
import { getUnidadRolListRepository } from './unidad-rol.repository';
4+
import { createEmptyUnidadRolList, UnidadRolList } from './unidad-rol-vm';
5+
6+
interface UseUnidadRolQueryResult {
7+
unidadRolList: UnidadRolList;
8+
isLoading: boolean;
9+
}
10+
11+
export const useUnidadRolList = (): UseUnidadRolQueryResult => {
12+
const { data: unidadRolList = createEmptyUnidadRolList(), isLoading } = useQuery({
13+
queryKey: commonQueryKeys.unidadRolList(),
14+
queryFn: () => getUnidadRolListRepository(),
15+
});
16+
17+
return {
18+
unidadRolList,
19+
isLoading,
20+
};
21+
};

src/core/router/route-tree.ts

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import { Route as LoginImport } from './../../scenes/login';
1515
import { Route as AuthImport } from './../../scenes/_auth';
1616
import { Route as IndexImport } from './../../scenes/index';
1717
import { Route as AuthUsersIndexImport } from './../../scenes/_auth/users/index';
18-
import { Route as AuthRecordsIndexImport } from './../../scenes/_auth/records/index';
18+
import { Route as AuthExpedientesIndexImport } from './../../scenes/_auth/expedientes/index';
1919
import { Route as AuthCreateUserIndexImport } from './../../scenes/_auth/create-user/index';
2020
import { Route as AuthUsersIdImport } from './../../scenes/_auth/users/$id';
21+
import { Route as AuthEditarExpedienteIdImport } from './../../scenes/_auth/editar-expediente/$id';
2122
import { Route as AuthEditUserIdImport } from './../../scenes/_auth/edit-user/$id';
22-
import { Route as AuthEditRecordIdImport } from './../../scenes/_auth/edit-record/$id';
2323

2424
// Create/Update Routes
2525

@@ -46,9 +46,9 @@ const AuthUsersIndexRoute = AuthUsersIndexImport.update({
4646
getParentRoute: () => AuthRoute,
4747
} as any);
4848

49-
const AuthRecordsIndexRoute = AuthRecordsIndexImport.update({
50-
id: '/records/',
51-
path: '/records/',
49+
const AuthExpedientesIndexRoute = AuthExpedientesIndexImport.update({
50+
id: '/expedientes/',
51+
path: '/expedientes/',
5252
getParentRoute: () => AuthRoute,
5353
} as any);
5454

@@ -64,15 +64,15 @@ const AuthUsersIdRoute = AuthUsersIdImport.update({
6464
getParentRoute: () => AuthRoute,
6565
} as any);
6666

67-
const AuthEditUserIdRoute = AuthEditUserIdImport.update({
68-
id: '/edit-user/$id',
69-
path: '/edit-user/$id',
67+
const AuthEditarExpedienteIdRoute = AuthEditarExpedienteIdImport.update({
68+
id: '/editar-expediente/$id',
69+
path: '/editar-expediente/$id',
7070
getParentRoute: () => AuthRoute,
7171
} as any);
7272

73-
const AuthEditRecordIdRoute = AuthEditRecordIdImport.update({
74-
id: '/edit-record/$id',
75-
path: '/edit-record/$id',
73+
const AuthEditUserIdRoute = AuthEditUserIdImport.update({
74+
id: '/edit-user/$id',
75+
path: '/edit-user/$id',
7676
getParentRoute: () => AuthRoute,
7777
} as any);
7878

@@ -101,20 +101,20 @@ declare module '@tanstack/react-router' {
101101
preLoaderRoute: typeof LoginImport;
102102
parentRoute: typeof rootRoute;
103103
};
104-
'/_auth/edit-record/$id': {
105-
id: '/_auth/edit-record/$id';
106-
path: '/edit-record/$id';
107-
fullPath: '/edit-record/$id';
108-
preLoaderRoute: typeof AuthEditRecordIdImport;
109-
parentRoute: typeof AuthImport;
110-
};
111104
'/_auth/edit-user/$id': {
112105
id: '/_auth/edit-user/$id';
113106
path: '/edit-user/$id';
114107
fullPath: '/edit-user/$id';
115108
preLoaderRoute: typeof AuthEditUserIdImport;
116109
parentRoute: typeof AuthImport;
117110
};
111+
'/_auth/editar-expediente/$id': {
112+
id: '/_auth/editar-expediente/$id';
113+
path: '/editar-expediente/$id';
114+
fullPath: '/editar-expediente/$id';
115+
preLoaderRoute: typeof AuthEditarExpedienteIdImport;
116+
parentRoute: typeof AuthImport;
117+
};
118118
'/_auth/users/$id': {
119119
id: '/_auth/users/$id';
120120
path: '/users/$id';
@@ -129,11 +129,11 @@ declare module '@tanstack/react-router' {
129129
preLoaderRoute: typeof AuthCreateUserIndexImport;
130130
parentRoute: typeof AuthImport;
131131
};
132-
'/_auth/records/': {
133-
id: '/_auth/records/';
134-
path: '/records';
135-
fullPath: '/records';
136-
preLoaderRoute: typeof AuthRecordsIndexImport;
132+
'/_auth/expedientes/': {
133+
id: '/_auth/expedientes/';
134+
path: '/expedientes';
135+
fullPath: '/expedientes';
136+
preLoaderRoute: typeof AuthExpedientesIndexImport;
137137
parentRoute: typeof AuthImport;
138138
};
139139
'/_auth/users/': {
@@ -149,20 +149,20 @@ declare module '@tanstack/react-router' {
149149
// Create and export the route tree
150150

151151
interface AuthRouteChildren {
152-
AuthEditRecordIdRoute: typeof AuthEditRecordIdRoute;
153152
AuthEditUserIdRoute: typeof AuthEditUserIdRoute;
153+
AuthEditarExpedienteIdRoute: typeof AuthEditarExpedienteIdRoute;
154154
AuthUsersIdRoute: typeof AuthUsersIdRoute;
155155
AuthCreateUserIndexRoute: typeof AuthCreateUserIndexRoute;
156-
AuthRecordsIndexRoute: typeof AuthRecordsIndexRoute;
156+
AuthExpedientesIndexRoute: typeof AuthExpedientesIndexRoute;
157157
AuthUsersIndexRoute: typeof AuthUsersIndexRoute;
158158
}
159159

160160
const AuthRouteChildren: AuthRouteChildren = {
161-
AuthEditRecordIdRoute: AuthEditRecordIdRoute,
162161
AuthEditUserIdRoute: AuthEditUserIdRoute,
162+
AuthEditarExpedienteIdRoute: AuthEditarExpedienteIdRoute,
163163
AuthUsersIdRoute: AuthUsersIdRoute,
164164
AuthCreateUserIndexRoute: AuthCreateUserIndexRoute,
165-
AuthRecordsIndexRoute: AuthRecordsIndexRoute,
165+
AuthExpedientesIndexRoute: AuthExpedientesIndexRoute,
166166
AuthUsersIndexRoute: AuthUsersIndexRoute,
167167
};
168168

@@ -172,23 +172,23 @@ export interface FileRoutesByFullPath {
172172
'/': typeof IndexRoute;
173173
'': typeof AuthRouteWithChildren;
174174
'/login': typeof LoginRoute;
175-
'/edit-record/$id': typeof AuthEditRecordIdRoute;
176175
'/edit-user/$id': typeof AuthEditUserIdRoute;
176+
'/editar-expediente/$id': typeof AuthEditarExpedienteIdRoute;
177177
'/users/$id': typeof AuthUsersIdRoute;
178178
'/create-user': typeof AuthCreateUserIndexRoute;
179-
'/records': typeof AuthRecordsIndexRoute;
179+
'/expedientes': typeof AuthExpedientesIndexRoute;
180180
'/users': typeof AuthUsersIndexRoute;
181181
}
182182

183183
export interface FileRoutesByTo {
184184
'/': typeof IndexRoute;
185185
'': typeof AuthRouteWithChildren;
186186
'/login': typeof LoginRoute;
187-
'/edit-record/$id': typeof AuthEditRecordIdRoute;
188187
'/edit-user/$id': typeof AuthEditUserIdRoute;
188+
'/editar-expediente/$id': typeof AuthEditarExpedienteIdRoute;
189189
'/users/$id': typeof AuthUsersIdRoute;
190190
'/create-user': typeof AuthCreateUserIndexRoute;
191-
'/records': typeof AuthRecordsIndexRoute;
191+
'/expedientes': typeof AuthExpedientesIndexRoute;
192192
'/users': typeof AuthUsersIndexRoute;
193193
}
194194

@@ -197,11 +197,11 @@ export interface FileRoutesById {
197197
'/': typeof IndexRoute;
198198
'/_auth': typeof AuthRouteWithChildren;
199199
'/login': typeof LoginRoute;
200-
'/_auth/edit-record/$id': typeof AuthEditRecordIdRoute;
201200
'/_auth/edit-user/$id': typeof AuthEditUserIdRoute;
201+
'/_auth/editar-expediente/$id': typeof AuthEditarExpedienteIdRoute;
202202
'/_auth/users/$id': typeof AuthUsersIdRoute;
203203
'/_auth/create-user/': typeof AuthCreateUserIndexRoute;
204-
'/_auth/records/': typeof AuthRecordsIndexRoute;
204+
'/_auth/expedientes/': typeof AuthExpedientesIndexRoute;
205205
'/_auth/users/': typeof AuthUsersIndexRoute;
206206
}
207207

@@ -211,33 +211,33 @@ export interface FileRouteTypes {
211211
| '/'
212212
| ''
213213
| '/login'
214-
| '/edit-record/$id'
215214
| '/edit-user/$id'
215+
| '/editar-expediente/$id'
216216
| '/users/$id'
217217
| '/create-user'
218-
| '/records'
218+
| '/expedientes'
219219
| '/users';
220220
fileRoutesByTo: FileRoutesByTo;
221221
to:
222222
| '/'
223223
| ''
224224
| '/login'
225-
| '/edit-record/$id'
226225
| '/edit-user/$id'
226+
| '/editar-expediente/$id'
227227
| '/users/$id'
228228
| '/create-user'
229-
| '/records'
229+
| '/expedientes'
230230
| '/users';
231231
id:
232232
| '__root__'
233233
| '/'
234234
| '/_auth'
235235
| '/login'
236-
| '/_auth/edit-record/$id'
237236
| '/_auth/edit-user/$id'
237+
| '/_auth/editar-expediente/$id'
238238
| '/_auth/users/$id'
239239
| '/_auth/create-user/'
240-
| '/_auth/records/'
240+
| '/_auth/expedientes/'
241241
| '/_auth/users/';
242242
fileRoutesById: FileRoutesById;
243243
}
@@ -273,25 +273,25 @@ export const routeTree = rootRoute._addFileChildren(rootRouteChildren)._addFileT
273273
"/_auth": {
274274
"filePath": "_auth.tsx",
275275
"children": [
276-
"/_auth/edit-record/$id",
277276
"/_auth/edit-user/$id",
277+
"/_auth/editar-expediente/$id",
278278
"/_auth/users/$id",
279279
"/_auth/create-user/",
280-
"/_auth/records/",
280+
"/_auth/expedientes/",
281281
"/_auth/users/"
282282
]
283283
},
284284
"/login": {
285285
"filePath": "login.tsx"
286286
},
287-
"/_auth/edit-record/$id": {
288-
"filePath": "_auth/edit-record/$id.tsx",
289-
"parent": "/_auth"
290-
},
291287
"/_auth/edit-user/$id": {
292288
"filePath": "_auth/edit-user/$id.tsx",
293289
"parent": "/_auth"
294290
},
291+
"/_auth/editar-expediente/$id": {
292+
"filePath": "_auth/editar-expediente/$id.tsx",
293+
"parent": "/_auth"
294+
},
295295
"/_auth/users/$id": {
296296
"filePath": "_auth/users/$id.tsx",
297297
"parent": "/_auth"
@@ -300,8 +300,8 @@ export const routeTree = rootRoute._addFileChildren(rootRouteChildren)._addFileT
300300
"filePath": "_auth/create-user/index.tsx",
301301
"parent": "/_auth"
302302
},
303-
"/_auth/records/": {
304-
"filePath": "_auth/records/index.tsx",
303+
"/_auth/expedientes/": {
304+
"filePath": "_auth/expedientes/index.tsx",
305305
"parent": "/_auth"
306306
},
307307
"/_auth/users/": {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
import { Expediente } from './crear-expediente.vm';
3+
4+
interface CreateExpedienteContextProps {
5+
formData: Expediente;
6+
activeStep: number;
7+
isOpen: boolean;
8+
onOpen: () => void;
9+
onNextStep: <K extends keyof Expediente>(step: K, value: Expediente[K]) => void;
10+
onPreviousStep: () => void;
11+
onCancel: () => void;
12+
}
13+
14+
export const CreateExpedienteContext = React.createContext<CreateExpedienteContextProps | undefined>(undefined);
15+
16+
export const useCreateExpedienteContext = () => {
17+
const context = React.useContext(CreateExpedienteContext);
18+
if (!context) {
19+
throw new Error('useCreateExpedienteContext must be used within a CreateExpedienteProvider');
20+
}
21+
return context;
22+
};

0 commit comments

Comments
 (0)