Merge branch 'dev' into feature/US-51
This commit is contained in:
		
						commit
						29ffab414c
					
				
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -60,9 +60,9 @@ email.invitation.text1=Fue invitado a la encuesta "{0}(#{1})". Para aceptar la s
 | 
			
		|||
email.invitation.text2=Saludos,
 | 
			
		||||
 | 
			
		||||
#Delete Colaborator
 | 
			
		||||
email.deleteColaborator.title=Se le ha expulsado de una encuesta como colaborador
 | 
			
		||||
email.deleteColaborator.greeting=¡Se le ha expulsado, {0}!
 | 
			
		||||
email.deleteColaborator.text1=Fue expulsado de la encuesta {0}(#{1})"
 | 
			
		||||
email.deleteColaborator.title=Eliminado de colaboración
 | 
			
		||||
email.deleteColaborator.greeting=Hola, {0}
 | 
			
		||||
email.deleteColaborator.text1=Le informamos que ya no cuenta con los permisos de colaborador para la encuesta {0}(#{1}), ya que su colaboración ha sido eliminada por el dueño de la encuesta"
 | 
			
		||||
email.deleteColaborator.text2=Saludos,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -170,9 +170,7 @@ export class DashboardAdminComponent implements OnInit {
 | 
			
		|||
              let cantPublicadas = 0;
 | 
			
		||||
              let cantFinalizadas = 0;
 | 
			
		||||
              let cantBorradores = 0;
 | 
			
		||||
              cantEncuestas = tmpEncuestas.filter(
 | 
			
		||||
                e => e.estado !== 'DELETED' && e.usuarioExtra?.id === u.id && e.usuarioExtra?.user?.authorities
 | 
			
		||||
              ).length;
 | 
			
		||||
              cantEncuestas = tmpEncuestas.filter(e => e.estado !== 'DELETED' && e.usuarioExtra?.id === u.id).length;
 | 
			
		||||
              cantPublicadas = tmpEncuestas.filter(e => e.estado === 'ACTIVE' && e.usuarioExtra?.id === u.id).length;
 | 
			
		||||
              cantFinalizadas = tmpEncuestas.filter(e => e.estado === 'FINISHED' && e.usuarioExtra?.id === u.id).length;
 | 
			
		||||
              cantBorradores = tmpEncuestas.filter(e => e.estado === 'DRAFT' && e.usuarioExtra?.id === u.id).length;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@
 | 
			
		|||
 | 
			
		||||
    <div class="ds-survey preview-survey" id="entities" *ngIf="ePreguntas && ePreguntas.length > 0">
 | 
			
		||||
      <div class="ds-survey--all-question-wrapper col-8">
 | 
			
		||||
        <div class="ds-survey--question-wrapper card-encuesta lift" *ngFor="let ePregunta of ePreguntas; let i = index; trackBy: trackId">
 | 
			
		||||
        <div class="ds-survey--question-wrapper card-encuesta" *ngFor="let ePregunta of ePreguntas; let i = index; trackBy: trackId">
 | 
			
		||||
          <div
 | 
			
		||||
            [attr.data-index]="ePregunta.id"
 | 
			
		||||
            [attr.data-tipo]="ePregunta.tipo"
 | 
			
		||||
| 
						 | 
				
			
			@ -79,7 +79,25 @@
 | 
			
		|||
              </ng-container>
 | 
			
		||||
            </ng-container>
 | 
			
		||||
            <div class="ds-survey--option ds-survey--option--base ds-survey--open-option" *ngIf="!ePregunta.tipo">
 | 
			
		||||
              <textarea id="{{ ePregunta.id }}" cols="33" rows="10"></textarea>
 | 
			
		||||
              <textarea class="ds-survey--textarea" id="{{ ePregunta.id }}" cols="33" rows="10"></textarea>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="ds-survey--question-wrapper card-encuesta">
 | 
			
		||||
          <div class="ds-survey--question">
 | 
			
		||||
            <div class="ds-survey--rating">
 | 
			
		||||
              <div class="ds-survey--titulo">
 | 
			
		||||
                <span class="ds-survey--titulo--name">Calificación</span>
 | 
			
		||||
              </div>
 | 
			
		||||
              <div class="ds-survey--option ds-survey--option--base">
 | 
			
		||||
                <fa-icon
 | 
			
		||||
                  *ngFor="let starNumber of this.stars"
 | 
			
		||||
                  id="{{ 'star-' + starNumber }}"
 | 
			
		||||
                  class="entity-icon--star--off"
 | 
			
		||||
                  [icon]="faStar"
 | 
			
		||||
                  (click)="updateRating(starNumber)"
 | 
			
		||||
                ></fa-icon>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -139,21 +157,21 @@
 | 
			
		|||
 | 
			
		||||
                <div class="mb-5">
 | 
			
		||||
                  <p class="ds-subtitle">Fecha de finalización</p>
 | 
			
		||||
                  <P>
 | 
			
		||||
                  <p>
 | 
			
		||||
                    {{
 | 
			
		||||
                      encuesta.fechaFinalizada === undefined
 | 
			
		||||
                        ? 'Sin finalizar'
 | 
			
		||||
                        : (encuesta.fechaFinalizada | formatShortDatetime | lowercase)
 | 
			
		||||
                    }}
 | 
			
		||||
                  </P>
 | 
			
		||||
                  </p>
 | 
			
		||||
                </div>
 | 
			
		||||
 | 
			
		||||
                <div class="mb-5">
 | 
			
		||||
                  <p class="ds-subtitle">Calificación</p>
 | 
			
		||||
                  <div>
 | 
			
		||||
                    <fa-icon *ngFor="let i of [].constructor(encuesta.calificacion)" class="entity-icon--star" [icon]="faStar"></fa-icon
 | 
			
		||||
                    <fa-icon *ngFor="let i of [].constructor(this.avgCalificacion)" class="entity-icon--star" [icon]="faStar"></fa-icon
 | 
			
		||||
                    ><fa-icon
 | 
			
		||||
                      *ngFor="let i of [].constructor(5 - encuesta.calificacion!)"
 | 
			
		||||
                      *ngFor="let i of [].constructor(5 - this.avgCalificacion)"
 | 
			
		||||
                      class="entity-icon--star--off"
 | 
			
		||||
                      [icon]="faStar"
 | 
			
		||||
                    ></fa-icon>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,6 +39,11 @@ export class EncuestaCompleteComponent implements OnInit {
 | 
			
		|||
  selectedSingleOptions: any;
 | 
			
		||||
  selectedMultiOptions: any;
 | 
			
		||||
  error: boolean;
 | 
			
		||||
  calificacion: number;
 | 
			
		||||
  stars: number[] = [1, 2, 3, 4, 5];
 | 
			
		||||
  cantidadCalificaciones: number = 0;
 | 
			
		||||
  avgCalificacion: number = 0;
 | 
			
		||||
  sumCalificacion: number = 0;
 | 
			
		||||
 | 
			
		||||
  constructor(
 | 
			
		||||
    protected activatedRoute: ActivatedRoute,
 | 
			
		||||
| 
						 | 
				
			
			@ -55,12 +60,16 @@ export class EncuestaCompleteComponent implements OnInit {
 | 
			
		|||
    this.selectedSingleOptions = {};
 | 
			
		||||
    this.selectedMultiOptions = [];
 | 
			
		||||
    this.error = false;
 | 
			
		||||
    this.calificacion = 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {
 | 
			
		||||
    this.activatedRoute.data.subscribe(({ encuesta }) => {
 | 
			
		||||
      if (encuesta) {
 | 
			
		||||
        this.encuesta = encuesta;
 | 
			
		||||
        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.isLocked = this.verifyPassword();
 | 
			
		||||
      if (this.isLocked) {
 | 
			
		||||
| 
						 | 
				
			
			@ -177,17 +186,29 @@ export class EncuestaCompleteComponent implements OnInit {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  finish(): void {
 | 
			
		||||
    this.updateEncuestaRating();
 | 
			
		||||
    this.getOpenQuestionAnswers();
 | 
			
		||||
    this.registerOpenQuestionAnswers();
 | 
			
		||||
    this.updateClosedOptionsCount();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateEncuestaRating() {
 | 
			
		||||
    if (this.calificacion !== 0) {
 | 
			
		||||
      const newSumCalificacion = this.sumCalificacion + this.calificacion;
 | 
			
		||||
      const newCantidadCalificacion = this.cantidadCalificaciones + 1;
 | 
			
		||||
      const newAvgCalificacion = newSumCalificacion / newCantidadCalificacion;
 | 
			
		||||
      const newRating = this.joinRatingValues(newAvgCalificacion, newCantidadCalificacion);
 | 
			
		||||
      this.encuesta!.calificacion = Number(newRating);
 | 
			
		||||
      this.encuestaService.updateSurvey(this.encuesta!);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateClosedOptionsCount() {
 | 
			
		||||
    for (let key in this.selectedSingleOptions) {
 | 
			
		||||
      this.subscribeToSaveResponse(this.ePreguntaCerradaOpcionService.updateCount(this.selectedSingleOptions[key]));
 | 
			
		||||
      this.ePreguntaCerradaOpcionService.updateCount(this.selectedSingleOptions[key]);
 | 
			
		||||
    }
 | 
			
		||||
    this.selectedMultiOptions.forEach((option: any) => {
 | 
			
		||||
      this.subscribeToSaveResponse(this.ePreguntaCerradaOpcionService.updateCount(option));
 | 
			
		||||
      this.ePreguntaCerradaOpcionService.updateCount(option);
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -197,7 +218,7 @@ export class EncuestaCompleteComponent implements OnInit {
 | 
			
		|||
        return p.id == id;
 | 
			
		||||
      });
 | 
			
		||||
      let newRespuesta = new EPreguntaAbiertaRespuesta(0, this.selectedOpenOptions[id], pregunta);
 | 
			
		||||
      this.subscribeToSaveResponse(this.ePreguntaAbiertaRespuestaService.create(newRespuesta));
 | 
			
		||||
      this.ePreguntaAbiertaRespuestaService.create(newRespuesta);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -226,4 +247,23 @@ export class EncuestaCompleteComponent implements OnInit {
 | 
			
		|||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  joinRatingValues(totalValue: number, ratingCount: number): Number {
 | 
			
		||||
    const result = totalValue.toString() + '.' + ratingCount.toString();
 | 
			
		||||
    return parseFloat(result);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateRating(value: number) {
 | 
			
		||||
    this.calificacion = value;
 | 
			
		||||
    this.stars.forEach(starNumber => {
 | 
			
		||||
      let starElement = document.getElementById(`star-${starNumber}`);
 | 
			
		||||
      if (starNumber > this.calificacion!) {
 | 
			
		||||
        starElement!.classList.add('entity-icon--star--off');
 | 
			
		||||
        starElement!.classList.remove('entity-icon--star');
 | 
			
		||||
      } else {
 | 
			
		||||
        starElement!.classList.add('entity-icon--star');
 | 
			
		||||
        starElement!.classList.remove('entity-icon--star--off');
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,6 @@ export class EncuestaFinalizarDialogComponent implements OnInit {
 | 
			
		|||
  ngOnInit(): void {}
 | 
			
		||||
 | 
			
		||||
  confirmFinalizar(encuesta: IEncuesta): void {
 | 
			
		||||
    debugger;
 | 
			
		||||
    const now = dayjs();
 | 
			
		||||
 | 
			
		||||
    encuesta.estado = EstadoEncuesta.FINISHED;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -107,7 +107,6 @@ export class EncuestaPublishDialogComponent implements OnInit {
 | 
			
		|||
 | 
			
		||||
  fechaFinalizacionIsInvalid(fechaFinalizar: dayjs.Dayjs, fechaPublicacion: dayjs.Dayjs): boolean {
 | 
			
		||||
    let numberDays: number;
 | 
			
		||||
    debugger;
 | 
			
		||||
 | 
			
		||||
    numberDays = fechaFinalizar?.diff(fechaPublicacion, 'days');
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,6 @@ export class FacturaService {
 | 
			
		|||
  constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
 | 
			
		||||
 | 
			
		||||
  create(factura: IFactura): Observable<EntityResponseType> {
 | 
			
		||||
    debugger;
 | 
			
		||||
    const copy = this.convertDateFromClient(factura);
 | 
			
		||||
    return this.http
 | 
			
		||||
      .post<IFactura>(this.resourceUrl, copy, { observe: 'response' })
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,7 +76,7 @@
 | 
			
		|||
              </ng-container>
 | 
			
		||||
            </ng-container>
 | 
			
		||||
            <div class="ds-survey--option ds-survey--option--base ds-survey--open-option" *ngIf="!pPregunta.tipo">
 | 
			
		||||
              <textarea cols="30" rows="10" disabled></textarea>
 | 
			
		||||
              <textarea class="ds-survey--textarea" cols="30" rows="10" disabled></textarea>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -106,7 +106,6 @@ export class PaypalDialogComponent implements OnInit {
 | 
			
		|||
        });
 | 
			
		||||
      },
 | 
			
		||||
      onClientAuthorization: data => {
 | 
			
		||||
        debugger;
 | 
			
		||||
        console.log('onClientAuthorization - you should probably inform your server about completed transaction at this point', data);
 | 
			
		||||
        this.updateUser();
 | 
			
		||||
        this.sendReceipt();
 | 
			
		||||
| 
						 | 
				
			
			@ -119,7 +118,6 @@ export class PaypalDialogComponent implements OnInit {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  getUser(): void {
 | 
			
		||||
    debugger;
 | 
			
		||||
    // Get jhi_user and usuario_extra information
 | 
			
		||||
    if (this.account !== null) {
 | 
			
		||||
      this.usuarioExtraService.find(this.account.id).subscribe(usuarioExtra => {
 | 
			
		||||
| 
						 | 
				
			
			@ -138,7 +136,6 @@ export class PaypalDialogComponent implements OnInit {
 | 
			
		|||
  sendReceipt(): void {
 | 
			
		||||
    const now = dayjs();
 | 
			
		||||
 | 
			
		||||
    debugger;
 | 
			
		||||
    this.factura = {
 | 
			
		||||
      nombreUsuario: String(this.usuarioExtra?.id!),
 | 
			
		||||
      nombrePlantilla: this.plantilla?.nombre!,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,6 @@ import { Pipe, PipeTransform, Injectable } from '@angular/core';
 | 
			
		|||
@Injectable()
 | 
			
		||||
export class FilterPipe implements PipeTransform {
 | 
			
		||||
  transform(items: any[], field: string, value: string): any[] {
 | 
			
		||||
    debugger;
 | 
			
		||||
    if (!items) {
 | 
			
		||||
      return [];
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -99,7 +99,12 @@
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.ds-survey--option {
 | 
			
		||||
.ds-survey--textarea {
 | 
			
		||||
  width: 100% !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.ds-survey--option,
 | 
			
		||||
.ds-survey--rating {
 | 
			
		||||
  @media screen and (max-width: 991px) {
 | 
			
		||||
    width: 21rem !important;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue