-
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
10 changed files
with
150 additions
and
12 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
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,14 @@ | ||
<div class="panel panel-warning"> | ||
<div class="panel-heading"> | ||
<div class="panel-title">Please, confirm deletion:</div> | ||
</div> | ||
<div class="panel-body"> | ||
<div class="text-center"> | ||
<button id="deleteBtn" type="button" (click)="delete()" | ||
class="btn btn-outline-danger m-1">Delete</button> | ||
<button id="listBtn" type="button" [routerLink]="['/role', role.id]" | ||
class="btn btn-outline-primary m-1">Cancel</button> | ||
</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,34 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
import { RoleService } from '../roleService'; | ||
import { Role } from '../role'; | ||
|
||
@Component({ | ||
selector: 'app-role-delete', | ||
templateUrl: './role-delete.component.html' | ||
}) | ||
export class RoleDeleteComponent implements OnInit { | ||
public role: Role = new Role(); | ||
private id: string; | ||
|
||
constructor( | ||
private route: ActivatedRoute, | ||
private router: Router, | ||
private roleService: RoleService | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.id = this.route.snapshot.paramMap.get('id'); | ||
this.roleService.getResource(this.id).subscribe( | ||
role => this.role = role | ||
); | ||
} | ||
|
||
delete(): void { | ||
this.roleService.deleteResource(this.role).subscribe( | ||
() => { | ||
this.router.navigate(['/role']); | ||
} | ||
); | ||
} | ||
} |
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,28 @@ | ||
<div class="card mb-4"> | ||
<div class="card-block"> | ||
<h4 class="card-title col-md-12 p-3">{{role.name}}</h4> | ||
<div class="card-body row m-1"> | ||
<div class="col-md-4 p-3"> | ||
<h6 class="card-subtitle text-muted">Role Name</h6> | ||
<p class="card-text">{{role.name}}</p> | ||
</div> | ||
<div class="col-md-4 p-3"> | ||
<h6 class="card-subtitle text-muted">Role ID</h6> | ||
<p class="card-text">{{role.id}}</p> | ||
</div> | ||
<!-- You can add more role-related details here --> | ||
</div> | ||
<div class="card-footer text-right"> | ||
<button id="listBtn" type="button" [routerLink]="['/role']" | ||
class="btn m-1 btn-outline-primary">Role List | ||
</button> | ||
<button id="editBtn" type="button" [routerLink]="['edit']" | ||
class="btn m-1 btn-outline-success">Edit | ||
</button> | ||
<button id="deleteBtn" type="button" [routerLink]="['delete']" | ||
class="btn m-1 btn-outline-danger">Delete | ||
</button> | ||
</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,32 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { RoleService } from '../roleService'; // Asegúrate de que la ruta sea correcta | ||
import { Role } from '../role'; | ||
import { AuthenticationBasicService } from '../../login-basic/authentication-basic.service'; | ||
|
||
@Component({ | ||
selector: 'app-role-detail', | ||
templateUrl: './role-detail.component.html' | ||
}) | ||
export class RoleDetailComponent implements OnInit { | ||
public role: Role = new Role(); | ||
|
||
constructor( | ||
private route: ActivatedRoute, | ||
private roleService: RoleService, | ||
private authenticationService: AuthenticationBasicService | ||
) {} | ||
|
||
ngOnInit(): void { | ||
const id = this.route.snapshot.paramMap.get('id'); | ||
this.roleService.getResource(id).subscribe( | ||
role => { | ||
this.role = role; | ||
} | ||
); | ||
} | ||
|
||
getCurrentRole(): Role { | ||
return this.roleService.getCurrentRole(); | ||
} | ||
} |
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,14 +1,25 @@ | ||
<div class="card mb-1" *ngFor="let role of roles"> | ||
<div class="card-block row m-1 col-12"> | ||
<div class="card-body row align-items-center"> | ||
<div class="col-6 mt-1"> | ||
<h6 class="card-subtitle text-muted">Name</h6> | ||
<a class="card-text" [routerLink]="['/roles', role.id]">{{role.name}}</a> | ||
<div class="container mt-4"> | ||
<!-- Título de la página --> | ||
<div class="row mb-3"> | ||
<div class="col-12"> | ||
<h2>Role List</h2> | ||
</div> | ||
</div> | ||
|
||
<!-- Lista de roles --> | ||
<div class="card mb-1" *ngFor="let role of roles"> | ||
<div class="card-block row m-1 col-12"> | ||
<div class="card-body row align-items-center"> | ||
<div class="col-6 mt-1"> | ||
<h6 class="card-subtitle text-muted">Name</h6> | ||
<a class="card-text" [routerLink]="['/role', role.id]">{{role.name}}</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<ngb-pagination class="d-flex justify-content-center" | ||
[(page)]="page" [pageSize]="pageSize" [collectionSize]="totalRoles" | ||
(pageChange)="changePage()"></ngb-pagination> | ||
<!-- Paginación --> | ||
<ngb-pagination class="d-flex justify-content-center" | ||
[(page)]="page" [pageSize]="pageSize" [collectionSize]="totalRoles" | ||
(pageChange)="changePage()"></ngb-pagination> | ||
</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
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