Add star rating for each survey and restyled the card

This commit is contained in:
Pablo Bonilla 2021-07-17 21:58:54 -06:00
parent 982332d154
commit 5d2f9ef41d
No known key found for this signature in database
GPG Key ID: 46877262B8DE47E2
3 changed files with 76 additions and 24 deletions

View File

@ -85,7 +85,7 @@
[attr.data-id]="encuesta.id" [attr.data-id]="encuesta.id"
> >
<div class="entity-header"> <div class="entity-header">
<div> <div class="entity-state--container">
<div <div
class="entity-state" class="entity-state"
[ngClass]=" [ngClass]="
@ -120,24 +120,35 @@
</div> </div>
</div> </div>
<br /> <div class="entity-body">
<br /> <div class="entity-body--row">
<br /> <span *ngIf="encuesta.acceso == 'PUBLIC'" class="title"
<!-- <span>{{ encuesta.calificacion }}</span> --> ><fa-icon class="entity-icon--access" [icon]="faUnlock"></fa-icon>&nbsp;&nbsp;{{ encuesta.nombre | titlecase }}</span
>
<span *ngIf="encuesta.acceso == 'PUBLIC'" class="title" </div>
><fa-icon class="entity-icon--access" [icon]="faUnlock"></fa-icon>&nbsp;&nbsp;{{ encuesta.nombre }}</span <div class="entity-body--row">
> <span *ngIf="encuesta.acceso == 'PRIVATE'" class="title mt-2"
<span *ngIf="encuesta.acceso == 'PRIVATE'" class="title mt-2" ><fa-icon class="entity-icon--access" [icon]="faLock"></fa-icon>&nbsp;&nbsp;{{ encuesta.nombre | titlecase }}</span
><fa-icon class="entity-icon--access" [icon]="faLock"></fa-icon>&nbsp;&nbsp;{{ encuesta.nombre }}</span >
> </div>
<span class="mt-2" <div class="entity-body--row">
><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon>&nbsp;&nbsp;{{ <span class="mt-2"
encuesta.fechaCreacion | formatShortDatetime ><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon>&nbsp;&nbsp;{{
}}</span encuesta.fechaCreacion | formatShortDatetime | titlecase
> }}</span
<span class="subtitle mt-2">{{ encuesta.descripcion }}</span> >
<span class="tag mt-2">{{ encuesta.categoria?.nombre | lowercase }}</span> </div>
<div class="entity-body--row">
<span class="subtitle mt-2">{{ encuesta.descripcion | titlecase }}</span>
</div>
<div class="entity-body--row">
<span class="tag mt-2">{{ encuesta.categoria?.nombre | lowercase }}</span>
</div>
<div class="entity-body--row">
<fa-icon *ngFor="let i of [].constructor(encuesta.calificacion)" class="entity-icon--star" [icon]="faStar"></fa-icon
><fa-icon *ngFor="let i of [].constructor(5 - encuesta.calificacion!)" class="entity-icon--star--off" [icon]="faStar"></fa-icon>
</div>
</div>
<!-- <p> <!-- <p>
<a [routerLink]="['/encuesta', encuesta.id, 'view']">{{ encuesta.id }}</a> <a [routerLink]="['/encuesta', encuesta.id, 'view']">{{ encuesta.id }}</a>

View File

@ -23,7 +23,18 @@ import { AccountService } from 'app/core/auth/account.service';
import { Account } from 'app/core/auth/account.model'; import { Account } from 'app/core/auth/account.model';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { faShareAlt, faLock, faUnlock, faCalendarAlt, faEdit, faCopy, faFile, faTrashAlt, faPlus } from '@fortawesome/free-solid-svg-icons'; import {
faShareAlt,
faLock,
faUnlock,
faCalendarAlt,
faEdit,
faCopy,
faFile,
faTrashAlt,
faPlus,
faStar,
} from '@fortawesome/free-solid-svg-icons';
import * as $ from 'jquery'; import * as $ from 'jquery';
@ -42,6 +53,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
faFile = faFile; faFile = faFile;
faTrashAlt = faTrashAlt; faTrashAlt = faTrashAlt;
faPlus = faPlus; faPlus = faPlus;
faStar = faStar;
account: Account | null = null; account: Account | null = null;
usuarioExtra: UsuarioExtra | null = null; usuarioExtra: UsuarioExtra | null = null;
@ -308,6 +320,14 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
} }
} }
counter(i: number) {
return new Array(i);
}
testMe(something: any) {
return 5 - something;
}
openContextMenu(event: any): void { openContextMenu(event: any): void {
document.querySelectorAll('.ds-list--entity').forEach(e => { document.querySelectorAll('.ds-list--entity').forEach(e => {
e.classList.remove('active'); e.classList.remove('active');

View File

@ -24,7 +24,7 @@
.ds-list--entity { .ds-list--entity {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-end; justify-content: space-between;
align-items: flex-start; align-items: flex-start;
border: 1px solid #dadce0; border: 1px solid #dadce0;
border-radius: $border-radius-small; border-radius: $border-radius-small;
@ -59,11 +59,14 @@
.entity-header { .entity-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-self: flex-start;
width: 100%; width: 100%;
pointer-events: none; pointer-events: none;
} }
.entity-body--row {
margin: 0.4rem 0;
}
.entity-share { .entity-share {
border-radius: 50%; border-radius: 50%;
background-color: #f1f5f9; background-color: #f1f5f9;
@ -77,13 +80,23 @@
color: #313747; color: #313747;
} }
.entity-share:hover {
background-color: #e3e6e9;
}
.entity-icon--access { .entity-icon--access {
font-size: 0.8rem; font-size: 0.8rem;
color: rgb(154, 156, 158); color: rgb(154, 156, 158);
} }
.entity-share:hover { .entity-icon--star {
background-color: #e3e6e9; color: #ffcc47;
margin-right: 0.2rem;
}
.entity-icon--star--off {
color: #d9dde0;
margin-right: 0.2rem;
} }
.entity-state { .entity-state {
@ -91,10 +104,18 @@
width: 10px; width: 10px;
height: 10px; height: 10px;
position: absolute; position: absolute;
left: 0;
opacity: 0; opacity: 0;
animation: scaleIn 4s infinite cubic-bezier(0.36, 0.11, 0.89, 0.32); animation: scaleIn 4s infinite cubic-bezier(0.36, 0.11, 0.89, 0.32);
} }
.entity-state--container {
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.entity-state--blue { .entity-state--blue {
background-color: #2962ff; background-color: #2962ff;
} }