Revert "Eliminar modulo de vista de categorias"

This reverts commit e3e9bb1fc5.
This commit is contained in:
Eduardo Quiros 2021-07-18 18:09:29 -06:00
parent a700cd8c46
commit 389f24b578
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
5 changed files with 109 additions and 1 deletions

View File

@ -1,13 +1,14 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { SharedModule } from 'app/shared/shared.module'; import { SharedModule } from 'app/shared/shared.module';
import { CategoriaComponent } from './list/categoria.component'; import { CategoriaComponent } from './list/categoria.component';
import { CategoriaDetailComponent } from './detail/categoria-detail.component';
import { CategoriaUpdateComponent } from './update/categoria-update.component'; import { CategoriaUpdateComponent } from './update/categoria-update.component';
import { CategoriaDeleteDialogComponent } from './delete/categoria-delete-dialog.component'; import { CategoriaDeleteDialogComponent } from './delete/categoria-delete-dialog.component';
import { CategoriaRoutingModule } from './route/categoria-routing.module'; import { CategoriaRoutingModule } from './route/categoria-routing.module';
@NgModule({ @NgModule({
imports: [SharedModule, CategoriaRoutingModule], imports: [SharedModule, CategoriaRoutingModule],
declarations: [CategoriaComponent, CategoriaUpdateComponent, CategoriaDeleteDialogComponent], declarations: [CategoriaComponent, CategoriaDetailComponent, CategoriaUpdateComponent, CategoriaDeleteDialogComponent],
entryComponents: [CategoriaDeleteDialogComponent], entryComponents: [CategoriaDeleteDialogComponent],
}) })
export class CategoriaModule {} export class CategoriaModule {}

View File

@ -0,0 +1,36 @@
<div class="row justify-content-center">
<div class="col-8">
<div *ngIf="categoria">
<h2 data-cy="categoriaDetailsHeading"><span jhiTranslate="dataSurveyApp.categoria.detail.title">Categoria</span></h2>
<hr />
<jhi-alert-error></jhi-alert-error>
<jhi-alert></jhi-alert>
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="global.field.id">ID</span></dt>
<dd>
<span>{{ categoria.id }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.categoria.nombre">Nombre</span></dt>
<dd>
<span>{{ categoria.nombre }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.categoria.estado">Estado</span></dt>
<dd>
<span jhiTranslate="{{ 'dataSurveyApp.EstadoCategoria.' + categoria.estado }}">{{ categoria.estado }}</span>
</dd>
</dl>
<button type="submit" (click)="previousState()" class="btn btn-ds btn-info" data-cy="entityDetailsBackButton">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back">Back</span>
</button>
<button type="button" [routerLink]="['/categoria', categoria.id, 'edit']" class="btn btn-ds btn-ds-primary btn-primary">
<fa-icon icon="pencil-alt"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit">Edit</span>
</button>
</div>
</div>
</div>

View File

@ -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<CategoriaDetailComponent>;
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 }));
});
});
});
});

View File

@ -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();
}
}

View File

@ -3,6 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { UserRouteAccessService } from 'app/core/auth/user-route-access.service'; import { UserRouteAccessService } from 'app/core/auth/user-route-access.service';
import { CategoriaComponent } from '../list/categoria.component'; import { CategoriaComponent } from '../list/categoria.component';
import { CategoriaDetailComponent } from '../detail/categoria-detail.component';
import { CategoriaUpdateComponent } from '../update/categoria-update.component'; import { CategoriaUpdateComponent } from '../update/categoria-update.component';
import { CategoriaRoutingResolveService } from './categoria-routing-resolve.service'; import { CategoriaRoutingResolveService } from './categoria-routing-resolve.service';
@ -12,6 +13,14 @@ const categoriaRoute: Routes = [
component: CategoriaComponent, component: CategoriaComponent,
canActivate: [UserRouteAccessService], canActivate: [UserRouteAccessService],
}, },
{
path: ':id/view',
component: CategoriaDetailComponent,
resolve: {
categoria: CategoriaRoutingResolveService,
},
canActivate: [UserRouteAccessService],
},
{ {
path: 'new', path: 'new',
component: CategoriaUpdateComponent, component: CategoriaUpdateComponent,