Merge pull request #57 from Quantum-P3/feature/US-21
mostrar encuestas en tabla para admin
This commit is contained in:
		
						commit
						0d07c7adc3
					
				| 
						 | 
				
			
			@ -32,11 +32,11 @@
 | 
			
		|||
  <jhi-alert></jhi-alert>
 | 
			
		||||
 | 
			
		||||
  <div class="alert alert-warning" id="no-result" *ngIf="encuestas?.length === 0">
 | 
			
		||||
    <span jhiTranslate="dataSurveyApp.encuesta.home.notFound">No encuestas found</span>
 | 
			
		||||
    <span jhiTranslate="dataSurveyApp.encuesta.home.notFound">No surveys found</span>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <!-- Lista de Encuestas del Usuario -->
 | 
			
		||||
  <div class="ds-list" (contextmenu)="openContextMenu($event)">
 | 
			
		||||
  <div class="ds-list" (contextmenu)="openContextMenu($event)" *ngIf="!isAdmin">
 | 
			
		||||
    <!-- Context Menu -->
 | 
			
		||||
    <div class="ds-contextmenu ds-contextmenu--closed" id="contextmenu">
 | 
			
		||||
      <ul id="ds-context-menu__list">
 | 
			
		||||
| 
						 | 
				
			
			@ -194,7 +194,7 @@
 | 
			
		|||
            <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(encuesta)" class="btn btn-danger btn-sm" data-cy="entityDeleteButton">
 | 
			
		||||
            <fa-icon icon="times"></fa-icon>
 | 
			
		||||
            <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
 | 
			
		||||
| 
						 | 
				
			
			@ -205,83 +205,69 @@
 | 
			
		|||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<!-- <div class="table-responsive" id="entities" *ngIf="encuestas && encuestas.length > 0">
 | 
			
		||||
    <table class="table table-striped" aria-describedby="page-heading">
 | 
			
		||||
      <thead>
 | 
			
		||||
        <tr>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="global.field.id">ID</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.nombre">Nombre</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.descripcion">Descripcion</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaCreacion">Fecha Creacion</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaPublicacion">Fecha Publicacion</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaFinalizar">Fecha Finalizar</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaFinalizada">Fecha Finalizada</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.calificacion">Calificacion</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.acceso">Acceso</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.contrasenna">Contrasenna</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.estado">Estado</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.categoria">Categoria</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.usuarioExtra">Usuario Extra</span></th>
 | 
			
		||||
          <th scope="col"></th>
 | 
			
		||||
        </tr>
 | 
			
		||||
      </thead>
 | 
			
		||||
      <tbody>
 | 
			
		||||
        <tr *ngFor="let encuesta of encuestas; trackBy: trackId" data-cy="entityTable">
 | 
			
		||||
          <td>
 | 
			
		||||
            <a [routerLink]="['/encuesta', encuesta.id, 'view']">{{ encuesta.id }}</a>
 | 
			
		||||
          </td>
 | 
			
		||||
          <td>{{ encuesta.nombre }}</td>
 | 
			
		||||
          <td>{{ encuesta.descripcion }}</td>
 | 
			
		||||
          <td>{{ encuesta.fechaCreacion | formatMediumDatetime }}</td>
 | 
			
		||||
          <td>{{ encuesta.fechaPublicacion | formatMediumDatetime }}</td>
 | 
			
		||||
          <td>{{ encuesta.fechaFinalizar | formatMediumDatetime }}</td>
 | 
			
		||||
          <td>{{ encuesta.fechaFinalizada | formatMediumDatetime }}</td>
 | 
			
		||||
          <td>{{ encuesta.calificacion }}</td>
 | 
			
		||||
          <td jhiTranslate="{{ 'dataSurveyApp.AccesoEncuesta.' + encuesta.acceso }}">{{ encuesta.acceso }}</td>
 | 
			
		||||
          <td>{{ encuesta.contrasenna }}</td>
 | 
			
		||||
          <td jhiTranslate="{{ 'dataSurveyApp.EstadoEncuesta.' + encuesta.estado }}">{{ encuesta.estado }}</td>
 | 
			
		||||
          <td>
 | 
			
		||||
            <div *ngIf="encuesta.categoria">
 | 
			
		||||
              <a [routerLink]="['/categoria', encuesta.categoria?.id, 'view']">{{ encuesta.categoria?.nombre }}</a>
 | 
			
		||||
            </div>
 | 
			
		||||
          </td>
 | 
			
		||||
          <td>
 | 
			
		||||
            <div *ngIf="encuesta.usuarioExtra">
 | 
			
		||||
              <a [routerLink]="['/usuario-extra', encuesta.usuarioExtra?.id, 'view']">{{ encuesta.usuarioExtra?.id }}</a>
 | 
			
		||||
            </div>
 | 
			
		||||
          </td>
 | 
			
		||||
          <td class="text-right">
 | 
			
		||||
            <div class="btn-group">
 | 
			
		||||
              <button
 | 
			
		||||
                type="submit"
 | 
			
		||||
                [routerLink]="['/encuesta', encuesta.id, 'view']"
 | 
			
		||||
                class="btn btn-info btn-sm"
 | 
			
		||||
                data-cy="entityDetailsButton"
 | 
			
		||||
              >
 | 
			
		||||
                <fa-icon icon="eye"></fa-icon>
 | 
			
		||||
                <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
 | 
			
		||||
              </button>
 | 
			
		||||
