diff --git a/src/layouts/Sidebar.svelte b/src/layouts/Sidebar.svelte
index c43b03a..6aca2e4 100644
--- a/src/layouts/Sidebar.svelte
+++ b/src/layouts/Sidebar.svelte
@@ -58,6 +58,11 @@
Personas
+
+
+ Roles
+
+
diff --git a/src/pages/roles/Admin.svelte b/src/pages/roles/Admin.svelte
new file mode 100644
index 0000000..7d9c147
--- /dev/null
+++ b/src/pages/roles/Admin.svelte
@@ -0,0 +1,109 @@
+
+
+Roles
+
+
+
+{#if rol}
+ rol = null}
+ on:refresh={() => onPage(page)}
+ />
+{/if}
+
+
\ No newline at end of file
diff --git a/src/pages/roles/ModalRol.svelte b/src/pages/roles/ModalRol.svelte
new file mode 100644
index 0000000..c45832b
--- /dev/null
+++ b/src/pages/roles/ModalRol.svelte
@@ -0,0 +1,275 @@
+
+
+
diff --git a/src/pages/rolesaplicaciones/Admin.svelte b/src/pages/rolesaplicaciones/Admin.svelte
new file mode 100644
index 0000000..84bbce2
--- /dev/null
+++ b/src/pages/rolesaplicaciones/Admin.svelte
@@ -0,0 +1,121 @@
+
+
+rolesyaplicaciones
+
+ {data2}
+ {#each data2 as rol}
+ {rol.id_rol}
+ {rol.id_aplicacion}
+ {/each}
+
+
+
+
+{#if rol}
+ rol = null}
+ on:refresh={() => onPage(page)}
+ />
+{/if}
+
+
+
\ No newline at end of file
diff --git a/src/pages/rolesaplicaciones/ModalRolaplicacion.svelte b/src/pages/rolesaplicaciones/ModalRolaplicacion.svelte
new file mode 100644
index 0000000..5589475
--- /dev/null
+++ b/src/pages/rolesaplicaciones/ModalRolaplicacion.svelte
@@ -0,0 +1,95 @@
+
+
+
\ No newline at end of file
diff --git a/src/routes/user.routes.js b/src/routes/user.routes.js
index d1f4d21..d10f84d 100644
--- a/src/routes/user.routes.js
+++ b/src/routes/user.routes.js
@@ -11,6 +11,8 @@ import PagePersonaCreate from '$/pages/personas/Persona.svelte'
import PagePersonaModifica from '$/pages/personas/Persona.svelte'
import PageMapaParaderos from '$/pages/mapas/Paraderos.svelte'
import PageMapaRutas from '$/pages/mapas/Rutas.svelte'
+import PageRoles from '$/pages/roles/Admin.svelte'
+import PageRolesyAplicaciones from '$/pages/rolesaplicaciones/Admin.svelte'
export const routes = [
{ path: '/', component: PageHome },
@@ -19,6 +21,8 @@ export const routes = [
{ path: '/usuarios', component: PageUsuarios },
{ path: '/usuarios/nuevo', component: PageUsuarioCreate },
{ path: '/usuarios/:login', component: PageUsuarioModifica },
+ { path: '/roles', component: PageRoles },
+ { path: '/rolesaplicaciones', component: PageRolesyAplicaciones },
{ path: '/comunas', component: PageComunas },
{ path: '/personas', component: PagePersonas },
{ path: '/personas/nuevo', component: PagePersonaCreate },
@@ -26,4 +30,5 @@ export const routes = [
{ path: '/mapas/paraderos', component: PageMapaParaderos },
{ path: '/mapas/rutas', component: PageMapaRutas },
{ path: '*', component: PageError },
+
]
\ No newline at end of file
diff --git a/src/services/roles.js b/src/services/roles.js
new file mode 100644
index 0000000..e7bafe3
--- /dev/null
+++ b/src/services/roles.js
@@ -0,0 +1,47 @@
+import { base, getToken } from './_config'
+
+export async function getRoles(params) {
+ const query = !params ? '' : '?' + (new URLSearchParams(params).toString());
+ const res = await fetch(`${base}/roles/${query}`, {
+ headers: { "Authorization": `Bearer ${getToken()}`, "Content-Type": "application/json" }
+ })
+ if (!res.ok) throw await res.json()
+ return res.json()
+}
+
+export async function getRol(id) {
+ const res = await fetch(`${base}/roles/${id}/`, {
+ headers: { "Authorization": `Bearer ${getToken()}`, "Content-Type": "application/json" }
+ })
+ if (!res.ok) throw await res.json()
+ return res.json()
+}
+
+export async function createRol(data) {
+ const res = await fetch(`${base}/roles/`, {
+ method: 'POST',
+ body: JSON.stringify(data),
+ headers: { "Authorization": `Bearer ${getToken()}`, "Content-Type": "application/json" }
+ })
+ if (!res.ok) throw await res.json()
+ return res.json()
+}
+
+export async function updateRol({ id_rol: id, ...data }) {
+ const res = await fetch(`${base}/roles/${id}/`, {
+ method: 'PATCH',
+ body: JSON.stringify(data),
+ headers: { "Authorization": `Bearer ${getToken()}`, "Content-Type": "application/json" }
+ })
+ if (!res.ok) throw await res.json()
+ return res.json()
+}
+
+export async function deleteRol(id) {
+ const res = await fetch(`${base}/roles/${id}/`, {
+ method: 'DELETE',
+ headers: { "Authorization": `Bearer ${getToken()}`, "Content-Type": "application/json" }
+ })
+ if (!res.ok) throw await res.json()
+ return res.text()
+}
\ No newline at end of file
diff --git a/src/services/rolesyaplicaciones.js b/src/services/rolesyaplicaciones.js
new file mode 100644
index 0000000..6b2a789
--- /dev/null
+++ b/src/services/rolesyaplicaciones.js
@@ -0,0 +1,58 @@
+import { base, getToken } from './_config'
+
+export async function getRolesyaplicaciones(idRol) {
+ const params = idRol ? { id_rol: idRol } : null; // Preparar los parámetros de la consulta
+ const query = params ? '?' + new URLSearchParams(params).toString() : '';
+ const res = await fetch(`${base}/rolyaplicacion/${query}`, {
+ headers: {"Authorization": `Bearer ${getToken()}`,"Content-Type": "application/json"}
+ });
+ if (!res.ok) throw await res.json();
+ return res.json();
+}
+
+export async function getRolesaplicaciones(params) {
+ const query = !params ? '' : '?' + (new URLSearchParams(params).toString());
+ const res = await fetch(`${base}/rolyaplicacion/${query}`, {
+ headers: { "Authorization": `Bearer ${getToken()}`, "Content-Type": "application/json" }
+ })
+ if (!res.ok) throw await res.json()
+ return res.json()
+}
+
+
+export async function getRolyaplicacion(id) {
+ const res = await fetch(`${base}/rolyaplicacion/${id}/`, {
+ headers: { "Authorization": `Bearer ${getToken()}`, "Content-Type": "application/json" }
+ })
+ if (!res.ok) throw await res.json()
+ return res.json()
+}
+
+export async function createRolyaplicacion(data) {
+ const res = await fetch(`${base}/rolyaplicacion/`, {
+ method: 'POST',
+ body: JSON.stringify(data),
+ headers: { "Authorization": `Bearer ${getToken()}`, "Content-Type": "application/json" }
+ })
+ if (!res.ok) throw await res.json()
+ return res.json()
+}
+
+export async function updateRolyaplicacion({ id_rol_app: id, ...data }) {
+ const res = await fetch(`${base}/rolyaplicacion/${id}/`, {
+ method: 'PATCH',
+ body: JSON.stringify(data),
+ headers: { "Authorization": `Bearer ${getToken()}`, "Content-Type": "application/json" }
+ })
+ if (!res.ok) throw await res.json()
+ return res.json()
+}
+
+export async function deleteRolyaplicacion(id) {
+ const res = await fetch(`${base}/rolyaplicacion/${id}/`, {
+ method: 'DELETE',
+ headers: { "Authorization": `Bearer ${getToken()}`, "Content-Type": "application/json" }
+ })
+ if (!res.ok) throw await res.json()
+ return res.text()
+}
\ No newline at end of file