-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
345 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<div class="row"> | ||
|
||
<div class="col-4"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h4 class="card-title">Usuarios</h4> | ||
|
||
<table class="table table-hover" *ngIf="usuarios.length > 0"> | ||
<tbody> | ||
<tr *ngFor="let usuario of usuarios" [routerLink]="['/usuarios']" class="pointer"> | ||
<td> | ||
<img [src]="usuario.img | imagen" class="img-50 img-circle"> | ||
</td> | ||
<td>{{ usuario.nombre }}</td> | ||
|
||
</tr> | ||
</tbody> | ||
|
||
</table> | ||
|
||
<div class="alert alert-info" *ngIf="usuarios.length === 0"> | ||
No hay registros | ||
</div> | ||
|
||
|
||
|
||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-4"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h4 class="card-title">Médicos</h4> | ||
|
||
<table class="table table-hover" *ngIf="medicos.length > 0"> | ||
<tbody> | ||
<tr *ngFor="let medico of medicos" [routerLink]="['/medico', medico._id]" class="pointer"> | ||
<td> | ||
<img [src]="medico.img | imagen:'medico'" class="img-50 img-circle"> | ||
</td> | ||
<td>{{ medico.nombre }}</td> | ||
|
||
</tr> | ||
</tbody> | ||
|
||
</table> | ||
|
||
<div class="alert alert-info" *ngIf="medicos.length === 0"> | ||
No hay registros | ||
</div> | ||
|
||
|
||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-4"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h4 class="card-title">Hospitales</h4> | ||
|
||
<table class="table table-hover" *ngIf="hospitales.length > 0"> | ||
<tbody> | ||
<tr *ngFor="let hospital of hospitales" [routerLink]="['/hospitales']" class="pointer"> | ||
<td> | ||
<img [src]="hospital.img | imagen:'hospital'" class="img-50 img-circle"> | ||
</td> | ||
<td>{{ hospital.nombre }}</td> | ||
|
||
</tr> | ||
</tbody> | ||
|
||
</table> | ||
|
||
<div class="alert alert-info" *ngIf="hospitales.length === 0"> | ||
No hay registros | ||
</div> | ||
|
||
|
||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
</div>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { URL_SERVICIOS } from 'src/app/config/config'; | ||
|
||
import { Medico } from 'src/app/models/medico.model'; | ||
import { Usuario } from 'src/app/models/usuario.model'; | ||
import { Hospital } from 'src/app/models/hospital.model'; | ||
|
||
@Component({ | ||
selector: 'app-busqueda', | ||
templateUrl: './busqueda.component.html', | ||
styles: [] | ||
}) | ||
export class BusquedaComponent implements OnInit { | ||
|
||
usuarios: Usuario[] = []; | ||
medicos: Medico[] = []; | ||
hospitales: Hospital[] = []; | ||
|
||
constructor( | ||
public activatedRoute: ActivatedRoute, | ||
public http: HttpClient | ||
) { | ||
activatedRoute.params | ||
.subscribe( params => { | ||
let termino = params['termino']; | ||
// console.log( termino ); | ||
this.buscar( termino ); | ||
} ); | ||
} | ||
|
||
ngOnInit() { | ||
} | ||
|
||
buscar( termino: string ) { | ||
|
||
let url = URL_SERVICIOS + '/busqueda/todo/' + termino ; | ||
|
||
this.http.get( url ) | ||
.subscribe( (resp: any) => { | ||
console.log( resp ); | ||
this.hospitales = resp.hospitales; | ||
this.medicos = resp.medicos; | ||
this.usuarios = resp.usuarios; | ||
|
||
} ); | ||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree } from '@angular/router'; | ||
import { Observable } from 'rxjs'; | ||
import { UsuarioService } from '../usuario/usuario.service'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class AdminGuard implements CanActivate { | ||
|
||
constructor( | ||
public _usuarioService: UsuarioService, | ||
// public router: Router | ||
|
||
){} | ||
|
||
canActivate() { | ||
|
||
if ( this._usuarioService.usuario.role === 'ADMIN_ROLE' ) { | ||
return true; | ||
} else { | ||
console.log('Bloqueado por el ADMIN GUARD'); | ||
// this.router.navigate(['/login']); | ||
this._usuarioService.logout(); | ||
return false; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,43 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { UsuarioService } from '../usuario/usuario.service'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class SidebarService { | ||
|
||
menu: any = [ | ||
{ | ||
titulo: 'Principal', | ||
icono: 'mdi mdi-gauge', | ||
submenu: [ | ||
{ titulo: 'Dashboard', url: '/dashboard'}, | ||
{ titulo: 'ProgressBar', url: '/progress'}, | ||
{ titulo: 'Gráficas', url: '/graficas1'}, | ||
{ titulo: 'Promesas', url: '/promesas'}, | ||
{ titulo: 'RxJs', url: '/rxjs'} | ||
] | ||
}, | ||
{ | ||
titulo: 'Mantenimientos', | ||
icono: 'mdi mdi-folder-lock-open', | ||
submenu: [ | ||
{ titulo: 'Usuarios', url: '/usuarios' }, | ||
{ titulo: 'Hospitales', url: '/hospitales' }, | ||
{ titulo: 'Médicos', url: '/medicos' } | ||
] | ||
} | ||
]; | ||
menu: any[] = []; | ||
|
||
constructor() { } | ||
// menu: any = [ | ||
// { | ||
// titulo: 'Principal', | ||
// icono: 'mdi mdi-gauge', | ||
// submenu: [ | ||
// { titulo: 'Dashboard', url: '/dashboard'}, | ||
// { titulo: 'ProgressBar', url: '/progress'}, | ||
// { titulo: 'Gráficas', url: '/graficas1'}, | ||
// { titulo: 'Promesas', url: '/promesas'}, | ||
// { titulo: 'RxJs', url: '/rxjs'} | ||
// ] | ||
// }, | ||
// { | ||
// titulo: 'Mantenimientos', | ||
// icono: 'mdi mdi-folder-lock-open', | ||
// submenu: [ | ||
// { titulo: 'Usuarios', url: '/usuarios' }, | ||
// { titulo: 'Hospitales', url: '/hospitales' }, | ||
// { titulo: 'Médicos', url: '/medicos' } | ||
// ] | ||
// } | ||
// ]; | ||
|
||
constructor( | ||
public _usuarioService: UsuarioService | ||
) { } | ||
|
||
|
||
cargarMenu() { | ||
this.menu = this._usuarioService.menu; | ||
}; | ||
|
||
} |
Oops, something went wrong.