<div class="table-responsive" id="entities" *ngIf="isAdmin && encuestas && encuestas.length > 0">
 | 
			
		||||
  <table class="table table-striped" aria-describedby="page-heading">
 | 
			
		||||
    <thead>
 | 
			
		||||
      <tr>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.nombre">Nombre</span></th>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaCreacion">Fecha Creacion</span></th>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.acceso">Acceso</span></th>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.estado">Estado</span></th>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.categoria">Categoria</span></th>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.usuarioExtra">Correo Usuario</span></th>
 | 
			
		||||
        <th scope="col"></th>
 | 
			
		||||
      </tr>
 | 
			
		||||
    </thead>
 | 
			
		||||
    <tbody>
 | 
			
		||||
      <tr *ngFor="let encuesta of encuestas; trackBy: trackId" data-cy="entityTable">
 | 
			
		||||
        <td>{{ encuesta.nombre }}</td>
 | 
			
		||||
        <td>{{ encuesta.fechaCreacion | formatMediumDatetime }}</td>
 | 
			
		||||
        <td jhiTranslate="{{ 'dataSurveyApp.AccesoEncuesta.' + encuesta.acceso }}">{{ encuesta.acceso }}</td>
 | 
			
		||||
        <td jhiTranslate="{{ 'dataSurveyApp.EstadoEncuesta.' + encuesta.estado }}">{{ encuesta.estado }}</td>
 | 
			
		||||
        <td>
 | 
			
		||||
          <div *ngIf="encuesta.categoria">
 | 
			
		||||
            <a [routerLink]="['/categoria', encuesta.categoria?.id, 'view']">{{ encuesta.categoria?.nombre }}</a>
 | 
			
		||||
          </div>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
          <div *ngIf="encuesta.usuarioExtra">
 | 
			
		||||
            <a [routerLink]="['/usuario-extra', encuesta.usuarioExtra?.nombre, 'view']">
 | 
			
		||||
              {{ encuesta.usuarioExtra?.nombre }}
 | 
			
		||||
            </a>
 | 
			
		||||
          </div>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td class="text-right">
 | 
			
		||||
          <div class="btn-group">
 | 
			
		||||
            <button
 | 
			
		||||
              type="submit"
 | 
			
		||||
              [routerLink]="['/encuesta', encuesta.id, 'view']"
 | 
			
		||||
              class="ds-btn btn-info btn-sm"
 | 
			
		||||
              data-cy="entityDetailsButton"
 | 
			
		||||
            >
 | 
			
		||||
              <fa-icon icon="eye"></fa-icon>
 | 
			
		||||
              <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
 | 
			
		||||
            </button>
 | 
			
		||||
 | 
			
		||||
              <button
 | 
			
		||||
                type="submit"
 | 
			
		||||
                [routerLink]="['/encuesta', encuesta.id, 'edit']"
 | 
			
		||||
                class="btn btn-primary btn-sm"
 | 
			
		||||
                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"
 | 
			
		||||
              [routerLink]="['/encuesta', encuesta.id, 'edit']"
 | 
			
		||||
              class="ds-btn ds-btn--primary btn-sm"
 | 
			
		||||
              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(encuesta)" class="btn btn-danger btn-sm" data-cy="entityDeleteButton">
 | 
			
		||||
                <fa-icon icon="times"></fa-icon>
 | 
			
		||||
                <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
 | 
			
		||||
              </button>
 | 
			
		||||
            </div>
 | 
			
		||||
          </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
      </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
  </div> -->
 | 
			
		||||
            <button type="submit" (click)="delete(encuesta)" class="ds-btn ds-btn--danger btn-sm" data-cy="entityDeleteButton">
 | 
			
		||||
              <fa-icon icon="times"></fa-icon>
 | 
			
		||||
              <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
 | 
			
		||||
            </button>
 | 
			
		||||
          </div>
 | 
			
		||||
        </td>
 | 
			
		||||
      </tr>
 | 
			
		||||
    </tbody>
 | 
			
		||||
  </table>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<!-- --------------------------------------------------------------------------------------------- -->
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -415,7 +401,7 @@
 | 
			
		|||
 | 
			
		||||
