deshabilitar funciones de modificación para la categoría nula

This commit is contained in:
Eduardo Quiros 2021-07-18 20:56:53 -06:00
parent 42f1b2eeff
commit 1d75fb6960
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
4 changed files with 16 additions and 10 deletions

View File

@ -25,11 +25,16 @@
</dl> </dl>
<button type="submit" (click)="previousState()" class="btn btn-ds 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> &nbsp;<span jhiTranslate="entity.action.back">Back</span>
</button> </button>
<button type="button" [routerLink]="['/categoria', categoria.id, 'edit']" class="btn btn-ds btn-ds-primary btn-primary"> <button
<fa-icon icon="pencil-alt"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit">Edit</span> *ngIf="categoria.id != 0"
type="button"
[routerLink]="['/categoria', categoria.id, 'edit']"
class="btn btn-ds btn-ds-primary btn-primary"
>
&nbsp;<span jhiTranslate="entity.action.edit">Edit</span>
</button> </button>
</div> </div>
</div> </div>

View File

@ -40,9 +40,9 @@
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let categoria of categorias | filter: 'nombre':searchString; trackBy: trackId" data-cy="entityTable"> <tr *ngFor="let categoria of categorias | filter: 'nombre':searchString; trackBy: trackId" data-cy="entityTable">
<td>{{ categoria.nombre }}</td> <td *ngIf="categoria.id != 0">{{ categoria.nombre }}</td>
<td jhiTranslate="{{ 'dataSurveyApp.EstadoCategoria.' + categoria.estado }}">{{ categoria.estado }}</td> <td *ngIf="categoria.id != 0" jhiTranslate="{{ 'dataSurveyApp.EstadoCategoria.' + categoria.estado }}">{{ categoria.estado }}</td>
<td class="text-right"> <td *ngIf="categoria.id != 0" class="text-right">
<div class="btn-group"> <div class="btn-group">
<button <button
type="submit" type="submit"
@ -50,13 +50,11 @@
class="btn-sm ds-btn ds-btn--primary" class="btn-sm ds-btn ds-btn--primary"
data-cy="entityEditButton" data-cy="entityEditButton"
> >
<fa-icon icon="pencil-alt"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span> <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
</button> </button>
<button type="submit" (click)="delete(categoria)" class="btn-sm ds-btn ds-btn--danger" data-cy="entityDeleteButton"> <button type="submit" (click)="toggleStatus(categoria)" class="btn-sm ds-btn ds-btn--toggle" data-cy="entityDeleteButton">
<fa-icon icon="times"></fa-icon> <span class="d-none d-md-inline" jhiTranslate="entity.action.toggleStatus">Toggle Status</span>
<span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
</button> </button>
</div> </div>
</td> </td>

View File

@ -53,6 +53,7 @@
</button> </button>
<button <button
*ngIf="this.id != 0"
type="submit" type="submit"
id="save-entity" id="save-entity"
data-cy="entityCreateSaveButton" data-cy="entityCreateSaveButton"

View File

@ -22,6 +22,7 @@ export class CategoriaUpdateComponent implements OnInit {
estado: [null, [Validators.required]], estado: [null, [Validators.required]],
}); });
public duplicateName: boolean; public duplicateName: boolean;
id: number | undefined;
constructor(protected categoriaService: CategoriaService, protected activatedRoute: ActivatedRoute, protected fb: FormBuilder) { constructor(protected categoriaService: CategoriaService, protected activatedRoute: ActivatedRoute, protected fb: FormBuilder) {
this.duplicateName = false; this.duplicateName = false;
@ -88,6 +89,7 @@ export class CategoriaUpdateComponent implements OnInit {
} }
protected updateForm(categoria: ICategoria): void { protected updateForm(categoria: ICategoria): void {
this.id = categoria.id;
this.editForm.patchValue({ this.editForm.patchValue({
id: categoria.id, id: categoria.id,
nombre: categoria.nombre, nombre: categoria.nombre,