diff --git a/src/main/webapp/app/entities/categoria/categoria.module.ts b/src/main/webapp/app/entities/categoria/categoria.module.ts index 59f2dd3..96383a6 100644 --- a/src/main/webapp/app/entities/categoria/categoria.module.ts +++ b/src/main/webapp/app/entities/categoria/categoria.module.ts @@ -1,13 +1,14 @@ import { NgModule } from '@angular/core'; import { SharedModule } from 'app/shared/shared.module'; import { CategoriaComponent } from './list/categoria.component'; +import { CategoriaDetailComponent } from './detail/categoria-detail.component'; import { CategoriaUpdateComponent } from './update/categoria-update.component'; import { CategoriaDeleteDialogComponent } from './delete/categoria-delete-dialog.component'; import { CategoriaRoutingModule } from './route/categoria-routing.module'; @NgModule({ imports: [SharedModule, CategoriaRoutingModule], - declarations: [CategoriaComponent, CategoriaUpdateComponent, CategoriaDeleteDialogComponent], + declarations: [CategoriaComponent, CategoriaDetailComponent, CategoriaUpdateComponent, CategoriaDeleteDialogComponent], entryComponents: [CategoriaDeleteDialogComponent], }) export class CategoriaModule {} diff --git a/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html new file mode 100644 index 0000000..9531c6c --- /dev/null +++ b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html @@ -0,0 +1,36 @@ +
+
+
+

Categoria

+ +
+ + + + + +
+
ID
+
+ {{ categoria.id }} +
+
Nombre
+
+ {{ categoria.nombre }} +
+
Estado
+
+ {{ categoria.estado }} +
+
+ + + + +
+
+
diff --git a/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.spec.ts b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.spec.ts new file mode 100644 index 0000000..506ac72 --- /dev/null +++ b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.spec.ts @@ -0,0 +1,38 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; + +import { CategoriaDetailComponent } from './categoria-detail.component'; + +describe('Component Tests', () => { + describe('Categoria Management Detail Component', () => { + let comp: CategoriaDetailComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [CategoriaDetailComponent], + providers: [ + { + provide: ActivatedRoute, + useValue: { data: of({ categoria: { id: 123 } }) }, + }, + ], + }) + .overrideTemplate(CategoriaDetailComponent, '') + .compileComponents(); + fixture = TestBed.createComponent(CategoriaDetailComponent); + comp = fixture.componentInstance; + }); + + describe('OnInit', () => { + it('Should load categoria on init', () => { + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.categoria).toEqual(expect.objectContaining({ id: 123 })); + }); + }); + }); +}); diff --git a/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.ts b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.ts new file mode 100644 index 0000000..36ecdcf --- /dev/null +++ b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.ts @@ -0,0 +1,24 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { ICategoria } from '../categoria.model'; + +@Component({ + selector: 'jhi-categoria-detail', + templateUrl: './categoria-detail.component.html', +}) +export class CategoriaDetailComponent implements OnInit { + categoria: ICategoria | null = null; + + constructor(protected activatedRoute: ActivatedRoute) {} + + ngOnInit(): void { + this.activatedRoute.data.subscribe(({ categoria }) => { + this.categoria = categoria; + }); + } + + previousState(): void { + window.history.back(); + } +} diff --git a/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts b/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts index 95acd27..d48d560 100644 --- a/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts +++ b/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts @@ -3,6 +3,7 @@ import { RouterModule, Routes } from '@angular/router'; import { UserRouteAccessService } from 'app/core/auth/user-route-access.service'; import { CategoriaComponent } from '../list/categoria.component'; +import { CategoriaDetailComponent } from '../detail/categoria-detail.component'; import { CategoriaUpdateComponent } from '../update/categoria-update.component'; import { CategoriaRoutingResolveService } from './categoria-routing-resolve.service'; @@ -12,6 +13,14 @@ const categoriaRoute: Routes = [ component: CategoriaComponent, canActivate: [UserRouteAccessService], }, + { + path: ':id/view', + component: CategoriaDetailComponent, + resolve: { + categoria: CategoriaRoutingResolveService, + }, + canActivate: [UserRouteAccessService], + }, { path: 'new', component: CategoriaUpdateComponent,