Merge branch 'feature/US-34' into feature/US-35

This commit is contained in:
Mariela Bonilla 2021-08-05 01:07:38 -06:00
commit 8e03a30733
5 changed files with 17 additions and 27 deletions

View File

@ -1,21 +1,20 @@
<form *ngIf="plantilla" name="deleteForm" (ngSubmit)="confirmDelete(plantilla.id!)"> <form class="ds-form" *ngIf="plantilla" name="deleteForm" (ngSubmit)="confirmDelete(plantilla)">
<div class="modal-header">
<h4 class="modal-title" data-cy="plantillaDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">&times;</button>
</div>
<div class="modal-body"> <div class="modal-body">
<jhi-alert-error></jhi-alert-error> <jhi-alert-error></jhi-alert-error>
<p class="ds-title--small">Eliminar plantilla</p>
<p id="jhi-delete-plantilla-heading" jhiTranslate="dataSurveyApp.plantilla.delete.question" [translateValues]="{ id: plantilla.id }"> <p
class="ds-subtitle"
id="jhi-delete-plantilla-heading"
jhiTranslate="dataSurveyApp.plantilla.delete.question"
[translateValues]="{ id: plantilla.id }"
>
Are you sure you want to delete this Plantilla? Are you sure you want to delete this Plantilla?
</p> </p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="cancel()"> <button type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal" (click)="cancel()">
<fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span> <fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button> </button>
<button id="jhi-confirm-delete-plantilla" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger"> <button id="jhi-confirm-delete-plantilla" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger">

View File

@ -3,6 +3,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { IPlantilla } from '../plantilla.model'; import { IPlantilla } from '../plantilla.model';
import { PlantillaService } from '../service/plantilla.service'; import { PlantillaService } from '../service/plantilla.service';
import { EstadoPlantilla } from '../../enumerations/estado-plantilla.model';
@Component({ @Component({
templateUrl: './plantilla-delete-dialog.component.html', templateUrl: './plantilla-delete-dialog.component.html',
@ -16,8 +17,9 @@ export class PlantillaDeleteDialogComponent {
this.activeModal.dismiss(); this.activeModal.dismiss();
} }
confirmDelete(id: number): void { confirmDelete(pPlantilla: IPlantilla): void {
this.plantillaService.delete(id).subscribe(() => { pPlantilla.estado = EstadoPlantilla.DELETED;
this.plantillaService.update(pPlantilla).subscribe(() => {
this.activeModal.close('deleted'); this.activeModal.close('deleted');
}); });
} }

View File

@ -39,7 +39,6 @@
<thead> <thead>
<tr> <tr>
<th scope="col"><span jhiTranslate="dataSurveyApp.plantilla.nombre">Nombre</span></th> <th scope="col"><span jhiTranslate="dataSurveyApp.plantilla.nombre">Nombre</span></th>
<th scope="col"><span jhiTranslate="dataSurveyApp.plantilla.descripcion">Descripcion</span></th>
<!-- <th scope="col"><span jhiTranslate="dataSurveyApp.plantilla.fechaCreacion">Fecha Creacion</span></th> --> <!-- <th scope="col"><span jhiTranslate="dataSurveyApp.plantilla.fechaCreacion">Fecha Creacion</span></th> -->
<th scope="col"><span jhiTranslate="dataSurveyApp.plantilla.fechaPublicacionTienda">Fecha Publicacion Tienda</span></th> <th scope="col"><span jhiTranslate="dataSurveyApp.plantilla.fechaPublicacionTienda">Fecha Publicacion Tienda</span></th>
<th scope="col"><span jhiTranslate="dataSurveyApp.plantilla.estado">Estado</span></th> <th scope="col"><span jhiTranslate="dataSurveyApp.plantilla.estado">Estado</span></th>
@ -51,7 +50,6 @@
<tbody> <tbody>
<tr *ngFor="let plantilla of plantillas; trackBy: trackId" data-cy="entityTable"> <tr *ngFor="let plantilla of plantillas; trackBy: trackId" data-cy="entityTable">
<td>{{ plantilla.nombre }}</td> <td>{{ plantilla.nombre }}</td>
<td>{{ plantilla.descripcion }}</td>
<!-- <td>{{ plantilla.fechaCreacion | formatMediumDatetime }}</td> --> <!-- <td>{{ plantilla.fechaCreacion | formatMediumDatetime }}</td> -->
<td *ngIf="plantilla.fechaPublicacionTienda">{{ plantilla.fechaPublicacionTienda | formatShortDatetime | titlecase }}</td> <td *ngIf="plantilla.fechaPublicacionTienda">{{ plantilla.fechaPublicacionTienda | formatShortDatetime | titlecase }}</td>
<td *ngIf="!plantilla.fechaPublicacionTienda">No establecida</td> <td *ngIf="!plantilla.fechaPublicacionTienda">No establecida</td>
@ -61,16 +59,6 @@
<td>{{ plantilla.categoria?.nombre }}</td> <td>{{ plantilla.categoria?.nombre }}</td>
<td class="text-right"> <td class="text-right">
<div class="btn-group"> <div class="btn-group">
<button
type="submit"
[routerLink]="['/plantilla', plantilla.id, 'view']"
class="ds-btn ds-btn--secondary btn-sm"
data-cy="entityDetailsButton"
>
<fa-icon icon="eye"></fa-icon>
<span class="d-none d-md-inline">Vista previa</span>
</button>
<button <button
type="submit" type="submit"
[routerLink]="['/plantilla', plantilla.id, 'edit']" [routerLink]="['/plantilla', plantilla.id, 'edit']"

View File

@ -53,7 +53,8 @@ export class PlantillaComponent implements OnInit {
this.plantillaService.query().subscribe( this.plantillaService.query().subscribe(
(res: HttpResponse<IPlantilla[]>) => { (res: HttpResponse<IPlantilla[]>) => {
this.isLoading = false; this.isLoading = false;
this.plantillas = res.body ?? []; const tempPlantillas = res.body ?? [];
this.plantillas = tempPlantillas.filter(p => p.estado !== EstadoPlantilla.DELETED);
}, },
() => { () => {
this.isLoading = false; this.isLoading = false;

View File

@ -12,7 +12,7 @@
"updated": "Una plantilla ha sido actualizada con el identificador {{ param }}", "updated": "Una plantilla ha sido actualizada con el identificador {{ param }}",
"deleted": "Una plantilla ha sido eliminada con el identificador {{ param }}", "deleted": "Una plantilla ha sido eliminada con el identificador {{ param }}",
"delete": { "delete": {
"question": "¿Seguro que quiere eliminar Plantilla {{ id }}?", "question": "¿Seguro que quiere eliminar esta plantilla?",
"deletefromstore": "¿Seguro que quiere eliminar esta plantilla de la tienda?" "deletefromstore": "¿Seguro que quiere eliminar esta plantilla de la tienda?"
}, },
"publish": { "publish": {