Merge branch 'dev' into feature/US-06-fix

This commit is contained in:
Pablo Bonilla 2021-07-11 20:37:54 -06:00
commit 4fb98dca73
No known key found for this signature in database
GPG Key ID: 46877262B8DE47E2
10 changed files with 66 additions and 38 deletions

View File

@ -1,8 +1,8 @@
<form *ngIf="categoria" name="deleteForm" (ngSubmit)="confirmDelete(categoria.id!)">
<form class="ds-form" *ngIf="categoria" name="deleteForm" (ngSubmit)="confirmDelete(categoria.id!)">
<div class="modal-header">
<h4 class="modal-title" data-cy="categoriaDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">&times;</button>
<button type="button" class="ds-btn close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">&times;</button>
</div>
<div class="modal-body">
@ -14,11 +14,11 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="cancel()">
<button type="button" class="btn btn-secondary ds-btn ds-btn-secondary" data-dismiss="modal" (click)="cancel()">
<fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button id="jhi-confirm-delete-categoria" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger">
<button id="jhi-confirm-delete-categoria" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger ds-btn ds-btn-danger">
<fa-icon icon="times"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>

View File

@ -24,11 +24,11 @@
</dd>
</dl>
<button type="submit" (click)="previousState()" class="btn btn-info" data-cy="entityDetailsBackButton">
<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-primary">
<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>

View File

@ -3,15 +3,10 @@
<span jhiTranslate="dataSurveyApp.categoria.home.title">Categorias</span>
<div class="d-flex justify-content-end">
<button class="btn btn-info mr-2" (click)="loadAll()" [disabled]="isLoading">
<fa-icon icon="sync" [spin]="isLoading"></fa-icon>
<span jhiTranslate="dataSurveyApp.categoria.home.refreshListLabel">Refresh List</span>
</button>
<button
id="jh-create-entity"
data-cy="entityCreateButton"
class="btn btn-primary jh-create-entity create-categoria"
class="btn btn-primary jh-create-entity create-categoria ds-btn ds-btn-primary"
[routerLink]="['/categoria/new']"
>
<fa-icon icon="plus"></fa-icon>
@ -32,7 +27,7 @@
<form class="ds-form">
<div class="input-group">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<input type="text" class="form-control" name="searchString" placeholder="Type to search..." [(ngModel)]="searchString" />
<input type="text" name="searchString" placeholder="Buscar..." [(ngModel)]="searchString" />
</div>
</form>
<table class="table table-striped" aria-describedby="page-heading">
@ -53,27 +48,22 @@
<td jhiTranslate="{{ 'dataSurveyApp.EstadoCategoria.' + categoria.estado }}">{{ categoria.estado }}</td>
<td class="text-right">
<div class="btn-group">
<button
type="submit"
[routerLink]="['/categoria', categoria.id, 'view']"
class="btn btn-info btn-sm"
data-cy="entityDetailsButton"
>
<fa-icon icon="eye"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
</button>
<button
type="submit"
[routerLink]="['/categoria', categoria.id, 'edit']"
class="btn btn-primary btn-sm"
class="btn btn-primary btn-sm ds-btn ds-btn-primary"
data-cy="entityEditButton"
>
<fa-icon icon="pencil-alt"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
</button>
<button type="submit" (click)="delete(categoria)" class="btn btn-danger btn-sm" data-cy="entityDeleteButton">
<button
type="submit"
(click)="delete(categoria)"
class="btn btn-danger btn-sm ds-btn ds-btn-danger"
data-cy="entityDeleteButton"
>
<fa-icon icon="times"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
</button>

View File

@ -1,12 +1,15 @@
<div class="row justify-content-center">
<div class="col-8">
<form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
<form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm" class="ds-form">
<h2 id="jhi-categoria-heading" data-cy="CategoriaCreateUpdateHeading" jhiTranslate="dataSurveyApp.categoria.home.createOrEditLabel">
Create or edit a Categoria
Create or edit a Category
</h2>
<div>
<jhi-alert-error></jhi-alert-error>
<div class="alert alert-danger" *ngIf="duplicateName" jhiTranslate="dataSurveyApp.categoria.errors.duplicateName">
A category with that name already exists.
</div>
<div class="form-group" [hidden]="editForm.get('id')!.value == null">
<label class="form-control-label" jhiTranslate="global.field.id" for="field_id">ID</label>
@ -39,7 +42,13 @@
</div>
<div>
<button type="button" id="cancel-save" data-cy="entityCreateCancelButton" class="btn btn-secondary" (click)="previousState()">
<button
type="button"
id="cancel-save"
data-cy="entityCreateCancelButton"
class="btn btn-secondary ds-btn ds-btn-secondary"
(click)="previousState()"
>
<fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
@ -48,7 +57,7 @@
id="save-entity"
data-cy="entityCreateSaveButton"
[disabled]="editForm.invalid || isSaving"
class="btn btn-primary"
class="btn btn-primary ds-btn ds-btn-primary"
>
<fa-icon icon="save"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button>

