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>
<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 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
*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>
</div>
</div>

View File

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

View File

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

View File

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