Merge pull request #106 from Quantum-P3/feature/US-30
Add publicar plantilla en tienda
This commit is contained in:
commit
91e5bcb96f
|
@ -0,0 +1,24 @@
|
|||
<form class="ds-form" name="deleteForm" (ngSubmit)="confirmDeleteFromStore()">
|
||||
<div class="modal-header">
|
||||
<!-- <h2 class="ds-title" data-cy="encuestaDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h2>
|
||||
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">×</button>-->
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<p class="ds-title--small">Eliminar de la tienda</p>
|
||||
<p class="ds-subtitle" id="jhi-delete-encuesta-heading" jhiTranslate="dataSurveyApp.plantilla.delete.deletefromstore">
|
||||
Are you sure you want to delete this template from the store?
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal" (click)="cancel()">
|
||||
<fa-icon icon="arrow-left"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
||||
</button>
|
||||
|
||||
<button id="jhi-confirm-delete-option" data-cy="entityConfirmDeleteButton" type="submit" class="ds-btn ds-btn--danger">
|
||||
<fa-icon icon="times"></fa-icon> <span jhiTranslate="entity.action.delete">Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,17 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
@Component({
|
||||
templateUrl: './plantilla-delete-store-dialog.component.html',
|
||||
})
|
||||
export class PlantillaDeleteStoreDialogComponent {
|
||||
constructor(protected activeModal: NgbActiveModal) {}
|
||||
|
||||
cancel(): void {
|
||||
this.activeModal.dismiss();
|
||||
}
|
||||
|
||||
confirmDeleteFromStore(): void {
|
||||
this.activeModal.close('confirm');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<form class="ds-form" name="deleteForm" (ngSubmit)="confirmPublishToStore()">
|
||||
<div class="modal-header">
|
||||
<!-- <h2 class="ds-title" data-cy="encuestaDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h2>
|
||||
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">×</button>-->
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<p class="ds-title--small">Publicar en la tienda</p>
|
||||
<p class="ds-subtitle" id="jhi-delete-encuesta-heading" jhiTranslate="dataSurveyApp.plantilla.publish.store">
|
||||
Are you sure you want to publish this template to the store?
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal" (click)="cancel()">
|
||||
<fa-icon icon="arrow-left"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
||||
</button>
|
||||
|
||||
<button id="jhi-confirm-delete-option" data-cy="entityConfirmDeleteButton" type="submit" class="ds-btn ds-btn--primary">
|
||||
<fa-icon [icon]="faStore"></fa-icon> <span jhiTranslate="entity.action.publish">Publish</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,20 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { faStore } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
@Component({
|
||||
templateUrl: './plantilla-publish-store-dialog.component.html',
|
||||
})
|
||||
export class PlantillaPublishStoreDialogComponent {
|
||||
faStore = faStore;
|
||||
|
||||
constructor(protected activeModal: NgbActiveModal) {}
|
||||
|
||||
cancel(): void {
|
||||
this.activeModal.dismiss();
|
||||
}
|
||||
|
||||
confirmPublishToStore(): void {
|
||||
this.activeModal.close('confirm');
|
||||
}
|
||||
}
|
|
@ -8,6 +8,8 @@ import { PlantillaRoutingModule } from './route/plantilla-routing.module';
|
|||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
import { PlantillaDeleteQuestionDialogComponent } from './plantilla-delete-question-dialog/plantilla-delete-question-dialog.component';
|
||||
import { PlantillaDeleteOptionDialogComponent } from './plantilla-delete-option-dialog/plantilla-delete-option-dialog.component';
|
||||
import { PlantillaPublishStoreDialogComponent } from './plantilla-publish-store-dialog/plantilla-publish-store-dialog.component';
|
||||
import { PlantillaDeleteStoreDialogComponent } from './plantilla-delete-store-dialog/plantilla-delete-store-dialog.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [SharedModule, PlantillaRoutingModule, FontAwesomeModule],
|
||||
|
@ -18,6 +20,8 @@ import { PlantillaDeleteOptionDialogComponent } from './plantilla-delete-option-
|
|||
PlantillaDeleteDialogComponent,
|
||||
PlantillaDeleteQuestionDialogComponent,
|
||||
PlantillaDeleteOptionDialogComponent,
|
||||
PlantillaPublishStoreDialogComponent,
|
||||
PlantillaDeleteStoreDialogComponent,
|
||||
],
|
||||
entryComponents: [PlantillaDeleteDialogComponent],
|
||||
})
|
||||
|
|
|
@ -26,6 +26,26 @@
|
|||
>
|
||||
<fa-icon icon="sync" [icon]="faPlus"></fa-icon> <span>Crear pregunta</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="ds-btn ds-btn--primary"
|
||||
(click)="publishTemplateToStore()"
|
||||
[disabled]="isLoading"
|
||||
*ngIf="plantilla!.estado === 'DRAFT' && pPreguntas && pPreguntas.length > 0"
|
||||
>
|
||||
<fa-icon icon="sync" [icon]="faStore"></fa-icon> <span>Publicar en tienda</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="ds-btn ds-btn--danger"
|
||||
(click)="deleteTemplateFromStore()"
|
||||
[disabled]="isLoading"
|
||||
*ngIf="plantilla!.estado === 'ACTIVE'"
|
||||
>
|
||||
<fa-icon icon="sync" [icon]="faStore"></fa-icon> <span>Eliminar de tienda</span>
|
||||
</button>
|
||||
</div>
|
||||
</h2>
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import { IPPreguntaCerrada } from 'app/entities/p-pregunta-cerrada/p-pregunta-ce
|
|||
import { PPreguntaCerradaService } from 'app/entities/p-pregunta-cerrada/service/p-pregunta-cerrada.service';
|
||||
import { PPreguntaCerradaDeleteDialogComponent } from 'app/entities/p-pregunta-cerrada/delete/p-pregunta-cerrada-delete-dialog.component';
|
||||
|
||||
import { faTimes, faPlus, faQuestion, faPollH, faEye } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faTimes, faPlus, faQuestion, faPollH, faEye, faStore } from '@fortawesome/free-solid-svg-icons';
|
||||
import { PreguntaCerradaTipo } from 'app/entities/enumerations/pregunta-cerrada-tipo.model';
|
||||
import { PlantillaDeleteQuestionDialogComponent } from '../plantilla-delete-question-dialog/plantilla-delete-question-dialog.component';
|
||||
import { PlantillaDeleteOptionDialogComponent } from '../plantilla-delete-option-dialog/plantilla-delete-option-dialog.component';
|
||||
|
@ -33,6 +33,9 @@ import { PlantillaDeleteOptionDialogComponent } from '../plantilla-delete-option
|
|||
import { ParametroAplicacionService } from './../../parametro-aplicacion/service/parametro-aplicacion.service';
|
||||
import { IParametroAplicacion } from './../../parametro-aplicacion/parametro-aplicacion.model';
|
||||
import { Router } from '@angular/router';
|
||||
import { EstadoPlantilla } from 'app/entities/enumerations/estado-plantilla.model';
|
||||
import { PlantillaDeleteStoreDialogComponent } from '../plantilla-delete-store-dialog/plantilla-delete-store-dialog.component';
|
||||
import { PlantillaPublishStoreDialogComponent } from '../plantilla-publish-store-dialog/plantilla-publish-store-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-plantilla-update',
|
||||
|
@ -44,6 +47,7 @@ export class PlantillaUpdateComponent implements OnInit, AfterViewChecked {
|
|||
faPollH = faPollH;
|
||||
faQuestion = faQuestion;
|
||||
faEye = faEye;
|
||||
faStore = faStore;
|
||||
|
||||
isSaving = false;
|
||||
isSavingQuestion = false;
|
||||
|
@ -449,4 +453,24 @@ export class PlantillaUpdateComponent implements OnInit, AfterViewChecked {
|
|||
trackUsuarioExtraById(index: number, item: IUsuarioExtra): number {
|
||||
return item.id!;
|
||||
}
|
||||
|
||||
publishTemplateToStore(): void {
|
||||
const modalRef = this.modalService.open(PlantillaPublishStoreDialogComponent, { size: 'lg', backdrop: 'static' });
|
||||
modalRef.closed.subscribe(reason => {
|
||||
if (reason === 'confirm') {
|
||||
this.plantilla!.estado = EstadoPlantilla.ACTIVE;
|
||||
this.plantillaService.update(this.plantilla!).subscribe(res => {});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
deleteTemplateFromStore(): void {
|
||||
const modalRef = this.modalService.open(PlantillaDeleteStoreDialogComponent, { size: 'lg', backdrop: 'static' });
|
||||
modalRef.closed.subscribe(reason => {
|
||||
if (reason === 'confirm') {
|
||||
this.plantilla!.estado = EstadoPlantilla.DRAFT;
|
||||
this.plantillaService.update(this.plantilla!).subscribe(res => {});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"EstadoPlantilla": {
|
||||
"null": "",
|
||||
"DRAFT": "Borrador",
|
||||
"ACTIVE": "Activa",
|
||||
"ACTIVE": "En tienda",
|
||||
"DELETED": "Eliminada",
|
||||
"DISABLED": "Desactivada"
|
||||
}
|
||||
|
|
|
@ -12,7 +12,11 @@
|
|||
"updated": "Una plantilla ha sido actualizada con el identificador {{ param }}",
|
||||
"deleted": "Una plantilla ha sido eliminada con el identificador {{ param }}",
|
||||
"delete": {
|
||||
"question": "¿Seguro que quiere eliminar Plantilla {{ id }}?"
|
||||
"question": "¿Seguro que quiere eliminar Plantilla {{ id }}?",
|
||||
"deletefromstore": "¿Seguro que quiere eliminar esta plantilla de la tienda?"
|
||||
},
|
||||
"publish": {
|
||||
"store": "¿Seguro que quiere publicar esta plantilla a la tienda?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Plantilla"
|
||||
|
|
Loading…
Reference in New Issue