View File

@ -14,19 +14,32 @@ import { CategoriaService } from '../service/categoria.service';
})
export class CategoriaUpdateComponent implements OnInit {
isSaving = false;
public categorias?: ICategoria[];
editForm = this.fb.group({
id: [],
nombre: [null, [Validators.required]],
estado: [null, [Validators.required]],
});
public duplicateName: boolean;
constructor(protected categoriaService: CategoriaService, protected activatedRoute: ActivatedRoute, protected fb: FormBuilder) {}
constructor(protected categoriaService: CategoriaService, protected activatedRoute: ActivatedRoute, protected fb: FormBuilder) {
this.duplicateName = false;
this.categorias = [];
this.loadAll();
}
ngOnInit(): void {
this.activatedRoute.data.subscribe(({ categoria }) => {
this.updateForm(categoria);
});
this.loadAll();
}
loadAll(): void {
this.categoriaService.query().subscribe(res => {
this.categorias = res.body ?? [];
});
}
previousState(): void {
@ -36,11 +49,23 @@ export class CategoriaUpdateComponent implements OnInit {
save(): void {
this.isSaving = true;
const categoria = this.createFromForm();
const condicion = this.categoryExists(categoria);
if (!condicion) {
if (categoria.id !== undefined) {
this.subscribeToSaveResponse(this.categoriaService.update(categoria));
} else {
this.subscribeToSaveResponse(this.categoriaService.create(categoria));
}
} else {
this.duplicateName = true;
this.isSaving = false;
}
}
protected categoryExists(categoria: ICategoria): boolean {
this.loadAll();
var condicion = this.categorias!.some(cat => cat.nombre === categoria.nombre);
return condicion;
}
protected subscribeToSaveResponse(result: Observable<HttpResponse<ICategoria>>): void {

View File

@ -12,6 +12,7 @@ import { AccountService } from 'app/core/auth/account.service';
import { LoginService } from './login.service';
import { LoginComponent } from './login.component';
import { SocialAuthService } from 'angularx-social-login';
describe('Component Tests', () => {
describe('LoginComponent', () => {

View File

@ -5,7 +5,7 @@
"title": "Categorías",
"refreshListLabel": "Refrescar lista",
"createLabel": "Crear nueva Categoría",
"createOrEditLabel": "Crear o editar Categoría",
"createOrEditLabel": "Datos de Categoría",
"notFound": "Ninguna Categoría encontrada"
},
"created": "Una nueva Categoría ha sido creada con el identificador {{ param }}",
@ -21,7 +21,10 @@
"nombre": "Nombre",
"estado": "Estado",
"encuesta": "Encuesta",
"plantilla": "Plantilla"
"plantilla": "Plantilla",
"errors": {
"duplicateName": "Ya existe una categoría con ese nombre."
}
}
}
}

View File

@ -31,7 +31,7 @@
"usuarioEncuesta": "Usuario Encuesta",
"ePreguntaAbierta": "E Pregunta Abierta",
"ePreguntaCerrada": "E Pregunta Cerrada",
"categoria": "Categoria",
"categoria": "Categoría",
"usuarioExtra": "Usuario Extra"
}
}

View File

@ -15,7 +15,7 @@
"ePreguntaCerrada": "E Pregunta Cerrada",
"ePreguntaCerradaOpcion": "E Pregunta Cerrada Opcion",
"usuarioEncuesta": "Usuario Encuesta",
"categoria": "Categoria",
"categoria": "Categoría",
"factura": "Factura",
"plantilla": "Plantilla",
"pPreguntaAbierta": "P Pregunta Abierta",

View File

@ -26,7 +26,7 @@
"precio": "Precio",
"pPreguntaCerrada": "P Pregunta Cerrada",
"pPreguntaAbierta": "P Pregunta Abierta",
"categoria": "Categoria",
"categoria": "Categoría",
"usuarioExtra": "Usuario Extra"
}
}