<!-- ------------------------------------------------------------------------------------------------- -->
 | 
			
		||||
 | 
			
		||||
<!-- <div class="row justify-content-center">
 | 
			
		||||
<!-- <div ngIf class="row justify-content-center">
 | 
			
		||||
  <div class="col-8">
 | 
			
		||||
    <form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
 | 
			
		||||
      <h2 id="jhi-encuesta-heading" data-cy="EncuestaCreateUpdateHeading" jhiTranslate="dataSurveyApp.encuesta.home.createOrEditLabel">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -106,7 +106,11 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
      (res: HttpResponse<IEncuesta[]>) => {
 | 
			
		||||
        this.isLoading = false;
 | 
			
		||||
        const tmpEncuestas = res.body ?? [];
 | 
			
		||||
        this.encuestas = tmpEncuestas.filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id);
 | 
			
		||||
        if (this.isAdmin()) {
 | 
			
		||||
          this.encuestas = tmpEncuestas;
 | 
			
		||||
        } else {
 | 
			
		||||
          this.encuestas = tmpEncuestas.filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id);
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      () => {
 | 
			
		||||
        this.isLoading = false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,15 +4,15 @@
 | 
			
		|||
      "home": {
 | 
			
		||||
        "title": "Encuestas",
 | 
			
		||||
        "refreshListLabel": "Refrescar lista",
 | 
			
		||||
        "createLabel": "Crear nuevo Encuesta",
 | 
			
		||||
        "createOrEditLabel": "Crear o editar Encuesta",
 | 
			
		||||
        "notFound": "Ningún Encuestas encontrado"
 | 
			
		||||
        "createLabel": "Crear nueva encuesta",
 | 
			
		||||
        "createOrEditLabel": "Crear o editar encuesta",
 | 
			
		||||
        "notFound": "Ninguna encuesta fue encontrada"
 | 
			
		||||
      },
 | 
			
		||||
      "created": "Un nuevo Encuesta ha sido creado con el identificador {{ param }}",
 | 
			
		||||
      "updated": "Un Encuesta ha sido actualizado con el identificador {{ param }}",
 | 
			
		||||
      "deleted": "Un Encuesta ha sido eliminado con el identificador {{ param }}",
 | 
			
		||||
      "created": "Una nueva encuesta ha sido creada con el identificador {{ param }}",
 | 
			
		||||
      "updated": "Una encuesta ha sido actualizado con el identificador {{ param }}",
 | 
			
		||||
      "deleted": "Una encuesta ha sido eliminada con el identificador {{ param }}",
 | 
			
		||||
      "delete": {
 | 
			
		||||
        "question": "¿Seguro que quiere eliminar Encuesta {{ id }}?"
 | 
			
		||||
        "question": "¿Seguro que quiere eliminar la encuesta {{ id }}?"
 | 
			
		||||
      },
 | 
			
		||||
      "detail": {
 | 
			
		||||
        "title": "Encuesta"
 | 
			
		||||
| 
						 | 
				
			
			@ -32,7 +32,7 @@
 | 
			
		|||
      "ePreguntaAbierta": "E Pregunta Abierta",
 | 
			
		||||
      "ePreguntaCerrada": "E Pregunta Cerrada",
 | 
			
		||||
      "categoria": "Categoría",
 | 
			
		||||
      "usuarioExtra": "Usuario Extra"
 | 
			
		||||
      "usuarioExtra": "Correo Usuario"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue