Compare commits
	
		
			No commits in common. "main" and "fix/shop-title" have entirely different histories.
		
	
	
		
			main
			...
			fix/shop-t
		
	
		| 
						 | 
				
			
			@ -80,14 +80,11 @@ public class EPreguntaCerradaOpcionResource {
 | 
			
		|||
            .body(result);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PutMapping("/e-pregunta-cerrada-opcions/count/{id}")
 | 
			
		||||
    public ResponseEntity<EPreguntaCerradaOpcion> updateOpcionCount(@PathVariable(value = "id", required = false) final Long id) {
 | 
			
		||||
        System.out.println(id);
 | 
			
		||||
        EPreguntaCerradaOpcion updatedOpcion = ePreguntaCerradaOpcionService.findOne(id).get();
 | 
			
		||||
        System.out.println(updatedOpcion);
 | 
			
		||||
        int cantidad = updatedOpcion.getCantidad() + 1;
 | 
			
		||||
        updatedOpcion.setCantidad(cantidad);
 | 
			
		||||
        this.ePreguntaCerradaOpcionService.partialUpdate(updatedOpcion);
 | 
			
		||||
    @PostMapping("/e-pregunta-cerrada-opcions/count/{id}")
 | 
			
		||||
    public ResponseEntity<EPreguntaCerradaOpcion> updateOpcionCount(@PathVariable(value = "id", required = true) final Long id) {
 | 
			
		||||
        EPreguntaCerradaOpcion updatedOpcion = getEPreguntaCerradaOpcion(id).getBody();
 | 
			
		||||
        int cantidad = updatedOpcion.getCantidad();
 | 
			
		||||
        updatedOpcion.setCantidad(cantidad += 1);
 | 
			
		||||
        return ResponseEntity.ok(updatedOpcion);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,7 +68,7 @@ email.deleteColaborator.text2=Saludos,
 | 
			
		|||
 | 
			
		||||
email.receipt.title=Comprobante de pago
 | 
			
		||||
email.receipt.user={0}
 | 
			
		||||
email.receipt.fecha=Fecha de pago: {0}
 | 
			
		||||
email.receipt.fecha={0}
 | 
			
		||||
email.receipt.plantilla={0}
 | 
			
		||||
email.receipt.precio=${0}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -135,9 +135,11 @@
 | 
			
		|||
          <div class="page-content container">
 | 
			
		||||
            <div class="container px-0">
 | 
			
		||||
              <div class="row mt-4">
 | 
			
		||||
                <div>
 | 
			
		||||
                <div class="col-12 col-lg-10 offset-lg-1">
 | 
			
		||||
                  <!-- .row -->
 | 
			
		||||
 | 
			
		||||
                  <hr class="row brc-default-l1 mx-n1 mb-4" />
 | 
			
		||||
 | 
			
		||||
                  <div class="row">
 | 
			
		||||
                    <div class="col-sm-6">
 | 
			
		||||
                      <div>
 | 
			
		||||
| 
						 | 
				
			
			@ -151,56 +153,31 @@
 | 
			
		|||
                    <!-- /.col -->
 | 
			
		||||
 | 
			
		||||
                    <div class="text-95 col-sm-6 align-self-start d-sm-flex justify-content-end">
 | 
			
		||||
                      <hr class="d-sm-none" />
 | 
			
		||||
                      <div class="text-grey-m2">
 | 
			
		||||
                        <div class="my-2">
 | 
			
		||||
                          <i class="text-blue-m2 text-xs mr-1"></i>
 | 
			
		||||
                          <i class="fa fa-circle text-blue-m2 text-xs mr-1"></i>
 | 
			
		||||
                          <span class="text-600 text-90" th:text="#{email.receipt.fecha(${factura.getFecha()}, 'dd-MM-yyyy HH:mm' )}"
 | 
			
		||||
                            >Fecha:</span
 | 
			
		||||
                          >
 | 
			
		||||
                        </div>
 | 
			
		||||
                      </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <hr class="d-sm-none" />
 | 
			
		||||
                    <!-- /.col -->
 | 
			
		||||
                  </div>
 | 
			
		||||
 | 
			
		||||
                  <div class="container">
 | 
			
		||||
                    <div class="row">
 | 
			
		||||
                      <div class="col-lg-10 mt-5 mb-5">
 | 
			
		||||
                        <table class="table table-bordered" style="width: 100%">
 | 
			
		||||
                          <thead>
 | 
			
		||||
                            <tr class="text-uppercase font-weight-bold text-blue">
 | 
			
		||||
                              <th>Plantilla</th>
 | 
			
		||||
                              <th>Cantidad</th>
 | 
			
		||||
                              <th>Precio</th>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                          </thead>
 | 
			
		||||
                  <div class="mt-4">
 | 
			
		||||
                    <div class="row text-600 text-white bgc-default-tp1 py-25">
 | 
			
		||||
                      <div class="col-9 col-sm-5">Plantilla</div>
 | 
			
		||||
                      <div class="d-none d-sm-block col-4 col-sm-2">Cantidad</div>
 | 
			
		||||
                      <div class="d-none d-sm-block col-sm-2">Precio</div>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                          <tbody style="text-align: center">
 | 
			
		||||
                            <tr class="text-95 text-secondary-d3">
 | 
			
		||||
                              <td th:text="#{email.receipt.plantilla(${factura.getNombrePlantilla()})}"></td>
 | 
			
		||||
                              <td>1</td>
 | 
			
		||||
                              <td th:text="#{email.receipt.precio(${factura.getCosto()})}"></td>
 | 
			
		||||
                            </tr>
 | 
			
		||||
                          </tbody>
 | 
			
		||||
                        </table>
 | 
			
		||||
 | 
			
		||||
                        <hr />
 | 
			
		||||
 | 
			
		||||
                        <!-- <div class="row text-600 text-white bgc-default-tp1 d-flex flex-row" >
 | 
			
		||||
                           <div class="col-9 col-sm-5">Plantilla</div>
 | 
			
		||||
                           <div class="d-none d-sm-block col-4 col-sm-2">Cantidad</div>
 | 
			
		||||
                           <div class="d-none d-sm-block col-sm-2">Precio</div>
 | 
			
		||||
                         </div>
 | 
			
		||||
 | 
			
		||||
                         <div class="text-95 text-secondary-d3">
 | 
			
		||||
                           <div class="row mb-2 mb-sm-0 py-25">
 | 
			
		||||
                             <div class="col-9 col-sm-5" th:text="#{email.receipt.plantilla(${factura.getNombrePlantilla()})}"></div>
 | 
			
		||||
                             <div class="d-none d-sm-block col-2">1</div>
 | 
			
		||||
                             <div class="d-none d-sm-block col-2 text-95" th:text="#{email.receipt.precio(${factura.getCosto()})}"></div>
 | 
			
		||||
                           </div>
 | 
			
		||||
                         </div>-->
 | 
			
		||||
                    <div class="text-95 text-secondary-d3">
 | 
			
		||||
                      <div class="row mb-2 mb-sm-0 py-25">
 | 
			
		||||
                        <div class="col-9 col-sm-5" th:text="#{email.receipt.plantilla(${factura.getNombrePlantilla()})}"></div>
 | 
			
		||||
                        <div class="d-none d-sm-block col-2">1</div>
 | 
			
		||||
                        <div class="d-none d-sm-block col-2 text-95" th:text="#{email.receipt.precio(${factura.getCosto()})}"></div>
 | 
			
		||||
                      </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                  </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -208,7 +185,7 @@
 | 
			
		|||
                  <div class="row mt-3">
 | 
			
		||||
                    <div class="col-12 col-sm-5 text-grey text-90 order-first order-sm-last">
 | 
			
		||||
                      <div class="row my-2 align-items-center bgc-primary-l3 p-2">
 | 
			
		||||
                        <div class="col-7 text-600 text-110 text-blue text-right">Monto total:</div>
 | 
			
		||||
                        <div class="col-7 text-right">Monto total</div>
 | 
			
		||||
                        <div class="col-5">
 | 
			
		||||
                          <span class="text-150 text-success-d3 opacity-2" th:text="#{email.receipt.precio(${factura.getCosto()})}"></span>
 | 
			
		||||
                        </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -396,59 +396,6 @@ export class DashboardUserComponent implements OnInit {
 | 
			
		|||
      const _excelFinalData = [_reporteEncuestasCreadas, _reporteUsuariosCompletadas, _reporteEncuestasEstado, _reporteEncuestasAcceso];
 | 
			
		||||
      const _fileName = 'reportes_generales_encuestas_DataSurvey';
 | 
			
		||||
      exportAsExcelFile(_sheets, _excelFinalData, _fileName);
 | 
			
		||||
    } else if (!this.reportPreguntas) {
 | 
			
		||||
      /*REPORTES POR ENCUESTA:
 | 
			
		||||
       * Nombre encuesta
 | 
			
		||||
       * categoria encuesta
 | 
			
		||||
       * calificacion encuesta
 | 
			
		||||
       *
 | 
			
		||||
       * preguntas:
 | 
			
		||||
       * contenido/ cantidad*/
 | 
			
		||||
 | 
			
		||||
      const _sheets = ['Datos de encuesta', 'Contenido de preguntas cerradas', 'Contenido de preguntas abiertas'];
 | 
			
		||||
 | 
			
		||||
      const _reporteDatosEncuesta = [
 | 
			
		||||
        {
 | 
			
		||||
          nombre_encuesta: this.encuesta?.nombre,
 | 
			
		||||
          categoria_encuesta: this.encuesta?.categoria?.nombre,
 | 
			
		||||
          calificacion_encuesta: this.encuesta?.calificacion,
 | 
			
		||||
        },
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      const _reporteContenidoPreguntasCerradas: any[] = [];
 | 
			
		||||
      const _reporteContenidoPreguntasAbiertas: any[] = [];
 | 
			
		||||
 | 
			
		||||
      this.ePreguntas!.forEach((pregunta: any, index) => {
 | 
			
		||||
        debugger;
 | 
			
		||||
        let _report: any = {};
 | 
			
		||||
        let _reportAbierta: any = {};
 | 
			
		||||
 | 
			
		||||
        if (!pregunta.tipo) {
 | 
			
		||||
          this.respuestaAbierta!.forEach((respuesta: any) => {
 | 
			
		||||
            if (respuesta.epreguntaAbierta?.id == pregunta.id) {
 | 
			
		||||
              // _reportAbierta['pregunta_abierta'] = pregunta.nombre;
 | 
			
		||||
              _reportAbierta['contenido'] = respuesta.respuesta;
 | 
			
		||||
              _reporteContenidoPreguntasAbiertas.push(_reportAbierta);
 | 
			
		||||
            }
 | 
			
		||||
          });
 | 
			
		||||
        } else {
 | 
			
		||||
          debugger;
 | 
			
		||||
 | 
			
		||||
          this.ePreguntasOpciones!.forEach((respuesta: any, index) => {
 | 
			
		||||
            console.log(respuesta.epreguntaCerrada);
 | 
			
		||||
 | 
			
		||||
            if (respuesta[index].epreguntaCerrada.id == pregunta.id) {
 | 
			
		||||
              _report['opcion_pregunta'] = respuesta[index].nombre;
 | 
			
		||||
              _report['cantidad'] = respuesta[index].cantidad;
 | 
			
		||||
              _reporteContenidoPreguntasCerradas.push(_report);
 | 
			
		||||
            }
 | 
			
		||||
          });
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      const _excelFinalData = [_reporteDatosEncuesta, _reporteContenidoPreguntasCerradas, _reporteContenidoPreguntasAbiertas];
 | 
			
		||||
      const _fileName = 'reportes_detalle_encuesta_datasurvey';
 | 
			
		||||
      exportAsExcelFile(_sheets, _excelFinalData, _fileName);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -510,83 +457,6 @@ export class DashboardUserComponent implements OnInit {
 | 
			
		|||
      generatePDFTable(doc, _docData, _docHeaders, _docTitle);
 | 
			
		||||
      doc.addPage('p');
 | 
			
		||||
 | 
			
		||||
      saveGeneratedPDF(doc, _fileName);
 | 
			
		||||
    } else {
 | 
			
		||||
      /*REPORTES POR ENCUESTA:
 | 
			
		||||
       * Nombre encuesta
 | 
			
		||||
       * categoria encuesta
 | 
			
		||||
       * calificacion encuesta
 | 
			
		||||
       *
 | 
			
		||||
       * preguntas:
 | 
			
		||||
       * contenido/ cantidad*/
 | 
			
		||||
 | 
			
		||||
      const doc = new jsPDF();
 | 
			
		||||
      const _fileName = 'reportes_detalles_encuestas_datasurvey';
 | 
			
		||||
      let _docData, _headers, _docHeaders, _docTitle;
 | 
			
		||||
 | 
			
		||||
      const _reporteDatosEncuesta = [
 | 
			
		||||
        {
 | 
			
		||||
          nombre_encuesta: this.encuesta?.nombre,
 | 
			
		||||
          categoria_encuesta: this.encuesta?.categoria?.nombre,
 | 
			
		||||
          calificacion_encuesta: this.encuesta?.calificacion!.toString(),
 | 
			
		||||
        },
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      _docData = generatePDFTableData(_reporteDatosEncuesta);
 | 
			
		||||
      _headers = ['nombre_encuesta', 'categoria_encuesta', 'calificacion_encuesta'];
 | 
			
		||||
      _docHeaders = createPDFTableHeaders(_headers);
 | 
			
		||||
      _docTitle = 'Reporte Detalle Encuesta';
 | 
			
		||||
 | 
			
		||||
      generatePDFTable(doc, _docData, _docHeaders, _docTitle);
 | 
			
		||||
      doc.addPage('l');
 | 
			
		||||
 | 
			
		||||
      const _reporteContenidoPreguntasCerradas: any[] = [];
 | 
			
		||||
      const _reporteContenidoPreguntasAbiertas: any[] = [];
 | 
			
		||||
 | 
			
		||||
      this.ePreguntas!.forEach((pregunta: any, index) => {
 | 
			
		||||
        debugger;
 | 
			
		||||
        let _report: any = {};
 | 
			
		||||
        let _reportAbierta: any = {};
 | 
			
		||||
 | 
			
		||||
        if (!pregunta.tipo) {
 | 
			
		||||
          this.respuestaAbierta!.forEach((respuesta: any) => {
 | 
			
		||||
            if (respuesta.epreguntaAbierta?.id == pregunta.id) {
 | 
			
		||||
              _reportAbierta['pregunta_abierta'] = 'Contenido';
 | 
			
		||||
              _reportAbierta['contenido'] = respuesta.respuesta;
 | 
			
		||||
              _reporteContenidoPreguntasAbiertas.push(_reportAbierta);
 | 
			
		||||
            }
 | 
			
		||||
          });
 | 
			
		||||
        } else {
 | 
			
		||||
          debugger;
 | 
			
		||||
 | 
			
		||||
          this.ePreguntasOpciones!.forEach((respuesta: any, index) => {
 | 
			
		||||
            console.log(respuesta.epreguntaCerrada);
 | 
			
		||||
 | 
			
		||||
            if (respuesta[index].epreguntaCerrada.id == pregunta.id) {
 | 
			
		||||
              _report['opcion_pregunta'] = respuesta[index].nombre;
 | 
			
		||||
              _report['cantidad'] = respuesta[index].cantidad.toString();
 | 
			
		||||
              _reporteContenidoPreguntasCerradas.push(_report);
 | 
			
		||||
            }
 | 
			
		||||
          });
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      _docData = generatePDFTableData(_reporteContenidoPreguntasCerradas);
 | 
			
		||||
      _headers = ['opcion_pregunta', 'cantidad'];
 | 
			
		||||
      _docHeaders = createPDFTableHeaders(_headers);
 | 
			
		||||
      _docTitle = 'Reporte de Cantidad Seleccion Opciones Cerradas';
 | 
			
		||||
 | 
			
		||||
      generatePDFTable(doc, _docData, _docHeaders, _docTitle);
 | 
			
		||||
      doc.addPage('l');
 | 
			
		||||
 | 
			
		||||
      _docData = generatePDFTableData(_reporteContenidoPreguntasAbiertas);
 | 
			
		||||
      _headers = ['pregunta_abierta', 'contenido'];
 | 
			
		||||
      _docHeaders = createPDFTableHeaders(_headers);
 | 
			
		||||
      _docTitle = 'Reporte Respuesta Pregunta Abierta';
 | 
			
		||||
 | 
			
		||||
      generatePDFTable(doc, _docData, _docHeaders, _docTitle);
 | 
			
		||||
      doc.addPage('l');
 | 
			
		||||
 | 
			
		||||
      saveGeneratedPDF(doc, _fileName);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ export interface IEPreguntaAbiertaRespuesta {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
export class EPreguntaAbiertaRespuesta implements IEPreguntaAbiertaRespuesta {
 | 
			
		||||
  constructor(public respuesta?: string, public epreguntaAbierta?: IEPreguntaAbierta | null) {}
 | 
			
		||||
  constructor(public id?: number, public respuesta?: string, public epreguntaAbierta?: IEPreguntaAbierta | null) {}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function getEPreguntaAbiertaRespuestaIdentifier(ePreguntaAbiertaRespuesta: IEPreguntaAbiertaRespuesta): number | undefined {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,6 @@ export class EPreguntaAbiertaRespuestaService {
 | 
			
		|||
  constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
 | 
			
		||||
 | 
			
		||||
  create(ePreguntaAbiertaRespuesta: IEPreguntaAbiertaRespuesta): Observable<EntityResponseType> {
 | 
			
		||||
    debugger;
 | 
			
		||||
    return this.http.post<IEPreguntaAbiertaRespuesta>(this.resourceUrl, ePreguntaAbiertaRespuesta, { observe: 'response' });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,9 +30,9 @@
 | 
			
		|||
        </dd>
 | 
			
		||||
        <dt><span jhiTranslate="dataSurveyApp.ePreguntaCerradaOpcion.ePreguntaCerrada">E Pregunta Cerrada</span></dt>
 | 
			
		||||
        <dd>
 | 
			
		||||
          <div *ngIf="ePreguntaCerradaOpcion.epreguntaCerrada">
 | 
			
		||||
            <a [routerLink]="['/e-pregunta-cerrada', ePreguntaCerradaOpcion.epreguntaCerrada?.id, 'view']">{{
 | 
			
		||||
              ePreguntaCerradaOpcion.epreguntaCerrada?.id
 | 
			
		||||
          <div *ngIf="ePreguntaCerradaOpcion.ePreguntaCerrada">
 | 
			
		||||
            <a [routerLink]="['/e-pregunta-cerrada', ePreguntaCerradaOpcion.ePreguntaCerrada?.id, 'view']">{{
 | 
			
		||||
              ePreguntaCerradaOpcion.ePreguntaCerrada?.id
 | 
			
		||||
            }}</a>
 | 
			
		||||
          </div>
 | 
			
		||||
        </dd>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ export interface IEPreguntaCerradaOpcion {
 | 
			
		|||
  nombre?: string;
 | 
			
		||||
  orden?: number;
 | 
			
		||||
  cantidad?: number;
 | 
			
		||||
  epreguntaCerrada?: IEPreguntaCerrada | null;
 | 
			
		||||
  ePreguntaCerrada?: IEPreguntaCerrada | null;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class EPreguntaCerradaOpcion implements IEPreguntaCerradaOpcion {
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,7 @@ export class EPreguntaCerradaOpcion implements IEPreguntaCerradaOpcion {
 | 
			
		|||
    public nombre?: string,
 | 
			
		||||
    public orden?: number,
 | 
			
		||||
    public cantidad?: number,
 | 
			
		||||
    public epreguntaCerrada?: IEPreguntaCerrada | null
 | 
			
		||||
    public ePreguntaCerrada?: IEPreguntaCerrada | null
 | 
			
		||||
  ) {}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,9 +49,9 @@
 | 
			
		|||
          <td>{{ ePreguntaCerradaOpcion.orden }}</td>
 | 
			
		||||
          <td>{{ ePreguntaCerradaOpcion.cantidad }}</td>
 | 
			
		||||
          <td>
 | 
			
		||||
            <div *ngIf="ePreguntaCerradaOpcion.epreguntaCerrada">
 | 
			
		||||
              <a [routerLink]="['/e-pregunta-cerrada', ePreguntaCerradaOpcion.epreguntaCerrada?.id, 'view']">{{
 | 
			
		||||
                ePreguntaCerradaOpcion.epreguntaCerrada?.id
 | 
			
		||||
            <div *ngIf="ePreguntaCerradaOpcion.ePreguntaCerrada">
 | 
			
		||||
              <a [routerLink]="['/e-pregunta-cerrada', ePreguntaCerradaOpcion.ePreguntaCerrada?.id, 'view']">{{
 | 
			
		||||
                ePreguntaCerradaOpcion.ePreguntaCerrada?.id
 | 
			
		||||
              }}</a>
 | 
			
		||||
            </div>
 | 
			
		||||
          </td>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,9 +16,8 @@ export class EPreguntaCerradaOpcionService {
 | 
			
		|||
 | 
			
		||||
  constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
 | 
			
		||||
 | 
			
		||||
  updateCount(id: number) {
 | 
			
		||||
    debugger;
 | 
			
		||||
    return this.http.put(`${this.resourceUrl}/count/${id}`, id, { observe: 'response' });
 | 
			
		||||
  updateCount(id: any) {
 | 
			
		||||
    return this.http.post(`${this.resourceUrl}/count/${id}`, id, { observe: 'response' });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  create(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion, preguntaId?: number): Observable<EntityResponseType> {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,7 +43,7 @@ describe('Component Tests', () => {
 | 
			
		|||
      it('Should call EPreguntaCerrada query and add missing value', () => {
 | 
			
		||||
        const ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion = { id: 456 };
 | 
			
		||||
        const ePreguntaCerrada: IEPreguntaCerrada = { id: 2192 };
 | 
			
		||||
        ePreguntaCerradaOpcion.epreguntaCerrada = ePreguntaCerrada;
 | 
			
		||||
        ePreguntaCerradaOpcion.ePreguntaCerrada = ePreguntaCerrada;
 | 
			
		||||
 | 
			
		||||
        const ePreguntaCerradaCollection: IEPreguntaCerrada[] = [{ id: 89287 }];
 | 
			
		||||
        jest.spyOn(ePreguntaCerradaService, 'query').mockReturnValue(of(new HttpResponse({ body: ePreguntaCerradaCollection })));
 | 
			
		||||
| 
						 | 
				
			
			@ -65,7 +65,7 @@ describe('Component Tests', () => {
 | 
			
		|||
      it('Should update editForm', () => {
 | 
			
		||||
        const ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion = { id: 456 };
 | 
			
		||||
        const ePreguntaCerrada: IEPreguntaCerrada = { id: 64500 };
 | 
			
		||||
        ePreguntaCerradaOpcion.epreguntaCerrada = ePreguntaCerrada;
 | 
			
		||||
        ePreguntaCerradaOpcion.ePreguntaCerrada = ePreguntaCerrada;
 | 
			
		||||
 | 
			
		||||
        activatedRoute.data = of({ ePreguntaCerradaOpcion });
 | 
			
		||||
        comp.ngOnInit();
 | 
			
		||||
| 
						 | 
				
			
			@ -85,12 +85,12 @@ export class EPreguntaCerradaOpcionUpdateComponent implements OnInit {
 | 
			
		|||
      nombre: ePreguntaCerradaOpcion.nombre,
 | 
			
		||||
      orden: ePreguntaCerradaOpcion.orden,
 | 
			
		||||
      cantidad: ePreguntaCerradaOpcion.cantidad,
 | 
			
		||||
      ePreguntaCerrada: ePreguntaCerradaOpcion.epreguntaCerrada,
 | 
			
		||||
      ePreguntaCerrada: ePreguntaCerradaOpcion.ePreguntaCerrada,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    this.ePreguntaCerradasSharedCollection = this.ePreguntaCerradaService.addEPreguntaCerradaToCollectionIfMissing(
 | 
			
		||||
      this.ePreguntaCerradasSharedCollection,
 | 
			
		||||
      ePreguntaCerradaOpcion.epreguntaCerrada
 | 
			
		||||
      ePreguntaCerradaOpcion.ePreguntaCerrada
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -116,7 +116,7 @@ export class EPreguntaCerradaOpcionUpdateComponent implements OnInit {
 | 
			
		|||
      nombre: this.editForm.get(['nombre'])!.value,
 | 
			
		||||
      orden: this.editForm.get(['orden'])!.value,
 | 
			
		||||
      cantidad: this.editForm.get(['cantidad'])!.value,
 | 
			
		||||
      epreguntaCerrada: this.editForm.get(['ePreguntaCerrada'])!.value,
 | 
			
		||||
      ePreguntaCerrada: this.editForm.get(['ePreguntaCerrada'])!.value,
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,11 +2,11 @@
 | 
			
		|||
  <div>
 | 
			
		||||
    <h2 id="page-heading" data-cy="EPreguntaCerradaHeading">
 | 
			
		||||
      <div class="d-flex align-items-center">
 | 
			
		||||
        <p class="ds-title">Encuesta: {{ encuesta!.nombre }}</p>
 | 
			
		||||
        <!--   <fa-icon class="ds-info--icon" [icon]="faQuestion" data-toggle="modal" data-target="#verParametros"></fa-icon>-->
 | 
			
		||||
        <p class="ds-title">Vista previa de {{ encuesta!.nombre }}</p>
 | 
			
		||||
          <fa-icon class="ds-info--icon" [icon]="faQuestion" data-toggle="modal" data-target="#verParametros"></fa-icon>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <p class="ds-subtitle">Fecha de inicio: {{ encuesta!.fechaPublicacion | formatShortDatetime | lowercase }}</p>
 | 
			
		||||
      <p class="ds-subtitle">Creada el día {{ encuesta!.fechaCreacion | formatShortDatetime | lowercase }}</p>
 | 
			
		||||
      <div class="d-flex justify-content-end">
 | 
			
		||||
        <button type="button" class="ds-btn ds-btn--secondary" (click)="previousState()">
 | 
			
		||||
          <fa-icon icon="arrow-left"></fa-icon>  <span jhiTranslate="entity.action.back">Back</span>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,6 @@ import { PreguntaCerradaTipo } from 'app/entities/enumerations/pregunta-cerrada-
 | 
			
		|||
import { EPreguntaAbiertaRespuesta } from 'app/entities/e-pregunta-abierta-respuesta/e-pregunta-abierta-respuesta.model';
 | 
			
		||||
import { Observable } from 'rxjs/internal/Observable';
 | 
			
		||||
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'jhi-complete',
 | 
			
		||||
| 
						 | 
				
			
			@ -68,14 +67,16 @@ export class EncuestaCompleteComponent implements OnInit {
 | 
			
		|||
    this.activatedRoute.data.subscribe(({ encuesta }) => {
 | 
			
		||||
      if (encuesta) {
 | 
			
		||||
        this.encuesta = encuesta;
 | 
			
		||||
        if (this.encuesta!.estado !== EstadoEncuesta.ACTIVE) {
 | 
			
		||||
          this.previousState();
 | 
			
		||||
        }
 | 
			
		||||
        this.avgCalificacion = parseInt(this.encuesta!.calificacion!.toString().split('.')[0]);
 | 
			
		||||
        this.cantidadCalificaciones = parseInt(this.encuesta!.calificacion!.toString().split('.')[1]);
 | 
			
		||||
        this.sumCalificacion = this.avgCalificacion * this.cantidadCalificaciones;
 | 
			
		||||
      }
 | 
			
		||||
      this.verifyPassword();
 | 
			
		||||
      this.isLocked = this.verifyPassword();
 | 
			
		||||
      if (this.isLocked) {
 | 
			
		||||
        this.previousState();
 | 
			
		||||
      } else {
 | 
			
		||||
        this.loadAll();
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
    for (let pregunta of this.ePreguntas!) {
 | 
			
		||||
      if (pregunta.tipo && pregunta.tipo === PreguntaCerradaTipo.SINGLE) {
 | 
			
		||||
| 
						 | 
				
			
			@ -84,22 +85,17 @@ export class EncuestaCompleteComponent implements OnInit {
 | 
			
		|||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  verifyPassword(): void {
 | 
			
		||||
  verifyPassword(): boolean {
 | 
			
		||||
    if (this.encuesta!.acceso === AccesoEncuesta.PUBLIC) {
 | 
			
		||||
      this.loadAll();
 | 
			
		||||
      this.isLocked = false;
 | 
			
		||||
      return false;
 | 
			
		||||
    } else {
 | 
			
		||||
      const modalRef = this.modalService.open(EncuestaPasswordDialogComponent, { size: 'lg', backdrop: 'static' });
 | 
			
		||||
      modalRef.componentInstance.encuesta = this.encuesta;
 | 
			
		||||
      modalRef.closed.subscribe(reason => {
 | 
			
		||||
        this.isLocked = reason != 'success';
 | 
			
		||||
        if (this.isLocked) {
 | 
			
		||||
          this.previousState();
 | 
			
		||||
        } else {
 | 
			
		||||
          this.loadAll();
 | 
			
		||||
        }
 | 
			
		||||
        return reason === 'success';
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngAfterViewChecked(): void {
 | 
			
		||||
| 
						 | 
				
			
			@ -190,57 +186,39 @@ export class EncuestaCompleteComponent implements OnInit {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  finish(): void {
 | 
			
		||||
    this.updateClosedOptionsCount();
 | 
			
		||||
    this.updateEncuestaRating();
 | 
			
		||||
    this.getOpenQuestionAnswers();
 | 
			
		||||
    this.registerOpenQuestionAnswers();
 | 
			
		||||
    this.updateEncuestaRating();
 | 
			
		||||
    this.previousState();
 | 
			
		||||
    this.updateClosedOptionsCount();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateEncuestaRating() {
 | 
			
		||||
    if (this.calificacion !== 0) {
 | 
			
		||||
      const newSumCalificacion = this.sumCalificacion + this.calificacion;
 | 
			
		||||
      const newCantidadCalificacion = this.cantidadCalificaciones + 1;
 | 
			
		||||
      const newAvgCalificacion = Math.round(newSumCalificacion / newCantidadCalificacion);
 | 
			
		||||
      const newRating = Number(this.joinRatingValues(newAvgCalificacion, newCantidadCalificacion));
 | 
			
		||||
      this.encuesta!.calificacion = newRating;
 | 
			
		||||
      this.encuestaService.updateSurvey(this.encuesta!).subscribe(() => {
 | 
			
		||||
        console.log('success');
 | 
			
		||||
      });
 | 
			
		||||
      const newAvgCalificacion = newSumCalificacion / newCantidadCalificacion;
 | 
			
		||||
      const newRating = this.joinRatingValues(newAvgCalificacion, newCantidadCalificacion);
 | 
			
		||||
      this.encuesta!.calificacion = Number(newRating);
 | 
			
		||||
      this.encuestaService.updateSurvey(this.encuesta!);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateClosedOptionsCount() {
 | 
			
		||||
    debugger;
 | 
			
		||||
    for (let key in this.selectedSingleOptions) {
 | 
			
		||||
      this.ePreguntaCerradaOpcionService.updateCount(this.selectedSingleOptions[key]).subscribe(() => {
 | 
			
		||||
        console.log('success');
 | 
			
		||||
      });
 | 
			
		||||
      this.ePreguntaCerradaOpcionService.updateCount(this.selectedSingleOptions[key]);
 | 
			
		||||
    }
 | 
			
		||||
    this.selectedMultiOptions.forEach((option: any) => {
 | 
			
		||||
      this.ePreguntaCerradaOpcionService.updateCount(option).subscribe(() => {
 | 
			
		||||
        console.log('success');
 | 
			
		||||
      });
 | 
			
		||||
      this.ePreguntaCerradaOpcionService.updateCount(option);
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  registerOpenQuestionAnswers() {
 | 
			
		||||
    debugger;
 | 
			
		||||
    for (let id in this.selectedOpenOptions) {
 | 
			
		||||
      let pregunta = this.ePreguntas!.find(p => {
 | 
			
		||||
        return p.id == id;
 | 
			
		||||
      });
 | 
			
		||||
      debugger;
 | 
			
		||||
      /*
 | 
			
		||||
 | 
			
		||||
      let newRespuesta = new EPreguntaAbiertaRespuesta(this.selectedOpenOptions[id], pregunta);
 | 
			
		||||
      this.subscribeToSaveResponse(this.ePreguntaAbiertaRespuestaService.create(newRespuesta));
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
      let newRespuesta = new EPreguntaAbiertaRespuesta(this.selectedOpenOptions[id], pregunta);
 | 
			
		||||
      this.ePreguntaAbiertaRespuestaService.create(newRespuesta).subscribe(() => {
 | 
			
		||||
        console.log('success');
 | 
			
		||||
      });
 | 
			
		||||
      let newRespuesta = new EPreguntaAbiertaRespuesta(0, this.selectedOpenOptions[id], pregunta);
 | 
			
		||||
      this.ePreguntaAbiertaRespuestaService.create(newRespuesta);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
<form class="ds-form" name="deleteForm">
 | 
			
		||||
<form class="ds-form" [formGroup]="passwordForm" name="deleteForm" (ngSubmit)="submitPassword()">
 | 
			
		||||
  <div *ngIf="this.isWrong">
 | 
			
		||||
    <p>Contraseña incorrecta</p>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="modal-body">
 | 
			
		||||
    <p class="ds-title--small" jhiTranslate="dataSurveyApp.encuesta.password.title">Enter password</p>
 | 
			
		||||
    <p class="ds-subtitle" id="jhi-delete-encuesta-heading" jhiTranslate="dataSurveyApp.encuesta.password.text">
 | 
			
		||||
      This survey is marked as private, please enter the password
 | 
			
		||||
    </p>
 | 
			
		||||
    <div class="alert alert-danger" *ngIf="this.isWrong">
 | 
			
		||||
      <p>Contraseña incorrecta</p>
 | 
			
		||||
    </div>
 | 
			
		||||
    <input [(ngModel)]="passwordInput" type="password" name="passwordInput" id="passwordInput" placeholder="qwerty..." />
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,13 @@
 | 
			
		|||
      <fa-icon icon="arrow-left"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
 | 
			
		||||
    </button>
 | 
			
		||||
 | 
			
		||||
    <button class="ds-btn ds-btn--primary" (click)="submitPassword()">
 | 
			
		||||
    <button
 | 
			
		||||
      id="jhi-confirm-delete-option"
 | 
			
		||||
      data-cy="submit"
 | 
			
		||||
      type="submit"
 | 
			
		||||
      class="ds-btn ds-btn--primary"
 | 
			
		||||
      [disabled]="passwordForm.get('password')!.invalid"
 | 
			
		||||
    >
 | 
			
		||||
      <span jhiTranslate="entity.action.submit">Submit</span>
 | 
			
		||||
    </button>
 | 
			
		||||
  </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
import { Component, OnInit } from '@angular/core';
 | 
			
		||||
import { FormBuilder, Validators } from '@angular/forms';
 | 
			
		||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 | 
			
		||||
import { IEncuesta } from '../encuesta.model';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -8,16 +9,21 @@ import { IEncuesta } from '../encuesta.model';
 | 
			
		|||
  styleUrls: ['./encuesta-password-dialog.component.scss'],
 | 
			
		||||
})
 | 
			
		||||
export class EncuestaPasswordDialogComponent implements OnInit {
 | 
			
		||||
  passwordForm = this.fb.group({
 | 
			
		||||
    password: [null, [Validators.required]],
 | 
			
		||||
  });
 | 
			
		||||
  encuesta?: IEncuesta;
 | 
			
		||||
  isWrong?: boolean;
 | 
			
		||||
  passwordInput?: string;
 | 
			
		||||
 | 
			
		||||
  constructor(protected activeModal: NgbActiveModal) {}
 | 
			
		||||
  constructor(protected activeModal: NgbActiveModal, protected fb: FormBuilder) {}
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {}
 | 
			
		||||
 | 
			
		||||
  submitPassword() {
 | 
			
		||||
    if (this.passwordInput != undefined && this.passwordInput === this.encuesta!.contrasenna) {
 | 
			
		||||
    const password = this.passwordForm.get(['password'])!.value;
 | 
			
		||||
 | 
			
		||||
    if (this.passwordForm.valid && password === this.encuesta!.contrasenna) {
 | 
			
		||||
      this.activeModal.close('success');
 | 
			
		||||
    } else {
 | 
			
		||||
      this.isWrong = true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,6 +44,7 @@ const encuestaRoute: Routes = [
 | 
			
		|||
    resolve: {
 | 
			
		||||
      encuesta: EncuestaRoutingResolveService,
 | 
			
		||||
    },
 | 
			
		||||
    canActivate: [UserRouteAccessService],
 | 
			
		||||
  },
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@
 | 
			
		|||
        [disabled]="isLoading"
 | 
			
		||||
        data-toggle="modal"
 | 
			
		||||
        data-target="#crearPregunta"
 | 
			
		||||
        *ngIf="encuesta!.estado !== 'ACTIVE' && encuesta!.estado !== 'FINISHED' && (isAutor() || isEscritor())"
 | 
			
		||||
        *ngIf="encuesta!.estado !== 'FINISHED' && (isAutor() || isEscritor())"
 | 
			
		||||
      >
 | 
			
		||||
        <fa-icon icon="sync" [icon]="faPlus"></fa-icon>  <span>Crear pregunta</span>
 | 
			
		||||
      </button>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -376,7 +376,7 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
 | 
			
		|||
      nombre: this.editForm.get(['nombre'])!.value,
 | 
			
		||||
      orden: 10,
 | 
			
		||||
      cantidad: 0,
 | 
			
		||||
      epreguntaCerrada: this.selectedQuestionToCreateOption,
 | 
			
		||||
      ePreguntaCerrada: this.selectedQuestionToCreateOption,
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -135,22 +135,20 @@
 | 
			
		|||
                      ></fa-icon>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="entity-body--row m-2">
 | 
			
		||||
                      <button class="ds-btn btn-card" routerLink="pagina-principal" routerLinkActive="router-link-active">
 | 
			
		||||
                        <fa-icon [icon]="faPollH"></fa-icon>  Ver más encuestas
 | 
			
		||||
                      </button>
 | 
			
		||||
                      <button class="ds-btn btn-card"><fa-icon [icon]="faPollH"></fa-icon>  Completar encuesta</button>
 | 
			
		||||
                    </div>
 | 
			
		||||
                  </div>
 | 
			
		||||
                </div>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <!-- <div class="row">
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col">
 | 
			
		||||
              <a routerLink="#">
 | 
			
		||||
                <button class="ds-btn ds-btn--primary fw-500 ms-lg-4 mb-4">Ver todas las encuestas</button>
 | 
			
		||||
              </a>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div> -->
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,13 +94,6 @@ export class HomeComponent implements OnInit, OnDestroy {
 | 
			
		|||
      (res: HttpResponse<IEncuesta[]>) => {
 | 
			
		||||
        this.isLoading = false;
 | 
			
		||||
        const tmpEncuestas = res.body ?? [];
 | 
			
		||||
 | 
			
		||||
        // Fix calificacion
 | 
			
		||||
        tmpEncuestas.forEach(encuesta => {
 | 
			
		||||
          const _calificacion = encuesta.calificacion;
 | 
			
		||||
          encuesta.calificacion = Number(_calificacion?.toString().split('.')[0]);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        this.encuestas = tmpEncuestas.filter(e => e.estado === 'ACTIVE' && e.acceso === 'PUBLIC');
 | 
			
		||||
        this.encuestasMostradas = this.encuestas.reverse().slice(0, 3);
 | 
			
		||||
      },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue