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

RUP - Agrear permiso para abm de plantillas #2833

Merged
merged 1 commit into from
May 5, 2023
Merged
Changes from all 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
12 changes: 12 additions & 0 deletions src/app/apps/rup/plantillas-rup/plantillas-rup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { BehaviorSubject, Observable } from 'rxjs';
import { take } from 'rxjs/operators';
import { PrestacionesService } from '../../../../app/modules/rup/services/prestaciones.service';
import { Auth } from '@andes/auth';
import { Router } from '@angular/router';
@Component({
selector: 'app-plantillas-rup',
templateUrl: './plantillas-rup.component.html',
Expand All @@ -33,6 +34,7 @@ export class PlantillasRUPComponent implements OnInit {
plantillas$: Observable<any> = this.subject.asObservable();
mostrarDescendientes = false;

public puedeCargarEditarPlantilla = false;
addItems = [
{
label: 'Plantilla',
Expand All @@ -55,10 +57,16 @@ export class PlantillasRUPComponent implements OnInit {
private sp: PlantillasService,
private snomedService: SnomedService,
public servicioPrestacion: PrestacionesService,
private router: Router,
private auth: Auth
) { }

ngOnInit() {
this.puedeCargarEditarPlantilla = this.auth.check('rup:plantilla');
// Si no tiene permiso, lo redirige al inicio.
if (!this.puedeCargarEditarPlantilla) {
this.redirect('inicio');
}
this.plex.updateTitle([{
route: '/',
name: 'ANDES'
Expand All @@ -70,6 +78,10 @@ export class PlantillasRUPComponent implements OnInit {
}]);
}

redirect(pagina: string) {
this.router.navigate(['./' + pagina]);
return false;
}
addElementToObservableArray(item) {
this.plantillas$.pipe(take(1)).subscribe(val => {

Expand Down