Merge pull request #80 from Quantum-P3/qa

dep
This commit is contained in:
Eduardo Quiros 2021-07-27 07:22:29 +00:00 committed by GitHub
commit a2ab5d2dce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
100 changed files with 5598 additions and 1471 deletions

View File

@ -24,13 +24,13 @@ public class CacheConfiguration {
private final javax.cache.configuration.Configuration<Object, Object> jcacheConfiguration; private final javax.cache.configuration.Configuration<Object, Object> jcacheConfiguration;
public CacheConfiguration(JHipsterProperties jHipsterProperties) { public CacheConfiguration(JHipsterProperties jHipsterProperties) {
JHipsterProperties.Cache.Ehcache ehcache = jHipsterProperties.getCache().getEhcache(); //JHipsterProperties.Cache.Ehcache ehcache = jHipsterProperties.getCache().getEhcache();
jcacheConfiguration = jcacheConfiguration =
Eh107Configuration.fromEhcacheCacheConfiguration( Eh107Configuration.fromEhcacheCacheConfiguration(
CacheConfigurationBuilder CacheConfigurationBuilder
.newCacheConfigurationBuilder(Object.class, Object.class, ResourcePoolsBuilder.heap(ehcache.getMaxEntries())) .newCacheConfigurationBuilder(Object.class, Object.class, ResourcePoolsBuilder.heap(100L))
.withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(ehcache.getTimeToLiveSeconds()))) .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(1)))
.build() .build()
); );
} }
@ -82,6 +82,7 @@ public class CacheConfiguration {
private void createCache(javax.cache.CacheManager cm, String cacheName) { private void createCache(javax.cache.CacheManager cm, String cacheName) {
javax.cache.Cache<Object, Object> cache = cm.getCache(cacheName); javax.cache.Cache<Object, Object> cache = cm.getCache(cacheName);
if (cache != null) { if (cache != null) {
cache.clear(); cache.clear();
} else { } else {

View File

@ -5,6 +5,7 @@ import java.util.Locale;
import javax.mail.MessagingException; import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage;
import org.datasurvey.domain.User; import org.datasurvey.domain.User;
import org.datasurvey.domain.UsuarioExtra;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
@ -29,6 +30,8 @@ public class MailService {
private static final String USER = "user"; private static final String USER = "user";
private static final String CONTRASENNA = "contrasenna";
private static final String BASE_URL = "baseUrl"; private static final String BASE_URL = "baseUrl";
private final JHipsterProperties jHipsterProperties; private final JHipsterProperties jHipsterProperties;
@ -92,6 +95,22 @@ public class MailService {
sendEmail(user.getEmail(), subject, content, false, true); sendEmail(user.getEmail(), subject, content, false, true);
} }
@Async
public void sendEmailFromTemplateEncuesta(User user, String templateName, String titleKey, String contrasenna) {
if (user.getEmail() == null) {
log.debug("Email doesn't exist for user '{}'", user.getLogin());
return;
}
Locale locale = Locale.forLanguageTag(user.getLangKey());
Context context = new Context(locale);
context.setVariable(CONTRASENNA, contrasenna);
context.setVariable(USER, user);
context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl());
String content = templateEngine.process(templateName, context);
String subject = messageSource.getMessage(titleKey, null, locale);
sendEmail(user.getEmail(), subject, content, false, true);
}
@Async @Async
public void sendActivationEmail(User user) { public void sendActivationEmail(User user) {
log.debug("Sending activation email to '{}'", user.getEmail()); log.debug("Sending activation email to '{}'", user.getEmail());
@ -115,4 +134,33 @@ public class MailService {
log.debug("Sending password restored email to '{}'", user.getEmail()); log.debug("Sending password restored email to '{}'", user.getEmail());
sendEmailFromTemplate(user, "mail/passwordRestoredEmail", "email.restored.title"); sendEmailFromTemplate(user, "mail/passwordRestoredEmail", "email.restored.title");
} }
@Async
public void sendSuspendedAccountMail(UsuarioExtra user) {
log.debug("Sending suspended account mail to '{}'", user.getUser().getEmail());
sendEmailFromTemplate(user.getUser(), "mail/suspendedAccountEmail", "email.suspended.title");
}
@Async
public void sendActivatedAccountMail(UsuarioExtra user) {
log.debug("Sending reactivated account mail to '{}'", user.getUser().getEmail());
sendEmailFromTemplate(user.getUser(), "mail/reactivatedAccountEmail", "email.reactivation.title");
}
@Async
public void sendPublishedPrivateMail(UsuarioExtra user, String contrasenna) {
log.debug("Sending reactivated account mail to '{}'", user.getUser().getEmail());
sendEmailFromTemplateEncuesta(user.getUser(), "mail/encuestaPrivadaEmail", "email.private.title", contrasenna);
}
@Async
public void sendPublishedPublicMail(UsuarioExtra user) {
log.debug("Sending reactivated account mail to '{}'", user.getUser().getEmail());
sendEmailFromTemplate(user.getUser(), "mail/encuestaPublicaEmail", "email.public.title");
}
public void sendEncuestaDeleted(UsuarioExtra user) {
log.debug("Sending encuesta deletion notification mail to '{}'", user.getUser().getEmail());
sendEmailFromTemplate(user.getUser(), "mail/encuestaDeletedEmail", "email.encuestaDeleted.title");
}
} }

View File

@ -76,6 +76,19 @@ public class UserService {
); );
} }
public Optional<User> modifyStatus(String login, Boolean estado) {
return userRepository
.findOneByLogin(login)
.map(
user -> {
// activate given user for the registration key.
user.setActivated(estado);
log.debug("Activated user: {}", user);
return user;
}
);
}
public Optional<User> completePasswordReset(String newPassword, String key) { public Optional<User> completePasswordReset(String newPassword, String key) {
log.debug("Reset user password for reset key {}", key); log.debug("Reset user password for reset key {}", key);
return userRepository return userRepository
@ -381,11 +394,16 @@ public class UserService {
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Optional<User> getUserWithAuthoritiesByLogin(String login) { public Optional<User> getUserWithAuthoritiesByLogin(String login) {
return userRepository.findOneWithAuthoritiesByLogin(login); return userRepository.findOneWithAuthoritiesByLogin(login);
//cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).clear();
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Optional<User> getUserWithAuthorities() { public Optional<User> getUserWithAuthorities() {
return SecurityUtils.getCurrentUserLogin().flatMap(userRepository::findOneWithAuthoritiesByLogin); return SecurityUtils.getCurrentUserLogin().flatMap(userRepository::findOneWithAuthoritiesByLogin);
//findOneWithAuthoritiesByLogin
//cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).clear();
//return user;
} }
/** /**

View File

@ -2,11 +2,13 @@ package org.datasurvey.web.rest;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.datasurvey.domain.EPreguntaCerrada;
import org.datasurvey.domain.EPreguntaCerradaOpcion; import org.datasurvey.domain.EPreguntaCerradaOpcion;
import org.datasurvey.repository.EPreguntaCerradaOpcionRepository; import org.datasurvey.repository.EPreguntaCerradaOpcionRepository;
import org.datasurvey.service.EPreguntaCerradaOpcionQueryService; import org.datasurvey.service.EPreguntaCerradaOpcionQueryService;
@ -58,10 +60,15 @@ public class EPreguntaCerradaOpcionResource {
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new ePreguntaCerradaOpcion, or with status {@code 400 (Bad Request)} if the ePreguntaCerradaOpcion has already an ID. * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new ePreguntaCerradaOpcion, or with status {@code 400 (Bad Request)} if the ePreguntaCerradaOpcion has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect. * @throws URISyntaxException if the Location URI syntax is incorrect.
*/ */
@PostMapping("/e-pregunta-cerrada-opcions") @PostMapping("/e-pregunta-cerrada-opcions/{id}")
public ResponseEntity<EPreguntaCerradaOpcion> createEPreguntaCerradaOpcion( public ResponseEntity<EPreguntaCerradaOpcion> createEPreguntaCerradaOpcion(
@Valid @RequestBody EPreguntaCerradaOpcion ePreguntaCerradaOpcion @Valid @RequestBody EPreguntaCerradaOpcion ePreguntaCerradaOpcion,
@PathVariable(value = "id", required = false) final Long id
) throws URISyntaxException { ) throws URISyntaxException {
EPreguntaCerrada ePreguntaCerrada = new EPreguntaCerrada();
ePreguntaCerrada.setId(id);
ePreguntaCerradaOpcion.setEPreguntaCerrada(ePreguntaCerrada);
log.debug("REST request to save EPreguntaCerradaOpcion : {}", ePreguntaCerradaOpcion); log.debug("REST request to save EPreguntaCerradaOpcion : {}", ePreguntaCerradaOpcion);
if (ePreguntaCerradaOpcion.getId() != null) { if (ePreguntaCerradaOpcion.getId() != null) {
throw new BadRequestAlertException("A new ePreguntaCerradaOpcion cannot already have an ID", ENTITY_NAME, "idexists"); throw new BadRequestAlertException("A new ePreguntaCerradaOpcion cannot already have an ID", ENTITY_NAME, "idexists");
@ -76,7 +83,7 @@ public class EPreguntaCerradaOpcionResource {
/** /**
* {@code PUT /e-pregunta-cerrada-opcions/:id} : Updates an existing ePreguntaCerradaOpcion. * {@code PUT /e-pregunta-cerrada-opcions/:id} : Updates an existing ePreguntaCerradaOpcion.
* *
* @param id the id of the ePreguntaCerradaOpcion to save. * @param id the id of the ePreguntaCerradaOpcion to save.
* @param ePreguntaCerradaOpcion the ePreguntaCerradaOpcion to update. * @param ePreguntaCerradaOpcion the ePreguntaCerradaOpcion to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated ePreguntaCerradaOpcion, * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated ePreguntaCerradaOpcion,
* or with status {@code 400 (Bad Request)} if the ePreguntaCerradaOpcion is not valid, * or with status {@code 400 (Bad Request)} if the ePreguntaCerradaOpcion is not valid,
@ -110,7 +117,7 @@ public class EPreguntaCerradaOpcionResource {
/** /**
* {@code PATCH /e-pregunta-cerrada-opcions/:id} : Partial updates given fields of an existing ePreguntaCerradaOpcion, field will ignore if it is null * {@code PATCH /e-pregunta-cerrada-opcions/:id} : Partial updates given fields of an existing ePreguntaCerradaOpcion, field will ignore if it is null
* *
* @param id the id of the ePreguntaCerradaOpcion to save. * @param id the id of the ePreguntaCerradaOpcion to save.
* @param ePreguntaCerradaOpcion the ePreguntaCerradaOpcion to update. * @param ePreguntaCerradaOpcion the ePreguntaCerradaOpcion to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated ePreguntaCerradaOpcion, * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated ePreguntaCerradaOpcion,
* or with status {@code 400 (Bad Request)} if the ePreguntaCerradaOpcion is not valid, * or with status {@code 400 (Bad Request)} if the ePreguntaCerradaOpcion is not valid,
@ -196,4 +203,15 @@ public class EPreguntaCerradaOpcionResource {
.headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString()))
.build(); .build();
} }
@PostMapping("/e-pregunta-cerrada-opcions/deleteMany")
public ResponseEntity<Void> deleteManyEPreguntaCerradaOpcion(@Valid @RequestBody int[] ids) {
for (int id : ids) {
ePreguntaCerradaOpcionService.delete((long) id);
}
return ResponseEntity
.noContent()
.headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, Arrays.toString(ids)))
.build();
}
} }

View File

@ -2,15 +2,25 @@ package org.datasurvey.web.rest;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.datasurvey.domain.EPreguntaAbierta;
import org.datasurvey.domain.EPreguntaCerrada;
import org.datasurvey.domain.EPreguntaCerradaOpcion;
import org.datasurvey.domain.Encuesta; import org.datasurvey.domain.Encuesta;
import org.datasurvey.domain.enumeration.AccesoEncuesta;
import org.datasurvey.repository.EncuestaRepository; import org.datasurvey.repository.EncuestaRepository;
import org.datasurvey.service.*;
import org.datasurvey.service.EncuestaQueryService; import org.datasurvey.service.EncuestaQueryService;
import org.datasurvey.service.EncuestaService; import org.datasurvey.service.EncuestaService;
import org.datasurvey.service.MailService;
import org.datasurvey.service.criteria.EncuestaCriteria; import org.datasurvey.service.criteria.EncuestaCriteria;
import org.datasurvey.web.rest.errors.BadRequestAlertException; import org.datasurvey.web.rest.errors.BadRequestAlertException;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -41,14 +51,30 @@ public class EncuestaResource {
private final EncuestaQueryService encuestaQueryService; private final EncuestaQueryService encuestaQueryService;
private final MailService mailService;
private final EPreguntaCerradaService ePreguntaCerradaService;
private final EPreguntaAbiertaService ePreguntaAbiertaService;
private final EPreguntaCerradaOpcionService ePreguntaCerradaOpcionService;
public EncuestaResource( public EncuestaResource(
EncuestaService encuestaService, EncuestaService encuestaService,
EncuestaRepository encuestaRepository, EncuestaRepository encuestaRepository,
EncuestaQueryService encuestaQueryService EncuestaQueryService encuestaQueryService,
MailService mailService,
EPreguntaCerradaService ePreguntaCerradaService,
EPreguntaAbiertaService ePreguntaAbiertaService,
EPreguntaCerradaOpcionService ePreguntaCerradaOpcionService
) { ) {
this.encuestaService = encuestaService; this.encuestaService = encuestaService;
this.encuestaRepository = encuestaRepository; this.encuestaRepository = encuestaRepository;
this.encuestaQueryService = encuestaQueryService; this.encuestaQueryService = encuestaQueryService;
this.mailService = mailService;
this.ePreguntaCerradaService = ePreguntaCerradaService;
this.ePreguntaAbiertaService = ePreguntaAbiertaService;
this.ePreguntaCerradaOpcionService = ePreguntaCerradaOpcionService;
} }
/** /**
@ -74,7 +100,7 @@ public class EncuestaResource {
/** /**
* {@code PUT /encuestas/:id} : Updates an existing encuesta. * {@code PUT /encuestas/:id} : Updates an existing encuesta.
* *
* @param id the id of the encuesta to save. * @param id the id of the encuesta to save.
* @param encuesta the encuesta to update. * @param encuesta the encuesta to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated encuesta, * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated encuesta,
* or with status {@code 400 (Bad Request)} if the encuesta is not valid, * or with status {@code 400 (Bad Request)} if the encuesta is not valid,
@ -99,6 +125,39 @@ public class EncuestaResource {
} }
Encuesta result = encuestaService.save(encuesta); Encuesta result = encuestaService.save(encuesta);
mailService.sendEncuestaDeleted(encuesta.getUsuarioExtra());
return ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, encuesta.getId().toString()))
.body(result);
}
@PutMapping("/encuestas/publish/{id}")
public ResponseEntity<Encuesta> publishEncuesta(
@PathVariable(value = "id", required = false) final Long id,
@Valid @RequestBody Encuesta encuesta
) throws URISyntaxException {
log.debug("REST request to update Encuesta : {}, {}", id, encuesta);
if (encuesta.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
if (!Objects.equals(id, encuesta.getId())) {
throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid");
}
if (!encuestaRepository.existsById(id)) {
throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound");
}
Encuesta result = encuestaService.save(encuesta);
if (result.getAcceso().equals(AccesoEncuesta.PRIVATE)) {
mailService.sendPublishedPrivateMail(result.getUsuarioExtra(), result.getContrasenna());
} else {
mailService.sendPublishedPublicMail(result.getUsuarioExtra());
}
return ResponseEntity return ResponseEntity
.ok() .ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, encuesta.getId().toString())) .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, encuesta.getId().toString()))
@ -108,7 +167,7 @@ public class EncuestaResource {
/** /**
* {@code PATCH /encuestas/:id} : Partial updates given fields of an existing encuesta, field will ignore if it is null * {@code PATCH /encuestas/:id} : Partial updates given fields of an existing encuesta, field will ignore if it is null
* *
* @param id the id of the encuesta to save. * @param id the id of the encuesta to save.
* @param encuesta the encuesta to update. * @param encuesta the encuesta to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated encuesta, * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated encuesta,
* or with status {@code 400 (Bad Request)} if the encuesta is not valid, * or with status {@code 400 (Bad Request)} if the encuesta is not valid,
@ -154,6 +213,55 @@ public class EncuestaResource {
return ResponseEntity.ok().body(entityList); return ResponseEntity.ok().body(entityList);
} }
@GetMapping("/encuestas/preguntas/{id}")
public ResponseEntity<List<Object>> getPreguntasByIdEncuesta(@PathVariable Long id) {
List<EPreguntaCerrada> preguntasCerradas = ePreguntaCerradaService.findAll();
List<EPreguntaAbierta> preguntasAbiertas = ePreguntaAbiertaService.findAll();
List<Object> preguntas = Stream.concat(preguntasCerradas.stream(), preguntasAbiertas.stream()).collect(Collectors.toList());
List<Object> preguntasFiltered = new ArrayList<>();
for (Object obj : preguntas) {
if (obj.getClass() == EPreguntaCerrada.class) {
if (((EPreguntaCerrada) obj).getEncuesta() != null) {
if (((EPreguntaCerrada) obj).getEncuesta().getId().equals(id)) {
preguntasFiltered.add(obj);
}
}
} else if (obj.getClass() == EPreguntaAbierta.class) {
if (((EPreguntaAbierta) obj).getEncuesta() != null) {
if (((EPreguntaAbierta) obj).getEncuesta().getId().equals(id)) {
preguntasFiltered.add(obj);
}
}
}
}
return ResponseEntity.ok().body(preguntasFiltered);
}
@GetMapping("/encuestas/preguntas-opciones/{id}")
public ResponseEntity<List<List<EPreguntaCerradaOpcion>>> getPreguntaCerradaOpcionByIdEncuesta(@PathVariable Long id) {
List<List<EPreguntaCerradaOpcion>> res = new ArrayList<>();
List<EPreguntaCerrada> preguntasCerradas = ePreguntaCerradaService.findAll();
List<EPreguntaCerrada> preguntasCerradasFiltered = preguntasCerradas
.stream()
.filter(p -> Objects.nonNull(p.getEncuesta()))
.filter(p -> p.getEncuesta().getId().equals(id))
.collect(Collectors.toList());
List<EPreguntaCerradaOpcion> opciones = ePreguntaCerradaOpcionService.findAll();
for (EPreguntaCerrada ePreguntaCerrada : preguntasCerradasFiltered) {
long preguntaCerradaId = ePreguntaCerrada.getId();
List<EPreguntaCerradaOpcion> opcionesFiltered = opciones
.stream()
.filter(o -> Objects.nonNull(o.getEPreguntaCerrada()))
.filter(o -> o.getEPreguntaCerrada().getId().equals(preguntaCerradaId))
.collect(Collectors.toList());
res.add(opcionesFiltered);
}
return ResponseEntity.ok().body(res);
}
/** /**
* {@code GET /encuestas/count} : count all the encuestas. * {@code GET /encuestas/count} : count all the encuestas.
* *
@ -194,4 +302,78 @@ public class EncuestaResource {
.headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString()))
.build(); .build();
} }
@DeleteMapping("encuestas/notify/{id}")
public ResponseEntity<Void> notifyEncuestaDeleted(@PathVariable Long id, @Valid @RequestBody Encuesta encuesta) {
log.debug("REST request to notify {} of deleted Encuesta", encuesta.getUsuarioExtra().getUser().getEmail());
mailService.sendEncuestaDeleted(encuesta.getUsuarioExtra());
return ResponseEntity.noContent().build();
}
@GetMapping("/encuestas/duplicate/{id}")
public ResponseEntity<Encuesta> getAllEncuestas(@PathVariable Long id) {
Optional<Encuesta> encuesta = encuestaService.findOne(id);
Encuesta newEncuesta = new Encuesta();
if (encuesta.isPresent()) {
// Encuesta
newEncuesta.setNombre(encuesta.get().getNombre());
newEncuesta.setDescripcion(encuesta.get().getDescripcion());
newEncuesta.setFechaCreacion(ZonedDateTime.now());
newEncuesta.setCalificacion(5d);
newEncuesta.setAcceso(encuesta.get().getAcceso());
newEncuesta.setEstado(encuesta.get().getEstado());
newEncuesta.setCategoria(encuesta.get().getCategoria());
newEncuesta.setUsuarioExtra(encuesta.get().getUsuarioExtra());
Encuesta encuestaCreated = encuestaService.save(newEncuesta);
// Preguntas cerradas
List<EPreguntaCerrada> preguntasCerradas = ePreguntaCerradaService.findAll();
for (EPreguntaCerrada ePreguntaCerrada : preguntasCerradas) {
if (ePreguntaCerrada.getEncuesta().getId().equals(id)) {
EPreguntaCerrada newEPreguntaCerrada = new EPreguntaCerrada();
newEPreguntaCerrada.setNombre(ePreguntaCerrada.getNombre());
newEPreguntaCerrada.setTipo(ePreguntaCerrada.getTipo());
newEPreguntaCerrada.setOpcional(ePreguntaCerrada.getOpcional());
newEPreguntaCerrada.setOrden(ePreguntaCerrada.getOrden());
newEPreguntaCerrada.setEncuesta(encuestaCreated);
ePreguntaCerradaService.save(newEPreguntaCerrada);
// Opciones de preguntas cerradas
List<EPreguntaCerradaOpcion> opciones = ePreguntaCerradaOpcionService.findAll();
for (EPreguntaCerradaOpcion ePreguntaCerradaOpcion : opciones) {
if (ePreguntaCerradaOpcion.getEPreguntaCerrada().getId().equals(ePreguntaCerrada.getId())) {
EPreguntaCerradaOpcion newEPreguntaCerradaOpcion = new EPreguntaCerradaOpcion();
newEPreguntaCerradaOpcion.setNombre(ePreguntaCerradaOpcion.getNombre());
newEPreguntaCerradaOpcion.setOrden(ePreguntaCerradaOpcion.getOrden());
newEPreguntaCerradaOpcion.setCantidad(0);
newEPreguntaCerradaOpcion.setEPreguntaCerrada(newEPreguntaCerrada);
ePreguntaCerradaOpcionService.save(newEPreguntaCerradaOpcion);
}
}
}
}
// Preguntas abiertas
List<EPreguntaAbierta> preguntasAbiertas = ePreguntaAbiertaService.findAll();
for (EPreguntaAbierta ePreguntaAbierta : preguntasAbiertas) {
if (ePreguntaAbierta.getEncuesta().getId().equals(id)) {
EPreguntaAbierta newEPreguntaAbierta = new EPreguntaAbierta();
newEPreguntaAbierta.setNombre(ePreguntaAbierta.getNombre());
newEPreguntaAbierta.setOpcional(ePreguntaAbierta.getOpcional());
newEPreguntaAbierta.setOrden(ePreguntaAbierta.getOrden());
newEPreguntaAbierta.setEncuesta(encuestaCreated);
ePreguntaAbiertaService.save(newEPreguntaAbierta);
}
}
return ResponseEntity.ok().body(encuestaCreated);
}
return ResponseEntity.ok().body(null);
}
} }

View File

@ -40,6 +40,7 @@ public class UserJWTController {
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
SecurityContextHolder.getContext().setAuthentication(authentication); SecurityContextHolder.getContext().setAuthentication(authentication);
String jwt = tokenProvider.createToken(authentication, loginVM.isRememberMe()); String jwt = tokenProvider.createToken(authentication, loginVM.isRememberMe());
HttpHeaders httpHeaders = new HttpHeaders(); HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt); httpHeaders.add(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt);
return new ResponseEntity<>(new JWTToken(jwt), httpHeaders, HttpStatus.OK); return new ResponseEntity<>(new JWTToken(jwt), httpHeaders, HttpStatus.OK);

View File

@ -9,6 +9,8 @@ import javax.validation.Valid;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.datasurvey.domain.UsuarioExtra; import org.datasurvey.domain.UsuarioExtra;
import org.datasurvey.repository.UsuarioExtraRepository; import org.datasurvey.repository.UsuarioExtraRepository;
import org.datasurvey.service.MailService;
import org.datasurvey.service.UserService;
import org.datasurvey.service.UsuarioExtraQueryService; import org.datasurvey.service.UsuarioExtraQueryService;
import org.datasurvey.service.UsuarioExtraService; import org.datasurvey.service.UsuarioExtraService;
import org.datasurvey.service.criteria.UsuarioExtraCriteria; import org.datasurvey.service.criteria.UsuarioExtraCriteria;
@ -41,14 +43,22 @@ public class UsuarioExtraResource {
private final UsuarioExtraQueryService usuarioExtraQueryService; private final UsuarioExtraQueryService usuarioExtraQueryService;
private final MailService mailService;
private final UserService userService;
public UsuarioExtraResource( public UsuarioExtraResource(
UsuarioExtraService usuarioExtraService, UsuarioExtraService usuarioExtraService,
UsuarioExtraRepository usuarioExtraRepository, UsuarioExtraRepository usuarioExtraRepository,
UsuarioExtraQueryService usuarioExtraQueryService UsuarioExtraQueryService usuarioExtraQueryService,
MailService mailService,
UserService userService
) { ) {
this.usuarioExtraService = usuarioExtraService; this.usuarioExtraService = usuarioExtraService;
this.usuarioExtraRepository = usuarioExtraRepository; this.usuarioExtraRepository = usuarioExtraRepository;
this.usuarioExtraQueryService = usuarioExtraQueryService; this.usuarioExtraQueryService = usuarioExtraQueryService;
this.mailService = mailService;
this.userService = userService;
} }
/** /**
@ -99,6 +109,40 @@ public class UsuarioExtraResource {
} }
UsuarioExtra result = usuarioExtraService.save(usuarioExtra); UsuarioExtra result = usuarioExtraService.save(usuarioExtra);
return ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, usuarioExtra.getId().toString()))
.body(result);
}
@PutMapping("/usuario-extras-estado/{id}")
public ResponseEntity<UsuarioExtra> updateUsuarioExtraEstado(
@PathVariable(value = "id", required = false) final Long id,
@Valid @RequestBody UsuarioExtra usuarioExtra
) throws URISyntaxException {
log.debug("REST request to update UsuarioExtra : {}, {}", id, usuarioExtra);
if (usuarioExtra.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
if (!Objects.equals(id, usuarioExtra.getId())) {
throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid");
}
if (!usuarioExtraRepository.existsById(id)) {
throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound");
}
UsuarioExtra result = usuarioExtraService.save(usuarioExtra);
if (usuarioExtra.getEstado().name().equals("SUSPENDED")) {
this.userService.modifyStatus(usuarioExtra.getUser().getLogin(), false);
mailService.sendSuspendedAccountMail(usuarioExtra); //se manda el correo de la suspecion
} else {
this.userService.modifyStatus(usuarioExtra.getUser().getLogin(), true);
mailService.sendActivatedAccountMail(usuarioExtra); //se manda el correo de reactivacion
}
return ResponseEntity return ResponseEntity
.ok() .ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, usuarioExtra.getId().toString())) .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, usuarioExtra.getId().toString()))

View File

@ -27,3 +27,28 @@ email.restored.text1=Your DataSurvey password has been successfully reset..
email.restored.text2=Regards, email.restored.text2=Regards,
email.restored.text3=If you did not make this change, please notify the following email immediately: email.restored.text3=If you did not make this change, please notify the following email immediately:
email.restored.email=datasurvey@gmail.com email.restored.email=datasurvey@gmail.com
#reactivar la cuenta
email.reactivation.title=Your account has been reactivated
email.reactivation.greeting=Hello, {0}!
email.reactivation.text1=Your account has been reactivated. Please click on the link so you can keep enjoying DataSurvey:
email.reactivation.text2=Regards,
#suspended accounr
email.suspended.title=Your account has been suspended
email.suspended.greeting=Dear {0}
email.suspended.text1=Su cuenta en DataSurvey se encuentra temporalmente suspendida. Si cree que es un error por favor haga clic en el siguiente enlace para enviar una solicitud para reactivar su cuenta:
email.suspended.text2=Saludos,
#PublicEncuesta
email.public.title=Su encuesta ha sido publicada
email.public.greeting=¡Felicidades {0}!
email.public.text1=Su encuesta ha sido publicada de manera publica
email.public.text2=Saludos,
#PrivateEncuesta
email.private.title=Su encuesta ha sido publicada de manera privada
email.private.greeting=¡Felicidades {0}!
email.private.text1=Su encuesta ha sdo publicada de manera privada. Su contraseña de acceso es: {0}
email.private.text2=Saludos,

View File

@ -28,3 +28,33 @@ email.restored.text2=Saludos,
email.restored.text3=Si usted no realizó este cambio, favor notifique inmediatamente al siguiente correo: email.restored.text3=Si usted no realizó este cambio, favor notifique inmediatamente al siguiente correo:
email.restored.email=datasurvey@gmail.com email.restored.email=datasurvey@gmail.com
#reactivate account
email.reactivation.title=Su cuenta ha sido reactivada
email.reactivation.greeting=¡Hola, {0}!
email.reactivation.text1=Su cuenta en DataSurvey ha sido reactivada. Por favor haga clic en el siguiente enlace para iniciar sesión y disfrutar de DataSurvey:
email.reactivation.text2=Saludos,
#suspended accounr
email.suspended.title=Su cuenta ha sido suspendida
email.suspended.greeting=Estimado {0}
email.suspended.text1=Lamentamos informarle que su cuenta en DataSurvey se encuentra temporalmente suspendida. Si cree que es un error por favor responda a este correo
email.suspended.text2=Saludos,
#PublicEncuesta
email.public.title=Su encuesta ha sido publicada
email.public.greeting=¡Felicidades {0}!
email.public.text1=Su encuesta ha sido publicada de manera publica
email.public.text2=Saludos,
#PrivateEncuesta
email.private.title=Su encuesta ha sido publicada de manera privada
email.private.greeting=¡Felicidades {0}!
email.private.text1=Su encuesta ha sdo publicada de manera privada. Su contraseña de acceso es: {0}
email.private.text2=Saludos,
#DeletedEncuesta
email.encuestaDeleted.title=Su encuesta ha sido eliminada
email.encuestaDeleted.greeting=Estimado {0}
email.encuestaDeleted.text1=Lamentamos informarle que su encuesta ha sido eliminada por un administrador
email.encuestaDeleted.text2=Saludos,

View File

@ -244,7 +244,7 @@
<img <img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png" src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png"
alt="" alt=""
style="width: 300px; max-width: 600px; height: auto; margin: auto; display: block" style="width: 250px; max-width: 600px; height: auto; margin: auto; display: block"
/> />
</td> </td>
</tr> </tr>

View File

@ -244,7 +244,7 @@
<img <img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png" src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png"
alt="" alt=""
style="width: 300px; max-width: 600px; height: auto; margin: auto; display: block" style="width: 250px; max-width: 600px; height: auto; margin: auto; display: block"
/> />
</td> </td>
</tr> </tr>
@ -264,7 +264,7 @@
th:with="url=(@{|${baseUrl}/account/reset/finish?key=${user.resetKey}|})" th:with="url=(@{|${baseUrl}/account/reset/finish?key=${user.resetKey}|})"
th:href="${url}" th:href="${url}"
class="btn btn-primary" class="btn btn-primary"
>Iniciar sesión</a >Iniciar Sesión</a
> >
</p> </p>
</div> </div>

View File

@ -0,0 +1,310 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width" />
<!-- Forcing initial-scale shouldn't be necessary -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- Use the latest (edge) version of IE rendering engine -->
<meta name="x-apple-disable-message-reformatting" />
<!-- Disable auto-scale in iOS 10 Mail entirely -->
<title th:text="#{email.encuestaDeleted.title}">Encuesta Eliminada</title>
<link rel="icon" th:href="@{|${baseUrl}/favicon.ico|}" />
<link href="https://fonts.googleapis.com/css?family=NotoSansSP:300,400,700" rel="stylesheet" />
<link rel="manifest" href="manifest.webapp" />
<style>
.bg_white {
background: #ffffff;
}
.bg_light {
background: #fafafa;
}
.bg_black {
background: #000000;
}
.bg_dark {
background: rgba(0, 0, 0, 0.8);
}
.email-section {
padding: 2.5em;
}
/*BUTTON*/
.btn {
padding: 10px 15px;
display: inline-block;
}
.btn.btn-primary {
border-radius: 5px;
background: #007bff;
color: #ffffff;
}
.btn.btn-white {
border-radius: 5px;
background: #ffffff;
color: #000000;
}
.btn.btn-white-outline {
border-radius: 5px;
background: transparent;
border: 1px solid #fff;
color: #fff;
}
.btn.btn-black-outline {
border-radius: 0px;
background: transparent;
border: 2px solid #000;
color: #000;
font-weight: 700;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Lato', sans-serif;
color: #000000;
margin-top: 0;
font-weight: 400;
}
body {
font-family: 'Noto Sans JP', sans-serif;
font-weight: 400;
font-size: 15px;
line-height: 1.8;
color: rgba(0, 0, 0, 0.4);
}
a {
color: #30e3ca;
}
table {
}
/*LOGO*/
.logo h1 {
margin: 0;
}
.logo h1 a {
color: #30e3ca;
font-size: 24px;
font-weight: 700;
font-family: 'Lato', sans-serif;
}
/*HERO*/
.hero {
position: relative;
z-index: 0;
}
.hero .text {
color: rgba(0, 0, 0, 0.3);
}
.hero .text h2 {
color: #000;
font-size: 40px;
margin-bottom: 0;
font-weight: 400;
line-height: 1.4;
}
.hero .text h3 {
font-size: 24px;
font-weight: 300;
}
.hero .text h2 span {
font-weight: 600;
color: #30e3ca;
}
/*HEADING SECTION*/
.heading-section {
}
.heading-section h2 {
color: #000000;
font-size: 28px;
margin-top: 0;
line-height: 1.4;
font-weight: 400;
}
.heading-section .subheading {
margin-bottom: 20px !important;
display: inline-block;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(0, 0, 0, 0.4);
position: relative;
}
.heading-section .subheading::after {
position: absolute;
left: 0;
right: 0;
bottom: -10px;
content: '';
width: 100%;
height: 2px;
background: #30e3ca;
margin: 0 auto;
}
.heading-section-white {
color: rgba(255, 255, 255, 0.8);
}
.heading-section-white h2 {
/*font-family: ;*/
line-height: 1;
padding-bottom: 0;
}
.heading-section-white h2 {
color: #ffffff;
}
.heading-section-white .subheading {
margin-bottom: 0;
display: inline-block;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(255, 255, 255, 0.4);
}
ul.social {
padding: 0;
}
ul.social li {
display: inline-block;
margin-right: 10px;
}
.footer {
border-top: 1px solid rgba(0, 0, 0, 0.05);
color: rgba(0, 0, 0, 0.5);
}
.footer .heading {
color: #000;
font-size: 20px;
}
.footer ul {
margin: 0;
padding: 0;
}
.footer ul li {
list-style: none;
margin-bottom: 10px;
}
.footer ul li a {
color: rgba(0, 0, 0, 1);
}
</style>
</head>
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1">
<center style="width: 100%; background-color: #f1f1f1">
<div
style="
display: none;
font-size: 1px;
max-height: 0px;
max-width: 0px;
opacity: 0;
overflow: hidden;
mso-hide: all;
font-family: sans-serif;
"
>
&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;
</div>
<div style="max-width: 600px; margin: 0 auto" class="email-container">
<!-- BEGIN BODY -->
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
<tr>
<td valign="top" class="bg_white" style="padding: 1em 2.5em 0 2.5em">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="logo" style="text-align: center">
<h1>
<a href="#"
><img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333881/DataSurveyLogo2_smr2ok.png"
alt=""
width="300"
/></a>
</h1>
</td>
</tr>
</table>
</td>
</tr>
<!-- end tr -->
<tr>
<td valign="middle" class="hero bg_white" style="padding: 3em 0 2em 0">
<img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png"
alt=""
style="width: 300px; max-width: 600px; height: auto; margin: auto; display: block"
/>
</td>
</tr>
<!-- end tr -->
<tr>
<td valign="middle" class="hero bg_white" style="padding: 2em 0 4em 0">
<table>
<tr>
<td>
<div class="text" style="padding: 0 2.5em; text-align: center">
<h2 th:text="#{email.encuestaDeleted.greeting(${user.login})}">¡Encuesta eliminada!</h2>
<h3 th:text="#{email.encuestaDeleted.text1}">¡Su encuesta ha sido eliminada exitosamente!</h3>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- end tr -->
<!-- 1 Column Text + Button : END -->
</table>
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
<tr>
<td valign="middle" class="bg_light footer email-section">
<table>
<tr>
<td valign="top" width="33.333%" style="padding-top: 20px">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="text-align: left; padding-right: 10px">
<h3 class="heading">Acerca de</h3>
<p>DataSurvey es su compañero más cercano para poder recolectar información valiosa para usted.</p>
</td>
</tr>
</table>
</td>
<td valign="top" width="33.333%" style="padding-top: 20px">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="text-align: left; padding-left: 5px; padding-right: 5px">
<h3 class="heading">Información de contacto</h3>
<ul>
<li><span href="mailto:datasurveyapp@gmail.com" class="text">datasurveyapp@gmail.com</span></li>
</ul>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- end: tr -->
<tr>
<td class="bg_light" style="text-align: center">
<p><a href="https://datasurvey.org" style="color: rgba(0, 0, 0, 0.8)">DataSurvey.org</a></p>
</td>
</tr>
</table>
</div>
</center>
</body>
</html>

View File

@ -0,0 +1,319 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width" />
<!-- Forcing initial-scale shouldn't be necessary -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- Use the latest (edge) version of IE rendering engine -->
<meta name="x-apple-disable-message-reformatting" />
<!-- Disable auto-scale in iOS 10 Mail entirely -->
<title th:text="#{email.private.title}">JHipster activation</title>
<link rel="icon" th:href="@{|${baseUrl}/favicon.ico|}" />
<link href="https://fonts.googleapis.com/css?family=NotoSansSP:300,400,700" rel="stylesheet" />
<link rel="manifest" href="manifest.webapp" />
<style>
.bg_white {
background: #ffffff;
}
.bg_light {
background: #fafafa;
}
.bg_black {
background: #000000;
}
.bg_dark {
background: rgba(0, 0, 0, 0.8);
}
.email-section {
padding: 2.5em;
}
/*BUTTON*/
.btn {
padding: 10px 15px;
display: inline-block;
}
.btn.btn-primary {
border-radius: 5px;
background: #007bff;
color: #ffffff;
}
.btn.btn-white {
border-radius: 5px;
background: #ffffff;
color: #000000;
}
.btn.btn-white-outline {
border-radius: 5px;
background: transparent;
border: 1px solid #fff;
color: #fff;
}
.btn.btn-black-outline {
border-radius: 0px;
background: transparent;
border: 2px solid #000;
color: #000;
font-weight: 700;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Lato', sans-serif;
color: #000000;
margin-top: 0;
font-weight: 400;
}
body {
font-family: 'Noto Sans JP', sans-serif;
font-weight: 400;
font-size: 15px;
line-height: 1.8;
color: rgba(0, 0, 0, 0.4);
}
a {
color: #30e3ca;
}
table {
}
/*LOGO*/
.logo h1 {
margin: 0;
}
.logo h1 a {
color: #30e3ca;
font-size: 24px;
font-weight: 700;
font-family: 'Lato', sans-serif;
}
/*HERO*/
.hero {
position: relative;
z-index: 0;
}
.hero .text {
color: rgba(0, 0, 0, 0.3);
}
.hero .text h2 {
color: #000;
font-size: 40px;
margin-bottom: 0;
font-weight: 400;
line-height: 1.4;
}
.hero .text h3 {
font-size: 24px;
font-weight: 300;
}
.hero .text h2 span {
font-weight: 600;
color: #30e3ca;
}
/*HEADING SECTION*/
.heading-section {
}
.heading-section h2 {
color: #000000;
font-size: 28px;
margin-top: 0;
line-height: 1.4;
font-weight: 400;
}
.heading-section .subheading {
margin-bottom: 20px !important;
display: inline-block;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(0, 0, 0, 0.4);
position: relative;
}
.heading-section .subheading::after {
position: absolute;
left: 0;
right: 0;
bottom: -10px;
content: '';
width: 100%;
height: 2px;
background: #30e3ca;
margin: 0 auto;
}
.heading-section-white {
color: rgba(255, 255, 255, 0.8);
}
.heading-section-white h2 {
/*font-family: ;*/
line-height: 1;
padding-bottom: 0;
}
.heading-section-white h2 {
color: #ffffff;
}
.heading-section-white .subheading {
margin-bottom: 0;
display: inline-block;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(255, 255, 255, 0.4);
}
ul.social {
padding: 0;
}
ul.social li {
display: inline-block;
margin-right: 10px;
}
.footer {
border-top: 1px solid rgba(0, 0, 0, 0.05);
color: rgba(0, 0, 0, 0.5);
}
.footer .heading {
color: #000;
font-size: 20px;
}
.footer ul {
margin: 0;
padding: 0;
}
.footer ul li {
list-style: none;
margin-bottom: 10px;
}
.footer ul li a {
color: rgba(0, 0, 0, 1);
}
</style>
</head>
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1">
<center style="width: 100%; background-color: #f1f1f1">
<div
style="
display: none;
font-size: 1px;
max-height: 0px;
max-width: 0px;
opacity: 0;
overflow: hidden;
mso-hide: all;
font-family: sans-serif;
"
>
&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;
</div>
<div style="max-width: 600px; margin: 0 auto" class="email-container">
<!-- BEGIN BODY -->
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
<tr>
<td valign="top" class="bg_white" style="padding: 1em 2.5em 0 2.5em">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="logo" style="text-align: center">
<h1>
<a href="#"
><img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333881/DataSurveyLogo2_smr2ok.png"
alt=""
width="300"
/></a>
</h1>
</td>
</tr>
</table>
</td>
</tr>
<!-- end tr -->
<tr>
<td valign="middle" class="hero bg_white" style="padding: 3em 0 2em 0">
<img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png"
alt=""
style="width: 250px; max-width: 600px; height: auto; margin: auto; display: block"
/>
</td>
</tr>
<!-- end tr -->
<tr>
<td valign="middle" class="hero bg_white" style="padding: 2em 0 4em 0">
<table>
<tr>
<td>
<div class="text" style="padding: 0 2.5em; text-align: center">
<h2 th:text="#{email.private.greeting(${user.login})}">¡Hola!</h2>
<h3 th:text="#{email.private.text1(${contrasenna})}">
Your JHipster account has been created, please click on the URL below to activate it:
</h3>
</div>
<div class="text" style="padding: 1em 2.5em; text-align: center">
<p>
<span th:text="#{email.private.text2}">Regards, </span>
<br />
<em th:text="#{email.signature}">JHipster.</em>
</p>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- end tr -->
<!-- 1 Column Text + Button : END -->
</table>
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
<tr>
<td valign="middle" class="bg_light footer email-section">
<table>
<tr>
<td valign="top" width="33.333%" style="padding-top: 20px">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="text-align: left; padding-right: 10px">
<h3 class="heading">Acerca de</h3>
<p>DataSurvey es su compañero más cercano para poder recolectar información valiosa para usted</p>
</td>
</tr>
</table>
</td>
<td valign="top" width="33.333%" style="padding-top: 20px">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="text-align: left; padding-left: 5px; padding-right: 5px">
<h3 class="heading">Información de contacto</h3>
<ul>
<li><span href="mailto:datasurveyapp@gmail.com" class="text">datasurveyapp@gmail.com</span></li>
</ul>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- end: tr -->
<tr>
<td class="bg_light" style="text-align: center">
<p><a href="https://datasurvey.org" style="color: rgba(0, 0, 0, 0.8)">DataSurvey.org</a></p>
</td>
</tr>
</table>
</div>
</center>
</body>
</html>

View File

@ -0,0 +1,319 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width" />
<!-- Forcing initial-scale shouldn't be necessary -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- Use the latest (edge) version of IE rendering engine -->
<meta name="x-apple-disable-message-reformatting" />
<!-- Disable auto-scale in iOS 10 Mail entirely -->
<title th:text="#{email.public.title}">JHipster activation</title>
<link rel="icon" th:href="@{|${baseUrl}/favicon.ico|}" />
<link href="https://fonts.googleapis.com/css?family=NotoSansSP:300,400,700" rel="stylesheet" />
<link rel="manifest" href="manifest.webapp" />
<style>
.bg_white {
background: #ffffff;
}
.bg_light {
background: #fafafa;
}
.bg_black {
background: #000000;
}
.bg_dark {
background: rgba(0, 0, 0, 0.8);
}
.email-section {
padding: 2.5em;
}
/*BUTTON*/
.btn {
padding: 10px 15px;
display: inline-block;
}
.btn.btn-primary {
border-radius: 5px;
background: #007bff;
color: #ffffff;
}
.btn.btn-white {
border-radius: 5px;
background: #ffffff;
color: #000000;
}
.btn.btn-white-outline {
border-radius: 5px;
background: transparent;
border: 1px solid #fff;
color: #fff;
}
.btn.btn-black-outline {
border-radius: 0px;
background: transparent;
border: 2px solid #000;
color: #000;
font-weight: 700;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Lato', sans-serif;
color: #000000;
margin-top: 0;
font-weight: 400;
}
body {
font-family: 'Noto Sans JP', sans-serif;
font-weight: 400;
font-size: 15px;
line-height: 1.8;
color: rgba(0, 0, 0, 0.4);
}
a {
color: #30e3ca;
}
table {
}
/*LOGO*/
.logo h1 {
margin: 0;
}
.logo h1 a {
color: #30e3ca;
font-size: 24px;
font-weight: 700;
font-family: 'Lato', sans-serif;
}
/*HERO*/
.hero {
position: relative;
z-index: 0;
}
.hero .text {
color: rgba(0, 0, 0, 0.3);
}
.hero .text h2 {
color: #000;
font-size: 40px;
margin-bottom: 0;
font-weight: 400;
line-height: 1.4;
}
.hero .text h3 {
font-size: 24px;
font-weight: 300;
}
.hero .text h2 span {
font-weight: 600;
color: #30e3ca;
}
/*HEADING SECTION*/
.heading-section {
}
.heading-section h2 {
color: #000000;
font-size: 28px;
margin-top: 0;
line-height: 1.4;
font-weight: 400;
}
.heading-section .subheading {
margin-bottom: 20px !important;
display: inline-block;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(0, 0, 0, 0.4);
position: relative;
}
.heading-section .subheading::after {
position: absolute;
left: 0;
right: 0;
bottom: -10px;
content: '';
width: 100%;
height: 2px;
background: #30e3ca;
margin: 0 auto;
}
.heading-section-white {
color: rgba(255, 255, 255, 0.8);
}
.heading-section-white h2 {
/*font-family: ;*/
line-height: 1;
padding-bottom: 0;
}
.heading-section-white h2 {
color: #ffffff;
}
.heading-section-white .subheading {
margin-bottom: 0;
display: inline-block;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(255, 255, 255, 0.4);
}
ul.social {
padding: 0;
}
ul.social li {
display: inline-block;
margin-right: 10px;
}
.footer {
border-top: 1px solid rgba(0, 0, 0, 0.05);
color: rgba(0, 0, 0, 0.5);
}
.footer .heading {
color: #000;
font-size: 20px;
}
.footer ul {
margin: 0;
padding: 0;
}
.footer ul li {
list-style: none;
margin-bottom: 10px;
}
.footer ul li a {
color: rgba(0, 0, 0, 1);
}
</style>
</head>
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1">
<center style="width: 100%; background-color: #f1f1f1">
<div
style="
display: none;
font-size: 1px;
max-height: 0px;
max-width: 0px;
opacity: 0;
overflow: hidden;
mso-hide: all;
font-family: sans-serif;
"
>
&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;
</div>
<div style="max-width: 600px; margin: 0 auto" class="email-container">
<!-- BEGIN BODY -->
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
<tr>
<td valign="top" class="bg_white" style="padding: 1em 2.5em 0 2.5em">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="logo" style="text-align: center">
<h1>
<a href="#"
><img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333881/DataSurveyLogo2_smr2ok.png"
alt=""
width="300"
/></a>
</h1>
</td>
</tr>
</table>
</td>
</tr>
<!-- end tr -->
<tr>
<td valign="middle" class="hero bg_white" style="padding: 3em 0 2em 0">
<img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png"
alt=""
style="width: 250px; max-width: 600px; height: auto; margin: auto; display: block"
/>
</td>
</tr>
<!-- end tr -->
<tr>
<td valign="middle" class="hero bg_white" style="padding: 2em 0 4em 0">
<table>
<tr>
<td>
<div class="text" style="padding: 0 2.5em; text-align: center">
<h2 th:text="#{email.public.greeting(${user.login})}">¡Hola!</h2>
<h3 th:text="#{email.public.text1}">
Your JHipster account has been created, please click on the URL below to activate it:
</h3>
</div>
<div class="text" style="padding: 1em 2.5em; text-align: center">
<p>
<span th:text="#{email.public.text2}">Regards, </span>
<br />
<em th:text="#{email.signature}">JHipster.</em>
</p>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- end tr -->
<!-- 1 Column Text + Button : END -->
</table>
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
<tr>
<td valign="middle" class="bg_light footer email-section">
<table>
<tr>
<td valign="top" width="33.333%" style="padding-top: 20px">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="text-align: left; padding-right: 10px">
<h3 class="heading">Acerca de</h3>
<p>DataSurvey es su compañero más cercano para poder recolectar información valiosa para usted</p>
</td>
</tr>
</table>
</td>
<td valign="top" width="33.333%" style="padding-top: 20px">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="text-align: left; padding-left: 5px; padding-right: 5px">
<h3 class="heading">Información de contacto</h3>
<ul>
<li><span href="mailto:datasurveyapp@gmail.com" class="text">datasurveyapp@gmail.com</span></li>
</ul>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- end: tr -->
<tr>
<td class="bg_light" style="text-align: center">
<p><a href="https://datasurvey.org" style="color: rgba(0, 0, 0, 0.8)">DataSurvey.org</a></p>
</td>
</tr>
</table>
</div>
</center>
</body>
</html>

View File

@ -244,7 +244,7 @@
<img <img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png" src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png"
alt="" alt=""
style="width: 300px; max-width: 600px; height: auto; margin: auto; display: block" style="width: 250px; max-width: 600px; height: auto; margin: auto; display: block"
/> />
</td> </td>
</tr> </tr>

View File

@ -244,7 +244,7 @@
<img <img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png" src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png"
alt="" alt=""
style="width: 300px; max-width: 600px; height: auto; margin: auto; display: block" style="width: 250px; max-width: 600px; height: auto; margin: auto; display: block"
/> />
</td> </td>
</tr> </tr>

View File

@ -0,0 +1,322 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width" />
<!-- Forcing initial-scale shouldn't be necessary -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- Use the latest (edge) version of IE rendering engine -->
<meta name="x-apple-disable-message-reformatting" />
<!-- Disable auto-scale in iOS 10 Mail entirely -->
<title th:text="#{email.reactivation.title}">JHipster activation</title>
<link rel="icon" th:href="@{|${baseUrl}/favicon.ico|}" />
<link href="https://fonts.googleapis.com/css?family=NotoSansSP:300,400,700" rel="stylesheet" />
<link rel="manifest" href="manifest.webapp" />
<style>
.bg_white {
background: #ffffff;
}
.bg_light {
background: #fafafa;
}
.bg_black {
background: #000000;
}
.bg_dark {
background: rgba(0, 0, 0, 0.8);
}
.email-section {
padding: 2.5em;
}
/*BUTTON*/
.btn {
padding: 10px 15px;
display: inline-block;
}
.btn.btn-primary {
border-radius: 5px;
background: #007bff;
color: #ffffff;
}
.btn.btn-white {
border-radius: 5px;
background: #ffffff;
color: #000000;
}
.btn.btn-white-outline {
border-radius: 5px;
background: transparent;
border: 1px solid #fff;
color: #fff;
}
.btn.btn-black-outline {
border-radius: 0px;
background: transparent;
border: 2px solid #000;
color: #000;
font-weight: 700;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Lato', sans-serif;
color: #000000;
margin-top: 0;
font-weight: 400;
}
body {
font-family: 'Noto Sans JP', sans-serif;
font-weight: 400;
font-size: 15px;
line-height: 1.8;
color: rgba(0, 0, 0, 0.4);
}
a {
color: #30e3ca;
}
table {
}
/*LOGO*/
.logo h1 {
margin: 0;
}
.logo h1 a {
color: #30e3ca;
font-size: 24px;
font-weight: 700;
font-family: 'Lato', sans-serif;
}
/*HERO*/
.hero {
position: relative;
z-index: 0;
}
.hero .text {
color: rgba(0, 0, 0, 0.3);
}
.hero .text h2 {
color: #000;
font-size: 40px;
margin-bottom: 0;
font-weight: 400;
line-height: 1.4;
}
.hero .text h3 {
font-size: 24px;
font-weight: 300;
}
.hero .text h2 span {
font-weight: 600;
color: #30e3ca;
}
/*HEADING SECTION*/
.heading-section {
}
.heading-section h2 {
color: #000000;
font-size: 28px;
margin-top: 0;
line-height: 1.4;
font-weight: 400;
}
.heading-section .subheading {
margin-bottom: 20px !important;
display: inline-block;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(0, 0, 0, 0.4);
position: relative;
}
.heading-section .subheading::after {
position: absolute;
left: 0;
right: 0;
bottom: -10px;
content: '';
width: 100%;
height: 2px;
background: #30e3ca;
margin: 0 auto;
}
.heading-section-white {
color: rgba(255, 255, 255, 0.8);
}
.heading-section-white h2 {
/*font-family: ;*/
line-height: 1;
padding-bottom: 0;
}
.heading-section-white h2 {
color: #ffffff;
}
.heading-section-white .subheading {
margin-bottom: 0;
display: inline-block;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(255, 255, 255, 0.4);
}
ul.social {
padding: 0;
}
ul.social li {
display: inline-block;
margin-right: 10px;
}
.footer {
border-top: 1px solid rgba(0, 0, 0, 0.05);
color: rgba(0, 0, 0, 0.5);
}
.footer .heading {
color: #000;
font-size: 20px;
}
.footer ul {
margin: 0;
padding: 0;
}
.footer ul li {
list-style: none;
margin-bottom: 10px;
}
.footer ul li a {
color: rgba(0, 0, 0, 1);
}
</style>
</head>
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1">
<center style="width: 100%; background-color: #f1f1f1">
<div
style="
display: none;
font-size: 1px;
max-height: 0px;
max-width: 0px;
opacity: 0;
overflow: hidden;
mso-hide: all;
font-family: sans-serif;
"
>
&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;
</div>
<div style="max-width: 600px; margin: 0 auto" class="email-container">
<!-- BEGIN BODY -->
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
<tr>
<td valign="top" class="bg_white" style="padding: 1em 2.5em 0 2.5em">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="logo" style="text-align: center">
<h1>
<a href="#"
><img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333881/DataSurveyLogo2_smr2ok.png"
alt=""
width="300"
/></a>
</h1>
</td>
</tr>
</table>
</td>
</tr>
<!-- end tr -->
<tr>
<td valign="middle" class="hero bg_white" style="padding: 3em 0 2em 0">
<img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png"
alt=""
style="width: 250px; max-width: 600px; height: auto; margin: auto; display: block"
/>
</td>
</tr>
<!-- end tr -->
<tr>
<td valign="middle" class="hero bg_white" style="padding: 2em 0 4em 0">
<table>
<tr>
<td>
<div class="text" style="padding: 0 2.5em; text-align: center">
<h2 th:text="#{email.reactivation.greeting(${user.login})}">¡Hola!</h2>
<h3 th:text="#{email.reactivation.text1}">
Your JHipster account has been created, please click on the URL below to activate it:
</h3>
<p>
<a th:with="url=(@{|${baseUrl}/login|})" th:href="${url}" class="btn btn-primary">Iniciar Sesión</a>
</p>
</div>
<div class="text" style="padding: 1em 2.5em; text-align: center">
<p>
<span th:text="#{email.reactivation.text2}">Regards, </span>
<br />
<em th:text="#{email.signature}">JHipster.</em>
</p>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- end tr -->
<!-- 1 Column Text + Button : END -->
</table>
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
<tr>
<td valign="middle" class="bg_light footer email-section">
<table>
<tr>
<td valign="top" width="33.333%" style="padding-top: 20px">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="text-align: left; padding-right: 10px">
<h3 class="heading">Acerca de</h3>
<p>DataSurvey es su compañero más cercano para poder recolectar información valiosa para usted</p>
</td>
</tr>
</table>
</td>
<td valign="top" width="33.333%" style="padding-top: 20px">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="text-align: left; padding-left: 5px; padding-right: 5px">
<h3 class="heading">Información de contacto</h3>
<ul>
<li><span href="mailto:datasurveyapp@gmail.com" class="text">datasurveyapp@gmail.com</span></li>
</ul>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- end: tr -->
<tr>
<td class="bg_light" style="text-align: center">
<p><a href="https://datasurvey.org" style="color: rgba(0, 0, 0, 0.8)">DataSurvey.org</a></p>
</td>
</tr>
</table>
</div>
</center>
</body>
</html>

View File

@ -0,0 +1,319 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width" />
<!-- Forcing initial-scale shouldn't be necessary -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- Use the latest (edge) version of IE rendering engine -->
<meta name="x-apple-disable-message-reformatting" />
<!-- Disable auto-scale in iOS 10 Mail entirely -->
<title th:text="#{email.suspended.title}">JHipster activation</title>
<link rel="icon" th:href="@{|${baseUrl}/favicon.ico|}" />
<link href="https://fonts.googleapis.com/css?family=NotoSansSP:300,400,700" rel="stylesheet" />
<link rel="manifest" href="manifest.webapp" />
<style>
.bg_white {
background: #ffffff;
}
.bg_light {
background: #fafafa;
}
.bg_black {
background: #000000;
}
.bg_dark {
background: rgba(0, 0, 0, 0.8);
}
.email-section {
padding: 2.5em;
}
/*BUTTON*/
.btn {
padding: 10px 15px;
display: inline-block;
}
.btn.btn-primary {
border-radius: 5px;
background: #007bff;
color: #ffffff;
}
.btn.btn-white {
border-radius: 5px;
background: #ffffff;
color: #000000;
}
.btn.btn-white-outline {
border-radius: 5px;
background: transparent;
border: 1px solid #fff;
color: #fff;
}
.btn.btn-black-outline {
border-radius: 0px;
background: transparent;
border: 2px solid #000;
color: #000;
font-weight: 700;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Lato', sans-serif;
color: #000000;
margin-top: 0;
font-weight: 400;
}
body {
font-family: 'Noto Sans JP', sans-serif;
font-weight: 400;
font-size: 15px;
line-height: 1.8;
color: rgba(0, 0, 0, 0.4);
}
a {
color: #30e3ca;
}
table {
}
/*LOGO*/
.logo h1 {
margin: 0;
}
.logo h1 a {
color: #30e3ca;
font-size: 24px;
font-weight: 700;
font-family: 'Lato', sans-serif;
}
/*HERO*/
.hero {
position: relative;
z-index: 0;
}
.hero .text {
color: rgba(0, 0, 0, 0.3);
}
.hero .text h2 {
color: #000;
font-size: 40px;
margin-bottom: 0;
font-weight: 400;
line-height: 1.4;
}
.hero .text h3 {
font-size: 24px;
font-weight: 300;
}
.hero .text h2 span {
font-weight: 600;
color: #30e3ca;
}
/*HEADING SECTION*/
.heading-section {
}
.heading-section h2 {
color: #000000;
font-size: 28px;
margin-top: 0;
line-height: 1.4;
font-weight: 400;
}
.heading-section .subheading {
margin-bottom: 20px !important;
display: inline-block;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(0, 0, 0, 0.4);
position: relative;
}
.heading-section .subheading::after {
position: absolute;
left: 0;
right: 0;
bottom: -10px;
content: '';
width: 100%;
height: 2px;
background: #30e3ca;
margin: 0 auto;
}
.heading-section-white {
color: rgba(255, 255, 255, 0.8);
}
.heading-section-white h2 {
/*font-family: ;*/
line-height: 1;
padding-bottom: 0;
}
.heading-section-white h2 {
color: #ffffff;
}
.heading-section-white .subheading {
margin-bottom: 0;
display: inline-block;
font-size: 13px;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(255, 255, 255, 0.4);
}
ul.social {
padding: 0;
}
ul.social li {
display: inline-block;
margin-right: 10px;
}
.footer {
border-top: 1px solid rgba(0, 0, 0, 0.05);
color: rgba(0, 0, 0, 0.5);
}
.footer .heading {
color: #000;
font-size: 20px;
}
.footer ul {
margin: 0;
padding: 0;
}
.footer ul li {
list-style: none;
margin-bottom: 10px;
}
.footer ul li a {
color: rgba(0, 0, 0, 1);
}
</style>
</head>
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1">
<center style="width: 100%; background-color: #f1f1f1">
<div
style="
display: none;
font-size: 1px;
max-height: 0px;
max-width: 0px;
opacity: 0;
overflow: hidden;
mso-hide: all;
font-family: sans-serif;
"
>
&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;
</div>
<div style="max-width: 600px; margin: 0 auto" class="email-container">
<!-- BEGIN BODY -->
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
<tr>
<td valign="top" class="bg_white" style="padding: 1em 2.5em 0 2.5em">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="logo" style="text-align: center">
<h1>
<a href="#"
><img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333881/DataSurveyLogo2_smr2ok.png"
alt=""
width="300"
/></a>
</h1>
</td>
</tr>
</table>
</td>
</tr>
<!-- end tr -->
<tr>
<td valign="middle" class="hero bg_white" style="padding: 3em 0 2em 0">
<img
src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png"
alt=""
style="width: 250px; max-width: 600px; height: auto; margin: auto; display: block"
/>
</td>
</tr>
<!-- end tr -->
<tr>
<td valign="middle" class="hero bg_white" style="padding: 2em 0 4em 0">
<table>
<tr>
<td>
<div class="text" style="padding: 0 2.5em; text-align: center">
<h2 th:text="#{email.suspended.greeting(${user.login})}">¡Hola!</h2>
<h3 th:text="#{email.suspended.text1}">
Your JHipster account has been created, please click on the URL below to activate it:
</h3>
</div>
<div class="text" style="padding: 1em 2.5em; text-align: center">
<p>
<span th:text="#{email.suspended.text2}">Regards, </span>
<br />
<em th:text="#{email.signature}">JHipster.</em>
</p>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- end tr -->
<!-- 1 Column Text + Button : END -->
</table>
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
<tr>
<td valign="middle" class="bg_light footer email-section">
<table>
<tr>
<td valign="top" width="33.333%" style="padding-top: 20px">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="text-align: left; padding-right: 10px">
<h3 class="heading">Acerca de</h3>
<p>DataSurvey es su compañero más cercano para poder recolectar información valiosa para usted</p>
</td>
</tr>
</table>
</td>
<td valign="top" width="33.333%" style="padding-top: 20px">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="text-align: left; padding-left: 5px; padding-right: 5px">
<h3 class="heading">Información de contacto</h3>
<ul>
<li><span href="mailto:datasurveyapp@gmail.com" class="text">datasurveyapp@gmail.com</span></li>
</ul>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- end: tr -->
<tr>
<td class="bg_light" style="text-align: center">
<p><a href="https://datasurvey.org" style="color: rgba(0, 0, 0, 0.8)">DataSurvey.org</a></p>
</td>
</tr>
</table>
</div>
</center>
</body>
</html>

View File

@ -1,172 +1,3 @@
<!-- <div>
<div class="row justify-content-center">
<div class="col-md-8">
<h2 jhiTranslate="settings.title" [translateValues]="{ username: account.login }" *ngIf="account">
User settings for [<strong>{{ account.login }}</strong
>]
</h2>
<div class="alert alert-success" *ngIf="success" jhiTranslate="settings.messages.success">
<strong>Settings saved!</strong>
</div>
<jhi-alert-error></jhi-alert-error>
<form name="form" role="form" (ngSubmit)="save()" [formGroup]="settingsForm" *ngIf="account" novalidate>
<div class="form-group">
<label class="form-control-label" for="firstName" jhiTranslate="settings.form.firstname">First Name</label>
<input
type="text"
class="form-control"
id="firstName"
name="firstName"
placeholder="{{ 'settings.form.firstname.placeholder' | translate }}"
formControlName="firstName"
data-cy="firstname"
/>
<div
*ngIf="
settingsForm.get('firstName')!.invalid && (settingsForm.get('firstName')!.dirty || settingsForm.get('firstName')!.touched)
"
>
<small
class="form-text text-danger"
*ngIf="settingsForm.get('firstName')?.errors?.required"
jhiTranslate="settings.messages.validate.firstname.required"
>
Your first name is required.
</small>
<small
class="form-text text-danger"
*ngIf="settingsForm.get('firstName')?.errors?.minlength"
jhiTranslate="settings.messages.validate.firstname.minlength"
>
Your first name is required to be at least 1 character.
</small>
<small
class="form-text text-danger"
*ngIf="settingsForm.get('firstName')?.errors?.maxlength"
jhiTranslate="settings.messages.validate.firstname.maxlength"
>
Your first name cannot be longer than 50 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" for="lastName" jhiTranslate="settings.form.lastname">Last Name</label>
<input
type="text"
class="form-control"
id="lastName"
name="lastName"
placeholder="{{ 'settings.form.lastname.placeholder' | translate }}"
formControlName="lastName"
data-cy="lastname"
/>
<div
*ngIf="settingsForm.get('lastName')!.invalid && (settingsForm.get('lastName')!.dirty || settingsForm.get('lastName')!.touched)"
>
<small
class="form-text text-danger"
*ngIf="settingsForm.get('lastName')?.errors?.required"
jhiTranslate="settings.messages.validate.lastname.required"
>
Your last name is required.
</small>
<small
class="form-text text-danger"
*ngIf="settingsForm.get('lastName')?.errors?.minlength"
jhiTranslate="settings.messages.validate.lastname.minlength"
>
Your last name is required to be at least 1 character.
</small>
<small
class="form-text text-danger"
*ngIf="settingsForm.get('lastName')?.errors?.maxlength"
jhiTranslate="settings.messages.validate.lastname.maxlength"
>
Your last name cannot be longer than 50 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" for="email" jhiTranslate="global.form.email.label">Email</label>
<input
type="email"
class="form-control"
id="email"
name="email"
placeholder="{{ 'global.form.email.placeholder' | translate }}"
formControlName="email"
data-cy="email"
/>
<div *ngIf="settingsForm.get('email')!.invalid && (settingsForm.get('email')!.dirty || settingsForm.get('email')!.touched)">
<small
class="form-text text-danger"
*ngIf="settingsForm.get('email')?.errors?.required"
jhiTranslate="global.messages.validate.email.required"
>
Your email is required.
</small>
<small
class="form-text text-danger"
*ngIf="settingsForm.get('email')?.errors?.email"
jhiTranslate="global.messages.validate.email.invalid"
>
Your email is invalid.
</small>
<small
class="form-text text-danger"
*ngIf="settingsForm.get('email')?.errors?.minlength"
jhiTranslate="global.messages.validate.email.minlength"
>
Your email is required to be at least 5 characters.
</small>
<small
class="form-text text-danger"
*ngIf="settingsForm.get('email')?.errors?.maxlength"
jhiTranslate="global.messages.validate.email.maxlength"
>
Your email cannot be longer than 100 characters.
</small>
</div>
</div>
<div class="form-group" *ngIf="languages && languages.length > 0">
<label for="langKey" jhiTranslate="settings.form.language">Language</label>
<select class="form-control" id="langKey" name="langKey" formControlName="langKey" data-cy="langKey">
<option *ngFor="let language of languages" [value]="language">{{ language | findLanguageFromKey }}</option>
</select>
</div>
<button
type="submit"
[disabled]="settingsForm.invalid"
class="btn btn-primary"
jhiTranslate="settings.form.button"
data-cy="submit"
>
Save
</button>
</form>
</div>
</div>
</div>
-------------------------------------------------------------------------------
-->
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="row w-75 pb-lg-5 pr-lg-5 mb-5" style="border-bottom: 1px solid #e7ebf3"> <div class="row w-75 pb-lg-5 pr-lg-5 mb-5" style="border-bottom: 1px solid #e7ebf3">
<div class="col-lg-4 mr-lg-5"> <div class="col-lg-4 mr-lg-5">

View File

@ -136,10 +136,6 @@ export class SettingsComponent implements OnInit {
save(): void { save(): void {
this.isSaving = true; this.isSaving = true;
const usuarioExtra = this.createFromForm(); const usuarioExtra = this.createFromForm();
console.log(usuarioExtra.iconoPerfil);
console.log(usuarioExtra.fechaNacimiento);
this.subscribeToSaveResponse(this.usuarioExtraService.update(usuarioExtra)); this.subscribeToSaveResponse(this.usuarioExtraService.update(usuarioExtra));
} }

View File

@ -3,3 +3,4 @@ export const EMAIL_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/email-already-used';
export const LOGIN_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/login-already-used'; export const LOGIN_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/login-already-used';
export const EMAIL_NOT_EXISTS_TYPE = PROBLEM_BASE_URL + '/email-not-exists'; export const EMAIL_NOT_EXISTS_TYPE = PROBLEM_BASE_URL + '/email-not-exists';
export const USER_IS_GOOGLE_TYPE = PROBLEM_BASE_URL + '/user-is-google'; export const USER_IS_GOOGLE_TYPE = PROBLEM_BASE_URL + '/user-is-google';
export const USER_IS_SUSPENDED = PROBLEM_BASE_URL + '/user-is-suspended';

View File

@ -72,6 +72,7 @@ export class AccountService {
shareReplay() shareReplay()
); );
} }
return this.accountCache$; return this.accountCache$;
} }

View File

@ -2,24 +2,25 @@
<div class="modal-header"></div> <div class="modal-header"></div>
<div class="modal-body"> <div class="modal-body">
<jhi-alert-error></jhi-alert-error> <!-- <jhi-alert-error></jhi-alert-error> -->
<p class="ds-title--small">Cambiar estado</p>
<p <p
class="ds-subtitle"
id="jhi-delete-categoria-heading" id="jhi-delete-categoria-heading"
jhiTranslate="dataSurveyApp.categoria.delete.question" jhiTranslate="dataSurveyApp.categoria.delete.question"
[translateValues]="{ nombre: categoria.nombre }" [translateValues]="{ nombre: categoria.nombre }"
style="text-align: center"
> >
Are you sure you want to toggle this category's status? Are you sure you want to toggle this category's status?
</p> </p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary ds-btn ds-btn-secondary" data-dismiss="modal" (click)="cancel()"> <button type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal" (click)="cancel()">
&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span> <fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button> </button>
<button id="jhi-confirm-delete-categoria" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger ds-btn ds-btn-danger"> <button id="jhi-confirm-delete-categoria" data-cy="entityConfirmDeleteButton" type="submit" class="ds-btn ds-btn--danger">
<fa-icon [icon]="faExchangeAlt"></fa-icon>
<span jhiTranslate="entity.action.toggleStatus">Toggle Status</span> <span jhiTranslate="entity.action.toggleStatus">Toggle Status</span>
</button> </button>
</div> </div>

View File

@ -10,10 +10,13 @@ import { finalize, map } from 'rxjs/operators';
import { Categoria, ICategoria } from '../categoria.model'; import { Categoria, ICategoria } from '../categoria.model';
import { CategoriaService } from '../service/categoria.service'; import { CategoriaService } from '../service/categoria.service';
import { faExchangeAlt } from '@fortawesome/free-solid-svg-icons';
@Component({ @Component({
templateUrl: './categoria-delete-dialog.component.html', templateUrl: './categoria-delete-dialog.component.html',
}) })
export class CategoriaDeleteDialogComponent { export class CategoriaDeleteDialogComponent {
faExchangeAlt = faExchangeAlt;
categoria?: ICategoria; categoria?: ICategoria;
encuestas?: IEncuesta[]; encuestas?: IEncuesta[];
encuestasFiltradas?: IEncuesta[]; encuestasFiltradas?: IEncuesta[];

View File

@ -1,6 +1,9 @@
<div> <div>
<h2 id="page-heading" data-cy="CategoriaHeading"> <h2 id="page-heading" data-cy="CategoriaHeading">
<span jhiTranslate="dataSurveyApp.categoria.home.title">Categorias</span> <div>
<span class="ds-title" jhiTranslate="dataSurveyApp.categoria.home.title">Categorias</span>
<p class="ds-subtitle">Categorice las encuestas de la aplicación</p>
</div>
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
<button <button
@ -19,12 +22,17 @@
</div>--> </div>-->
<div> <div
<jhi-alert class="alert-success"></jhi-alert> *ngIf="success"
class="alert alert-success alert-dismissible fade show"
role="alert"
jhiTranslate="dataSurveyApp.categoria.delete.success"
>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div> </div>
<div class="alert alert-success" *ngIf="success" jhiTranslate="dataSurveyApp.categoria.delete.success"></div>
<div class="alert alert-warning" id="no-result" *ngIf="categorias?.length === 0"> <div class="alert alert-warning" id="no-result" *ngIf="categorias?.length === 0">
<span jhiTranslate="dataSurveyApp.categoria.home.notFound">No categorias found</span> <span jhiTranslate="dataSurveyApp.categoria.home.notFound">No categorias found</span>
</div> </div>
@ -59,7 +67,8 @@
<span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span> <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
</button> </button>
<button type="submit" (click)="toggleStatus(categoria)" class="btn-sm ds-btn ds-btn--toggle" data-cy="entityDeleteButton"> <button type="submit" (click)="toggleStatus(categoria)" class="ds-btn ds-btn--danger" data-cy="entityDeleteButton">
<fa-icon [icon]="faExchangeAlt"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.toggleStatus">Toggle Status</span> <span class="d-none d-md-inline" jhiTranslate="entity.action.toggleStatus">Toggle Status</span>
</button> </button>
</div> </div>

View File

@ -6,11 +6,15 @@ import { ICategoria } from '../categoria.model';
import { CategoriaService } from '../service/categoria.service'; import { CategoriaService } from '../service/categoria.service';
import { CategoriaDeleteDialogComponent } from '../delete/categoria-delete-dialog.component'; import { CategoriaDeleteDialogComponent } from '../delete/categoria-delete-dialog.component';
import { faExchangeAlt } from '@fortawesome/free-solid-svg-icons';
@Component({ @Component({
selector: 'jhi-categoria', selector: 'jhi-categoria',
templateUrl: './categoria.component.html', templateUrl: './categoria.component.html',
}) })
export class CategoriaComponent implements OnInit { export class CategoriaComponent implements OnInit {
faExchangeAlt = faExchangeAlt;
categorias?: ICategoria[]; categorias?: ICategoria[];
isLoading = false; isLoading = false;
public searchString: string; public searchString: string;

View File

@ -46,10 +46,10 @@
type="button" type="button"
id="cancel-save" id="cancel-save"
data-cy="entityCreateCancelButton" data-cy="entityCreateCancelButton"
class="btn btn-secondary ds-btn ds-btn-secondary" class="ds-btn ds-btn--secondary"
(click)="previousState()" (click)="previousState()"
> >
&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span> <fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button> </button>
<button <button
@ -58,7 +58,7 @@
id="save-entity" id="save-entity"
data-cy="entityCreateSaveButton" data-cy="entityCreateSaveButton"
[disabled]="editForm.invalid || isSaving" [disabled]="editForm.invalid || isSaving"
class="btn btn-primary ds-btn ds-btn-primary" class="ds-btn ds-btn--primary"
> >
&nbsp;<span jhiTranslate="entity.action.save">Save</span> &nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button> </button>

View File

@ -16,8 +16,8 @@ export class EPreguntaCerradaOpcionService {
constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {} constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
create(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion): Observable<EntityResponseType> { create(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion, preguntaId?: number): Observable<EntityResponseType> {
return this.http.post<IEPreguntaCerradaOpcion>(this.resourceUrl, ePreguntaCerradaOpcion, { observe: 'response' }); return this.http.post<IEPreguntaCerradaOpcion>(`${this.resourceUrl}/${preguntaId}`, ePreguntaCerradaOpcion, { observe: 'response' });
} }
update(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion): Observable<EntityResponseType> { update(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion): Observable<EntityResponseType> {
@ -49,6 +49,10 @@ export class EPreguntaCerradaOpcionService {
return this.http.delete(`${this.resourceUrl}/${id}`, { observe: 'response' }); return this.http.delete(`${this.resourceUrl}/${id}`, { observe: 'response' });
} }
deleteMany(ids: number[]): Observable<EntityResponseType> {
return this.http.post<IEPreguntaCerradaOpcion>(`${this.resourceUrl}/deleteMany`, ids, { observe: 'response' });
}
addEPreguntaCerradaOpcionToCollectionIfMissing( addEPreguntaCerradaOpcionToCollectionIfMissing(
ePreguntaCerradaOpcionCollection: IEPreguntaCerradaOpcion[], ePreguntaCerradaOpcionCollection: IEPreguntaCerradaOpcion[],
...ePreguntaCerradaOpcionsToCheck: (IEPreguntaCerradaOpcion | null | undefined)[] ...ePreguntaCerradaOpcionsToCheck: (IEPreguntaCerradaOpcion | null | undefined)[]

View File

@ -1,24 +1,28 @@
<form *ngIf="encuesta" name="deleteForm" (ngSubmit)="confirmDelete(encuesta.id!)"> <form class="ds-form" *ngIf="encuesta" name="deleteForm" (ngSubmit)="confirmDelete(encuesta!)">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" data-cy="encuestaDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h4> <!-- <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()">&times;</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">&times;</button>-->
</div> </div>
<div class="modal-body"> <div class="modal-body">
<jhi-alert-error></jhi-alert-error> <p class="ds-title--small">Eliminar encuesta</p>
<p
<p id="jhi-delete-encuesta-heading" jhiTranslate="dataSurveyApp.encuesta.delete.question" [translateValues]="{ id: encuesta.id }"> class="ds-subtitle"
Are you sure you want to delete this Encuesta? id="jhi-delete-encuesta-heading"
jhiTranslate="dataSurveyApp.encuesta.delete.question"
[translateValues]="{ id: encuesta.id }"
>
Are you sure you want to delete this survey?
</p> </p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="cancel()"> <button type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal" (click)="cancel()">
<fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span> <fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button> </button>
<button id="jhi-confirm-delete-encuesta" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger"> <button id="jhi-confirm-delete-encuesta" data-cy="entityConfirmDeleteButton" type="submit" class="ds-btn ds-btn--danger">
<fa-icon icon="times"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span> <fa-icon icon="times"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
</button> </button>
</div> </div>

View File

@ -1,65 +0,0 @@
jest.mock('@ng-bootstrap/ng-bootstrap');
import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { of } from 'rxjs';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { EncuestaService } from '../service/encuesta.service';
import { EncuestaDeleteDialogComponent } from './encuesta-delete-dialog.component';
describe('Component Tests', () => {
describe('Encuesta Management Delete Component', () => {
let comp: EncuestaDeleteDialogComponent;
let fixture: ComponentFixture<EncuestaDeleteDialogComponent>;
let service: EncuestaService;
let mockActiveModal: NgbActiveModal;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [EncuestaDeleteDialogComponent],
providers: [NgbActiveModal],
})
.overrideTemplate(EncuestaDeleteDialogComponent, '')
.compileComponents();
fixture = TestBed.createComponent(EncuestaDeleteDialogComponent);
comp = fixture.componentInstance;
service = TestBed.inject(EncuestaService);
mockActiveModal = TestBed.inject(NgbActiveModal);
});
describe('confirmDelete', () => {
it('Should call delete service on confirmDelete', inject(
[],
fakeAsync(() => {
// GIVEN
jest.spyOn(service, 'delete').mockReturnValue(of(new HttpResponse({})));
// WHEN
comp.confirmDelete(123);
tick();
// THEN
expect(service.delete).toHaveBeenCalledWith(123);
expect(mockActiveModal.close).toHaveBeenCalledWith('deleted');
})
));
it('Should not call delete service on clear', () => {
// GIVEN
jest.spyOn(service, 'delete');
// WHEN
comp.cancel();
// THEN
expect(service.delete).not.toHaveBeenCalled();
expect(mockActiveModal.close).not.toHaveBeenCalled();
expect(mockActiveModal.dismiss).toHaveBeenCalled();
});
});
});
});

View File

@ -1,14 +1,16 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { IEncuesta } from '../encuesta.model'; import { IEncuesta } from '../encuesta.model';
import { EncuestaService } from '../service/encuesta.service'; import { EncuestaService } from '../service/encuesta.service';
import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model';
import { IUsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model';
@Component({ @Component({
templateUrl: './encuesta-delete-dialog.component.html', templateUrl: './encuesta-delete-dialog.component.html',
}) })
export class EncuestaDeleteDialogComponent { export class EncuestaDeleteDialogComponent {
encuesta?: IEncuesta; encuesta?: IEncuesta;
usuarioExtra?: IUsuarioExtra;
constructor(protected encuestaService: EncuestaService, protected activeModal: NgbActiveModal) {} constructor(protected encuestaService: EncuestaService, protected activeModal: NgbActiveModal) {}
@ -16,9 +18,11 @@ export class EncuestaDeleteDialogComponent {
this.activeModal.dismiss(); this.activeModal.dismiss();
} }
confirmDelete(id: number): void { confirmDelete(encuesta: IEncuesta): void {
this.encuestaService.delete(id).subscribe(() => { encuesta.estado = EstadoEncuesta.DELETED;
this.encuestaService.deleteEncuesta(encuesta).subscribe(() => {
this.activeModal.close('deleted'); this.activeModal.close('deleted');
}); });
//this.encuestaService.deletedNotification(encuesta);
} }
} }

View File

@ -1,80 +1,201 @@
<div class="row justify-content-center"> <div class="container-fluid" *ngIf="encuesta">
<div class="col-8"> <div>
<div *ngIf="encuesta"> <h2 id="page-heading" data-cy="EPreguntaCerradaHeading">
<h2 data-cy="encuestaDetailsHeading"><span jhiTranslate="dataSurveyApp.encuesta.detail.title">Encuesta</span></h2> <p class="ds-title">
Vista previa de {{ encuesta!.nombre }}
<fa-icon class="ds-info--icon" [icon]="faQuestion" data-toggle="modal" data-target="#verParametros"></fa-icon>
</p>
<hr /> <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>&nbsp;&nbsp;<span jhiTranslate="entity.action.back">Back</span>
</button>
<ng-container *ngIf="encuesta!.estado === 'DRAFT'">
<button type="button" class="ds-btn ds-btn--primary" (click)="publishSurvey()">Publicar encuesta</button>
</ng-container>
</div>
</h2>
<jhi-alert-error></jhi-alert-error> <jhi-alert-error></jhi-alert-error>
<div *ngIf="successPublished" class="alert alert-success alert-dismissible fade show" role="alert">
<jhi-alert></jhi-alert> Su encuesta fue publicada exitosamente
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<dl class="row-md jh-entity-details"> <span aria-hidden="true">&times;</span>
<dt><span jhiTranslate="global.field.id">ID</span></dt>
<dd>
<span>{{ encuesta.id }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.nombre">Nombre</span></dt>
<dd>
<span>{{ encuesta.nombre }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.descripcion">Descripcion</span></dt>
<dd>
<span>{{ encuesta.descripcion }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.fechaCreacion">Fecha Creacion</span></dt>
<dd>
<span>{{ encuesta.fechaCreacion | formatMediumDatetime }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.fechaPublicacion">Fecha Publicacion</span></dt>
<dd>
<span>{{ encuesta.fechaPublicacion | formatMediumDatetime }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.fechaFinalizar">Fecha Finalizar</span></dt>
<dd>
<span>{{ encuesta.fechaFinalizar | formatMediumDatetime }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.fechaFinalizada">Fecha Finalizada</span></dt>
<dd>
<span>{{ encuesta.fechaFinalizada | formatMediumDatetime }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.calificacion">Calificacion</span></dt>
<dd>
<span>{{ encuesta.calificacion }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.acceso">Acceso</span></dt>
<dd>
<span jhiTranslate="{{ 'dataSurveyApp.AccesoEncuesta.' + encuesta.acceso }}">{{ encuesta.acceso }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.contrasenna">Contrasenna</span></dt>
<dd>
<span>{{ encuesta.contrasenna }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.estado">Estado</span></dt>
<dd>
<span jhiTranslate="{{ 'dataSurveyApp.EstadoEncuesta.' + encuesta.estado }}">{{ encuesta.estado }}</span>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.categoria">Categoria</span></dt>
<dd>
<div *ngIf="encuesta.categoria">
<a [routerLink]="['/categoria', encuesta.categoria?.id, 'view']">{{ encuesta.categoria?.nombre }}</a>
</div>
</dd>
<dt><span jhiTranslate="dataSurveyApp.encuesta.usuarioExtra">Usuario Extra</span></dt>
<dd>
<div *ngIf="encuesta.usuarioExtra">
<a [routerLink]="['/usuario-extra', encuesta.usuarioExtra?.id, 'view']">{{ encuesta.usuarioExtra?.id }}</a>
</div>
</dd>
</dl>
<button type="submit" (click)="previousState()" class="btn btn-info" data-cy="entityDetailsBackButton">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back">Back</span>
</button> </button>
</div>
<button type="button" [routerLink]="['/encuesta', encuesta.id, 'edit']" class="btn btn-primary"> <!-- <jhi-alert></jhi-alert> -->
<fa-icon icon="pencil-alt"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit">Edit</span>
</button> <div class="alert alert-warning" id="no-result" *ngIf="ePreguntas?.length === 0">
<span>No se encontraron preguntas</span>
</div>
<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
[attr.data-index]="ePregunta.id"
[attr.data-tipo]="ePregunta.tipo"
[attr.data-opcional]="ePregunta.opcional"
class="ds-survey--question"
>
<div class="ds-survey--titulo">
<span class="ds-survey--titulo--name">{{ i + 1 }}. {{ ePregunta.nombre }}</span>
</div>
<div>
<span *ngIf="ePregunta.tipo === 'SINGLE'" class="ds-subtitle"
>Pregunta de respuesta {{ 'dataSurveyApp.PreguntaCerradaTipo.SINGLE' | translate | lowercase }}
{{ ePregunta.opcional ? '(opcional)' : '' }}</span
>
<span *ngIf="ePregunta.tipo === 'MULTIPLE'" class="ds-subtitle"
>Pregunta de respuesta {{ 'dataSurveyApp.PreguntaCerradaTipo.MULTIPLE' | translate | lowercase }}
{{ ePregunta.opcional ? '(opcional)' : '' }}</span
>
<span *ngIf="!ePregunta.tipo" class="ds-subtitle"
>Pregunta de respuesta abierta {{ ePregunta.opcional ? '(opcional)' : '' }}</span
>
</div>
<ng-container *ngIf="ePregunta.tipo">
<ng-container *ngFor="let ePreguntaOpcion of ePreguntasOpciones; let j = index; trackBy: trackId">
<ng-container *ngFor="let ePreguntaOpcionFinal of ePreguntaOpcion">
<ng-container *ngIf="ePregunta.id === ePreguntaOpcionFinal.epreguntaCerrada.id">
<div
class="ds-survey--option ds-survey--option--base ds-survey--closed-option can-delete"
[attr.data-id]="ePreguntaOpcionFinal.id"
>
<div class="radio" *ngIf="ePregunta.tipo === 'SINGLE'">
<input
type="radio"
style="border-radius: 3px"
name="{{ 'radio' + ePregunta.id }}"
id="{{ 'radio' + ePreguntaOpcionFinal.id }}"
/>
<!-- <input class="ds-survey--checkbox" id="{{ ePregunta.id }}-{{ ePreguntaOpcionFinal.id }}" type="checkbox" disabled /> -->
<label for="{{ 'radio' + ePreguntaOpcionFinal.id }}">{{ ePreguntaOpcionFinal.nombre }}</label>
</div>
<div class="checkbox" *ngIf="ePregunta.tipo === 'MULTIPLE'">
<input type="checkbox" style="border-radius: 3px" id="{{ 'checkbox' + ePreguntaOpcionFinal.id }}" />
<!-- <input class="ds-survey--checkbox" id="{{ ePregunta.id }}-{{ ePreguntaOpcionFinal.id }}" type="checkbox" disabled /> -->
<label for="{{ 'checkbox' + ePreguntaOpcionFinal.id }}">{{ ePreguntaOpcionFinal.nombre }}</label>
</div>
</div>
</ng-container>
</ng-container>
</ng-container>
</ng-container>
<div class="ds-survey--option ds-survey--option--base ds-survey--open-option" *ngIf="!ePregunta.tipo">
<textarea cols="30" rows="10" disabled></textarea>
</div>
</div>
</div>
</div>
<div
class="modal fade ds-modal"
id="verParametros"
tabindex="-1"
role="dialog"
aria-labelledby="exampleModalCenterTitle"
aria-hidden="true"
>
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title" id="exampleModalLongTitle">Información de encuesta</h1>
</div>
<div class="modal-body">
<div>
<div class="mb-5">
<p style="font-size: 1.2em" class="ds-subtitle">Cantidad de preguntas:</p>
<p>{{ ePreguntas?.length }}</p>
</div>
<!--<div>
<p style="font-size: 1.2em" class="ds-survey--titulo--name">Colaboradores</p>
</div>-->
<div class="mb-5">
<p class="ds-subtitle" jhiTranslate="dataSurveyApp.encuesta.acceso">Acceso:</p>
<p jhiTranslate="{{ 'dataSurveyApp.AccesoEncuesta.' + encuesta.acceso }}">{{ encuesta.acceso }}</p>
</div>
<div *ngIf="encuesta.acceso === 'PRIVATE'" class="mb-5">
<p class="ds-subtitle">Contraseña:</p>
<p>{{ encuesta.contrasenna }}</p>
</div>
<div class="mb-5">
<p class="ds-subtitle">Estado:</p>
<p jhiTranslate="{{ 'dataSurveyApp.EstadoEncuesta.' + encuesta.estado }}">{{ encuesta.estado }}</p>
</div>
<div *ngIf="encuesta.categoria" class="mb-5">
<p class="ds-subtitle">Categoría:</p>
<P> </P> {{ encuesta.categoria?.nombre }}
</div>
<div class="mb-5">
<p class="ds-subtitle">Fecha de publicación:</p>
<P
>{{
encuesta.fechaPublicacion === undefined
? 'Sin publicar'
: (encuesta.fechaFinalizada | formatShortDatetime | lowercase)
}}
</P>
</div>
<!--<div class="mb-5">
<p jhiTranslate="dataSurveyApp.encuesta.fechaFinalizar" class="ds-subtitle" > Fecha Finalizar</p>
<p> </p></div>
<dl>
<dt><span jhiTranslate="dataSurveyApp.encuesta.fechaFinalizar">Fecha Finalizar</span></dt>
<dd>
<span>
-
{{
encuesta.fechaFinalizar === undefined
? 'Sin fecha de finalización'
: (encuesta.fechaFinalizada | formatShortDatetime | lowercase)
}}</span
>
</dd>
</dl>-->
<div class="mb-5">
<p class="ds-subtitle">Fecha de finalización:</p>
<P>
{{
encuesta.fechaFinalizada === undefined
? 'Sin finalizar'
: (encuesta.fechaFinalizada | formatShortDatetime | lowercase)
}}
</P>
</div>
<div class="mb-5">
<p class="ds-subtitle">Calificación:</p>
<dd>
<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>
</dd>
</div>
</div>
</div>
<div class="modal-footer">
<button id="cancelBtnVerParametros" type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;<span>Volver</span>
</button>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,20 +1,160 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { HttpResponse } from '@angular/common/http';
import { FormBuilder, Validators } from '@angular/forms';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model';
import { IEncuesta } from '../encuesta.model'; import { Observable } from 'rxjs';
import { finalize, map } from 'rxjs/operators';
import * as dayjs from 'dayjs';
import { DATE_TIME_FORMAT } from 'app/config/input.constants';
import { IEncuesta, Encuesta } from '../encuesta.model';
import { EncuestaService } from '../service/encuesta.service';
import { ICategoria } from 'app/entities/categoria/categoria.model';
import { CategoriaService } from 'app/entities/categoria/service/categoria.service';
import { IUsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model';
import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-extra.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { IEPreguntaCerrada } from 'app/entities/e-pregunta-cerrada/e-pregunta-cerrada.model';
import { EPreguntaCerradaService } from 'app/entities/e-pregunta-cerrada/service/e-pregunta-cerrada.service';
import { EPreguntaCerradaDeleteDialogComponent } from 'app/entities/e-pregunta-cerrada/delete/e-pregunta-cerrada-delete-dialog.component';
import { IEPreguntaAbierta } from '../../e-pregunta-abierta/e-pregunta-abierta.model';
import { EPreguntaCerrada } from '../../e-pregunta-cerrada/e-pregunta-cerrada.model';
import { EPreguntaCerradaOpcion, IEPreguntaCerradaOpcion } from '../../e-pregunta-cerrada-opcion/e-pregunta-cerrada-opcion.model';
import { EPreguntaAbiertaService } from '../../e-pregunta-abierta/service/e-pregunta-abierta.service';
import { EPreguntaCerradaOpcionService } from '../../e-pregunta-cerrada-opcion/service/e-pregunta-cerrada-opcion.service';
import { PreguntaCerradaTipo } from 'app/entities/enumerations/pregunta-cerrada-tipo.model';
import { faTimes, faPlus, faStar, faQuestion } from '@fortawesome/free-solid-svg-icons';
import { EncuestaPublishDialogComponent } from '../encuesta-publish-dialog/encuesta-publish-dialog.component';
@Component({ @Component({
selector: 'jhi-encuesta-detail', selector: 'jhi-encuesta-detail',
templateUrl: './encuesta-detail.component.html', templateUrl: './encuesta-detail.component.html',
}) })
export class EncuestaDetailComponent implements OnInit { export class EncuestaDetailComponent implements OnInit {
categoriasSharedCollection: ICategoria[] = [];
usuarioExtrasSharedCollection: IUsuarioExtra[] = [];
faTimes = faTimes;
faPlus = faPlus;
faStar = faStar;
faQuestion = faQuestion;
encuesta: IEncuesta | null = null; encuesta: IEncuesta | null = null;
isLoading = false;
successPublished = false;
ePreguntas?: any[];
ePreguntasOpciones?: any[];
constructor(protected activatedRoute: ActivatedRoute) {} constructor(
protected activatedRoute: ActivatedRoute,
protected encuestaService: EncuestaService,
protected categoriaService: CategoriaService,
protected usuarioExtraService: UsuarioExtraService,
protected fb: FormBuilder,
protected modalService: NgbModal,
protected ePreguntaCerradaService: EPreguntaCerradaService,
protected ePreguntaCerradaOpcionService: EPreguntaCerradaOpcionService,
protected ePreguntaAbiertaService: EPreguntaAbiertaService
) {}
ngOnInit(): void { ngOnInit(): void {
this.activatedRoute.data.subscribe(({ encuesta }) => { this.activatedRoute.data.subscribe(({ encuesta }) => {
this.encuesta = encuesta; if (encuesta) {
this.encuesta = encuesta;
this.loadAll();
} else {
this.previousState();
}
});
}
ngAfterViewChecked(): void {
this.initListeners();
}
initListeners(): void {
const checkboxes = document.getElementsByClassName('ds-survey--checkbox');
for (let i = 0; i < checkboxes.length; i++) {
checkboxes[i].addEventListener('click', e => {
if ((e.target as HTMLInputElement).checked) {
(e.target as HTMLElement).offsetParent!.classList.add('ds-survey--closed-option--active');
} else {
(e.target as HTMLElement).offsetParent!.classList.remove('ds-survey--closed-option--active');
}
});
}
}
trackId(index: number, item: IEPreguntaCerrada): number {
return item.id!;
}
trackEPreguntaCerradaById(index: number, item: IEPreguntaCerrada): number {
return item.id!;
}
trackCategoriaById(index: number, item: ICategoria): number {
return item.id!;
}
trackUsuarioExtraById(index: number, item: IUsuarioExtra): number {
return item.id!;
}
getEncuesta(id: number) {
return this.encuestaService.findEncuesta(id);
}
loadAll(): void {
this.isLoading = true;
this.encuestaService
.findQuestions(this.encuesta?.id!)
.pipe(
finalize(() =>
this.encuestaService.findQuestionsOptions(this.encuesta?.id!).subscribe(
(res: any) => {
this.isLoading = false;
this.ePreguntasOpciones = res.body ?? [];
},
() => {
this.isLoading = false;
}
)
)
)
.subscribe(
(res: any) => {
this.isLoading = false;
this.ePreguntas = res.body ?? [];
},
() => {
this.isLoading = false;
}
);
/* this.encuestaService.findQuestionsOptions(this.encuesta?.id!).subscribe(
(res: any) => {
this.isLoading = false;
this.ePreguntasOpciones = res.body ?? [];
},
() => {
this.isLoading = false;
}
);*/
}
publishSurvey(): void {
const modalRef = this.modalService.open(EncuestaPublishDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.encuesta = this.encuesta;
// unsubscribe not needed because closed completes on modal close
modalRef.closed.subscribe(reason => {
if (reason === 'published') {
this.successPublished = true;
this.loadAll();
}
}); });
} }

View File

@ -0,0 +1,24 @@
<form class="ds-form" name="deleteForm" (ngSubmit)="confirmDelete()">
<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()">&times;</button>-->
</div>
<div class="modal-body">
<p class="ds-title--small">Eliminar opción</p>
<p class="ds-subtitle" id="jhi-delete-encuesta-heading" jhiTranslate="dataSurveyApp.encuesta.delete.deleteoption">
Are you sure you want to delete this option?
</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>&nbsp;<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>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</form>

View File

@ -0,0 +1,17 @@
import { Component } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
@Component({
templateUrl: './encuesta-delete-option-dialog.component.html',
})
export class EncuestaDeleteOptionDialogComponent {
constructor(protected activeModal: NgbActiveModal) {}
cancel(): void {
this.activeModal.dismiss();
}
confirmDelete(): void {
this.activeModal.close('confirm');
}
}

View File

@ -0,0 +1,24 @@
<form class="ds-form" name="deleteForm" (ngSubmit)="confirmDelete()">
<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()">&times;</button>-->
</div>
<div class="modal-body">
<p class="ds-title--small">Eliminar pregunta</p>
<p class="ds-subtitle" id="jhi-delete-encuesta-heading" jhiTranslate="dataSurveyApp.encuesta.delete.deletequestion">
Are you sure you want to delete this question?
</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>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button id="jhi-confirm-delete-question" data-cy="entityConfirmDeleteButton" type="submit" class="ds-btn ds-btn--danger">
<fa-icon icon="times"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</form>

View File

@ -0,0 +1,17 @@
import { Component } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
@Component({
templateUrl: './encuesta-delete-question-dialog.component.html',
})
export class EncuestaDeleteQuestionDialogComponent {
constructor(protected activeModal: NgbActiveModal) {}
cancel(): void {
this.activeModal.dismiss();
}
confirmDelete(): void {
this.activeModal.close('confirm');
}
}

View File

@ -0,0 +1,61 @@
<form *ngIf="encuesta" name="deleteForm" (ngSubmit)="confirmPublish(encuesta!)">
<div class="modal-header">
<!-- <h4 class="modal-title" data-cy="encuestaDeleteDialogHeading" jhiTranslate="entity.publish.title">Confirm delete operation</h4>-->
</div>
<div class="modal-body">
<div class="alert alert-danger" *ngIf="fechaFinalizarInvalid && !fechaFinalizarInvalidMax" data-cy="fechaError">
Debe ingresar un rango de fechas mayor al indicado
</div>
<div class="alert alert-danger" *ngIf="fechaFinalizarInvalidMax && !fechaFinalizarInvalid" data-cy="fechaError">
Debe ingresar un rango de fechas menor al indicado
</div>
<p id="jhi-delete-encuesta-heading">Elija la fecha de finalización de su encuesta</p>
<hr />
<!--<input type="date" onchange="fechaFinalizacionIsInvalid()" />-->
<div class="d-flex" [formGroup]="fechaForm">
<input
id="field_fechaFinalizacion"
data-cy="fechaFinalizacion"
type="date"
class="form-control"
name="fechaFinalizacion"
formControlName="fechaFinalizacion"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
<div
*ngIf="
fechaForm.get('fechaFinalizacion')!.invalid &&
(fechaForm.get('fechaFinalizacion')!.dirty || fechaForm.get('fechaFinalizacion')!.touched)
"
>
<small
class="form-text text-danger"
*ngIf="fechaForm.get('fechaFinalizacion')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
</div>
</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>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button
[disabled]="fechaForm.invalid"
id="jhi-confirm-delete-encuesta"
data-cy="entityConfirmDeleteButton"
type="submit"
class="ds-btn ds-btn--primary"
>
&nbsp;<span jhiTranslate="entity.action.publish">Delete</span>
</button>
</div>
</form>

View File

@ -0,0 +1,134 @@
import { Component, OnInit } from '@angular/core';
import { IEncuesta } from '../encuesta.model';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { EncuestaService } from '../service/encuesta.service';
import { EstadoEncuesta } from '../../enumerations/estado-encuesta.model';
import { AccesoEncuesta } from '../../enumerations/acceso-encuesta.model';
import { passwordResetFinishRoute } from '../../../account/password-reset/finish/password-reset-finish.route';
import { FormBuilder, Validators } from '@angular/forms';
import { IParametroAplicacion } from 'app/entities/parametro-aplicacion/parametro-aplicacion.model';
import { ParametroAplicacionService } from 'app/entities/parametro-aplicacion/service/parametro-aplicacion.service';
import { HttpResponse } from '@angular/common/http';
import { DATE_FORMAT, DATE_TIME_FORMAT } from '../../../config/input.constants';
import * as dayjs from 'dayjs';
import { finalize } from 'rxjs/operators';
@Component({
selector: 'jhi-encuesta-publish-dialog',
templateUrl: './encuesta-publish-dialog.component.html',
styleUrls: ['./encuesta-publish-dialog.component.scss'],
})
export class EncuestaPublishDialogComponent implements OnInit {
encuesta?: IEncuesta;
//fechaFinalizacion?: Date;
fechaFinalizarInvalid?: boolean = false;
fechaFinalizarInvalidMax?: boolean = false;
isLoading?: boolean;
parametroAplicacions?: IParametroAplicacion[];
isMin = false;
isMax = false;
datoMin?: number;
datoMax?: number;
now = new Date();
fechaForm = this.fb.group({
fechaFinalizacion: [null, [Validators.required]],
});
constructor(
protected parametroAplicacionService: ParametroAplicacionService,
protected encuestaService: EncuestaService,
protected fb: FormBuilder,
protected activeModal: NgbActiveModal
) {}
ngOnInit(): void {
this.loadAll();
}
cancel(): void {
this.activeModal.dismiss();
}
confirmPublish(encuesta: IEncuesta): void {
this.fechaFinalizarInvalid = false;
this.fechaFinalizarInvalidMax = false;
const now = dayjs();
/*this.loadAll()
this.parametroAplicacions?.forEach(datos => {
this.datoMin = datos.minDiasEncuesta;
this.datoMax = datos.maxDiasEncuesta;
});*/
encuesta.fechaFinalizar = dayjs(this.fechaForm.get(['fechaFinalizacion'])!.value);
encuesta.fechaPublicacion = dayjs(now, DATE_TIME_FORMAT);
if (this.fechaFinalizacionIsInvalid(encuesta.fechaFinalizar, encuesta.fechaPublicacion)) {
if (encuesta.estado === 'DRAFT') {
encuesta.estado = EstadoEncuesta.ACTIVE;
}
if (encuesta.acceso === AccesoEncuesta.PRIVATE) {
encuesta.contrasenna = this.generatePassword();
}
this.encuestaService.update(encuesta).subscribe(() => {
this.activeModal.close('published');
});
}
}
loadAll(): void {
this.isLoading = true;
this.parametroAplicacionService
.query()
.pipe(finalize(() => this.onLoadFinalize()))
.subscribe(
(res: HttpResponse<IParametroAplicacion[]>) => {
this.isLoading = false;
this.parametroAplicacions = res.body ?? [];
},
() => {
this.isLoading = false;
}
);
}
onLoadFinalize() {
this.parametroAplicacions?.forEach(datos => {
this.datoMin = datos.minDiasEncuesta;
this.datoMax = datos.maxDiasEncuesta;
});
this.isLoading = false;
}
fechaFinalizacionIsInvalid(fechaFinalizar: dayjs.Dayjs, fechaPublicacion: dayjs.Dayjs): boolean {
let numberDays: number;
debugger;
numberDays = fechaFinalizar?.diff(fechaPublicacion, 'days');
if (numberDays <= this.datoMin!) {
this.fechaFinalizarInvalid = true;
return false;
} else if (numberDays >= this.datoMax!) {
this.fechaFinalizarInvalidMax = true;
return false;
} else {
return true;
}
}
generatePassword(): string {
const alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
let password = '';
for (let i = 0; i < 5; i++) {
password += alpha.charAt(Math.floor(Math.random() * alpha.length));
}
return password;
}
}

View File

@ -6,10 +6,21 @@ import { EncuestaUpdateComponent } from './update/encuesta-update.component';
import { EncuestaDeleteDialogComponent } from './delete/encuesta-delete-dialog.component'; import { EncuestaDeleteDialogComponent } from './delete/encuesta-delete-dialog.component';
import { EncuestaRoutingModule } from './route/encuesta-routing.module'; import { EncuestaRoutingModule } from './route/encuesta-routing.module';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { EncuestaPublishDialogComponent } from './encuesta-publish-dialog/encuesta-publish-dialog.component';
import { EncuestaDeleteQuestionDialogComponent } from './encuesta-delete-question-dialog/encuesta-delete-question-dialog.component';
import { EncuestaDeleteOptionDialogComponent } from './encuesta-delete-option-dialog/encuesta-delete-option-dialog.component';
@NgModule({ @NgModule({
imports: [SharedModule, EncuestaRoutingModule, FontAwesomeModule], imports: [SharedModule, EncuestaRoutingModule, FontAwesomeModule],
declarations: [EncuestaComponent, EncuestaDetailComponent, EncuestaUpdateComponent, EncuestaDeleteDialogComponent], declarations: [
EncuestaComponent,
EncuestaDetailComponent,
EncuestaUpdateComponent,
EncuestaDeleteDialogComponent,
EncuestaPublishDialogComponent,
EncuestaDeleteQuestionDialogComponent,
EncuestaDeleteOptionDialogComponent,
],
entryComponents: [EncuestaDeleteDialogComponent], entryComponents: [EncuestaDeleteDialogComponent],
}) })
export class EncuestaModule {} export class EncuestaModule {}

View File

@ -1,9 +1,13 @@
<div> <div>
<h2 id="page-heading" data-cy="EncuestaHeading"> <h2 id="page-heading" data-cy="EncuestaHeading">
<div class="d-flex flex-sm-row flex-column justify-content-between align-items-center"> <div class="d-flex flex-sm-row flex-column justify-content-between align-items-center">
<div> <div *ngIf="isAdmin() && isAuthenticated()">
<span class="ds-title" jhiTranslate="dataSurveyApp.encuesta.home.title">Encuestas</span> <span class="ds-title" jhiTranslate="dataSurveyApp.encuesta.home.title">Encuestas</span>
<p class="ds-subtitle">Cree encuestas y publiquelas mundialmente.</p> <p class="ds-subtitle">Administre las encuestas de todos los usuarios</p>
</div>
<div *ngIf="!isAdmin() && isAuthenticated()">
<span class="ds-title" jhiTranslate="dataSurveyApp.encuesta.home.title">Encuestas</span>
<p class="ds-subtitle">Cree encuestas y publiquelas mundialmente</p>
</div> </div>
<div> <div>
@ -27,61 +31,110 @@
</div> </div>
</h2> </h2>
<jhi-alert-error></jhi-alert-error> <!-- <jhi-alert-error></jhi-alert-error> -->
<jhi-alert></jhi-alert> <div *ngIf="successPublished" class="alert alert-success alert-dismissible fade show" role="alert">
Su encuesta fue publicada exitosamente
<div class="alert alert-warning" id="no-result" *ngIf="encuestas?.length === 0"> <button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span jhiTranslate="dataSurveyApp.encuesta.home.notFound">No encuestas found</span> <span aria-hidden="true">&times;</span>
</button>
</div> </div>
<div class="alert alert-warning" id="no-result" *ngIf="encuestas?.length === 0">
<span jhiTranslate="dataSurveyApp.encuesta.home.notFound">No surveys found</span>
</div>
<form class="ds-form">
<div class="input-group">
<div class="ds-filter">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<input type="text" name="searchString" placeholder="Buscar por nombre..." [(ngModel)]="searchString" />
</div>
<div class="ds-filter">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<select name="accesoEncuestas" id="accesoEncuesta" [(ngModel)]="accesoEncuesta" style="width: 200px">
<option value="" selected="selected" disabled="disabled">Filtrar por acceso</option>
<option value="">Todos Accesos</option>
<option value="Public">Públicas</option>
<option value="Private">Privadas</option>
</select>
</div>
<div class="ds-filter">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<select name="estadoEncuesta" id="estadoEncuesta" [(ngModel)]="estadoEncuesta" style="width: 200px">
<option value="" selected="selected" disabled="disabled">Filtrar por estado</option>
<option value="">Todos Estados</option>
<option value="Draft">Borradores</option>
<option value="Active">Activadas</option>
<option value="Finished">Finalizadas</option>
</select>
</div>
<!--<div class="col-3">
<div class="input-group-addon "><i class="glyphicon glyphicon-search"></i></div>
<select id="categoriaEncuesta" name="categoriaEncuesta" [(ngModel)]="categoriaEncuesta">
<option [ngValue]="null" selected>Filtre por categoría</option>
<option
*ngFor="let categoriaOption of categoriasSharedCollection; trackBy: trackCategoriaById"
[ngValue]="categoriaOption.nombre" >
{{ categoriaOption.nombre }}
</option>
</select>
</div>-->
</div>
</form>
<!-- Lista de Encuestas del Usuario --> <!-- Lista de Encuestas del Usuario -->
<div class="ds-list" (contextmenu)="openContextMenu($event)"> <div class="ds-list" (contextmenu)="openContextMenu($event)" *ngIf="!isAdmin()">
<!-- Context Menu --> <!-- Context Menu -->
<div class="ds-contextmenu ds-contextmenu--closed" id="contextmenu"> <div class="ds-contextmenu ds-contextmenu--closed" id="contextmenu">
<ul id="ds-context-menu__list"> <ul id="ds-context-menu__list">
<div class="ds-contextmenu__divider ds-contextmenu__divider--separator-bottom" id="contextmenu-create--separator"> <div class="ds-contextmenu__divider ds-contextmenu__divider--separator-bottom" id="contextmenu-create--separator">
<li> <li *ngIf="!isAdmin() && isAuthenticated()">
<button <button type="button" (click)="resetForm()" data-toggle="modal" data-target="#crearEncuesta">
*ngIf="!isAdmin() && isAuthenticated()"
type="button"
(click)="resetForm()"
data-toggle="modal"
data-target="#crearEncuesta"
>
<fa-icon class="contextmenu__icon" [icon]="faPlus"></fa-icon>Crear <fa-icon class="contextmenu__icon" [icon]="faPlus"></fa-icon>Crear
</button> </button>
</li> </li>
</div> </div>
<div class="ds-contextmenu__divider ds-contextmenu__divider--separator-bottom" id="contextmenu-edit--separator"> <div class="ds-contextmenu__divider ds-contextmenu__divider--separator-bottom" id="contextmenu-edit--separator">
<li class="d-justify justify-content-start"> <li class="d-justify justify-content-start" id="contextmenu-edit">
<button type="button" id="contextmenu-edit"><fa-icon class="contextmenu__icon" [icon]="faEdit"></fa-icon>Editar</button> <button type="button" (click)="openSurvey(null)"><fa-icon class="contextmenu__icon" [icon]="faEdit"></fa-icon>Editar</button>
</li> </li>
<li> <li id="contextmenu-preview">
<button type="button" id="contextmenu-duplicate"><fa-icon class="contextmenu__icon" [icon]="faCopy"></fa-icon>Duplicar</button> <button type="button" (click)="openPreview()">
</li> <fa-icon class="contextmenu__icon" [icon]="faPollH"></fa-icon>Ver vista previa
<li>
<button type="button" id="contextmenu-rename">
<fa-icon class="contextmenu__icon" [icon]="faFile"></fa-icon>Cambiar nombre
</button> </button>
</li> </li>
<li> <li id="contextmenu-duplicate">
<button type="button" id="contextmenu-share"><fa-icon class="contextmenu__icon" [icon]="faShareAlt"></fa-icon>Compartir</button> <button type="button" (click)="duplicateSurvey()"><fa-icon class="contextmenu__icon" [icon]="faCopy"></fa-icon>Duplicar</button>
</li> </li>
<li id="contextmenu-publish">
<button type="button" (click)="publish()" data-toggle="modal" data-target="#publicarEncuesta">
<!--Agarrar el id de la encuesta -->
<fa-icon class="contextmenu__icon" [icon]="faUpload"></fa-icon>Publicar
</button>
</li>
<!-- <li>
<button type="button" id="contextmenu-share"><fa-icon class="contextmenu__icon" [icon]="faShareAlt"></fa-icon>Compartir</button>
</li> -->
</div> </div>
<div class="ds-contextmenu__divider" id="contextmenu-delete--separator"> <div class="ds-contextmenu__divider" id="contextmenu-delete--separator">
<li> <li>
<button type="button"><fa-icon class="contextmenu__icon" [icon]="faTrashAlt"></fa-icon>Eliminar</button> <button type="button" (click)="deleteSurvey()">
<fa-icon class="contextmenu__icon" [icon]="faTrashAlt"></fa-icon>Eliminar
</button>
</li> </li>
</div> </div>
</ul> </ul>
</div> </div>
<div <div
class="ds-list--entity" class="ds-list--entity"
*ngFor="let encuesta of encuestas; trackBy: trackId" *ngFor="
let encuesta of encuestas! | filter: 'nombre':searchString | filter: 'acceso':accesoEncuesta | filter: 'estado':estadoEncuesta;
trackBy: trackId
"
(dblclick)="openSurvey($event)" (dblclick)="openSurvey($event)"
(click)="selectSurvey($event)" (click)="selectSurvey($event)"
[hidden]="encuesta.estado == 'DELETED'"
[attr.data-id]="encuesta.id" [attr.data-id]="encuesta.id"
> >
<div class="entity-header"> <div class="entity-header">
@ -149,139 +202,77 @@
><fa-icon *ngFor="let i of [].constructor(5 - encuesta.calificacion!)" class="entity-icon--star--off" [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>
</div> </div>
<!-- <p>
<a [routerLink]="['/encuesta', encuesta.id, 'view']">{{ encuesta.id }}</a>
</p>
<p>{{ encuesta.nombre }}</p>
<p>{{ encuesta.descripcion }}</p>
<p>{{ encuesta.fechaCreacion | formatMediumDatetime }}</p>
<p>{{ encuesta.fechaPublicacion | formatMediumDatetime }}</p>
<p>{{ encuesta.fechaFinalizar | formatMediumDatetime }}</p>
<p>{{ encuesta.fechaFinalizada | formatMediumDatetime }}</p>
<p>{{ encuesta.calificacion }}</p>
<p jhiTranslate="{{ 'dataSurveyApp.AccesoEncuesta.' + encuesta.acceso }}">{{ encuesta.acceso }}</p>
<p>{{ encuesta.contrasenna }}</p>
<p jhiTranslate="{{ 'dataSurveyApp.EstadoEncuesta.' + encuesta.estado }}">{{ encuesta.estado }}</p>
<div>
<div *ngIf="encuesta.categoria">
<a [routerLink]="['/categoria', encuesta.categoria?.id, 'view']">{{ encuesta.categoria?.nombre }}</a>
</div>
</div>
<div>
<div *ngIf="encuesta.usuarioExtra">
<a [routerLink]="['/usuario-extra', encuesta.usuarioExtra?.id, 'view']">{{ encuesta.usuarioExtra?.id }}</a>
</div>
</div>
<div 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>
<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" (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>
</div> -->
</div> </div>
</div> </div>
</div> </div>
<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 Creación</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 | filter: 'nombre':searchString | filter: 'acceso':accesoEncuesta | filter: 'estado':estadoEncuesta;
trackBy: trackId
"
data-cy="entityTable"
>
<td>{{ encuesta.nombre }}</td>
<td>{{ encuesta.fechaCreacion | formatShortDatetime | titlecase }}</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> -->
{{ encuesta.categoria?.nombre }}
</div>
</td>
<td>
<div *ngIf="encuesta.usuarioExtra">
{{ encuesta.usuarioExtra?.user?.login }}
</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> -->
<!-- <div class="table-responsive" id="entities" *ngIf="encuestas && encuestas.length > 0"> <!-- <button
<table class="table table-striped" aria-describedby="page-heading"> type="submit"
<thead> [routerLink]="['/encuesta', encuesta.id, 'edit']"
<tr> class="ds-btn ds-btn--primary btn-sm"
<th scope="col"><span jhiTranslate="global.field.id">ID</span></th> data-cy="entityEditButton"
<th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.nombre">Nombre</span></th> >
<th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.descripcion">Descripcion</span></th> <fa-icon icon="pencil-alt"></fa-icon>
<th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaCreacion">Fecha Creacion</span></th> <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
<th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaPublicacion">Fecha Publicacion</span></th> </button> -->
<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>
<button <button type="submit" (click)="delete(encuesta)" class="ds-btn ds-btn--danger btn-sm" data-cy="entityDeleteButton">
type="submit" <fa-icon icon="times"></fa-icon>
[routerLink]="['/encuesta', encuesta.id, 'edit']" <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
class="btn btn-primary btn-sm" </button>
data-cy="entityEditButton" </div>
> </td>
<fa-icon icon="pencil-alt"></fa-icon> </tr>
<span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span> </tbody>
</button> </table>
</div>
<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> -->
<!-- --------------------------------------------------------------------------------------------- --> <!-- --------------------------------------------------------------------------------------------- -->
@ -303,8 +294,6 @@
<div class="modal-body"> <div class="modal-body">
<!-- Survey Registration Modal --> <!-- Survey Registration Modal -->
<div> <div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group"> <div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.nombre" for="field_nombre">Nombre</label> <label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.nombre" for="field_nombre">Nombre</label>
<input type="text" class="form-control" name="nombre" id="field_nombre" data-cy="nombre" formControlName="nombre" /> <input type="text" class="form-control" name="nombre" id="field_nombre" data-cy="nombre" formControlName="nombre" />
@ -412,268 +401,3 @@
</div> </div>
</div> </div>
</div> </div>
<!-- ------------------------------------------------------------------------------------------------- -->
<!-- <div 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">
Create or edit a Encuesta
</h2>
<div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group" [hidden]="editForm.get('id')!.value == null">
<label class="form-control-label" jhiTranslate="global.field.id" for="field_id">ID</label>
<input type="number" class="form-control" name="id" id="field_id" data-cy="id" formControlName="id" [readonly]="true" />
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.nombre" for="field_nombre">Nombre</label>
<input type="text" class="form-control" name="nombre" id="field_nombre" data-cy="nombre" formControlName="nombre" />
<div *ngIf="editForm.get('nombre')!.invalid && (editForm.get('nombre')!.dirty || editForm.get('nombre')!.touched)">
<small class="form-text text-danger" *ngIf="editForm.get('nombre')?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small
class="form-text text-danger"
*ngIf="editForm.get('nombre')?.errors?.minlength"
jhiTranslate="entity.validation.minlength"
[translateValues]="{ min: 1 }"
>
This field is required to be at least 1 characters.
</small>
<small
class="form-text text-danger"
*ngIf="editForm.get('nombre')?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength"
[translateValues]="{ max: 50 }"
>
This field cannot be longer than 50 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.descripcion" for="field_descripcion">Descripcion</label>
<input
type="text"
class="form-control"
name="descripcion"
id="field_descripcion"
data-cy="descripcion"
formControlName="descripcion"
/>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaCreacion" for="field_fechaCreacion"
>Fecha Creacion</label
>
<div class="d-flex">
<input
id="field_fechaCreacion"
data-cy="fechaCreacion"
type="datetime-local"
class="form-control"
name="fechaCreacion"
formControlName="fechaCreacion"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
<div
*ngIf="
editForm.get('fechaCreacion')!.invalid && (editForm.get('fechaCreacion')!.dirty || editForm.get('fechaCreacion')!.touched)
"
>
<small
class="form-text text-danger"
*ngIf="editForm.get('fechaCreacion')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
<small
class="form-text text-danger"
[hidden]="!editForm.get('fechaCreacion')?.errors?.ZonedDateTimelocal"
jhiTranslate="entity.validation.ZonedDateTimelocal"
>
This field should be a date and time.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaPublicacion" for="field_fechaPublicacion"
>Fecha Publicacion</label
>
<div class="d-flex">
<input
id="field_fechaPublicacion"
data-cy="fechaPublicacion"
type="datetime-local"
class="form-control"
name="fechaPublicacion"
formControlName="fechaPublicacion"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaFinalizar" for="field_fechaFinalizar"
>Fecha Finalizar</label
>
<div class="d-flex">
<input
id="field_fechaFinalizar"
data-cy="fechaFinalizar"
type="datetime-local"
class="form-control"
name="fechaFinalizar"
formControlName="fechaFinalizar"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaFinalizada" for="field_fechaFinalizada"
>Fecha Finalizada</label
>
<div class="d-flex">
<input
id="field_fechaFinalizada"
data-cy="fechaFinalizada"
type="datetime-local"
class="form-control"
name="fechaFinalizada"
formControlName="fechaFinalizada"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.calificacion" for="field_calificacion">Calificacion</label>
<input
type="number"
class="form-control"
name="calificacion"
id="field_calificacion"
data-cy="calificacion"
formControlName="calificacion"
/>
<div
*ngIf="editForm.get('calificacion')!.invalid && (editForm.get('calificacion')!.dirty || editForm.get('calificacion')!.touched)"
>
<small
class="form-text text-danger"
*ngIf="editForm.get('calificacion')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
<small
class="form-text text-danger"
[hidden]="!editForm.get('calificacion')?.errors?.number"
jhiTranslate="entity.validation.number"
>
This field should be a number.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.acceso" for="field_acceso">Acceso</label>
<select class="form-control" name="acceso" formControlName="acceso" id="field_acceso" data-cy="acceso">
<option [ngValue]="null">{{ 'dataSurveyApp.AccesoEncuesta.null' | translate }}</option>
<option value="PUBLIC">{{ 'dataSurveyApp.AccesoEncuesta.PUBLIC' | translate }}</option>
<option value="PRIVATE">{{ 'dataSurveyApp.AccesoEncuesta.PRIVATE' | translate }}</option>
</select>
<div *ngIf="editForm.get('acceso')!.invalid && (editForm.get('acceso')!.dirty || editForm.get('acceso')!.touched)">
<small class="form-text text-danger" *ngIf="editForm.get('acceso')?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.contrasenna" for="field_contrasenna">Contrasenna</label>
<input
type="text"
class="form-control"
name="contrasenna"
id="field_contrasenna"
data-cy="contrasenna"
formControlName="contrasenna"
/>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.estado" for="field_estado">Estado</label>
<select class="form-control" name="estado" formControlName="estado" id="field_estado" data-cy="estado">
<option [ngValue]="null">{{ 'dataSurveyApp.EstadoEncuesta.null' | translate }}</option>
<option value="DRAFT">{{ 'dataSurveyApp.EstadoEncuesta.DRAFT' | translate }}</option>
<option value="ACTIVE">{{ 'dataSurveyApp.EstadoEncuesta.ACTIVE' | translate }}</option>
<option value="FINISHED">{{ 'dataSurveyApp.EstadoEncuesta.FINISHED' | translate }}</option>
<option value="DELETED">{{ 'dataSurveyApp.EstadoEncuesta.DELETED' | translate }}</option>
</select>
<div *ngIf="editForm.get('estado')!.invalid && (editForm.get('estado')!.dirty || editForm.get('estado')!.touched)">
<small class="form-text text-danger" *ngIf="editForm.get('estado')?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.categoria" for="field_categoria">Categoria</label>
<select class="form-control" id="field_categoria" data-cy="categoria" name="categoria" formControlName="categoria">
<option [ngValue]="null"></option>
<option
[ngValue]="categoriaOption.id === editForm.get('categoria')!.value?.id ? editForm.get('categoria')!.value : categoriaOption"
*ngFor="let categoriaOption of categoriasSharedCollection; trackBy: trackCategoriaById"
>
{{ categoriaOption.nombre }}
</option>
</select>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.usuarioExtra" for="field_usuarioExtra"
>Usuario Extra</label
>
<select class="form-control" id="field_usuarioExtra" data-cy="usuarioExtra" name="usuarioExtra" formControlName="usuarioExtra">
<option [ngValue]="null"></option>
<option
[ngValue]="
usuarioExtraOption.id === editForm.get('usuarioExtra')!.value?.id ? editForm.get('usuarioExtra')!.value : usuarioExtraOption
"
*ngFor="let usuarioExtraOption of usuarioExtrasSharedCollection; trackBy: trackUsuarioExtraById"
>
{{ usuarioExtraOption.id }}
</option>
</select>
</div>
</div>
<div>
<button type="button" id="cancel-save" data-cy="entityCreateCancelButton" class="btn btn-secondary" (click)="previousState()">
<fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button
type="submit"
id="save-entity"
data-cy="entityCreateSaveButton"
[disabled]="editForm.invalid || isSaving"
class="btn btn-primary"
>
<fa-icon icon="save"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button>
</div>
</form>
</div>
</div> -->

View File

@ -22,6 +22,8 @@ import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model'
import { AccountService } from 'app/core/auth/account.service'; 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 { EncuestaPublishDialogComponent } from '../encuesta-publish-dialog/encuesta-publish-dialog.component';
import { IUser } from '../../user/user.model';
import { import {
faShareAlt, faShareAlt,
@ -34,6 +36,8 @@ import {
faTrashAlt, faTrashAlt,
faPlus, faPlus,
faStar, faStar,
faUpload,
faPollH,
} from '@fortawesome/free-solid-svg-icons'; } from '@fortawesome/free-solid-svg-icons';
import * as $ from 'jquery'; import * as $ from 'jquery';
@ -54,17 +58,30 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
faTrashAlt = faTrashAlt; faTrashAlt = faTrashAlt;
faPlus = faPlus; faPlus = faPlus;
faStar = faStar; faStar = faStar;
faUpload = faUpload;
isPublished: Boolean = false;
successPublished = false;
faPollH = faPollH;
account: Account | null = null; account: Account | null = null;
usuarioExtra: UsuarioExtra | null = null; usuarioExtra: UsuarioExtra | null = null;
estadoDeleted = EstadoEncuesta.DELETED;
encuestas?: IEncuesta[]; encuestas?: IEncuesta[];
isLoading = false; isLoading = false;
selectedSurvey?: IEncuesta | null = null;
idEncuesta: number | null = null;
isSaving = false; isSaving = false;
categoriasSharedCollection: ICategoria[] = []; categoriasSharedCollection: ICategoria[] = [];
usuarioExtrasSharedCollection: IUsuarioExtra[] = []; usuarioExtrasSharedCollection: IUsuarioExtra[] = [];
userSharedCollection: IUser[] = [];
encuestaencontrada: IEncuesta | null = null;
public searchString: string;
public accesoEncuesta: string;
//public categoriaEncuesta: string;
public estadoEncuesta: string;
editForm = this.fb.group({ editForm = this.fb.group({
id: [], id: [],
@ -83,6 +100,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
}); });
createAnother: Boolean = false; createAnother: Boolean = false;
selectedSurveyId: number | null = null;
constructor( constructor(
protected encuestaService: EncuestaService, protected encuestaService: EncuestaService,
@ -93,7 +111,11 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
protected fb: FormBuilder, protected fb: FormBuilder,
protected accountService: AccountService, protected accountService: AccountService,
protected router: Router protected router: Router
) {} ) {
this.searchString = '';
this.accesoEncuesta = '';
this.estadoEncuesta = '';
}
resetForm(): void { resetForm(): void {
this.editForm.reset(); this.editForm.reset();
@ -102,19 +124,70 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
loadAll(): void { loadAll(): void {
this.isLoading = true; this.isLoading = true;
this.encuestaService.query().subscribe( this.usuarioExtraService
(res: HttpResponse<IEncuesta[]>) => { .retrieveAllPublicUsers()
this.isLoading = false; .pipe(finalize(() => this.loadPublicUser()))
const tmpEncuestas = res.body ?? []; .subscribe(res => {
this.encuestas = tmpEncuestas.filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id); this.userSharedCollection = res;
}, });
() => { }
this.isLoading = false;
} loadPublicUser(): void {
); this.usuarioExtraService
.retrieveAllPublicUsers()
.pipe(finalize(() => this.loadUserExtras()))
.subscribe(res => {
this.userSharedCollection = res;
});
}
loadUserExtras() {
this.usuarioExtraService
.query()
.pipe(
finalize(() =>
this.encuestaService.query().subscribe(
(res: HttpResponse<IEncuesta[]>) => {
this.isLoading = false;
const tmpEncuestas = res.body ?? [];
if (this.isAdmin()) {
this.encuestas = tmpEncuestas.filter(e => e.estado !== EstadoEncuesta.DELETED);
this.encuestas.forEach(e => {
e.usuarioExtra = this.usuarioExtrasSharedCollection?.find(pU => pU.id == e.usuarioExtra?.id);
});
} else {
this.encuestas = tmpEncuestas
.filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id)
.filter(e => e.estado !== EstadoEncuesta.DELETED);
}
},
() => {
this.isLoading = false;
}
)
)
)
.subscribe(
(res: HttpResponse<IUsuarioExtra[]>) => {
this.isLoading = false;
this.usuarioExtrasSharedCollection = res.body ?? [];
this.usuarioExtrasSharedCollection.forEach(uE => {
uE.user = this.userSharedCollection?.find(pU => pU.id == uE.user?.id);
});
},
() => {
this.isLoading = false;
}
);
} }
ngOnInit(): void { ngOnInit(): void {
this.searchString = '';
this.accesoEncuesta = '';
//this.categoriaEncuesta = '';
this.estadoEncuesta = '';
document.body.addEventListener('click', e => { document.body.addEventListener('click', e => {
document.getElementById('contextmenu')!.classList.add('ds-contextmenu--closed'); document.getElementById('contextmenu')!.classList.add('ds-contextmenu--closed');
document.getElementById('contextmenu')!.classList.remove('ds-contextmenu--open'); document.getElementById('contextmenu')!.classList.remove('ds-contextmenu--open');
@ -147,6 +220,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => { this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => {
this.usuarioExtra = usuarioExtra.body; this.usuarioExtra = usuarioExtra.body;
this.loadAll(); this.loadAll();
this.loadRelationshipsOptions(); this.loadRelationshipsOptions();
if (this.usuarioExtra !== null) { if (this.usuarioExtra !== null) {
if (this.usuarioExtra.id === undefined) { if (this.usuarioExtra.id === undefined) {
@ -163,7 +237,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
ngAfterViewInit(): void {} ngAfterViewInit(): void {}
trackId(index: number, item: IEncuesta): number { trackId(_index: number, item: IEncuesta): number {
return item.id!; return item.id!;
} }
@ -178,6 +252,48 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
}); });
} }
deleteSurvey(): void {
if (this.selectedSurveyId != null) {
this.getEncuesta(this.selectedSurveyId)
.pipe(
finalize(() => {
const modalRef = this.modalService.open(EncuestaDeleteDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.encuesta = this.encuestaencontrada;
modalRef.closed.subscribe(reason => {
if (reason === 'deleted') {
this.loadAll();
}
});
})
)
.subscribe(data => {
this.encuestaencontrada = data;
});
/*const modalRef = this.modalService.open(EncuestaDeleteDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.encuesta = this.getEncuesta(this.selectedSurvey)
.pipe(finalize(() =>
modalRef.closed.subscribe(reason => {
if (reason === 'deleted') {
this.loadAll();
}
})
))
.subscribe(data=> {
console.log(data);
//this.encuestaencontrada = data;
});
*/
// unsubscribe not needed because closed completes on modal close
}
}
getEncuesta(id: number) {
return this.encuestaService.findEncuesta(id);
}
previousState(): void { previousState(): void {
window.history.back(); window.history.back();
} }
@ -193,11 +309,11 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
} }
} }
trackCategoriaById(index: number, item: ICategoria): number { trackCategoriaById(_index: number, item: ICategoria): number {
return item.id!; return item.id!;
} }
trackUsuarioExtraById(index: number, item: IUsuarioExtra): number { trackUsuarioExtraById(_index: number, item: IUsuarioExtra): number {
return item.id!; return item.id!;
} }
@ -307,11 +423,17 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
} }
openSurvey(event: any): void { openSurvey(event: any): void {
const surveyId = event.target.getAttribute('data-id'); if (event === null) {
this.router.navigate(['/encuesta', surveyId, 'edit']); const surveyId = this.selectedSurveyId;
this.router.navigate(['/encuesta', surveyId, 'edit']);
} else {
const surveyId = event.target.dataset.id;
this.router.navigate(['/encuesta', surveyId, 'edit']);
}
} }
selectSurvey(event: any): void { selectSurvey(event: any): void {
this.idEncuesta = event.target.getAttribute('data-id');
document.querySelectorAll('.ds-list--entity').forEach(e => { document.querySelectorAll('.ds-list--entity').forEach(e => {
e.classList.remove('active'); e.classList.remove('active');
}); });
@ -320,35 +442,45 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
} }
} }
counter(i: number) { openPreview() {
return new Array(i); const surveyId = this.selectedSurveyId;
this.router.navigate(['/encuesta', surveyId, 'preview']);
} }
testMe(something: any) { async openContextMenu(event: any): Promise<void> {
return 5 - something;
}
openContextMenu(event: any): void {
document.querySelectorAll('.ds-list--entity').forEach(e => {
e.classList.remove('active');
});
if (event.type === 'contextmenu') { if (event.type === 'contextmenu') {
event.preventDefault(); event.preventDefault();
if (event.target === null) return;
document.getElementById('contextmenu-create--separator')!.style.display = 'block'; document.querySelectorAll('.ds-list--entity').forEach(e => {
document.getElementById('contextmenu-edit--separator')!.style.display = 'block'; e.classList.remove('active');
document.getElementById('contextmenu-delete--separator')!.style.display = 'block'; });
document.getElementById('contextmenu-edit')!.style.display = 'block';
document.getElementById('contextmenu-duplicate')!.style.display = 'block';
document.getElementById('contextmenu-rename')!.style.display = 'block';
document.getElementById('contextmenu-share')!.style.display = 'block';
if ((event.target as HTMLElement).classList.contains('ds-list')) { if ((event.target as HTMLElement).classList.contains('ds-list')) {
document.getElementById('contextmenu-create--separator')!.style.display = 'block';
document.getElementById('contextmenu-edit--separator')!.style.display = 'none'; document.getElementById('contextmenu-edit--separator')!.style.display = 'none';
document.getElementById('contextmenu-delete--separator')!.style.display = 'none'; document.getElementById('contextmenu-delete--separator')!.style.display = 'none';
} else if ((event.target as HTMLElement).classList.contains('ds-list--entity')) { } else if ((event.target as HTMLElement).classList.contains('ds-list--entity')) {
this.selectedSurveyId = Number(event.target.dataset.id);
event.target.classList.add('active'); event.target.classList.add('active');
let res = await this.encuestaService.find(this.selectedSurveyId).toPromise();
this.selectedSurvey = res.body;
this.isPublished = this.selectedSurvey!.estado === 'ACTIVE' || this.selectedSurvey!.estado === 'FINISHED'; // QUE SE LE MUESTRE CUANDO ESTE EN DRAFT
document.getElementById('contextmenu-create--separator')!.style.display = 'none';
document.getElementById('contextmenu-edit--separator')!.style.display = 'block';
document.getElementById('contextmenu-delete--separator')!.style.display = 'block';
document.getElementById('contextmenu-edit')!.style.display = 'block';
document.getElementById('contextmenu-preview')!.style.display = 'block';
if (!this.isPublished) {
document.getElementById('contextmenu-publish')!.style.display = 'block';
document.getElementById('contextmenu-duplicate')!.style.display = 'block';
} else {
document.getElementById('contextmenu-publish')!.style.display = 'none';
document.getElementById('contextmenu-duplicate')!.style.display = 'none';
}
// document.getElementById('contextmenu-share')!.style.display = 'block';
document.getElementById('contextmenu-create--separator')!.style.display = 'none'; document.getElementById('contextmenu-create--separator')!.style.display = 'none';
} }
@ -359,4 +491,21 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
document.getElementById('contextmenu')!.style.maxHeight = '100%'; document.getElementById('contextmenu')!.style.maxHeight = '100%';
} }
} }
publish(): void {
const modalRef = this.modalService.open(EncuestaPublishDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.encuesta = this.selectedSurvey;
// unsubscribe not needed because closed completes on modal close
modalRef.closed.subscribe(reason => {
if (reason === 'published') {
this.successPublished = true;
this.loadAll();
}
});
}
async duplicateSurvey(): Promise<void> {
const res = await this.encuestaService.duplicate(this.selectedSurveyId!).toPromise();
this.loadAll();
}
} }

View File

@ -34,7 +34,7 @@ describe('Service Tests', () => {
describe('resolve', () => { describe('resolve', () => {
it('should return IEncuesta returned by find', () => { it('should return IEncuesta returned by find', () => {
// GIVEN // GIVEN
service.find = jest.fn(id => of(new HttpResponse({ body: { id } }))); // service.find = jest.fn(id => of(new HttpResponse({ body: { id } })));
mockActivatedRouteSnapshot.params = { id: 123 }; mockActivatedRouteSnapshot.params = { id: 123 };
// WHEN // WHEN

View File

@ -14,7 +14,7 @@ const encuestaRoute: Routes = [
canActivate: [UserRouteAccessService], canActivate: [UserRouteAccessService],
}, },
{ {
path: ':id/view', path: ':id/preview',
component: EncuestaDetailComponent, component: EncuestaDetailComponent,
resolve: { resolve: {
encuesta: EncuestaRoutingResolveService, encuesta: EncuestaRoutingResolveService,

View File

@ -15,6 +15,7 @@ export type EntityArrayResponseType = HttpResponse<IEncuesta[]>;
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class EncuestaService { export class EncuestaService {
protected resourceUrl = this.applicationConfigService.getEndpointFor('api/encuestas'); protected resourceUrl = this.applicationConfigService.getEndpointFor('api/encuestas');
protected resourceUrlPublish = this.applicationConfigService.getEndpointFor('api/encuestas/publish');
constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {} constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
@ -28,7 +29,7 @@ export class EncuestaService {
update(encuesta: IEncuesta): Observable<EntityResponseType> { update(encuesta: IEncuesta): Observable<EntityResponseType> {
const copy = this.convertDateFromClient(encuesta); const copy = this.convertDateFromClient(encuesta);
return this.http return this.http
.put<IEncuesta>(`${this.resourceUrl}/${getEncuestaIdentifier(encuesta) as number}`, copy, { observe: 'response' }) .put<IEncuesta>(`${this.resourceUrlPublish}/${getEncuestaIdentifier(encuesta) as number}`, copy, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res))); .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
} }
@ -39,12 +40,44 @@ export class EncuestaService {
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res))); .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
} }
find(id: number): Observable<EntityResponseType> { find(id: Number): Observable<EntityResponseType> {
return this.http return this.http
.get<IEncuesta>(`${this.resourceUrl}/${id}`, { observe: 'response' }) .get<IEncuesta>(`${this.resourceUrl}/${id}`, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res))); .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
} }
findEncuesta(id: number): Observable<IEncuesta> {
return this.http.get<IEncuesta>(`${this.resourceUrl}/${id}`);
}
findQuestions(id: number): Observable<EntityResponseType> {
return this.http
.get<any>(`${this.resourceUrl}/preguntas/${id}`, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
findQuestionsOptions(id: number): Observable<EntityResponseType> {
return this.http
.get<any>(`${this.resourceUrl}/preguntas-opciones/${id}`, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
duplicate(id: number): Observable<EntityResponseType> {
return this.http.get<any>(`${this.resourceUrl}/duplicate/${id}`, { observe: 'response' });
}
publishEncuesta(encuesta: IEncuesta): Observable<EntityResponseType> {
//const copy = this.convertDateFromClient(encuesta);
return this.http.put<IEncuesta>(`${this.resourceUrl}/publish/${getEncuestaIdentifier(encuesta) as number}`, encuesta, {
observe: 'response',
});
}
deleteEncuesta(encuesta: IEncuesta): Observable<EntityResponseType> {
//const copy = this.convertDateFromClient(encuesta);
return this.http.put<IEncuesta>(`${this.resourceUrl}/${getEncuestaIdentifier(encuesta) as number}`, encuesta, { observe: 'response' });
}
query(req?: any): Observable<EntityArrayResponseType> { query(req?: any): Observable<EntityArrayResponseType> {
const options = createRequestOption(req); const options = createRequestOption(req);
return this.http return this.http
@ -56,6 +89,10 @@ export class EncuestaService {
return this.http.delete(`${this.resourceUrl}/${id}`, { observe: 'response' }); return this.http.delete(`${this.resourceUrl}/${id}`, { observe: 'response' });
} }
deletedNotification(encuesta: IEncuesta): Observable<HttpResponse<{}>> {
return this.http.delete(`${this.resourceUrl}/notify/${encuesta.id}`, { observe: 'response' });
}
addEncuestaToCollectionIfMissing(encuestaCollection: IEncuesta[], ...encuestasToCheck: (IEncuesta | null | undefined)[]): IEncuesta[] { addEncuestaToCollectionIfMissing(encuestaCollection: IEncuesta[], ...encuestasToCheck: (IEncuesta | null | undefined)[]): IEncuesta[] {
const encuestas: IEncuesta[] = encuestasToCheck.filter(isPresent); const encuestas: IEncuesta[] = encuestasToCheck.filter(isPresent);
if (encuestas.length > 0) { if (encuestas.length > 0) {

View File

@ -1,262 +1,402 @@
<div class="row justify-content-center"> <div>
<div class="col-8"> <h2 id="page-heading" data-cy="EPreguntaCerradaHeading">
<form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm"> <div class="d-flex align-items-center">
<h2 id="jhi-encuesta-heading" data-cy="EncuestaCreateUpdateHeading" jhiTranslate="dataSurveyApp.encuesta.home.createOrEditLabel"> <p class="ds-title">{{ encuesta!.nombre }}</p>
Create or edit a Encuesta &nbsp;&nbsp;<fa-icon
</h2> class="ds-info--icon"
[icon]="faQuestion"
data-toggle="modal"
data-target="#verParametros"
(click)="loadAplicationParameters()"
></fa-icon>
&nbsp;&nbsp;<fa-icon class="ds-info--icon" [icon]="faEye" (click)="openPreview()"></fa-icon>
</div>
<div> <p class="ds-subtitle">Creada el día {{ encuesta!.fechaCreacion | formatShortDatetime | lowercase }}</p>
<jhi-alert-error></jhi-alert-error>
<div class="form-group" [hidden]="editForm.get('id')!.value == null"> <div class="d-flex justify-content-end">
<label class="form-control-label" jhiTranslate="global.field.id" for="field_id">ID</label> <button type="button" class="ds-btn ds-btn--secondary" (click)="previousState()">
<input type="number" class="form-control" name="id" id="field_id" data-cy="id" formControlName="id" [readonly]="true" /> <fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;<span jhiTranslate="entity.action.back">Back</span>
</div> </button>
<button type="button" class="ds-btn ds-btn--secondary" (click)="loadAll()" [disabled]="isLoading">
<fa-icon icon="sync" [spin]="isLoading"></fa-icon>&nbsp;&nbsp;<span>Refrescar preguntas</span>
</button>
<div class="form-group"> <button
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.nombre" for="field_nombre">Nombre</label> type="button"
<input type="text" class="form-control" name="nombre" id="field_nombre" data-cy="nombre" formControlName="nombre" /> class="ds-btn ds-btn--primary"
<div *ngIf="editForm.get('nombre')!.invalid && (editForm.get('nombre')!.dirty || editForm.get('nombre')!.touched)"> (click)="createQuestion()"
<small class="form-text text-danger" *ngIf="editForm.get('nombre')?.errors?.required" jhiTranslate="entity.validation.required"> [disabled]="isLoading"
This field is required. data-toggle="modal"
</small> data-target="#crearPregunta"
<small >
class="form-text text-danger" <fa-icon icon="sync" [icon]="faPlus"></fa-icon>&nbsp;&nbsp;<span>Crear pregunta</span>
*ngIf="editForm.get('nombre')?.errors?.minlength" </button>
jhiTranslate="entity.validation.minlength" </div>
[translateValues]="{ min: 1 }" </h2>
>
This field is required to be at least 1 characters.
</small>
<small
class="form-text text-danger"
*ngIf="editForm.get('nombre')?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength"
[translateValues]="{ max: 50 }"
>
This field cannot be longer than 50 characters.
</small>
</div>
</div>
<div class="form-group"> <jhi-alert-error></jhi-alert-error>
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.descripcion" for="field_descripcion">Descripcion</label>
<input
type="text"
class="form-control"
name="descripcion"
id="field_descripcion"
data-cy="descripcion"
formControlName="descripcion"
/>
</div>
<div class="form-group"> <!-- <jhi-alert></jhi-alert> -->
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaCreacion" for="field_fechaCreacion"
>Fecha Creacion</label <!-- <div class="alert alert-warning" id="no-result" *ngIf="ePreguntas?.length === 0">
> <span>No se encontraron preguntas</span>
<div class="d-flex"> </div> -->
<input <!-- *ngIf="ePreguntas && ePreguntas.length > 0" -->
id="field_fechaCreacion" <div class="ds-survey" id="entities">
data-cy="fechaCreacion" <div class="ds-survey--all-question-wrapper">
type="datetime-local" <ng-container *ngIf="encuesta!.estado === 'ACTIVE'">
class="form-control" <p class="ds-title text-center">Encuesta en progreso</p>
name="fechaCreacion" <p class="ds-subtitle">No puede modificar la encuesta debido a que esta ya está en progreso.</p>
formControlName="fechaCreacion" </ng-container>
placeholder="YYYY-MM-DD HH:mm" <ng-container *ngIf="encuesta!.estado === 'FINISHED'">
/> <p class="ds-title text-center">Encuesta finalizada</p>
</div> <p class="ds-subtitle">No puede modificar la encuesta debido a que esta ya ha concluido.</p>
</ng-container>
<ng-container *ngIf="encuesta!.estado === 'DRAFT' && ePreguntas && ePreguntas.length === 0">
<p class="ds-title text-center">Encuesta vacía</p>
<p class="ds-subtitle">Inicie creando preguntas y opciones para su encuesta.</p>
</ng-container>
<ng-container *ngIf="encuesta!.estado === 'DRAFT'">
<div class="ds-survey--question-wrapper" *ngFor="let ePregunta of ePreguntas; let i = index; trackBy: trackId">
<div <div
*ngIf=" [attr.data-index]="ePregunta.id"
editForm.get('fechaCreacion')!.invalid && (editForm.get('fechaCreacion')!.dirty || editForm.get('fechaCreacion')!.touched) [attr.data-tipo]="ePregunta.tipo"
" [attr.data-opcional]="ePregunta.opcional"
class="ds-survey--question"
> >
<small <div class="ds-survey--titulo">
class="form-text text-danger" <span class="ds-survey--titulo--name">{{ i + 1 }}. {{ ePregunta.nombre }}</span>
*ngIf="editForm.get('fechaCreacion')?.errors?.required" <fa-icon
jhiTranslate="entity.validation.required" *ngIf="encuesta!.estado === 'DRAFT'"
> class="ds-survey--titulo--icon"
This field is required. [icon]="faTimes"
</small> (click)="deleteQuestion($event)"
<small [attr.data-id]="ePregunta.id"
class="form-text text-danger" [attr.data-type]="ePregunta.tipo"
[hidden]="!editForm.get('fechaCreacion')?.errors?.ZonedDateTimelocal" ></fa-icon>
jhiTranslate="entity.validation.ZonedDateTimelocal" </div>
> <div>
This field should be a date and time. <span *ngIf="ePregunta.tipo === 'SINGLE'" class="ds-subtitle"
</small> >Pregunta de respuesta {{ 'dataSurveyApp.PreguntaCerradaTipo.SINGLE' | translate | lowercase }}
{{ ePregunta.opcional ? '(opcional)' : '' }}</span
>
<span *ngIf="ePregunta.tipo === 'MULTIPLE'" class="ds-subtitle"
>Pregunta de respuesta {{ 'dataSurveyApp.PreguntaCerradaTipo.MULTIPLE' | translate | lowercase }}
{{ ePregunta.opcional ? '(opcional)' : '' }}</span
>
<span *ngIf="!ePregunta.tipo" class="ds-subtitle"
>Pregunta de respuesta abierta {{ ePregunta.opcional ? '(opcional)' : '' }}</span
>
</div>
<ng-container *ngIf="ePregunta.tipo">
<ng-container *ngFor="let ePreguntaOpcion of ePreguntasOpciones; let j = index; trackBy: trackId">
<ng-container *ngFor="let ePreguntaOpcionFinal of ePreguntaOpcion">
<ng-container *ngIf="ePregunta.id === ePreguntaOpcionFinal.epreguntaCerrada.id">
<div
class="ds-survey--option ds-survey--option--base ds-survey--closed-option can-delete"
[attr.data-id]="ePreguntaOpcionFinal.id"
>
<!-- <input class="ds-survey--checkbox" id="{{ ePregunta.id }}-{{ ePreguntaOpcionFinal.id }}" type="checkbox" disabled /> -->
<label for="{{ ePregunta.id }}-{{ ePreguntaOpcionFinal.id }}">{{ ePreguntaOpcionFinal.nombre }}</label>
<fa-icon
*ngIf="encuesta!.estado === 'DRAFT'"
class="ds-survey--titulo--icon ds-survey--titulo--icon--small"
[icon]="faTimes"
(click)="deleteOption($event)"
[attr.data-optionid]="ePreguntaOpcionFinal.id"
></fa-icon>
</div>
</ng-container>
</ng-container>
</ng-container>
<div
class="ds-survey--option ds-survey--option--add ds-survey--closed-option"
(click)="resetForm($event)"
data-toggle="modal"
data-target="#crearOpcion"
[attr.data-id]="ePregunta.id"
>
<fa-icon
class="ds-survey--add-option--icon"
[icon]="faPlus"
[attr.data-id]="ePregunta.id"
[attr.data-type]="ePregunta.tipo"
></fa-icon>
<span class="ds-survey--add-option">Añadir opción</span>
</div>
</ng-container>
<div class="ds-survey--option ds-survey--option--base ds-survey--open-option" *ngIf="!ePregunta.tipo">
<textarea name="" id="" cols="30" rows="10" disabled></textarea>
</div>
</div> </div>
</div> </div>
</ng-container>
<div class="form-group"> </div>
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaPublicacion" for="field_fechaPublicacion"
>Fecha Publicacion</label
>
<div class="d-flex">
<input
id="field_fechaPublicacion"
data-cy="fechaPublicacion"
type="datetime-local"
class="form-control"
name="fechaPublicacion"
formControlName="fechaPublicacion"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaFinalizar" for="field_fechaFinalizar"
>Fecha Finalizar</label
>
<div class="d-flex">
<input
id="field_fechaFinalizar"
data-cy="fechaFinalizar"
type="datetime-local"
class="form-control"
name="fechaFinalizar"
formControlName="fechaFinalizar"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.fechaFinalizada" for="field_fechaFinalizada"
>Fecha Finalizada</label
>
<div class="d-flex">
<input
id="field_fechaFinalizada"
data-cy="fechaFinalizada"
type="datetime-local"
class="form-control"
name="fechaFinalizada"
formControlName="fechaFinalizada"
placeholder="YYYY-MM-DD HH:mm"
/>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.calificacion" for="field_calificacion">Calificacion</label>
<input
type="number"
class="form-control"
name="calificacion"
id="field_calificacion"
data-cy="calificacion"
formControlName="calificacion"
/>
<div
*ngIf="editForm.get('calificacion')!.invalid && (editForm.get('calificacion')!.dirty || editForm.get('calificacion')!.touched)"
>
<small
class="form-text text-danger"
*ngIf="editForm.get('calificacion')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
<small
class="form-text text-danger"
[hidden]="!editForm.get('calificacion')?.errors?.number"
jhiTranslate="entity.validation.number"
>
This field should be a number.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.acceso" for="field_acceso">Acceso</label>
<select class="form-control" name="acceso" formControlName="acceso" id="field_acceso" data-cy="acceso">
<option [ngValue]="null">{{ 'dataSurveyApp.AccesoEncuesta.null' | translate }}</option>
<option value="PUBLIC">{{ 'dataSurveyApp.AccesoEncuesta.PUBLIC' | translate }}</option>
<option value="PRIVATE">{{ 'dataSurveyApp.AccesoEncuesta.PRIVATE' | translate }}</option>
</select>
<div *ngIf="editForm.get('acceso')!.invalid && (editForm.get('acceso')!.dirty || editForm.get('acceso')!.touched)">
<small class="form-text text-danger" *ngIf="editForm.get('acceso')?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.contrasenna" for="field_contrasenna">Contrasenna</label>
<input
type="text"
class="form-control"
name="contrasenna"
id="field_contrasenna"
data-cy="contrasenna"
formControlName="contrasenna"
/>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.estado" for="field_estado">Estado</label>
<select class="form-control" name="estado" formControlName="estado" id="field_estado" data-cy="estado">
<option [ngValue]="null">{{ 'dataSurveyApp.EstadoEncuesta.null' | translate }}</option>
<option value="DRAFT">{{ 'dataSurveyApp.EstadoEncuesta.DRAFT' | translate }}</option>
<option value="ACTIVE">{{ 'dataSurveyApp.EstadoEncuesta.ACTIVE' | translate }}</option>
<option value="FINISHED">{{ 'dataSurveyApp.EstadoEncuesta.FINISHED' | translate }}</option>
<option value="DELETED">{{ 'dataSurveyApp.EstadoEncuesta.DELETED' | translate }}</option>
</select>
<div *ngIf="editForm.get('estado')!.invalid && (editForm.get('estado')!.dirty || editForm.get('estado')!.touched)">
<small class="form-text text-danger" *ngIf="editForm.get('estado')?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.categoria" for="field_categoria">Categoria</label>
<select class="form-control" id="field_categoria" data-cy="categoria" name="categoria" formControlName="categoria">
<option [ngValue]="null"></option>
<option
[ngValue]="categoriaOption.id === editForm.get('categoria')!.value?.id ? editForm.get('categoria')!.value : categoriaOption"
*ngFor="let categoriaOption of categoriasSharedCollection; trackBy: trackCategoriaById"
>
{{ categoriaOption.nombre }}
</option>
</select>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.encuesta.usuarioExtra" for="field_usuarioExtra"
>Usuario Extra</label
>
<select class="form-control" id="field_usuarioExtra" data-cy="usuarioExtra" name="usuarioExtra" formControlName="usuarioExtra">
<option [ngValue]="null"></option>
<option
[ngValue]="
usuarioExtraOption.id === editForm.get('usuarioExtra')!.value?.id ? editForm.get('usuarioExtra')!.value : usuarioExtraOption
"
*ngFor="let usuarioExtraOption of usuarioExtrasSharedCollection; trackBy: trackUsuarioExtraById"
>
{{ usuarioExtraOption.id }}
</option>
</select>
</div>
</div>
<div>
<button type="button" id="cancel-save" data-cy="entityCreateCancelButton" class="btn btn-secondary" (click)="previousState()">
<fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button
type="submit"
id="save-entity"
data-cy="entityCreateSaveButton"
[disabled]="editForm.invalid || isSaving"
class="btn btn-primary"
>
<fa-icon icon="save"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button>
</div>
</form>
</div> </div>
</div> </div>
<!-- Create Option Modal -->
<div class="modal fade ds-modal" id="crearOpcion" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form autocomplete="off" class="ds-form" name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
<div class="modal-header">
<h1 class="modal-title" id="exampleModalLongTitle">Crear Opción</h1>
</div>
<div class="modal-body">
<!-- Survey Closed Question Create Option Modal -->
<div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.ePreguntaCerradaOpcion.nombre" for="field_nombre">Nombre</label>
<input type="text" class="form-control" name="nombre" id="field_nombre" data-cy="nombre" formControlName="nombre" />
<div *ngIf="editForm.get('nombre')!.invalid && (editForm.get('nombre')!.dirty || editForm.get('nombre')!.touched)">
<small
class="form-text text-danger"
*ngIf="editForm.get('nombre')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
<small
class="form-text text-danger"
*ngIf="editForm.get('nombre')?.errors?.minlength"
jhiTranslate="entity.validation.minlength"
[translateValues]="{ min: 1 }"
>
This field is required to be at least 1 characters.
</small>
<small
class="form-text text-danger"
*ngIf="editForm.get('nombre')?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength"
[translateValues]="{ max: 500 }"
>
This field cannot be longer than 500 characters.
</small>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<input id="createAnother" type="checkbox" (change)="createAnotherChange($event)" />
<label for="createAnother">Crear otra</label>
<button id="cancelBtn" type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button
type="submit"
id="save-entity"
data-cy="entityCreateSaveButton"
class="ds-btn ds-btn--primary"
[disabled]="editForm.invalid || isSaving"
>
<span jhiTranslate="entity.action.create">Create</span>
</button>
</div>
</form>
</div>
</div>
</div>
<!-- ------------------------------------------------------------------------------------------------- -->
<!-- Create Question Modal -->
<div
class="modal fade ds-modal"
id="crearPregunta"
tabindex="-1"
role="dialog"
aria-labelledby="exampleModalCenterTitle"
aria-hidden="true"
>
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form
autocomplete="off"
class="ds-form"
name="editFormQuestion"
role="form"
novalidate
(ngSubmit)="saveQuestion()"
[formGroup]="editFormQuestion"
>
<div class="modal-header">
<h1 class="modal-title" id="exampleModalLongTitle2">Crear Pregunta</h1>
</div>
<div class="modal-body">
<!-- Survey Create Question Modal -->
<div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group">
<label class="form-control-label" for="field_nombre">Pregunta</label>
<input type="text" class="form-control" name="nombre" id="field_nombre2" data-cy="nombre" formControlName="nombre" />
<div
*ngIf="
editFormQuestion.get('nombre')!.invalid &&
(editFormQuestion.get('nombre')!.dirty || editFormQuestion.get('nombre')!.touched)
"
>
<small
class="form-text text-danger"
*ngIf="editFormQuestion.get('nombre')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
<small
class="form-text text-danger"
*ngIf="editFormQuestion.get('nombre')?.errors?.minlength"
jhiTranslate="entity.validation.minlength"
[translateValues]="{ min: 1 }"
>
This field is required to be at least 1 characters.
</small>
<small
class="form-text text-danger"
*ngIf="editFormQuestion.get('nombre')?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength"
[translateValues]="{ max: 500 }"
>
This field cannot be longer than 500 characters.
</small>
</div>
</div>
<!-- Custom Form Group (Closed & Open Question Validation) -->
<div class="form-group">
<label class="form-control-label" for="field_tipo">Tipo de pregunta</label>
<select class="form-control" name="tipopregunta" formControlName="tipopregunta" id="field_tipo2" data-cy="tipopregunta">
<option selected value="CLOSED">Opción multiple</option>
<option value="OPEN">Respuesta abierta</option>
</select>
<div
*ngIf="
editFormQuestion.get('tipopregunta')!.invalid &&
(editFormQuestion.get('tipopregunta')!.dirty || editFormQuestion.get('tipopregunta')!.touched)
"
>
<small
class="form-text text-danger"
*ngIf="editFormQuestion.get('tipopregunta')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
</div>
</div>
<ng-container *ngIf="editFormQuestion.get('tipopregunta')!.value === 'CLOSED'">
<div class="form-group">
<label class="form-control-label" jhiTranslate="dataSurveyApp.ePreguntaCerrada.tiporespuesta" for="field_tipo">Tipo</label>
<select class="form-control" name="tipo" formControlName="tipo" id="field_tipo" data-cy="tipo">
<option selected value="SINGLE">{{ 'dataSurveyApp.PreguntaCerradaTipo.SINGLE' | translate }}</option>
<option value="MULTIPLE">{{ 'dataSurveyApp.PreguntaCerradaTipo.MULTIPLE' | translate }}</option>
</select>
<div
*ngIf="
editFormQuestion.get('tipo')!.invalid && (editFormQuestion.get('tipo')!.dirty || editFormQuestion.get('tipo')!.touched)
"
>
<small
class="form-text text-danger"
*ngIf="editFormQuestion.get('tipo')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
</div>
</div>
</ng-container>
<div class="form-group">
<label class="form-control-label" for="field_opcional">Opcional</label>
<input type="checkbox" class="form-check" name="opcional" id="field_opcional" data-cy="opcional" formControlName="opcional" />
<div
*ngIf="
editFormQuestion.get('opcional')!.invalid &&
(editFormQuestion.get('opcional')!.dirty || editFormQuestion.get('opcional')!.touched)
"
>
<small
class="form-text text-danger"
*ngIf="editFormQuestion.get('opcional')?.errors?.required"
jhiTranslate="entity.validation.required"
>
This field is required.
</small>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<input id="createAnotherQuestion" type="checkbox" (change)="createAnotherQuestionChange($event)" />
<label for="createAnotherQuestion">Crear otra</label>
<button id="cancelBtnQuestion" type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button
type="submit"
id="save-question"
data-cy="entityCreateSaveButton"
class="ds-btn ds-btn--primary"
[disabled]="editFormQuestion.invalid || isSaving"
>
<span jhiTranslate="entity.action.create">Create</span>
</button>
</div>
</form>
</div>
</div>
</div>
<!-- ------------------------------------------------------------------------------------------------- -->
<!-- Survey Parameters Information -->
<div
class="modal fade ds-modal"
id="verParametros"
tabindex="-1"
role="dialog"
aria-labelledby="exampleModalCenterTitle"
aria-hidden="true"
>
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title" id="exampleModalLongTitle">Información de Encuesta</h1>
</div>
<!-- {
"id": 1,
"maxDiasEncuesta": 20,
"minDiasEncuesta": 2,
"maxCantidadPreguntas": 10,
"minCantidadPreguntas": 2
} -->
<div class="modal-body">
<div>
<div class="mb-5">
<p class="ds-subtitle">Duración de encuesta permitida</p>
<p>{{ parametrosAplicacion!.minDiasEncuesta }} - {{ parametrosAplicacion!.maxDiasEncuesta }} días</p>
</div>
<div>
<p class="ds-subtitle">Cantidad de preguntas por encuesta</p>
<p>{{ parametrosAplicacion!.minCantidadPreguntas }} - {{ parametrosAplicacion!.maxCantidadPreguntas }} preguntas</p>
</div>
</div>
</div>
<div class="modal-footer">
<button id="cancelBtnVerParametros" type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;<span>Volver</span>
</button>
</div>
</div>
</div>
</div>
<!-- ------------------------------------------------------------------------------------------------- -->

View File

@ -1,4 +1,9 @@
import { Component, OnInit } from '@angular/core'; import { IEPreguntaAbierta } from './../../e-pregunta-abierta/e-pregunta-abierta.model';
import { EPreguntaCerrada } from './../../e-pregunta-cerrada/e-pregunta-cerrada.model';
import { EPreguntaCerradaOpcion, IEPreguntaCerradaOpcion } from './../../e-pregunta-cerrada-opcion/e-pregunta-cerrada-opcion.model';
import { EPreguntaAbiertaService } from './../../e-pregunta-abierta/service/e-pregunta-abierta.service';
import { EPreguntaCerradaOpcionService } from './../../e-pregunta-cerrada-opcion/service/e-pregunta-cerrada-opcion.service';
import { AfterViewChecked, Component, OnInit } from '@angular/core';
import { HttpResponse } from '@angular/common/http'; import { HttpResponse } from '@angular/common/http';
import { FormBuilder, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
@ -15,82 +20,276 @@ import { CategoriaService } from 'app/entities/categoria/service/categoria.servi
import { IUsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model'; import { IUsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model';
import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-extra.service'; import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-extra.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { IEPreguntaCerrada } from 'app/entities/e-pregunta-cerrada/e-pregunta-cerrada.model';
import { EPreguntaCerradaService } from 'app/entities/e-pregunta-cerrada/service/e-pregunta-cerrada.service';
import { EPreguntaCerradaDeleteDialogComponent } from 'app/entities/e-pregunta-cerrada/delete/e-pregunta-cerrada-delete-dialog.component';
import { faTimes, faPlus, faQuestion, faPollH, faEye } from '@fortawesome/free-solid-svg-icons';
import { PreguntaCerradaTipo } from 'app/entities/enumerations/pregunta-cerrada-tipo.model';
import { EncuestaDeleteQuestionDialogComponent } from '../encuesta-delete-question-dialog/encuesta-delete-question-dialog.component';
import { EncuestaDeleteOptionDialogComponent } from '../encuesta-delete-option-dialog/encuesta-delete-option-dialog.component';
import { ParametroAplicacionService } from './../../parametro-aplicacion/service/parametro-aplicacion.service';
import { IParametroAplicacion } from './../../parametro-aplicacion/parametro-aplicacion.model';
import { Router } from '@angular/router';
@Component({ @Component({
selector: 'jhi-encuesta-update', selector: 'jhi-encuesta-update',
templateUrl: './encuesta-update.component.html', templateUrl: './encuesta-update.component.html',
}) })
export class EncuestaUpdateComponent implements OnInit { export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
faTimes = faTimes;
faPlus = faPlus;
faPollH = faPollH;
faQuestion = faQuestion;
faEye = faEye;
isSaving = false; isSaving = false;
isSavingQuestion = false;
categoriasSharedCollection: ICategoria[] = []; categoriasSharedCollection: ICategoria[] = [];
usuarioExtrasSharedCollection: IUsuarioExtra[] = []; usuarioExtrasSharedCollection: IUsuarioExtra[] = [];
// editForm = this.fb.group({
// id: [],
// nombre: [null, [Validators.required, Validators.minLength(1), Validators.maxLength(50)]],
// descripcion: [],
// fechaCreacion: [null, [Validators.required]],
// fechaPublicacion: [],
// fechaFinalizar: [],
// fechaFinalizada: [],
// calificacion: [null, [Validators.required]],
// acceso: [null, [Validators.required]],
// contrasenna: [],
// estado: [null, [Validators.required]],
// categoria: [],
// usuarioExtra: [],
// });
editForm = this.fb.group({ editForm = this.fb.group({
id: [], id: [],
nombre: [null, [Validators.required, Validators.minLength(1), Validators.maxLength(50)]], nombre: [null, [Validators.required, Validators.minLength(1), Validators.maxLength(500)]],
descripcion: [], // orden: [null, [Validators.required]],
fechaCreacion: [null, [Validators.required]], // cantidad: [null, [Validators.required]],
fechaPublicacion: [], // ePreguntaCerrada: [],
fechaFinalizar: [],
fechaFinalizada: [],
calificacion: [null, [Validators.required]],
acceso: [null, [Validators.required]],
contrasenna: [],
estado: [null, [Validators.required]],
categoria: [],
usuarioExtra: [],
}); });
editFormQuestion = this.fb.group({
id: [],
nombre: [null, [Validators.required, Validators.minLength(1), Validators.maxLength(500)]],
tipo: [PreguntaCerradaTipo.SINGLE],
opcional: [false],
tipopregunta: ['CLOSED'],
});
ePreguntas?: any[];
ePreguntasOpciones?: any[];
encuesta: Encuesta | null = null;
parametrosAplicacion?: IParametroAplicacion | null = null;
isLoading = false;
createAnother: Boolean = false;
createAnotherQuestion: Boolean = false;
selectedQuestionToCreateOption: IEPreguntaCerrada | null = null;
constructor( constructor(
protected encuestaService: EncuestaService, protected encuestaService: EncuestaService,
protected categoriaService: CategoriaService, protected categoriaService: CategoriaService,
protected usuarioExtraService: UsuarioExtraService, protected usuarioExtraService: UsuarioExtraService,
protected activatedRoute: ActivatedRoute, protected activatedRoute: ActivatedRoute,
protected fb: FormBuilder protected fb: FormBuilder,
protected modalService: NgbModal,
protected ePreguntaCerradaService: EPreguntaCerradaService,
protected ePreguntaCerradaOpcionService: EPreguntaCerradaOpcionService,
protected parametroAplicacionService: ParametroAplicacionService,
protected ePreguntaAbiertaService: EPreguntaAbiertaService,
protected router: Router
) {} ) {}
loadAll(): void {
this.isLoading = true;
this.encuestaService.findQuestions(this.encuesta?.id!).subscribe(
(res: any) => {
this.isLoading = false;
this.ePreguntas = res.body ?? [];
console.log(this.ePreguntas);
},
() => {
this.isLoading = false;
}
);
this.encuestaService.findQuestionsOptions(this.encuesta?.id!).subscribe(
(res: any) => {
this.isLoading = false;
this.ePreguntasOpciones = res.body ?? [];
},
() => {
this.isLoading = false;
}
);
}
async loadAplicationParameters(): Promise<void> {
const params = await this.parametroAplicacionService.find(1).toPromise();
this.parametrosAplicacion = params.body;
//console.log(this.parametrosAplicacion);
}
ngOnInit(): void { ngOnInit(): void {
this.activatedRoute.data.subscribe(({ encuesta }) => { this.activatedRoute.data.subscribe(({ encuesta }) => {
console.log(this.activatedRoute.data);
console.log(encuesta);
if (encuesta.id === undefined) { if (encuesta.id === undefined) {
const today = dayjs().startOf('day'); const today = dayjs().startOf('day');
encuesta.fechaCreacion = today; encuesta.fechaCreacion = today;
encuesta.fechaPublicacion = today; encuesta.fechaPublicacion = today;
encuesta.fechaFinalizar = today; encuesta.fechaFinalizar = today;
encuesta.fechaFinalizada = today; encuesta.fechaFinalizada = today;
} else {
this.encuesta = encuesta;
this.loadAll();
this.loadAplicationParameters();
} }
this.updateForm(encuesta); // this.updateForm(encuesta);
this.loadRelationshipsOptions(); // this.loadRelationshipsOptions();
}); });
} }
ngAfterViewChecked(): void {
this.initListeners();
}
trackId(index: number, item: IEPreguntaCerrada): number {
return item.id!;
}
delete(ePreguntaCerrada: IEPreguntaCerrada): void {
const modalRef = this.modalService.open(EPreguntaCerradaDeleteDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.ePreguntaCerrada = ePreguntaCerrada;
// unsubscribe not needed because closed completes on modal close
modalRef.closed.subscribe(reason => {
if (reason === 'deleted') {
this.loadAll();
}
});
}
initListeners(): void {
const checkboxes = document.getElementsByClassName('ds-survey--checkbox');
for (let i = 0; i < checkboxes.length; i++) {
checkboxes[i].addEventListener('click', e => {
if ((e.target as HTMLInputElement).checked) {
(e.target as HTMLElement).offsetParent!.classList.add('ds-survey--closed-option--active');
} else {
(e.target as HTMLElement).offsetParent!.classList.remove('ds-survey--closed-option--active');
}
});
}
}
previousState(): void { previousState(): void {
window.history.back(); window.history.back();
} }
save(): void { publishSurvey(): void {}
this.isSaving = true;
const encuesta = this.createFromForm(); finishSurvey(): void {}
if (encuesta.id !== undefined) {
this.subscribeToSaveResponse(this.encuestaService.update(encuesta)); addOption(event: any): void {}
} else {
this.subscribeToSaveResponse(this.encuestaService.create(encuesta)); openPreview() {
const surveyId = this.encuesta?.id;
this.router.navigate(['/encuesta', surveyId, 'preview']);
}
resetForm(event: any): void {
this.editForm.reset();
if (event !== null) {
const id = event.target.dataset.id;
this.ePreguntaCerradaService.find(id).subscribe(e => {
this.selectedQuestionToCreateOption = e.body;
});
} }
} }
trackCategoriaById(index: number, item: ICategoria): number { deleteQuestion(event: any) {
const modalRef = this.modalService.open(EncuestaDeleteQuestionDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.closed.subscribe(reason => {
if (reason === 'confirm') {
const id = event.target.dataset.id;
if (event.target.dataset.type) {
// Delete closed question
const questionElement = (event.target as HTMLElement).parentElement?.parentElement;
const optionIdsToDelete: number[] = [];
// Get options IDs
questionElement?.childNodes.forEach((e, i) => {
if (e.nodeName !== 'DIV') return;
if (i === 0) return;
if ((e as HTMLElement).dataset.id === undefined) return;
if (!(e as HTMLElement).classList.contains('can-delete')) return;
let optionId = (e as HTMLElement).dataset.id;
optionIdsToDelete.push(+optionId!);
});
if (optionIdsToDelete.length === 0) {
this.ePreguntaCerradaService.delete(id).subscribe(e => {
this.loadAll();
});
} else {
// Delete question options
this.ePreguntaCerradaOpcionService.deleteMany(optionIdsToDelete).subscribe(e => {
// Delete question
this.ePreguntaCerradaService.delete(id).subscribe(e => {
this.loadAll();
});
});
}
} else {
// Delete open question
this.ePreguntaAbiertaService.delete(id).subscribe(e => {
this.loadAll();
});
}
}
});
}
deleteOption(event: any): void {
const modalRef = this.modalService.open(EncuestaDeleteOptionDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.closed.subscribe(reason => {
if (reason === 'confirm') {
const id = event.target.dataset.optionid;
this.ePreguntaCerradaOpcionService.delete(id).subscribe(e => {
this.ePreguntas = [];
this.ePreguntasOpciones = [];
this.loadAll();
});
}
});
}
save(): void {
this.isSaving = true;
const ePreguntaCerradaOpcion = this.createFromForm();
if (ePreguntaCerradaOpcion.id !== undefined) {
this.subscribeToSaveResponse(this.ePreguntaCerradaOpcionService.update(ePreguntaCerradaOpcion));
} else {
this.subscribeToSaveResponse(
this.ePreguntaCerradaOpcionService.create(ePreguntaCerradaOpcion, this.selectedQuestionToCreateOption?.id!)
);
}
}
trackEPreguntaCerradaById(index: number, item: IEPreguntaCerrada): number {
return item.id!; return item.id!;
} }
trackUsuarioExtraById(index: number, item: IUsuarioExtra): number { protected subscribeToSaveResponse(result: Observable<HttpResponse<IEPreguntaCerradaOpcion>>): void {
return item.id!;
}
protected subscribeToSaveResponse(result: Observable<HttpResponse<IEncuesta>>): void {
result.pipe(finalize(() => this.onSaveFinalize())).subscribe( result.pipe(finalize(() => this.onSaveFinalize())).subscribe(
() => this.onSaveSuccess(), () => this.onSaveSuccess(),
() => this.onSaveError() () => this.onSaveError()
@ -98,7 +297,14 @@ export class EncuestaUpdateComponent implements OnInit {
} }
protected onSaveSuccess(): void { protected onSaveSuccess(): void {
this.previousState(); // this.previousState();
this.resetForm(null);
this.ePreguntas = [];
this.ePreguntasOpciones = [];
this.loadAll();
if (!this.createAnother) {
$('#cancelBtn').click();
}
} }
protected onSaveError(): void { protected onSaveError(): void {
@ -109,79 +315,221 @@ export class EncuestaUpdateComponent implements OnInit {
this.isSaving = false; this.isSaving = false;
} }
protected updateForm(encuesta: IEncuesta): void { protected createFromForm(): IEPreguntaCerradaOpcion {
this.editForm.patchValue({
id: encuesta.id,
nombre: encuesta.nombre,
descripcion: encuesta.descripcion,
fechaCreacion: encuesta.fechaCreacion ? encuesta.fechaCreacion.format(DATE_TIME_FORMAT) : null,
fechaPublicacion: encuesta.fechaPublicacion ? encuesta.fechaPublicacion.format(DATE_TIME_FORMAT) : null,
fechaFinalizar: encuesta.fechaFinalizar ? encuesta.fechaFinalizar.format(DATE_TIME_FORMAT) : null,
fechaFinalizada: encuesta.fechaFinalizada ? encuesta.fechaFinalizada.format(DATE_TIME_FORMAT) : null,
calificacion: encuesta.calificacion,
acceso: encuesta.acceso,
contrasenna: encuesta.contrasenna,
estado: encuesta.estado,
categoria: encuesta.categoria,
usuarioExtra: encuesta.usuarioExtra,
});
this.categoriasSharedCollection = this.categoriaService.addCategoriaToCollectionIfMissing(
this.categoriasSharedCollection,
encuesta.categoria
);
this.usuarioExtrasSharedCollection = this.usuarioExtraService.addUsuarioExtraToCollectionIfMissing(
this.usuarioExtrasSharedCollection,
encuesta.usuarioExtra
);
}
protected loadRelationshipsOptions(): void {
this.categoriaService
.query()
.pipe(map((res: HttpResponse<ICategoria[]>) => res.body ?? []))
.pipe(
map((categorias: ICategoria[]) =>
this.categoriaService.addCategoriaToCollectionIfMissing(categorias, this.editForm.get('categoria')!.value)
)
)
.subscribe((categorias: ICategoria[]) => (this.categoriasSharedCollection = categorias));
this.usuarioExtraService
.query()
.pipe(map((res: HttpResponse<IUsuarioExtra[]>) => res.body ?? []))
.pipe(
map((usuarioExtras: IUsuarioExtra[]) =>
this.usuarioExtraService.addUsuarioExtraToCollectionIfMissing(usuarioExtras, this.editForm.get('usuarioExtra')!.value)
)
)
.subscribe((usuarioExtras: IUsuarioExtra[]) => (this.usuarioExtrasSharedCollection = usuarioExtras));
}
protected createFromForm(): IEncuesta {
return { return {
...new Encuesta(), // ...new EPreguntaCerradaOpcion(),
id: this.editForm.get(['id'])!.value, id: undefined,
nombre: this.editForm.get(['nombre'])!.value, nombre: this.editForm.get(['nombre'])!.value,
descripcion: this.editForm.get(['descripcion'])!.value, orden: 10,
fechaCreacion: this.editForm.get(['fechaCreacion'])!.value cantidad: 0,
? dayjs(this.editForm.get(['fechaCreacion'])!.value, DATE_TIME_FORMAT) ePreguntaCerrada: this.selectedQuestionToCreateOption,
: undefined,
fechaPublicacion: this.editForm.get(['fechaPublicacion'])!.value
? dayjs(this.editForm.get(['fechaPublicacion'])!.value, DATE_TIME_FORMAT)
: undefined,
fechaFinalizar: this.editForm.get(['fechaFinalizar'])!.value
? dayjs(this.editForm.get(['fechaFinalizar'])!.value, DATE_TIME_FORMAT)
: undefined,
fechaFinalizada: this.editForm.get(['fechaFinalizada'])!.value
? dayjs(this.editForm.get(['fechaFinalizada'])!.value, DATE_TIME_FORMAT)
: undefined,
calificacion: this.editForm.get(['calificacion'])!.value,
acceso: this.editForm.get(['acceso'])!.value,
contrasenna: this.editForm.get(['contrasenna'])!.value,
estado: this.editForm.get(['estado'])!.value,
categoria: this.editForm.get(['categoria'])!.value,
usuarioExtra: this.editForm.get(['usuarioExtra'])!.value,
}; };
} }
createAnotherChange(event: any) {
this.createAnother = event.target.checked;
}
createQuestion(): void {
const surveyId = this.encuesta?.id;
console.log(surveyId);
}
protected createFromFormClosedQuestion(): IEPreguntaCerrada {
return {
// ...new EPreguntaCerrada(),
id: undefined,
nombre: this.editFormQuestion.get(['nombre'])!.value,
tipo: this.editFormQuestion.get(['tipo'])!.value,
opcional: this.editFormQuestion.get(['opcional'])!.value,
orden: 10,
encuesta: this.encuesta,
};
}
protected createFromFormOpenQuestion(): IEPreguntaAbierta {
return {
// ...new EPreguntaAbierta(),
id: undefined,
nombre: this.editFormQuestion.get(['nombre'])!.value,
opcional: this.editFormQuestion.get(['opcional'])!.value,
orden: 10,
encuesta: this.encuesta,
};
}
createAnotherQuestionChange(event: any) {
this.createAnotherQuestion = event.target.checked;
}
saveQuestion(): void {
this.isSavingQuestion = true;
const tipoPregunta = this.editFormQuestion.get(['tipopregunta'])!.value;
if (tipoPregunta === 'CLOSED') {
const ePreguntaCerrada = this.createFromFormClosedQuestion();
if (ePreguntaCerrada.id !== undefined) {
this.subscribeToSaveResponseQuestionClosed(this.ePreguntaCerradaService.update(ePreguntaCerrada));
} else {
this.subscribeToSaveResponseQuestionClosed(this.ePreguntaCerradaService.create(ePreguntaCerrada));
}
} else if (tipoPregunta === 'OPEN') {
const ePreguntaAbierta = this.createFromFormOpenQuestion();
if (ePreguntaAbierta.id !== undefined) {
this.subscribeToSaveResponseQuestionOpen(this.ePreguntaAbiertaService.update(ePreguntaAbierta));
} else {
this.subscribeToSaveResponseQuestionOpen(this.ePreguntaAbiertaService.create(ePreguntaAbierta));
}
}
}
protected subscribeToSaveResponseQuestionClosed(result: Observable<HttpResponse<IEPreguntaCerrada>>): void {
result.pipe(finalize(() => this.onSaveFinalizeQuestion())).subscribe(
() => this.onSaveSuccessQuestion(),
() => this.onSaveErrorQuestion()
);
}
protected subscribeToSaveResponseQuestionOpen(result: Observable<HttpResponse<IEPreguntaAbierta>>): void {
result.pipe(finalize(() => this.onSaveFinalizeQuestion())).subscribe(
() => this.onSaveSuccessQuestion(),
() => this.onSaveErrorQuestion()
);
}
protected onSaveSuccessQuestion(): void {
this.editFormQuestion.reset({ tipo: PreguntaCerradaTipo.SINGLE, tipopregunta: 'CLOSED', opcional: false });
this.editForm.reset();
this.ePreguntas = [];
this.ePreguntasOpciones = [];
this.loadAll();
if (!this.createAnotherQuestion) {
$('#cancelBtnQuestion').click();
}
}
protected onSaveErrorQuestion(): void {
// Api for inheritance.
}
protected onSaveFinalizeQuestion(): void {
this.isSavingQuestion = false;
}
// previousState(): void {
// window.history.back();
// }
// save(): void {
// this.isSaving = true;
// const encuesta = this.createFromForm();
// if (encuesta.id !== undefined) {
// this.subscribeToSaveResponse(this.encuestaService.update(encuesta));
// } else {
// this.subscribeToSaveResponse(this.encuestaService.create(encuesta));
// }
// }
trackCategoriaById(index: number, item: ICategoria): number {
return item.id!;
}
trackUsuarioExtraById(index: number, item: IUsuarioExtra): number {
return item.id!;
}
// protected subscribeToSaveResponse(result: Observable<HttpResponse<IEncuesta>>): void {
// result.pipe(finalize(() => this.onSaveFinalize())).subscribe(
// () => this.onSaveSuccess(),
// () => this.onSaveError()
// );
// }
// protected onSaveSuccess(): void {
// this.previousState();
// }
// protected onSaveError(): void {
// // Api for inheritance.
// }
// protected onSaveFinalize(): void {
// this.isSaving = false;
// }
// protected updateForm(encuesta: IEncuesta): void {
// this.editForm.patchValue({
// id: encuesta.id,
// nombre: encuesta.nombre,
// descripcion: encuesta.descripcion,
// fechaCreacion: encuesta.fechaCreacion ? encuesta.fechaCreacion.format(DATE_TIME_FORMAT) : null,
// fechaPublicacion: encuesta.fechaPublicacion ? encuesta.fechaPublicacion.format(DATE_TIME_FORMAT) : null,
// fechaFinalizar: encuesta.fechaFinalizar ? encuesta.fechaFinalizar.format(DATE_TIME_FORMAT) : null,
// fechaFinalizada: encuesta.fechaFinalizada ? encuesta.fechaFinalizada.format(DATE_TIME_FORMAT) : null,
// calificacion: encuesta.calificacion,
// acceso: encuesta.acceso,
// contrasenna: encuesta.contrasenna,
// estado: encuesta.estado,
// categoria: encuesta.categoria,
// usuarioExtra: encuesta.usuarioExtra,
// });
// this.categoriasSharedCollection = this.categoriaService.addCategoriaToCollectionIfMissing(
// this.categoriasSharedCollection,
// encuesta.categoria
// );
// this.usuarioExtrasSharedCollection = this.usuarioExtraService.addUsuarioExtraToCollectionIfMissing(
// this.usuarioExtrasSharedCollection,
// encuesta.usuarioExtra
// );
// }
// protected loadRelationshipsOptions(): void {
// this.categoriaService
// .query()
// .pipe(map((res: HttpResponse<ICategoria[]>) => res.body ?? []))
// .pipe(
// map((categorias: ICategoria[]) =>
// this.categoriaService.addCategoriaToCollectionIfMissing(categorias, this.editForm.get('categoria')!.value)
// )
// )
// .subscribe((categorias: ICategoria[]) => (this.categoriasSharedCollection = categorias));
// this.usuarioExtraService
// .query()
// .pipe(map((res: HttpResponse<IUsuarioExtra[]>) => res.body ?? []))
// .pipe(
// map((usuarioExtras: IUsuarioExtra[]) =>
// this.usuarioExtraService.addUsuarioExtraToCollectionIfMissing(usuarioExtras, this.editForm.get('usuarioExtra')!.value)
// )
// )
// .subscribe((usuarioExtras: IUsuarioExtra[]) => (this.usuarioExtrasSharedCollection = usuarioExtras));
// }
// protected createFromForm(): IEncuesta {
// return {
// ...new Encuesta(),
// id: this.editForm.get(['id'])!.value,
// nombre: this.editForm.get(['nombre'])!.value,
// descripcion: this.editForm.get(['descripcion'])!.value,
// fechaCreacion: this.editForm.get(['fechaCreacion'])!.value
// ? dayjs(this.editForm.get(['fechaCreacion'])!.value, DATE_TIME_FORMAT)
// : undefined,
// fechaPublicacion: this.editForm.get(['fechaPublicacion'])!.value
// ? dayjs(this.editForm.get(['fechaPublicacion'])!.value, DATE_TIME_FORMAT)
// : undefined,
// fechaFinalizar: this.editForm.get(['fechaFinalizar'])!.value
// ? dayjs(this.editForm.get(['fechaFinalizar'])!.value, DATE_TIME_FORMAT)
// : undefined,
// fechaFinalizada: this.editForm.get(['fechaFinalizada'])!.value
// ? dayjs(this.editForm.get(['fechaFinalizada'])!.value, DATE_TIME_FORMAT)
// : undefined,
// calificacion: this.editForm.get(['calificacion'])!.value,
// acceso: this.editForm.get(['acceso'])!.value,
// contrasenna: this.editForm.get(['contrasenna'])!.value,
// estado: this.editForm.get(['estado'])!.value,
// categoria: this.editForm.get(['categoria'])!.value,
// usuarioExtra: this.editForm.get(['usuarioExtra'])!.value,
// };
// }
} }

View File

@ -1,17 +1,14 @@
<div class="row justify-content-center ds-form"> <div class="row justify-content-center ds-form">
<div class="row w-75 mb-4" style="border-bottom: 1px solid #e7ebf3"> <div class="row w-75">
<div class="col-lg-10 mr-lg-5"> <!-- <h2 id="page-heading" data-cy="EncuestaHeading">
<div class="row"> <div class="d-flex flex-sm-row flex-column justify-content-between align-items-center">
<div class="w-100">
<p class="ds-title">Configuración</p>
</div>
<div> <div>
<p class="ds-subtitle">Configuración de parámetros de DataSurvey.</p> <span class="ds-title">Configuración</span>
<p class="ds-subtitle">Configure los parámetros de encuestas de DataSurvey</p>
</div> </div>
</div> </div>
</div> </h2> -->
</div>
<div class="row w-75">
<div class="w-100 alert alert-danger" *ngIf="minDiasIncorrect"> <div class="w-100 alert alert-danger" *ngIf="minDiasIncorrect">
La cantidad mínima de los días, debe ser inferior a la cantidad máxima La cantidad mínima de los días, debe ser inferior a la cantidad máxima
</div> </div>

View File

@ -1,29 +1,23 @@
<form *ngIf="usuarioExtra" name="deleteForm" (ngSubmit)="confirmDelete(usuarioExtra.id!)"> <form class="ds-form" *ngIf="usuarioExtra" name="deleteForm" (ngSubmit)="confirmDelete(usuarioExtra)">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" data-cy="usuarioExtraDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h4> <!--<h4 class="modal-title" data-cy="usuarioExtraDeleteDialogHeading" jhiTranslate="entity.delete.status">Confirm delete operation</h4>-->
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">&times;</button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<jhi-alert-error></jhi-alert-error> <p class="ds-title--small">Cambiar estado</p>
<p class="ds-subtitle" id="jhi-delete-usuarioExtra-heading" jhiTranslate="dataSurveyApp.usuarioExtra.delete.question">
<p Are you sure you want to toggle this user's status?
id="jhi-delete-usuarioExtra-heading"
jhiTranslate="dataSurveyApp.usuarioExtra.delete.question"
[translateValues]="{ id: usuarioExtra.id }"
>
Are you sure you want to delete this Usuario Extra?
</p> </p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="cancel()"> <button type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal" (click)="cancel()">
<fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span> <fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button> </button>
<button id="jhi-confirm-delete-usuarioExtra" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger"> <button id="jhi-confirm-delete-usuarioExtra" data-cy="entityConfirmDeleteButton" type="submit" class="ds-btn ds-btn--danger">
<fa-icon icon="times"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span> <fa-icon [icon]="faExchangeAlt"></fa-icon>
<span jhiTranslate="entity.action.toggleStatus">Cambiar estado</span>
</button> </button>
</div> </div>
</form> </form>

View File

@ -1,65 +0,0 @@
jest.mock('@ng-bootstrap/ng-bootstrap');
import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { of } from 'rxjs';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { UsuarioExtraService } from '../service/usuario-extra.service';
import { UsuarioExtraDeleteDialogComponent } from './usuario-extra-delete-dialog.component';
describe('Component Tests', () => {
describe('UsuarioExtra Management Delete Component', () => {
let comp: UsuarioExtraDeleteDialogComponent;
let fixture: ComponentFixture<UsuarioExtraDeleteDialogComponent>;
let service: UsuarioExtraService;
let mockActiveModal: NgbActiveModal;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [UsuarioExtraDeleteDialogComponent],
providers: [NgbActiveModal],
})
.overrideTemplate(UsuarioExtraDeleteDialogComponent, '')
.compileComponents();
fixture = TestBed.createComponent(UsuarioExtraDeleteDialogComponent);
comp = fixture.componentInstance;
service = TestBed.inject(UsuarioExtraService);
mockActiveModal = TestBed.inject(NgbActiveModal);
});
describe('confirmDelete', () => {
it('Should call delete service on confirmDelete', inject(
[],
fakeAsync(() => {
// GIVEN
jest.spyOn(service, 'delete').mockReturnValue(of(new HttpResponse({})));
// WHEN
comp.confirmDelete(123);
tick();
// THEN
expect(service.delete).toHaveBeenCalledWith(123);
expect(mockActiveModal.close).toHaveBeenCalledWith('deleted');
})
));
it('Should not call delete service on clear', () => {
// GIVEN
jest.spyOn(service, 'delete');
// WHEN
comp.cancel();
// THEN
expect(service.delete).not.toHaveBeenCalled();
expect(mockActiveModal.close).not.toHaveBeenCalled();
expect(mockActiveModal.dismiss).toHaveBeenCalled();
});
});
});
});

View File

@ -3,11 +3,16 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { IUsuarioExtra } from '../usuario-extra.model'; import { IUsuarioExtra } from '../usuario-extra.model';
import { UsuarioExtraService } from '../service/usuario-extra.service'; import { UsuarioExtraService } from '../service/usuario-extra.service';
import { EstadoUsuario } from '../../enumerations/estado-usuario.model';
import { faExchangeAlt } from '@fortawesome/free-solid-svg-icons';
@Component({ @Component({
templateUrl: './usuario-extra-delete-dialog.component.html', templateUrl: './usuario-extra-delete-dialog.component.html',
}) })
export class UsuarioExtraDeleteDialogComponent { export class UsuarioExtraDeleteDialogComponent {
faExchangeAlt = faExchangeAlt;
usuarioExtra?: IUsuarioExtra; usuarioExtra?: IUsuarioExtra;
constructor(protected usuarioExtraService: UsuarioExtraService, protected activeModal: NgbActiveModal) {} constructor(protected usuarioExtraService: UsuarioExtraService, protected activeModal: NgbActiveModal) {}
@ -16,8 +21,13 @@ export class UsuarioExtraDeleteDialogComponent {
this.activeModal.dismiss(); this.activeModal.dismiss();
} }
confirmDelete(id: number): void { confirmDelete(usuarioExtra: IUsuarioExtra): void {
this.usuarioExtraService.delete(id).subscribe(() => { if (usuarioExtra.estado == EstadoUsuario.ACTIVE) {
usuarioExtra.estado = EstadoUsuario.SUSPENDED;
} else {
usuarioExtra.estado = EstadoUsuario.ACTIVE;
}
this.usuarioExtraService.updateEstado(usuarioExtra).subscribe(() => {
this.activeModal.close('deleted'); this.activeModal.close('deleted');
}); });
} }

View File

@ -1,6 +1,9 @@
<div> <div>
<h2 id="page-heading" data-cy="UsuarioExtraHeading"> <h2 id="page-heading" data-cy="UsuarioExtraHeading">
<span jhiTranslate="dataSurveyApp.usuarioExtra.home.title">Usuarios</span> <div>
<span class="ds-title" jhiTranslate="dataSurveyApp.usuarioExtra.home.title">Usuarios</span>
<p class="ds-subtitle">Administre los usuarios registrados en la aplicación</p>
</div>
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
<button id="jh-create-entity" data-cy="entityCreateButton" class="ds-btn ds-btn--primary" [routerLink]="['/usuario-extra/new']"> <button id="jh-create-entity" data-cy="entityCreateButton" class="ds-btn ds-btn--primary" [routerLink]="['/usuario-extra/new']">
@ -12,12 +15,33 @@
<jhi-alert-error></jhi-alert-error> <jhi-alert-error></jhi-alert-error>
<jhi-alert></jhi-alert> <div *ngIf="successChange" class="alert alert-success alert-dismissible fade show" role="alert">
El estado del usuario fue modificado correctamente
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="alert alert-warning" id="no-result" *ngIf="usuarioExtras?.length === 0"> <div class="alert alert-warning" id="no-result" *ngIf="usuarioExtras?.length === 0">
<span jhiTranslate="dataSurveyApp.usuarioExtra.home.notFound">No usuarioExtras found</span> <span jhiTranslate="dataSurveyApp.usuarioExtra.home.notFound">No usuarioExtras found</span>
</div> </div>
<form class="ds-form d-inline">
<div class="input-group">
<div class="ds-filter">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<input type="text" name="searchNombreUsuario" placeholder="Buscar por nombre..." [(ngModel)]="searchNombreUsuario" />
</div>
<div class="ds-filter">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<select name="searchEstadoUsuario" id="searchEstadoUsuario" [(ngModel)]="searchEstadoUsuario" style="width: 200px">
<option value="" selected="selected" disabled="disabled">Filtrar por estado</option>
<option value="">Todos Estados</option>
<option value="Active">Activos</option>
<option value="Suspended">Bloqueados</option>
</select>
</div>
</div>
</form>
<div class="table-responsive" id="entities" *ngIf="usuarioExtras && usuarioExtras.length > 0"> <div class="table-responsive" id="entities" *ngIf="usuarioExtras && usuarioExtras.length > 0">
<table class="table table-striped" aria-describedby="page-heading"> <table class="table table-striped" aria-describedby="page-heading">
<thead> <thead>
@ -26,13 +50,20 @@
<th scope="col"><span jhiTranslate="dataSurveyApp.usuarioExtra.iconoPerfil">Icono</span></th> <th scope="col"><span jhiTranslate="dataSurveyApp.usuarioExtra.iconoPerfil">Icono</span></th>
<th scope="col"><span jhiTranslate="dataSurveyApp.usuarioExtra.nombre">Nombre Usuario</span></th> <th scope="col"><span jhiTranslate="dataSurveyApp.usuarioExtra.nombre">Nombre Usuario</span></th>
<th scope="col"><span jhiTranslate="dataSurveyApp.usuarioExtra.correo">Correo electrónico</span></th> <th scope="col"><span jhiTranslate="dataSurveyApp.usuarioExtra.correo">Correo electrónico</span></th>
<th scope="col"><span>Fecha de nacimiento</span></th>
<th scope="col"><span jhiTranslate="dataSurveyApp.usuarioExtra.estado">Estado</span></th> <th scope="col"><span jhiTranslate="dataSurveyApp.usuarioExtra.estado">Estado</span></th>
<!--<th scope="col"><span jhiTranslate="dataSurveyApp.usuarioExtra.plantilla">Plantilla</span></th>--> <!--<th scope="col"><span jhiTranslate="dataSurveyApp.usuarioExtra.plantilla">Plantilla</span></th>-->
<th scope="col"></th> <th scope="col"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let usuarioExtra of usuarioExtras; trackBy: trackId" data-cy="entityTable"> <tr
*ngFor="
let usuarioExtra of usuarioExtras | filter: 'nombre':searchNombreUsuario | filter: 'estado':searchEstadoUsuario;
trackBy: trackId
"
data-cy="entityTable"
>
<td *ngIf="usuarioExtra.user"> <td *ngIf="usuarioExtra.user">
<ul class="listRoles"> <ul class="listRoles">
<li *ngFor="let userRole of usuarioExtra.user.authorities"> <li *ngFor="let userRole of usuarioExtra.user.authorities">
@ -45,6 +76,8 @@
</td> </td>
<td>{{ usuarioExtra.nombre }}</td> <td>{{ usuarioExtra.nombre }}</td>
<td *ngIf="usuarioExtra.user">{{ usuarioExtra.user.email }}</td> <td *ngIf="usuarioExtra.user">{{ usuarioExtra.user.email }}</td>
<td *ngIf="usuarioExtra.fechaNacimiento == null">No establecida</td>
<td *ngIf="usuarioExtra.fechaNacimiento != null">{{ usuarioExtra.fechaNacimiento | formatMediumDate }}</td>
<td jhiTranslate="{{ 'dataSurveyApp.EstadoUsuario.' + usuarioExtra.estado }}">{{ usuarioExtra.estado }}</td> <td jhiTranslate="{{ 'dataSurveyApp.EstadoUsuario.' + usuarioExtra.estado }}">{{ usuarioExtra.estado }}</td>
<!--<td> <!--<td>
<span *ngFor="let plantilla of usuarioExtra.plantillas; let last = last"> <span *ngFor="let plantilla of usuarioExtra.plantillas; let last = last">
@ -52,7 +85,7 @@
>{{ last ? '' : ', ' }} >{{ last ? '' : ', ' }}
</span> </span>
</td>--> </td>-->
<td class="text-center"> <td class="text-right">
<div class="btn-group"> <div class="btn-group">
<button <button
type="submit" type="submit"
@ -60,13 +93,12 @@
class="ds-btn ds-btn--primary btn-sm" class="ds-btn ds-btn--primary btn-sm"
data-cy="entityDetailsButton" data-cy="entityDetailsButton"
> >
<fa-icon icon="eye"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span> <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
</button> </button>
&nbsp;&nbsp;
<button type="submit" (click)="delete(usuarioExtra)" class="ds-btn ds-btn--danger btn-sm" data-cy="entityDeleteButton"> <button type="submit" (click)="delete(usuarioExtra)" class="ds-btn ds-btn--danger" data-cy="entityDeleteButton">
<fa-icon icon="times"></fa-icon> <fa-icon [icon]="faExchangeAlt"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span> <span class="d-none d-md-inline" jhiTranslate="entity.action.toggleStatus">Toggle Status</span>
</button> </button>
</div> </div>
</td> </td>

View File

@ -8,17 +8,27 @@ import { UsuarioExtraDeleteDialogComponent } from '../delete/usuario-extra-delet
import { IUser } from '../../user/user.model'; import { IUser } from '../../user/user.model';
import { finalize } from 'rxjs/operators'; import { finalize } from 'rxjs/operators';
import { faExchangeAlt } from '@fortawesome/free-solid-svg-icons';
@Component({ @Component({
selector: 'jhi-usuario-extra', selector: 'jhi-usuario-extra',
templateUrl: './usuario-extra.component.html', templateUrl: './usuario-extra.component.html',
styleUrls: ['./usuario-extra.component.scss'], styleUrls: ['./usuario-extra.component.scss'],
}) })
export class UsuarioExtraComponent implements OnInit { export class UsuarioExtraComponent implements OnInit {
faExchangeAlt = faExchangeAlt;
usuarioExtras?: IUsuarioExtra[]; usuarioExtras?: IUsuarioExtra[];
publicUsers?: IUser[]; publicUsers?: IUser[];
isLoading = false; isLoading = false;
successChange = false;
public searchNombreUsuario: string;
public searchEstadoUsuario: string;
constructor(protected usuarioExtraService: UsuarioExtraService, protected modalService: NgbModal) {} constructor(protected usuarioExtraService: UsuarioExtraService, protected modalService: NgbModal) {
this.searchNombreUsuario = '';
this.searchEstadoUsuario = '';
}
loadPublicUser(): void { loadPublicUser(): void {
this.usuarioExtraService this.usuarioExtraService
@ -60,6 +70,8 @@ export class UsuarioExtraComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.searchNombreUsuario = '';
this.searchEstadoUsuario = '';
this.loadAll(); this.loadAll();
} }
@ -73,6 +85,7 @@ export class UsuarioExtraComponent implements OnInit {
// unsubscribe not needed because closed completes on modal close // unsubscribe not needed because closed completes on modal close
modalRef.closed.subscribe(reason => { modalRef.closed.subscribe(reason => {
if (reason === 'deleted') { if (reason === 'deleted') {
this.successChange = true;
this.loadAll(); this.loadAll();
} }
}); });

View File

@ -18,6 +18,7 @@ export type EntityArrayUserPublicResponseType = HttpResponse<IUser[]>;
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class UsuarioExtraService { export class UsuarioExtraService {
protected resourceUrl = this.applicationConfigService.getEndpointFor('api/usuario-extras'); protected resourceUrl = this.applicationConfigService.getEndpointFor('api/usuario-extras');
protected resourceUrlEstado = this.applicationConfigService.getEndpointFor('api/usuario-extras-estado');
protected resourceUrlPublicUser = this.applicationConfigService.getEndpointFor('api'); protected resourceUrlPublicUser = this.applicationConfigService.getEndpointFor('api');
constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {} constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
@ -36,6 +37,13 @@ export class UsuarioExtraService {
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res))); .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
} }
updateEstado(usuarioExtra: IUsuarioExtra): Observable<EntityResponseType> {
const copy = this.convertDateFromClient(usuarioExtra);
return this.http
.put<IUsuarioExtra>(`${this.resourceUrlEstado}/${getUsuarioExtraIdentifier(usuarioExtra) as number}`, copy, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
partialUpdate(usuarioExtra: IUsuarioExtra): Observable<EntityResponseType> { partialUpdate(usuarioExtra: IUsuarioExtra): Observable<EntityResponseType> {
const copy = this.convertDateFromClient(usuarioExtra); const copy = this.convertDateFromClient(usuarioExtra);
return this.http return this.http

View File

@ -1,78 +1,275 @@
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col">
<span class="hipster img-fluid rounded"></span> <div class="container-fluid navbar navbar-marketing navbar-expand-lg bg-white navbar-light">
</div> <div class="container px-5 py-4">
<a class="text-dark" routerLink="login"
><img src="http://datasurvey.org/content/img_datasurvey/datasurvey-logo-text-black.svg" width="300" alt=""
/></a>
<div class="col-md-9"> <div class="col-6" style="text-align: end">
<h1 class="display-4"><span jhiTranslate="home.title">Welcome, Java Hipster!</span> (Data Survey)</h1> <!--<a href="#">
<button class="ds-btn ds-btn&#45;&#45;primary fw-500 ms-lg-4">Encuestas</button>
</a>-->
<a routerLink="login" [hidden]="!notAccount">
<button class="ds-btn ds-btn--primary fw-500 ms-lg-4">Iniciar Sesión</button>
</a>
<p class="lead" jhiTranslate="home.subtitle">This is your homepage</p> <a routerLink="account/register" [hidden]="!notAccount">
<button class="ds-btn ds-btn--primary fw-500 ms-lg-4">Registrarse</button>
<div [ngSwitch]="account !== null"> </a>
<div class="alert alert-success" *ngSwitchCase="true"> </div>
<span id="home-logged-message" *ngIf="account" jhiTranslate="home.logged.message" [translateValues]="{ username: account.login }"
>You are logged in as user "{{ account.login }}".</span
>
</div>
<div class="alert alert-warning" *ngSwitchCase="false">
<span jhiTranslate="global.messages.info.authenticated.prefix">If you want to </span>
<a class="alert-link" (click)="login()" jhiTranslate="global.messages.info.authenticated.link">sign in</a
><span jhiTranslate="global.messages.info.authenticated.suffix"
>, you can try the default accounts:<br />- Administrator (login="admin" and password="admin") <br />- User (login="user" and
password="user").</span
>
</div>
<div class="alert alert-warning" *ngSwitchCase="false">
<span jhiTranslate="global.messages.info.register.noaccount">You don't have an account yet?</span>&nbsp;
<a class="alert-link" routerLink="account/register" jhiTranslate="global.messages.info.register.link">Register a new account</a>
</div> </div>
</div> </div>
<!-- Page Header-->
<div
class="page-header-ui page-header-ui-dark bg-img-cover overlay overlay-40"
style="background-image: url('../../content/img_datasurvey/banner2.png')"
>
<div class="page-header-ui-content py-5 position-relative">
<div class="container px-5">
<div class="row gx-5 justify-content-center">
<div class="col-xl-8 col-lg-10 text-center">
<div data-aos="fade-up">
<h1 class="page-header-ui-title">¡Le damos la bienvenida a DataSurvey!</h1>
<h5 class="page-header-ui-text">
Somos su mejor aliado para la recolección de información, a través de nuestra plataforma
</h5>
<div class="row" [hidden]="!notAccount">
<div class="col">
<a routerLink="/login">
<button class="ds-btn ds-btn--primary fw-500 ms-lg-4">Comenzar</button>
</a>
</div>
</div>
</div>
<!--<div class="row">
<div class="col">
<a routerLink="/login">
<button class="ds-btn ds-btn--primary fw-500 ms-lg-4">Iniciar Sesión</button>
</a>
<a routerLink="/account/register">
<button class="ds-btn ds-btn--primary fw-500 ms-lg-4">Registrarse</button>
</a>
</div>
</div>-->
</div>
</div>
</div>
</div>
<div class="svg-border-rounded text-white">
<!-- Rounded SVG Border-->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144.54 17.34" preserveAspectRatio="none" fill="currentColor">
<path d="M144.54,17.34H0V0H144.54ZM0,0S32.36,17.34,72.27,17.34,144.54,0,144.54,0"></path>
</svg>
</div>
</div>
<div class="bg-white py-10" id="get-started">
<div class="container px-5">
<div class="row gx-5 text-center">
<div class="col-lg-4 mb-5 mb-lg-0">
<div class="icon-stack icon-stack-xl bg-gradient-primary-to-secondary text-white mb-4"><i class="fa fa-droplet"></i></div>
<h2>Diseño amigable</h2>
<hr />
<p class="mb-0">Contamos con una interfaz fácil de utilizar</p>
</div>
<div class="col-lg-4 mb-5 mb-lg-0">
<div class="icon-stack icon-stack-xl bg-gradient-primary-to-secondary text-white mb-4"><i class="fa fa-code"></i></div>
<h2>Fácil uso</h2>
<hr />
<p class="mb-0">Contamos con una plataforma muy sencilla de usar</p>
</div>
<div class="col-lg-4">
<div class="icon-stack icon-stack-xl bg-gradient-primary-to-secondary text-white mb-4"><i class="fa fa-truck"></i></div>
<h2>Diverso contenido</h2>
<hr />
<p class="mb-0">Podrá encontrar y crear encuestas de diferentes categorías</p>
</div>
</div>
</div>
<div class="svg-border-rounded text-light">
<!-- Rounded SVG Border-->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144.54 17.34" preserveAspectRatio="none" fill="currentColor">
<path d="M144.54,17.34H0V0H144.54ZM0,0S32.36,17.34,72.27,17.34,144.54,0,144.54,0"></path>
</svg>
</div>
</div>
<div class="bg-light py-10 container-encuestas">
<div class="container px-0">
<h1 class="text-center mb-4">Encuestas</h1>
<div class="row gx-5" *ngIf="encuestas && encuestas.length > 0">
<div class="col-xl-4 col-lg-4 col-md-6 mb-5" *ngFor="let encuesta of encuestasMostradas; trackBy: trackId">
<div
class="card-encuesta lift h-100"
(dblclick)="openSurvey($event)"
(click)="selectSurvey($event)"
[attr.data-id]="encuesta.id"
>
<div class="card-body p-3">
<div class="card-title mb-0">{{ encuesta.nombre }}</div>
<div class="entity-body--row m-2">
<span class="tag mt-2">{{ encuesta.categoria?.nombre | lowercase }}</span>
</div>
<div class="entity-body--row m-2">
<span class="subtitle mt-2">{{ encuesta.descripcion | titlecase }}</span>
</div>
<div class="text-xs text-gray-500">
<div class="entity-body">
<div class="entity-body--row m-2">
<span class="mt-2"
>Fecha Publicada&nbsp;&nbsp;<fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon>&nbsp;&nbsp;{{
encuesta.fechaPublicacion | formatShortDatetime | titlecase
}}</span
>
</div>
<div class="entity-body--row m-2">
<span class="mt-2"
>Fecha de Finalización &nbsp;&nbsp;<fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon
>&nbsp;&nbsp;{{ encuesta.fechaFinalizar | formatShortDatetime | titlecase }}</span
>
</div>
<div class="entity-body--row m-2">
<p>Calificacion</p>
<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 class="entity-body--row m-2">
<button class="ds-btn btn-card"><fa-icon [icon]="faPollH"></fa-icon>&nbsp;&nbsp;Completar encuesta</button>
</div>
</div>
</div>
</div>
</div>
</div>
<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 class="container my-5">
<div class="text-center mb-4">
<h1>Preguntas frecuentes</h1>
</div>
<p jhiTranslate="home.question">If you have any question on JHipster:</p> <!--Accordion wrapper-->
<div class="accordion md-accordion" id="accordionEx" role="tablist" aria-multiselectable="true">
<!-- Accordion card -->
<div class="card accordion-item">
<!-- Card header -->
<div class="card-header" role="tab" id="headingOne1">
<a
data-toggle="collapse"
data-parent="#accordionEx"
href="#collapseOne1"
aria-expanded="true"
aria-controls="collapseOne1"
class="accordion-header"
>
<h2 class="mb-0">
<button
class="accordion-button py-4 collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapseOne1"
aria-expanded="true"
aria-controls="collapseOne"
>
¿Qué métodos de pago están disponibles en DataSurvey?
</button>
</h2>
</a>
</div>
<ul> <!-- Card body -->
<li> <div id="collapseOne1" class="collapse show" role="tabpanel" aria-labelledby="headingOne1" data-parent="#accordionEx">
<a href="https://www.jhipster.tech/" target="_blank" rel="noopener noreferrer" jhiTranslate="home.link.homepage" <div class="card-body">DataSurvey utiliza PayPal como método de pago para la compra de plantillas</div>
>JHipster homepage</a </div>
> </div>
</li> <!-- Accordion card -->
<li>
<a
href="https://stackoverflow.com/tags/jhipster/info"
target="_blank"
rel="noopener noreferrer"
jhiTranslate="home.link.stackoverflow"
>JHipster on Stack Overflow</a
>
</li>
<li>
<a
href="https://github.com/jhipster/generator-jhipster/issues?state=open"
target="_blank"
rel="noopener noreferrer"
jhiTranslate="home.link.bugtracker"
>JHipster bug tracker</a
>
</li>
<li>
<a href="https://gitter.im/jhipster/generator-jhipster" target="_blank" rel="noopener noreferrer" jhiTranslate="home.link.chat"
>JHipster public chat room</a
>
</li>
<li>
<a href="https://twitter.com/jhipster" target="_blank" rel="noopener noreferrer" jhiTranslate="home.link.follow"
>follow @jhipster on Twitter</a
>
</li>
</ul>
<p> <!-- Accordion card -->
<span jhiTranslate="home.like">If you like JHipster, don't forget to give us a star on</span> <div class="card accordion-item">
<a href="https://github.com/jhipster/generator-jhipster" target="_blank" rel="noopener noreferrer" jhiTranslate="home.github" <!-- Card header -->
>GitHub</a <div class="card-header" role="tab" id="headingTwo2">
>! <a
</p> data-toggle="collapse"
data-parent="#accordionEx"
href="#collapseTwo2"
aria-expanded="true"
aria-controls="collapseTwo2"
class="accordion-header"
>
<h2 class="mb-0">
<button
class="accordion-button py-4 collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapseTwo2"
aria-expanded="true"
aria-controls="collapseTwo"
>
¿Debo iniciar sesión o registrarme para poder completar encuestas?
</button>
</h2>
</a>
</div>
<!-- Card body -->
<div id="collapseTwo2" class="collapse" role="tabpanel" aria-labelledby="headingTwo2" data-parent="#accordionEx">
<div class="card-body">
Uno de los objetivos de DataSurvey es que se puedan compartir las encuestas con todos los usuarios, sin necesidad de tener una
cuenta en la plataforma
</div>
</div>
</div>
<!-- Accordion card -->
<!-- Accordion card -->
<div class="card">
<!-- Card header -->
<!-- Card header -->
<div class="card-header" role="tab" id="headingThree3">
<a
data-toggle="collapse"
data-parent="#accordionEx"
href="#collapseThree3"
aria-expanded="true"
aria-controls="collapseThree3"
class="accordion-header"
>
<h2 class="mb-0">
<button
class="accordion-button py-4 collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapseThree3"
aria-expanded="true"
aria-controls="collapseThree"
>
¿Cómo comparto una encuesta?
</button>
</h2>
</a>
</div>
<!-- Card body -->
<div id="collapseThree3" class="collapse" role="tabpanel" aria-labelledby="headingThree3" data-parent="#accordionEx">
<div class="card-body">
La plataforma tiene dos tipos de encuestas: públicas y privadas. Las públicas pueden ser compartidas con todo tipo de usuario,
sin ninguna excepción, mientras que las encuestas privadas, necesitan de una clave para poder ser accesadas
</div>
</div>
</div>
<!-- Accordion card -->
</div>
<!-- Accordion wrapper -->
</div>
</div> </div>
</div> </div>

View File

@ -10,6 +10,201 @@ Main page styles
background-size: contain; background-size: contain;
} }
.bg-img-cover {
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
.overlay {
position: relative;
}
.overlay:before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #000;
opacity: 0.5;
}
.overlay-10:before {
opacity: 0.1;
}
.overlay-20:before {
opacity: 0.2;
}
.overlay-30:before {
opacity: 0.3;
}
.overlay-40:before {
opacity: 0.4;
}
.overlay-50:before {
opacity: 0.5;
}
.overlay-60:before {
opacity: 0.6;
}
.overlay-70:before {
opacity: 0.7;
}
.overlay-80:before {
opacity: 0.8;
}
.overlay-90:before {
opacity: 0.9;
}
.fixed-top,
.page-header-ui.navbar-fixed .navbar {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 1030;
}
.text-white-75,
.page-header-ui-dark .page-header-ui-text a {
color: rgba(255, 255, 255, 0.75) !important;
}
.page-header-ui {
position: relative;
padding-top: 8rem;
padding-bottom: 8rem;
}
.page-header-ui .page-header-ui-content .page-header-ui-title {
font-size: 2.5rem;
}
.page-header-ui .page-header-ui-content .page-header-ui-text {
font-size: 1.15rem;
}
.page-header-ui .page-header-ui-content .page-header-ui-text.small {
font-size: 0.9rem;
}
.page-header-ui-dark {
color: #fff;
background-color: #212832;
}
.svg-border-rounded svg {
position: absolute;
bottom: 0;
left: 0;
height: 1rem;
width: 100%;
}
@media (min-width: 576px) {
.svg-border-rounded svg {
height: 1.5rem;
}
}
@media (min-width: 768px) {
.svg-border-rounded svg {
height: 2rem;
}
}
@media (min-width: 992px) {
.svg-border-rounded svg {
height: 2.5rem;
}
}
@media (min-width: 1200px) {
.svg-border-rounded svg {
height: 3rem;
}
}
/**
Cards
**/
.lift {
box-shadow: 0 0.15rem 1.75rem 0 rgba(33, 40, 50, 0.15);
transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.lift:hover {
transform: translateY(-0.3333333333rem);
box-shadow: 0 0.5rem 2rem 0 rgba(33, 40, 50, 0.25);
}
.lift:active {
transform: none;
box-shadow: 0 0.15rem 1.75rem 0 rgba(33, 40, 50, 0.15);
}
.lift-sm {
box-shadow: 0 0.125rem 0.25rem 0 rgba(33, 40, 50, 0.2);
}
.lift-sm:hover {
transform: translateY(-0.1666666667rem);
box-shadow: 0 0.25rem 1rem 0 rgba(33, 40, 50, 0.25);
}
.lift-sm:active {
transform: none;
box-shadow: 0 0.125rem 0.25rem 0 rgba(33, 40, 50, 0.2);
}
/*.card.lift {
text-decoration: none;
color: inherit;
}
.card-flag {
position: absolute;
font-size: 0.7rem;
padding: 0.3rem 0.5rem;
line-height: 1;
}
.card-flag-dark {
background-color: rgba(33, 40, 50, 0.7);
color: #fff;
}
.card-flag-light {
background-color: rgba(255, 255, 255, 0.7);
color: #69707a;
}
.card-flag-lg {
font-size: 0.9rem;
padding: 0.5rem 0.65rem;
}
.card-flag-top-right {
border-top-left-radius: 0.25rem;
border-bottom-left-radius: 0.25rem;
top: 0.5rem;
right: 0;
}
.card-flag-top-left {
border-top-right-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
top: 0.5rem;
left: 0;
}*/
.border-cyan {
border-color: #00cfd5 !important;
}
.py-10 {
padding-top: 6rem !important;
padding-bottom: 6rem !important;
}
/* wait autoprefixer update to allow simple generation of high pixel density media query */ /* wait autoprefixer update to allow simple generation of high pixel density media query */
@media only screen and (-webkit-min-device-pixel-ratio: 2), @media only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (-moz-min-device-pixel-ratio: 2), only screen and (-moz-min-device-pixel-ratio: 2),
@ -21,3 +216,199 @@ Main page styles
background-size: contain; background-size: contain;
} }
} }
.icon-stack {
display: inline-flex;
justify-content: center;
align-items: center;
border-radius: 100%;
height: 2.5rem;
width: 2.5rem;
font-size: 1rem;
background-color: #f2f6fc;
flex-shrink: 0;
}
.icon-stack svg {
height: 1rem;
width: 1rem;
}
.icon-stack-sm {
height: 2rem;
width: 2rem;
}
.icon-stack-lg {
height: 4rem;
width: 4rem;
font-size: 1.5rem;
}
.icon-stack-lg svg {
height: 1.5rem;
width: 1.5rem;
}
.icon-stack-xl {
height: 5rem;
width: 5rem;
font-size: 1.75rem;
}
.icon-stack-xl svg {
height: 1.75rem;
width: 1.75rem;
}
.container-encuestas {
background-image: url('../../content/img_datasurvey/background encuestas landing.png');
max-height: 1536px;
overflow-y: auto;
}
.bg-gradient-primary-to-secondary {
background-color: #1c44b2 !important;
background-image: linear-gradient(135deg, #1c44b2 0%, #00b88d 100%) !important;
}
/*.card .entity-icon--star {
color: #ffcc47;
margin-right: 0.2rem;
}
.card .card-title {
font-size: 2em;
}
.card .tag {
font-size: 0.8rem;
color: #f8f8f8;
margin-top: 0.5rem;
padding: 0.2rem 1.5rem;
background-color: #2962ff94;
border-radius: 15px;
}
.card .subtitle {
color: rgba(0, 0, 0, 0.54);
font-size: 0.9rem;
}
.card .btn-card {
padding: 11px 10px !important;
}*/
.accordion-button {
position: relative;
display: flex;
align-items: center;
width: 100%;
padding: 1rem 1.25rem;
font-size: 1rem;
color: #69707a;
text-align: left;
background-color: #fff;
border: 0;
border-radius: 0;
overflow-anchor: none;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out,
border-radius 0.15s ease;
}
@media (prefers-reduced-motion: reduce) {
.accordion-button {
transition: none;
}
}
.accordion-button:not(.collapsed) {
color: #0057da;
background-color: #e6effe;
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.125);
}
.accordion-button:not(.collapsed)::after {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230057da'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
transform: rotate(-180deg);
}
.accordion-button::after {
flex-shrink: 0;
width: 1.25rem;
height: 1.25rem;
margin-left: auto;
content: '';
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2369707a'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
background-repeat: no-repeat;
background-size: 1.25rem;
transition: transform 0.2s ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
.accordion-button::after {
transition: none;
}
}
.accordion-button:hover {
z-index: 2;
}
.accordion-button:focus {
z-index: 3;
border-color: transparent;
outline: 0;
box-shadow: 0 0 0 0.25rem #00b88d3a;
}
.accordion-header {
margin-bottom: 0;
}
.accordion-item {
background-color: #fff;
border: 1px solid rgba(0, 0, 0, 0.125);
}
.accordion-item:first-of-type {
border-top-left-radius: 0.35rem;
border-top-right-radius: 0.35rem;
}
.accordion-item:first-of-type .accordion-button {
border-top-left-radius: calc(0.35rem - 1px);
border-top-right-radius: calc(0.35rem - 1px);
}
.accordion-item:not(:first-of-type) {
border-top: 0;
}
.accordion-item:last-of-type {
border-bottom-right-radius: 0.35rem;
border-bottom-left-radius: 0.35rem;
}
.accordion-item:last-of-type .accordion-button.collapsed {
border-bottom-right-radius: calc(0.35rem - 1px);
border-bottom-left-radius: calc(0.35rem - 1px);
}
.accordion-item:last-of-type .accordion-collapse {
border-bottom-right-radius: 0.35rem;
border-bottom-left-radius: 0.35rem;
}
.accordion-body {
padding: 1rem 1.25rem;
}
.accordion-flush .accordion-collapse {
border-width: 0;
}
.accordion-flush .accordion-item {
border-right: 0;
border-left: 0;
border-radius: 0;
}
.accordion-flush .accordion-item:first-child {
border-top: 0;
}
.accordion-flush .accordion-item:last-child {
border-bottom: 0;
}
.accordion-flush .accordion-item .accordion-button {
border-radius: 0;
}
.card-header {
padding: 0;
}
.card-header .collapsed {
background-color: #e6effe;
}

View File

@ -1,11 +1,26 @@
import { Component, OnInit, OnDestroy } from '@angular/core'; import { Component, OnInit, OnDestroy } from '@angular/core';
import { HttpResponse } from '@angular/common/http';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { IEncuesta } from 'app/entities/encuesta/encuesta.model';
import { EncuestaService } from 'app/entities/encuesta/service/encuesta.service';
import { FormBuilder } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { ICategoria } from 'app/entities/categoria/categoria.model';
import { CategoriaService } from 'app/entities/categoria/service/categoria.service';
import { IUsuarioExtra, UsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model';
import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-extra.service';
import { AccountService } from 'app/core/auth/account.service'; 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 { faPollH, faCalendarAlt, faStar } from '@fortawesome/free-solid-svg-icons';
import * as $ from 'jquery';
@Component({ @Component({
selector: 'jhi-home', selector: 'jhi-home',
templateUrl: './home.component.html', templateUrl: './home.component.html',
@ -13,16 +28,48 @@ import { Account } from 'app/core/auth/account.model';
}) })
export class HomeComponent implements OnInit, OnDestroy { export class HomeComponent implements OnInit, OnDestroy {
account: Account | null = null; account: Account | null = null;
private readonly destroy$ = new Subject<void>(); private readonly destroy$ = new Subject<void>();
constructor(private accountService: AccountService, private router: Router) {} usuarioExtra: UsuarioExtra | null = null;
encuestas?: IEncuesta[];
encuestasMostradas: IEncuesta[] = new Array(3);
isLoading = false;
faStar = faStar;
faCalendarAlt = faCalendarAlt;
faPollH = faPollH;
notAccount: boolean = true;
public searchEncuestaPublica: string;
constructor(
protected encuestaService: EncuestaService,
protected modalService: NgbModal,
protected categoriaService: CategoriaService,
protected usuarioExtraService: UsuarioExtraService,
protected activatedRoute: ActivatedRoute,
protected fb: FormBuilder,
protected accountService: AccountService,
protected router: Router
) {
this.searchEncuestaPublica = '';
}
ngOnInit(): void { ngOnInit(): void {
this.searchEncuestaPublica = '';
this.accountService this.accountService
.getAuthenticationState() .getAuthenticationState()
.pipe(takeUntil(this.destroy$)) .pipe(takeUntil(this.destroy$))
.subscribe(account => (this.account = account)); .subscribe(account => {
if (account !== null) {
this.account = account;
this.notAccount = false;
} else {
this.notAccount = true;
}
});
this.loadAll();
} }
login(): void { login(): void {
@ -33,4 +80,44 @@ export class HomeComponent implements OnInit, OnDestroy {
this.destroy$.next(); this.destroy$.next();
this.destroy$.complete(); this.destroy$.complete();
} }
ngAfterViewInit(): void {}
trackId(index: number, item: IEncuesta): number {
return item.id!;
}
loadAll(): void {
this.isLoading = true;
this.encuestaService.query().subscribe(
(res: HttpResponse<IEncuesta[]>) => {
this.isLoading = false;
const tmpEncuestas = res.body ?? [];
this.encuestas = tmpEncuestas.filter(e => e.estado === 'ACTIVE' && e.acceso === 'PUBLIC');
this.encuestasMostradas = this.encuestas.reverse().slice(0, 3);
},
() => {
this.isLoading = false;
}
);
}
openSurvey(event: any): void {
const surveyId = event.target.getAttribute('data-id');
this.router.navigate(['/encuesta', surveyId, 'edit']);
}
selectSurvey(event: any): void {
document.querySelectorAll('.ds-list--entity').forEach(e => {
e.classList.remove('active');
});
if (event.target.classList.contains('ds-list--entity')) {
event.target.classList.add('active');
}
}
counter(i: number) {
return new Array(i);
}
} }

View File

@ -4,9 +4,10 @@ import { RouterModule } from '@angular/router';
import { SharedModule } from 'app/shared/shared.module'; import { SharedModule } from 'app/shared/shared.module';
import { HOME_ROUTE } from './home.route'; import { HOME_ROUTE } from './home.route';
import { HomeComponent } from './home.component'; import { HomeComponent } from './home.component';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
@NgModule({ @NgModule({
imports: [SharedModule, RouterModule.forChild([HOME_ROUTE])], imports: [SharedModule, RouterModule.forChild([HOME_ROUTE]), FontAwesomeModule],
declarations: [HomeComponent], declarations: [HomeComponent],
}) })
export class HomeModule {} export class HomeModule {}

View File

@ -1,3 +1,8 @@
<div class="footer"> <div #footer class="footer">
<p jhiTranslate="footer">This is your footer</p> <div>
<p>
Copyright © Derechos reservados - Desarrollado por
<a style="color: #00b88d" href="http://pablobonilla.io/quantum" target="_blank">Quantum</a>
</p>
</div>
</div> </div>

View File

@ -0,0 +1,7 @@
.footer {
background: #192e4d;
color: white;
padding: 12px 0;
font-size: 0.8em;
text-align: center;
}

View File

@ -3,5 +3,6 @@ import { Component } from '@angular/core';
@Component({ @Component({
selector: 'jhi-footer', selector: 'jhi-footer',
templateUrl: './footer.component.html', templateUrl: './footer.component.html',
styleUrls: ['./footer.component.scss'],
}) })
export class FooterComponent {} export class FooterComponent {}

View File

@ -19,3 +19,4 @@
</div> </div>
</div> </div>
</ng-template> </ng-template>
<jhi-footer></jhi-footer>

View File

@ -1,7 +1,7 @@
<div class="logo"> <div class="logo">
<a routerLink="/" class="simple-text"> <a routerLink="/" class="simple-text">
<div class="logo-image-small"> <div class="logo-image-small">
<img src="../../../content/img_datasurvey/datasurvey-logo-text.svg" /> <img src="../../../content/img_datasurvey/datasurvey-logo-text-white-PNG.png" />
</div> </div>
</a> </a>
</div> </div>
@ -103,7 +103,7 @@
<li class="position-absolute fixed-bottom w-100 mb-5"> <li class="position-absolute fixed-bottom w-100 mb-5">
<a (click)="logout()" class="p-3 w-100 m-0 text-center"> <a (click)="logout()" class="p-3 w-100 m-0 text-center">
<!-- <i class="nc-icon nc-user-run"></i> --> <!-- <i class="nc-icon nc-user-run"></i> -->
<p style="letter-spacing: 0.3rem">Cerrar Sesion</p> <p style="letter-spacing: 0.3rem">Cerrar Sesión</p>
</a> </a>
</li> </li>
<li class="position-absolute fixed-bottom w-100 mb-5" style="bottom: -4rem"> <li class="position-absolute fixed-bottom w-100 mb-5" style="bottom: -4rem">

View File

@ -61,8 +61,11 @@ export class SidebarComponent {
if (account !== null) { if (account !== null) {
this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => { this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => {
this.usuarioExtra = usuarioExtra.body; this.usuarioExtra = usuarioExtra.body;
this.usuarioExtra!.nombre = const fullName = this.usuarioExtra!.nombre;
usuarioExtra.body!.nombre!.trim().split(' ')[0] + ' ' + usuarioExtra.body!.nombre!.trim().split(' ')[1]; const firstName = fullName?.split(' ')[0] === undefined ? '' : fullName?.split(' ')[0];
const lastName = fullName?.split(' ')[1] === undefined ? '' : fullName?.split(' ')[1];
this.usuarioExtra!.nombre = `${firstName} ${lastName}`;
}); });
} }
}); });

View File

@ -16,24 +16,24 @@ export interface ChildrenItems {
} }
export const ADMIN_ROUTES: RouteInfo[] = [ export const ADMIN_ROUTES: RouteInfo[] = [
{ // {
path: '/dashboard', // path: '/dashboard',
title: 'Dashboard', // title: 'Dashboard',
type: 'link', // type: 'link',
icontype: 'nc-icon nc-chart-bar-32', // icontype: 'nc-icon nc-chart-bar-32',
}, // },
{ {
path: '/encuesta', path: '/encuesta',
title: 'Encuestas', title: 'Encuestas',
type: 'link', type: 'link',
icontype: 'nc-icon nc-paper', icontype: 'nc-icon nc-paper',
}, },
{ // {
path: '/plantilla', // path: '/plantilla',
title: 'Plantillas', // title: 'Plantillas',
type: 'link', // type: 'link',
icontype: 'nc-icon nc-album-2', // icontype: 'nc-icon nc-album-2',
}, // },
{ {
path: '/categoria', path: '/categoria',
title: 'Categorías', title: 'Categorías',
@ -61,22 +61,22 @@ export const USER_ROUTES: RouteInfo[] = [
type: 'link', type: 'link',
icontype: 'nc-icon nc-paper', icontype: 'nc-icon nc-paper',
}, },
{ // {
path: '/tienda', // path: '/tienda',
title: 'Tienda', // title: 'Tienda',
type: 'link', // type: 'link',
icontype: 'nc-icon nc-cart-simple', // icontype: 'nc-icon nc-cart-simple',
}, // },
{ // {
path: '/plantilla', // path: '/plantilla',
title: 'Plantillas', // title: 'Plantillas',
type: 'link', // type: 'link',
icontype: 'nc-icon nc-album-2', // icontype: 'nc-icon nc-album-2',
}, // },
{ // {
path: '/colaboraciones', // path: '/colaboraciones',
title: 'Colaboraciones', // title: 'Colaboraciones',
type: 'link', // type: 'link',
icontype: 'nc-icon nc-world-2', // icontype: 'nc-icon nc-world-2',
}, // },
]; ];

View File

@ -62,7 +62,7 @@
<div class="col-xxl-4 col-lg-5"> <div class="col-xxl-4 col-lg-5">
<div class="card mt-5"> <div class="card mt-5">
<!-- Logo --> <!-- Logo -->
<div class="pl-4 pt-4 pr-4 pb-1 text-center"> <div role="button" routerLink="/" class="pl-4 pt-4 pr-4 pb-1 text-center">
<img src="../../content/img_datasurvey/datasurvey-logo-text-black.svg" alt="" /> <img src="../../content/img_datasurvey/datasurvey-logo-text-black.svg" alt="" />
</div> </div>
@ -76,13 +76,20 @@
<div <div
class="alert alert-danger" class="alert alert-danger"
*ngIf="authenticationError" *ngIf="error && !userSuspended"
jhiTranslate="login.messages.error.authentication" jhiTranslate="login.messages.error.authentication"
data-cy="loginError" data-cy="loginError"
> >
<strong>Failed to sign in!</strong> Please check your credentials and try again. <strong>Failed to sign in!</strong> Please check your credentials and try again.
</div> </div>
<div
class="alert alert-danger"
*ngIf="userSuspended && !error"
jhiTranslate="login.messages.error.userSuspended"
data-cy="loginError"
></div>
<form class="ds-form" role="form" (ngSubmit)="login()" [formGroup]="loginForm"> <form class="ds-form" role="form" (ngSubmit)="login()" [formGroup]="loginForm">
<div class="mb-3"> <div class="mb-3">
<div class="form-group"> <div class="form-group">

View File

@ -9,8 +9,10 @@ import { GoogleLoginProvider } from 'angularx-social-login';
import { RegisterService } from '../account/register/register.service'; import { RegisterService } from '../account/register/register.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from '../config/error.constants'; import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE, USER_IS_SUSPENDED } from '../config/error.constants';
import { LocalStorageService } from 'ngx-webstorage'; import { LocalStorageService } from 'ngx-webstorage';
import { UsuarioExtra } from '../entities/usuario-extra/usuario-extra.model';
import { Account } from '../core/auth/account.model';
@Component({ @Component({
selector: 'jhi-login', selector: 'jhi-login',
@ -25,6 +27,8 @@ export class LoginComponent implements OnInit, AfterViewInit {
error = false; error = false;
errorEmailExists = false; errorEmailExists = false;
errorUserExists = false; errorUserExists = false;
userSuspended = false;
imprimir = false;
loginForm = this.fb.group({ loginForm = this.fb.group({
username: [null, [Validators.required, Validators.email, Validators.maxLength(254)]], username: [null, [Validators.required, Validators.email, Validators.maxLength(254)]],
@ -48,18 +52,6 @@ export class LoginComponent implements OnInit, AfterViewInit {
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
//Servicio para verificar si el usuario se encuentra loggeado
/*this.authService.authState.subscribe(user => {
this.user = user;
this.loggedIn = user != null;
/!* console.log('correo: ' + user.email);
console.log('correo: ' + user.name);
console.log('ID: ' + this.user.id);*!/
this.authenticacionGoogle();
});
*/
// if already authenticated then navigate to home page // if already authenticated then navigate to home page
this.accountService.identity().subscribe(() => { this.accountService.identity().subscribe(() => {
if (this.accountService.isAuthenticated()) { if (this.accountService.isAuthenticated()) {
@ -89,7 +81,10 @@ export class LoginComponent implements OnInit, AfterViewInit {
} }
authenticacionGoogle(): void { authenticacionGoogle(): void {
this.loginService.login({ username: this.user.email, password: this.user.id, rememberMe: true }).subscribe( this.error = false;
this.userSuspended = false;
this.loginService.login({ username: this.user.email, password: this.user.id, rememberMe: false }).subscribe(
() => { () => {
this.authenticationError = false; this.authenticationError = false;
if (!this.router.getCurrentNavigation()) { if (!this.router.getCurrentNavigation()) {
@ -98,21 +93,14 @@ export class LoginComponent implements OnInit, AfterViewInit {
this.router.navigate(['']); this.router.navigate(['']);
} }
}, },
() => this.activateGoogle() response => {
/*this.registerService debugger;
.save({ if (response.status == 401 && response.error.detail == 'Bad credentials') {
login: this.user.email, this.activateGoogle();
email: this.user.email, } else {
password: this.user.id, this.processError(response);
langKey: this.translateService.currentLang, }
name: this.user.name, }
profileIcon: this.randomProfilePic(),
isAdmin: 0,
})
.subscribe(
() => (this.success = true),
response => this.processError(response)
) */ //console.log("Usuario no existe")
); );
} }
@ -121,10 +109,13 @@ export class LoginComponent implements OnInit, AfterViewInit {
} }
processError(response: HttpErrorResponse): void { processError(response: HttpErrorResponse): void {
debugger;
if (response.status === 400 && response.error.type === LOGIN_ALREADY_USED_TYPE) { if (response.status === 400 && response.error.type === LOGIN_ALREADY_USED_TYPE) {
this.errorUserExists = true; this.errorUserExists = true;
} else if (response.status === 400 && response.error.type === EMAIL_ALREADY_USED_TYPE) { } else if (response.status === 400 && response.error.type === EMAIL_ALREADY_USED_TYPE) {
this.errorEmailExists = true; this.errorEmailExists = true;
} else if (response.status === 401) {
this.userSuspended = true;
} else { } else {
this.error = true; this.error = true;
} }
@ -135,6 +126,9 @@ export class LoginComponent implements OnInit, AfterViewInit {
} }
activateGoogle(): void { activateGoogle(): void {
this.error = false;
this.userSuspended = false;
this.registerService this.registerService
.save({ .save({
login: this.user.email, login: this.user.email,
@ -157,6 +151,9 @@ export class LoginComponent implements OnInit, AfterViewInit {
} }
login(): void { login(): void {
this.error = false;
this.userSuspended = false;
debugger;
this.loginService this.loginService
.login({ .login({
username: this.loginForm.get('username')!.value, username: this.loginForm.get('username')!.value,
@ -164,14 +161,30 @@ export class LoginComponent implements OnInit, AfterViewInit {
rememberMe: this.loginForm.get('rememberMe')!.value, rememberMe: this.loginForm.get('rememberMe')!.value,
}) })
.subscribe( .subscribe(
() => { value => {
debugger;
console.log(value);
/*if (value?.activated == false){
this.userSuspended = true;
console.log(value.activated)
}else {*/
this.authenticationError = false; this.authenticationError = false;
if (!this.router.getCurrentNavigation()) { if (!this.router.getCurrentNavigation()) {
// There were no routing during login (eg from navigationToStoredUrl) // There were no routing during login (eg from navigationToStoredUrl)
this.router.navigate(['']); this.router.navigate(['']);
} }
// }
}, },
() => (this.authenticationError = true) response => {
debugger;
if (response.status == 401 && response.error.detail == 'Bad credentials') {
this.error = true;
} else {
this.processError(response);
}
}
); );
} }
} }

View File

@ -12,6 +12,7 @@ export class LoginService {
constructor(private accountService: AccountService, private authServerProvider: AuthServerProvider) {} constructor(private accountService: AccountService, private authServerProvider: AuthServerProvider) {}
login(credentials: Login): Observable<Account | null> { login(credentials: Login): Observable<Account | null> {
debugger;
return this.authServerProvider.login(credentials).pipe(mergeMap(() => this.accountService.identity(true))); return this.authServerProvider.login(credentials).pipe(mergeMap(() => this.accountService.identity(true)));
} }

View File

@ -0,0 +1,57 @@
.app-loading .container {
margin: auto auto;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.app-loading .tittle {
margin-bottom: 40px;
color: #44b9ff;
letter-spacing: 4px;
text-transform: uppercase;
}
.app-loading .square-container {
list-style-type: none;
display: flex;
position: relative;
}
.app-loading .square {
margin: 4px;
width: 30px;
height: 30px;
border-radius: 7px;
animation: rotating 2s ease infinite;
}
.app-loading .square1 {
background: #192e4d;
animation-delay: 0.2s;
}
.app-loading .square2 {
background: #018adf;
animation-delay: 0.4s;
}
.app-loading .square3 {
background: #20a9fe;
animation-delay: 0.6s;
}
.app-loading .square4 {
background: #00e0ac;
animation-delay: 0.8s;
}
.app-loading .square5 {
background: #70ffde;
animation-delay: 1s;
}
@keyframes rotating {
0% {
transform: rotate(0) scale(1);
}
50% {
transform: rotate(90deg) scale(0.6);
}
100% {
transform: rotate(90deg) scale(1);
}
}

View File

@ -0,0 +1,199 @@
.loader {
height: 100%;
width: 100%;
}
.loader .l_main {
position: absolute;
top: 20%;
left: 50%;
width: 172px;
height: 128px;
margin: 0;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
@media (max-width: 550px) {
.loader {
-webkit-transform: scale(0.75);
transform: scale(0.75);
}
}
@media (max-width: 440px) {
.loader {
-webkit-transform: scale(0.5);
transform: scale(0.5);
}
}
.l_square {
position: relative;
}
.l_square:nth-child(1) {
margin-left: 0px;
}
.l_square:nth-child(2) {
margin-left: 44px;
}
.l_square:nth-child(3) {
margin-left: 88px;
}
.l_square:nth-child(4) {
margin-left: 132px;
}
.l_square span {
position: absolute;
top: 0px;
left: 20px;
height: 36px;
width: 36px;
border-radius: 2px;
background-color: #1c44b2;
}
.l_square span:nth-child(1) {
top: 0px;
}
.l_square span:nth-child(2) {
top: 44px;
}
.l_square span:nth-child(3) {
top: 88px;
}
.l_square:nth-child(1) span {
-webkit-animation: animsquare1 2s infinite ease-in;
animation: animsquare1 2s infinite ease-in;
}
.l_square:nth-child(2) span {
-webkit-animation: animsquare2 2s infinite ease-in;
animation: animsquare2 2s infinite ease-in;
}
.l_square:nth-child(3) span {
-webkit-animation: animsquare3 2s infinite ease-in;
animation: animsquare3 2s infinite ease-in;
}
.l_square:nth-child(4) span {
-webkit-animation: animsquare4 2s infinite ease-in;
animation: animsquare4 2s infinite ease-in;
}
.l_square span:nth-child(1) {
-webkit-animation-delay: 0s;
animation-delay: 0s;
}
.l_square span:nth-child(2) {
-webkit-animation-delay: 0.15s;
animation-delay: 0.15s;
}
.l_square span:nth-child(3) {
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s;
}
@-webkit-keyframes animsquare1 {
0%,
5%,
95%,
100% {
-webkit-transform: translate(0px, 0px) rotate(0deg);
transform: translate(0px, 0px) rotate(0deg);
}
30%,
70% {
-webkit-transform: translate(-40px, 0px) rotate(-90deg);
transform: translate(-40px, 0px) rotate(-90deg);
}
}
@keyframes animsquare1 {
0%,
5%,
95%,
100% {
-webkit-transform: translate(0px, 0px) rotate(0deg);
transform: translate(0px, 0px) rotate(0deg);
}
30%,
70% {
-webkit-transform: translate(-40px, 0px) rotate(-90deg);
transform: translate(-40px, 0px) rotate(-90deg);
}
}
@-webkit-keyframes animsquare2 {
0%,
10%,
90%,
100% {
-webkit-transform: translate(0px, 0px) rotate(0deg);
transform: translate(0px, 0px) rotate(0deg);
}
35%,
65% {
-webkit-transform: translate(-40px, 0px) rotate(-90deg);
transform: translate(-40px, 0px) rotate(-90deg);
}
}
@keyframes animsquare2 {
0%,
10%,
90%,
100% {
-webkit-transform: translate(0px, 0px) rotate(0deg);
transform: translate(0px, 0px) rotate(0deg);
}
35%,
65% {
-webkit-transform: translate(-40px, 0px) rotate(-90deg);
transform: translate(-40px, 0px) rotate(-90deg);
}
}
@-webkit-keyframes animsquare3 {
0%,
15%,
85%,
100% {
-webkit-transform: translate(0px, 0px) rotate(0deg);
transform: translate(0px, 0px) rotate(0deg);
}
40%,
60% {
-webkit-transform: translate(-40px, 0px) rotate(-90deg);
transform: translate(-40px, 0px) rotate(-90deg);
}
}
@keyframes animsquare3 {
0%,
15%,
85%,
100% {
-webkit-transform: translate(0px, 0px) rotate(0deg);
transform: translate(0px, 0px) rotate(0deg);
}
40%,
60% {
-webkit-transform: translate(-40px, 0px) rotate(-90deg);
transform: translate(-40px, 0px) rotate(-90deg);
}
}
@-webkit-keyframes animsquare4 {
0%,
20%,
80%,
100% {
-webkit-transform: translate(0px, 0px) rotate(0deg);
transform: translate(0px, 0px) rotate(0deg);
}
45%,
55% {
-webkit-transform: translate(-40px, 0px) rotate(-90deg);
transform: translate(-40px, 0px) rotate(-90deg);
}
}
@keyframes animsquare4 {
0%,
20%,
80%,
100% {
-webkit-transform: translate(0px, 0px) rotate(0deg);
transform: translate(0px, 0px) rotate(0deg);
}
45%,
55% {
-webkit-transform: translate(-40px, 0px) rotate(-90deg);
transform: translate(-40px, 0px) rotate(-90deg);
}
}

View File

@ -102,7 +102,7 @@
font-weight: normal; font-weight: normal;
} }
.app-loading .lds-pacman { /*.app-loading .lds-pacman {
position: relative; position: relative;
margin: auto; margin: auto;
width: 200px !important; width: 200px !important;
@ -149,4 +149,4 @@
.app-loading .lds-pacman > div:nth-child(1) div:nth-child(3) { .app-loading .lds-pacman > div:nth-child(1) div:nth-child(3) {
-webkit-animation-delay: 0s; -webkit-animation-delay: 0s;
animation-delay: 0s; animation-delay: 0s;
} }*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 2528.24 410.62"><defs><style>.cls-1{font-size:300px;fill:#282828;font-family:Avenir-Heavy, "Avenir 85 Heavy";font-weight:800;}.cls-2{fill:#1072e8;}.cls-3{opacity:0.3;isolation:isolate;}.cls-4{fill:#2f92dd;}</style></defs><title>Asset 5</title><g id="Layer_2" data-name="Layer 2"><g id="Quantum"><text class="cls-1" transform="translate(540.01 301.05)">DATASURVEY</text><g id="Logo"><path class="cls-2" d="M210,210v99.82l-.72.15H110V210Z"/><path class="cls-2" d="M406.53,209.47c0,69.41-38.34,130.67-96.74,167.11a234.09,234.09,0,0,1-99.79,34V309.78c55.73-11.31,97-51.71,97-99.81,0-46-37.74-85-89.8-98.19A58.58,58.58,0,0,0,202.63,110H110V210H10V80H80V10H193.46c48,0,95.09,14.89,133.34,44.07C375.53,91.21,406.53,147,406.53,209.47Z"/><image class="cls-3" width="89" height="89" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAYAAABVC4ivAAAACXBIWXMAAAsSAAALEgHS3X78AAAIBElEQVR4Xu3d3VLiTBcF4LV354eIyIBazOEceAfeAJfuDXg4Z96ARfnVG/GHkO5e30E6DCKIKM4IZFVRapmK8Ljd6VDlbiGJJl8bXXdAk88nWndAk9cREZn/mmvaQYP8zszBvgAO3wOwGrtBXpMFXBkOhzIej2fQnU6HV1dXBMBV2NJc+FYnAAsAuby81DzPdTKZ6GAwkLIsJY5j3t7estVq+W6366+vrz0AonKewTbIKzIHrBcXF6bb7Zo8z6Msy0xZlgoAxhjGcezLsrR5nrvBYGADtG+Q16QGvry8NHd3d6bdbkcAEgCJMSYyxhiSYq11zjlLckpyWhRF+evXL3t1deUxV81NT17IInAURUmSJGlZlq0oilre+xSAEREYY2ySJIW11kynU7TbbY5Go1nLqM/ZrJPnMg98e3sbRVGUtFqtzDl3rKpdkj1jzKlz7sw5dyoiP5xzHVXNsixL4ziO8jw3w+HwxQqkqeSQReAkSZI0TTMAbVXtiMgJyQ6ADECkqo7ks6pGqHpwaYyZ9vv9Mqw+BKGaG2QsB86yLANwrKon3vsegF6APgKgIlKSfCBJ730hIs9FURiS4pxrKnk+a4C7qtr33p+pah9Al2SGasHwLCJKslDVR5JxHMdmPB5rmqazc5PkQSO/BSwiPwLsuaqekzwF0AWQiogH8EDSisgDycQYY6y12u12Jc/zppKB9cDGmFMA5yQHAM5F5DT05EhEpiQhIo8AEhGJnHPGez+Pe9g9+b3AAAYi8jN83hORI5J1q5iSTFU18t4rSUnT9FU/Bg4QeVNgkoNQxScikgLwodWmIhJ5742qajjv0hwU8geAfwI4I9kD0EZ1E1KSnIpIRFJVdSVunYNB/iDwuYj056oYJKUGFhFFtdKQuY+vchDInwA+BdANvTgSES8iNgCvreA6e4/8SeAfANqh/yqAcr6Cw2Nt9vq9i88CkzxGdRudsLqnUCyYrWoR89nbSt4GsIhkAGJUt9E+9GNggyoG9hR5i8AJqhVFfWOxEW6dvUPeMnDdIhiqeGNgYM968raBZcML3KrsTSV/BTBJDeeuW8WHsheV/JXA28jWTvSv8sXAH67e+ew08i4AAzuMvCvAwI4i7xIwsIPIuwYM7BjyLgIDO4S8q8DAjiDvMjCwA8i7Dgx8c+R9AAa+MfK+AAPfFHmfgIFviLxvwMA3Q95HYOAbIe8rMPBNkPcZGPgGyPsODPxj5EMABv4h8qEAA/8I+ZCAgX+AfGjAwF9GPkRg4C8iHyow8JeQDxkY+AvIhw4MfDFyA1zly5Ab4D/5EuQG+GW2jtwAv85WkRvg5dkacgO8OltBboDfzqeRG+D1+RRyA/y+fBi5AX5/PoTcAG+WjZEb4M2zEXID/LG8G7kB/njehdwAfy5rkRvgz+dN5AZ4O1mJ3ABvL0uR54Hv7u5Mq9WKa2BV7Rpj+jgwYKn+if3N76vq+2ba18AAtJ4f3Gq1MlTTV0/q0Yqs5qX9ZDUB8ExE+qjGLLZFpIVq4okBoHw5QmbXpmIzBKjm1tezkQlUuFwz6HvVKAa5uLgwaZpGSZKkzrkjVe1473thOOg5qko+F5FTkj1WY72OSKbhvPXEqdmTWfGzvnWCoJdqPmc9Rr3eKMDjD/zKvECeaxMKwEwmk6Qsy5aqtkXkBEBPVfskT0Nr6JE8QVW9KauxXspqjmU9cryu4p1rE3WVhtdSshqAagFYAI6kB+C99wRA5xziOH51nmWVLHmeK4AoTdMkiqIWySOSnQDdRTXitiMiR1INpTMAZk9GRFzAlfCL28nULQJVBVsReSY5AVCISIEK3qmqQ8A2xtRVPavuRWQZDodyc3OjvV7PSDWLMjXGZACygJ0BSAFEAdJLNVpRJAymQ9UqgB2s3sWEamZ4bRMRGZN8APAkIhOSBYDSOeeMMT7Pc6Zp+qJ9zJDrihuPxzIYDOTx8VGzLDMAjHMuCsdqONRLNXX1OTyJ2exKEdnpVcSS1D3YAigC8H8k71HNUH5W1Wkcx7YoCjdXybNNXZZe+MqylHBQbU9VdaFin8PJEaDTOeB6ZQLsH7ILLeKJ5L2I3InIf977B+/9s7W2TJLEGWN8HMfLK3k+cRzTOUdrrTPGWFUtSD6TfJDqwmZF5HEBeN8qeBapBu/V15sJgIcA/D9VvXfOPYlIYa21x8fHPrSLlT0ZnU6HNzc3PDs780VR2CRJCufck6pGrFKIyAOAJAxoNmG87QyX7xituCuRP+tiT9KRLEg+e+8fVPWe5D3JJ1UtiqKwo9HI39zcvKjkFzvmhD93vbi4iNI0jZ1zaZIkmapmInLknMtUtUUykT/zgxXYL9jFiAidcwyriFJEpt77Z5JPJJ+8909xHE+yLCum06m9vr52wNs75rDb7frb21vXbren0+kUWZZ5kqVUS5jYGGOcc4Yvp/7tHbK8vMkgAO+cc3EcW2ttKSKFqhZxHE+NMdP7+3v3+/fvF1sSAXi991NdzZeXl1rvexTHcWSMiYqiMHEcG+eceu8lTdMZ7MLQ/L3I/HsRk8kEIkJjjLfWuiRJnLXWTqdT2+/3bQB2wDt2MZtbIchwOJTRaKR5npt+v6/OOSmKQrvdrgDAsiH5+xxjDPM8pzGGaZr6drvtR6PRm9vEAUuQgT9rZsxhj8djmUwmAgBFURwU7nzqG41Wq8X5DQ/DY+nukm9uFTeHDbzuuYcIvYj16sZjWTbej28B/iDzFuiybIzcZPP8H+Y/C/188ppfAAAAAElFTkSuQmCC"/><polygon class="cls-4" points="80 10.36 80 80 10.35 80 80 10.36"/></g></g></g></svg> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 2528.24 410.62"><defs><style>.cls-1{font-size:285px;fill:#282828;font-family:"Noto Sans JP", "Helvetica Neue";font-weight:800;}.cls-2{fill:#1072e8;}.cls-3{opacity:0.3;isolation:isolate;}.cls-4{fill:#2f92dd;}</style></defs><title>Asset 5</title><g id="Layer_2" data-name="Layer 2"><g id="Quantum"><text class="cls-1" transform="translate(540.01 301.05)">DATASURVEY</text><g id="Logo"><path class="cls-2" d="M210,210v99.82l-.72.15H110V210Z"/><path class="cls-2" d="M406.53,209.47c0,69.41-38.34,130.67-96.74,167.11a234.09,234.09,0,0,1-99.79,34V309.78c55.73-11.31,97-51.71,97-99.81,0-46-37.74-85-89.8-98.19A58.58,58.58,0,0,0,202.63,110H110V210H10V80H80V10H193.46c48,0,95.09,14.89,133.34,44.07C375.53,91.21,406.53,147,406.53,209.47Z"/><image class="cls-3" width="89" height="89" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAYAAABVC4ivAAAACXBIWXMAAAsSAAALEgHS3X78AAAIBElEQVR4Xu3d3VLiTBcF4LV354eIyIBazOEceAfeAJfuDXg4Z96ARfnVG/GHkO5e30E6DCKIKM4IZFVRapmK8Ljd6VDlbiGJJl8bXXdAk88nWndAk9cREZn/mmvaQYP8zszBvgAO3wOwGrtBXpMFXBkOhzIej2fQnU6HV1dXBMBV2NJc+FYnAAsAuby81DzPdTKZ6GAwkLIsJY5j3t7estVq+W6366+vrz0AonKewTbIKzIHrBcXF6bb7Zo8z6Msy0xZlgoAxhjGcezLsrR5nrvBYGADtG+Q16QGvry8NHd3d6bdbkcAEgCJMSYyxhiSYq11zjlLckpyWhRF+evXL3t1deUxV81NT17IInAURUmSJGlZlq0oilre+xSAEREYY2ySJIW11kynU7TbbY5Go1nLqM/ZrJPnMg98e3sbRVGUtFqtzDl3rKpdkj1jzKlz7sw5dyoiP5xzHVXNsixL4ziO8jw3w+HwxQqkqeSQReAkSZI0TTMAbVXtiMgJyQ6ADECkqo7ks6pGqHpwaYyZ9vv9Mqw+BKGaG2QsB86yLANwrKon3vsegF6APgKgIlKSfCBJ730hIs9FURiS4pxrKnk+a4C7qtr33p+pah9Al2SGasHwLCJKslDVR5JxHMdmPB5rmqazc5PkQSO/BSwiPwLsuaqekzwF0AWQiogH8EDSisgDycQYY6y12u12Jc/zppKB9cDGmFMA5yQHAM5F5DT05EhEpiQhIo8AEhGJnHPGez+Pe9g9+b3AAAYi8jN83hORI5J1q5iSTFU18t4rSUnT9FU/Bg4QeVNgkoNQxScikgLwodWmIhJ5742qajjv0hwU8geAfwI4I9kD0EZ1E1KSnIpIRFJVdSVunYNB/iDwuYj056oYJKUGFhFFtdKQuY+vchDInwA+BdANvTgSES8iNgCvreA6e4/8SeAfANqh/yqAcr6Cw2Nt9vq9i88CkzxGdRudsLqnUCyYrWoR89nbSt4GsIhkAGJUt9E+9GNggyoG9hR5i8AJqhVFfWOxEW6dvUPeMnDdIhiqeGNgYM968raBZcML3KrsTSV/BTBJDeeuW8WHsheV/JXA28jWTvSv8sXAH67e+ew08i4AAzuMvCvAwI4i7xIwsIPIuwYM7BjyLgIDO4S8q8DAjiDvMjCwA8i7Dgx8c+R9AAa+MfK+AAPfFHmfgIFviLxvwMA3Q95HYOAbIe8rMPBNkPcZGPgGyPsODPxj5EMABv4h8qEAA/8I+ZCAgX+AfGjAwF9GPkRg4C8iHyow8JeQDxkY+AvIhw4MfDFyA1zly5Ab4D/5EuQG+GW2jtwAv85WkRvg5dkacgO8OltBboDfzqeRG+D1+RRyA/y+fBi5AX5/PoTcAG+WjZEb4M2zEXID/LG8G7kB/njehdwAfy5rkRvgz+dN5AZ4O1mJ3ABvL0uR54Hv7u5Mq9WKa2BV7Rpj+jgwYKn+if3N76vq+2ba18AAtJ4f3Gq1MlTTV0/q0Yqs5qX9ZDUB8ExE+qjGLLZFpIVq4okBoHw5QmbXpmIzBKjm1tezkQlUuFwz6HvVKAa5uLgwaZpGSZKkzrkjVe1473thOOg5qko+F5FTkj1WY72OSKbhvPXEqdmTWfGzvnWCoJdqPmc9Rr3eKMDjD/zKvECeaxMKwEwmk6Qsy5aqtkXkBEBPVfskT0Nr6JE8QVW9KauxXspqjmU9cryu4p1rE3WVhtdSshqAagFYAI6kB+C99wRA5xziOH51nmWVLHmeK4AoTdMkiqIWySOSnQDdRTXitiMiR1INpTMAZk9GRFzAlfCL28nULQJVBVsReSY5AVCISIEK3qmqQ8A2xtRVPavuRWQZDodyc3OjvV7PSDWLMjXGZACygJ0BSAFEAdJLNVpRJAymQ9UqgB2s3sWEamZ4bRMRGZN8APAkIhOSBYDSOeeMMT7Pc6Zp+qJ9zJDrihuPxzIYDOTx8VGzLDMAjHMuCsdqONRLNXX1OTyJ2exKEdnpVcSS1D3YAigC8H8k71HNUH5W1Wkcx7YoCjdXybNNXZZe+MqylHBQbU9VdaFin8PJEaDTOeB6ZQLsH7ILLeKJ5L2I3InIf977B+/9s7W2TJLEGWN8HMfLK3k+cRzTOUdrrTPGWFUtSD6TfJDqwmZF5HEBeN8qeBapBu/V15sJgIcA/D9VvXfOPYlIYa21x8fHPrSLlT0ZnU6HNzc3PDs780VR2CRJCufck6pGrFKIyAOAJAxoNmG87QyX7xituCuRP+tiT9KRLEg+e+8fVPWe5D3JJ1UtiqKwo9HI39zcvKjkFzvmhD93vbi4iNI0jZ1zaZIkmapmInLknMtUtUUykT/zgxXYL9jFiAidcwyriFJEpt77Z5JPJJ+8909xHE+yLCum06m9vr52wNs75rDb7frb21vXbren0+kUWZZ5kqVUS5jYGGOcc4Yvp/7tHbK8vMkgAO+cc3EcW2ttKSKFqhZxHE+NMdP7+3v3+/fvF1sSAXi991NdzZeXl1rvexTHcWSMiYqiMHEcG+eceu8lTdMZ7MLQ/L3I/HsRk8kEIkJjjLfWuiRJnLXWTqdT2+/3bQB2wDt2MZtbIchwOJTRaKR5npt+v6/OOSmKQrvdrgDAsiH5+xxjDPM8pzGGaZr6drvtR6PRm9vEAUuQgT9rZsxhj8djmUwmAgBFURwU7nzqG41Wq8X5DQ/DY+nukm9uFTeHDbzuuYcIvYj16sZjWTbej28B/iDzFuiybIzcZPP8H+Y/C/188ppfAAAAAElFTkSuQmCC"/><polygon class="cls-4" points="80 10.36 80 80 10.35 80 80 10.36"/></g></g></g></svg>

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -98,3 +98,7 @@
@import 'paper-dashboard/datasurvey-list'; @import 'paper-dashboard/datasurvey-list';
@import 'paper-dashboard/datasurvey-table'; @import 'paper-dashboard/datasurvey-table';
@import 'paper-dashboard/datasurvey-contextmenu'; @import 'paper-dashboard/datasurvey-contextmenu';
@import 'paper-dashboard/datasurvey-survey-update';
@import 'paper-dashboard/datasurvey-home';
@import 'paper-dashboard/datasurvey-filter';
@import 'paper-dashboard/datasurvey-survey';

View File

@ -61,12 +61,21 @@
} }
.ds-btn--danger { .ds-btn--danger {
background-color: transparent; background-color: #e73636;
color: #e73636; color: #fff;
&:hover { &:hover {
background-color: #f7f9ff; background-color: #d33232;
color: #d33232; }
&--light {
background-color: transparent;
color: #e73636;
&:hover {
background-color: #f7f9ff;
color: #d33232;
}
} }
} }

View File

@ -0,0 +1,3 @@
.ds-filter:not(:first-of-type) {
margin-left: 2rem;
}

View File

@ -75,7 +75,9 @@ $form-background: #f1f5f9;
} }
label { label {
font-size: 0.8rem;
color: #757d94; color: #757d94;
margin-bottom: 0.5rem;
} }
} }

View File

@ -11,6 +11,14 @@
font-size: 1.2rem; font-size: 1.2rem;
} }
.ds-title--small {
color: #313747;
font-weight: 900;
letter-spacing: 0.025rem;
text-transform: uppercase;
font-size: 1.1rem;
}
.ds-subtitle { .ds-subtitle {
color: #757d94; color: #757d94;
font-size: 0.9rem; font-size: 0.9rem;
@ -19,3 +27,22 @@
p { p {
margin: 0 !important; margin: 0 !important;
} }
.ds-info--icon {
border-radius: 50%;
background-color: #f1f5f9;
cursor: pointer;
transition: background-color 0.2s ease-in-out;
width: 20px;
height: 20px;
font-size: 0.7rem;
color: #313747;
pointer-events: visible !important;
display: flex;
align-items: center;
justify-content: center;
&:hover {
background-color: #e3e6e9;
}
}

View File

@ -0,0 +1,112 @@
/**
Cards
**/
.lift {
box-shadow: 0 0.15rem 1.75rem 0 rgba(33, 40, 50, 0.15);
transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.lift:hover {
transform: translateY(-0.3333333333rem);
box-shadow: 0 0.5rem 2rem 0 rgba(33, 40, 50, 0.25);
}
.lift:active {
transform: none;
box-shadow: 0 0.15rem 1.75rem 0 rgba(33, 40, 50, 0.15);
}
.lift-sm {
box-shadow: 0 0.125rem 0.25rem 0 rgba(33, 40, 50, 0.2);
}
.lift-sm:hover {
transform: translateY(-0.1666666667rem);
box-shadow: 0 0.25rem 1rem 0 rgba(33, 40, 50, 0.25);
}
.lift-sm:active {
transform: none;
box-shadow: 0 0.125rem 0.25rem 0 rgba(33, 40, 50, 0.2);
}
.card-encuesta {
border-radius: 12px;
background-color: #ffffff;
margin-bottom: 20px;
position: relative;
border: 0 none;
}
.card-encuesta.lift {
text-decoration: none;
color: inherit;
}
.card-flag {
position: absolute;
font-size: 0.7rem;
padding: 0.3rem 0.5rem;
line-height: 1;
}
.card-flag-dark {
background-color: rgba(33, 40, 50, 0.7);
color: #fff;
}
.card-flag-light {
background-color: rgba(255, 255, 255, 0.7);
color: #69707a;
}
.card-flag-lg {
font-size: 0.9rem;
padding: 0.5rem 0.65rem;
}
.card-flag-top-right {
border-top-left-radius: 0.25rem;
border-bottom-left-radius: 0.25rem;
top: 0.5rem;
right: 0;
}
.card-flag-top-left {
border-top-right-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
top: 0.5rem;
left: 0;
}
.card-encuesta .entity-icon--star {
color: #ffcc47;
margin-right: 0.2rem;
}
.card-encuesta .card-title {
font-size: 2em;
}
.card-encuesta .tag {
font-size: 0.8rem;
color: #f8f8f8;
margin-top: 0.5rem;
padding: 0.2rem 1.5rem;
background-color: #2962ff94;
border-radius: 15px;
}
.card-encuesta .subtitle {
color: rgba(0, 0, 0, 0.54);
font-size: 0.9rem;
}
.card-encuesta .btn-card {
padding: 11px 10px !important;
}
.border-cyan {
border-color: #00cfd5 !important;
}
.py-10 {
padding-top: 6rem !important;
padding-bottom: 6rem !important;
}

View File

@ -31,8 +31,15 @@
padding: 0.5rem; padding: 0.5rem;
margin: 1rem; margin: 1rem;
word-wrap: break-word; word-wrap: break-word;
transition: all 0.1s ease-in-out;
*:not(div) { &:hover {
// top: -3px;
// box-shadow: rgba(80, 80, 80, 0.15) 0px 5px 15px;
background-color: #f5f9fd;
}
* {
pointer-events: none; pointer-events: none;
} }
@ -78,6 +85,7 @@
width: 25px; width: 25px;
height: 25px; height: 25px;
color: #313747; color: #313747;
pointer-events: visible !important;
} }
.entity-share:hover { .entity-share:hover {

View File

@ -12,7 +12,13 @@
.modal-header, .modal-header,
.modal-footer { .modal-footer {
border: none; border: none;
padding: 2rem; padding: 2rem !important;
display: flex;
align-items: center;
label {
margin: 0 0.2rem 0 0;
}
} }
.modal-body { .modal-body {

View File

@ -0,0 +1,164 @@
.ds-survey {
display: flex;
&--titulo {
display: flex;
justify-content: space-between;
align-items: center;
&--name {
color: #1f3779;
}
&--icon {
border-radius: 50%;
background-color: #f1f5f9;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
transition: background-color 0.2s ease-in-out;
font-size: 1rem;
padding: 0.8rem;
width: 25px;
height: 25px;
color: #1f3779;
pointer-events: visible !important;
transition: all 0.1s ease-in-out;
* {
pointer-events: none;
}
&:hover {
background-color: #e73636;
color: #fff;
}
&--small {
font-size: 0.8rem;
padding: 0.3rem;
}
}
}
&--all-question-wrapper {
display: flex;
flex-direction: column;
border: 2px dashed #f1f1f1;
border-radius: $border-radius-x-large;
padding: 2rem 5rem;
margin: 0 auto;
}
&--question-wrapper {
margin: 0 auto;
}
&--question {
display: flex;
flex-direction: column;
font-size: 1.2rem;
color: #15131d;
padding: 2rem;
border-bottom: 1px solid #e9e9e9;
}
&--option {
display: flex;
align-items: center;
margin: 0.5rem 0;
border-radius: 5px;
font-weight: 500;
letter-spacing: 0.025rem;
color: #787878;
background-color: transparent;
position: relative;
top: 0;
transition: all 0.1s ease-in-out;
&--base {
border: 1px solid #e6e6e6;
}
&--add {
border: 2px dashed #9c9c9c;
transition: all 0.1s ease-in-out;
&:hover {
border: 2px dashed #727272;
}
&:hover .ds-survey--add-option {
color: #727272;
}
&:hover .ds-survey--add-option--icon {
color: #727272;
}
}
}
&--closed-option {
display: flex;
width: 25rem;
align-items: center;
font-size: 0.9rem;
color: #15131d;
padding: 1rem;
transition: all 0.1s ease-in-out;
cursor: pointer;
position: relative;
label {
width: 100%;
margin: 0;
color: #1f3779;
}
}
&--open-option {
display: flex;
align-items: center;
font-size: 0.9rem;
color: #15131d;
transition: all 0.1s ease-in-out;
position: relative;
& textarea {
width: 25rem;
height: 20rem;
padding: 1rem 3rem;
color: #787878;
border: none;
resize: none;
&:disabled {
background-color: transparent;
}
}
}
&--add-option {
width: 100%;
color: #919191;
transition: all 0.1s ease-in-out;
pointer-events: none;
&--icon {
margin: 0 1rem;
display: flex;
justify-content: center;
align-items: center;
width: 25px;
height: 25px;
color: #919191;
pointer-events: visible !important;
transition: all 0.1s ease-in-out;
* {
pointer-events: none;
}
}
}
}

View File

@ -0,0 +1,115 @@
.preview-survey {
/* --------------------------------------- */
/* ----- Radio Button */
/* --------------------------------------- */
/* --------------------------------------- */
/* ----- Checkbox */
/* --------------------------------------- */
}
.preview-survey h2 {
font-size: 16px;
color: #001f3f;
margin-bottom: 20px;
margin-left: 20px;
}
.preview-survey > div {
padding: 20px 0;
border-bottom: 1px solid #ccc;
}
.preview-survey .radio label,
.preview-survey .checkbox label {
display: inline-block;
cursor: pointer;
color: #00b88d;
position: relative;
padding: 5px 15px 5px 51px;
font-size: 1em;
border-radius: 5px;
-webkit-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.preview-survey .radio label:hover,
.preview-survey .checkbox label:hover {
background: rgba(0, 184, 141, 0.1);
}
.preview-survey .radio label:before,
.preview-survey .checkbox label:before {
content: '';
display: inline-block;
width: 17px;
height: 17px;
position: absolute;
left: 15px;
border-radius: 50%;
background: none;
border: 3px solid #00b88d;
}
.preview-survey input[type='radio'] {
display: none;
}
.preview-survey input[type='radio']:checked + label:before {
display: none;
}
.preview-survey input[type='radio']:checked + label {
padding: 5px 15px;
background: #00b88d;
border-radius: 2px;
color: #fff;
}
.preview-survey .checkbox label:before {
border-radius: 3px;
}
.preview-survey .checkbox input[type='checkbox'] {
display: none;
}
.preview-survey .checkbox input[type='checkbox']:checked + label:before {
display: none;
}
.preview-survey .checkbox input[type='checkbox']:checked + label {
background: #00b88d;
color: #fff;
padding: 5px 15px;
}
.preview-survey .ds-survey--open-option textarea {
border: 3px solid #00b88d;
}
.preview-survey .entity-icon--star {
color: #ffcc47;
margin-right: 0.2rem;
}
.preview-survey dt {
margin-bottom: 10px;
}
.preview-survey dd {
margin-left: 40px;
}
.ds-survey--all-question-wrapper,
.info-encuesta {
@media screen and (max-width: 991px) {
padding: 2rem 0rem;
flex-basis: 0;
flex-grow: 1;
max-width: 100%;
}
}
.ds-survey--option {
@media screen and (max-width: 991px) {
width: 21rem !important;
}
@media screen and (max-width: 500px) {
width: 12rem !important;
}
}
.preview-survey {
@media screen and (max-width: 991px) {
flex-direction: column-reverse;
}
}

View File

@ -1,5 +1,6 @@
.modal-header { .modal-header {
border-bottom: 1px solid $medium-gray; // border-bottom: 1px solid $medium-gray;
border: none !important;
padding: 20px; padding: 20px;
text-align: center; text-align: center;
display: block !important; display: block !important;
@ -41,9 +42,9 @@
} }
.modal-content { .modal-content {
border: 0 none; border: none !important;
border-radius: 10px; border-radius: 3px !important;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.15), 0 0 1px 1px rgba(0, 0, 0, 0.1); box-shadow: none !important;
.modal-header { .modal-header {
h6 { h6 {
margin-top: 10px; margin-top: 10px;
@ -59,8 +60,9 @@
color: #000; color: #000;
} }
.modal-footer { .modal-footer {
border-top: 1px solid $medium-gray; // border-top: 1px solid $medium-gray;
padding: 0px; border: none !important;
// padding: 0px;
&.no-border-footer { &.no-border-footer {
border-top: 0 none; border-top: 0 none;

View File

@ -23,7 +23,8 @@
"opcional": "Opcional", "opcional": "Opcional",
"orden": "Orden", "orden": "Orden",
"ePreguntaCerradaOpcion": "E Pregunta Cerrada Opcion", "ePreguntaCerradaOpcion": "E Pregunta Cerrada Opcion",
"encuesta": "Encuesta" "encuesta": "Encuesta",
"tiporespuesta": "Tipo de respuesta"
} }
} }
} }

View File

@ -4,35 +4,37 @@
"home": { "home": {
"title": "Encuestas", "title": "Encuestas",
"refreshListLabel": "Refrescar lista", "refreshListLabel": "Refrescar lista",
"createLabel": "Crear nuevo Encuesta", "createLabel": "Crear nueva encuesta",
"createOrEditLabel": "Crear o editar Encuesta", "createOrEditLabel": "Crear o editar encuesta",
"notFound": "Ningún Encuestas encontrado" "notFound": "Ninguna encuesta fue encontrada"
}, },
"created": "Un nuevo Encuesta ha sido creado con el identificador {{ param }}", "created": "Una nueva encuesta ha sido creada con el identificador {{ param }}",
"updated": "Un Encuesta ha sido actualizado con el identificador {{ param }}", "updated": "Una encuesta ha sido actualizado con el identificador {{ param }}",
"deleted": "Un Encuesta ha sido eliminado con el identificador {{ param }}", "deleted": "Una encuesta ha sido eliminada con el identificador {{ param }}",
"delete": { "delete": {
"question": "¿Seguro que quiere eliminar Encuesta {{ id }}?" "question": "¿Seguro que quiere eliminar la encuesta?",
"deletequestion": "¿Seguro que quiere eliminar esta pregunta?",
"deleteoption": "¿Seguro que quiere eliminar esta opción?"
}, },
"detail": { "detail": {
"title": "Encuesta" "title": "Encuesta"
}, },
"id": "ID", "id": "ID",
"nombre": "Nombre", "nombre": "Nombre",
"descripcion": "Descripcion", "descripcion": "Descripción",
"fechaCreacion": "Fecha Creacion", "fechaCreacion": "Fecha Creación",
"fechaPublicacion": "Fecha Publicacion", "fechaPublicacion": "Fecha Publicación",
"fechaFinalizar": "Fecha Finalizar", "fechaFinalizar": "Fecha Finalizar",
"fechaFinalizada": "Fecha Finalizada", "fechaFinalizada": "Fecha Finalizada",
"calificacion": "Calificacion", "calificacion": "Calificación",
"acceso": "Acceso", "acceso": "Acceso",
"contrasenna": "Contrasenna", "contrasenna": "Contraseña",
"estado": "Estado", "estado": "Estado",
"usuarioEncuesta": "Usuario Encuesta", "usuarioEncuesta": "Usuario Encuesta",
"ePreguntaAbierta": "E Pregunta Abierta", "ePreguntaAbierta": "Pregunta Abierta",
"ePreguntaCerrada": "E Pregunta Cerrada", "ePreguntaCerrada": "Pregunta Cerrada",
"categoria": "Categoría", "categoria": "Categoría",
"usuarioExtra": "Usuario Extra" "usuarioExtra": "Correo Usuario"
} }
} }
} }

View File

@ -129,14 +129,16 @@
"create": "Crear", "create": "Crear",
"enable": "Habilitar", "enable": "Habilitar",
"disable": "Deshabilitar", "disable": "Deshabilitar",
"toggleStatus": "Cambiar Estado" "toggleStatus": "Cambiar Estado",
"publish": "Publicar"
}, },
"detail": { "detail": {
"field": "Campo", "field": "Campo",
"value": "Valor" "value": "Valor"
}, },
"delete": { "delete": {
"title": "Confirmar operación de borrado" "title": "Confirmar de operación",
"status": "Confirmar cambio de estado"
}, },
"validation": { "validation": {
"required": "Este campo es obligatorio.", "required": "Este campo es obligatorio.",
@ -150,6 +152,11 @@
"number": "Este campo debe ser un número.", "number": "Este campo debe ser un número.",
"integerNumber": "Este campo debe ser un número entero.", "integerNumber": "Este campo debe ser un número entero.",
"datetimelocal": "Este campo debe ser una fecha y hora." "datetimelocal": "Este campo debe ser una fecha y hora."
},
"publish": {
"title": "Publicar encuesta",
"detail": "¿Está seguro de querer publicar esta encuesta?",
"success": "Su encuesta fue publicada exitosamente"
} }
}, },
"error": { "error": {

View File

@ -10,7 +10,8 @@
"messages": { "messages": {
"error": { "error": {
"authentication": "Revise las credenciales e intente de nuevo ", "authentication": "Revise las credenciales e intente de nuevo ",
"isGoogle": "Al haber ingresado por medio de Google no cuenta con los permisos para modificar su contraseña" "isGoogle": "Al haber ingresado por medio de Google no cuenta con los permisos para modificar su contraseña",
"userSuspended": "No cuenta con los permisos para iniciar sesión. Su cuenta se encuentra suspendida"
} }
}, },
"password": { "password": {

View File

@ -12,7 +12,7 @@
"updated": "El usuario con el identificador {{ param }} ha sido actualizado", "updated": "El usuario con el identificador {{ param }} ha sido actualizado",
"deleted": "El usuario con el identificador {{ param }} ha sido eliminado", "deleted": "El usuario con el identificador {{ param }} ha sido eliminado",
"delete": { "delete": {
"question": "¿Seguro que quiere eliminar el usuario {{ id }}?" "question": "¿Seguro que quiere cambiar el estado del usuario?"
}, },
"detail": { "detail": {
"title": "Usuario" "title": "Usuario"

View File

@ -13,6 +13,8 @@
<link rel="icon" href="favicon.ico" /> <link rel="icon" href="favicon.ico" />
<link rel="manifest" href="manifest.webapp" /> <link rel="manifest" href="manifest.webapp" />
<link rel="stylesheet" href="content/css/loading.css" /> <link rel="stylesheet" href="content/css/loading.css" />
<link rel="stylesheet" href="content/css/loading-2.css" />
<link rel="stylesheet" href="content/css/loading-boxes.css" />
<!-- jhipster-needle-add-resources-to-root - JHipster will add new resources here --> <!-- jhipster-needle-add-resources-to-root - JHipster will add new resources here -->
</head> </head>
<body> <body>
@ -24,16 +26,23 @@
<![endif]--> <![endif]-->
<jhi-main> <jhi-main>
<div class="app-loading"> <div class="app-loading">
<div class="lds-pacman"> <div class="loader">
<div> <div class="l_main">
<div></div> <div class="l_square"><span></span><span></span><span></span></div>
<div></div> <div class="l_square"><span></span><span></span><span></span></div>
<div></div> <div class="l_square"><span></span><span></span><span></span></div>
<div class="l_square"><span></span><span></span><span></span></div>
</div> </div>
<div> </div>
<div></div>
<div></div> <div class="container">
<div></div> <div class="tittle"><h2>Cargando</h2></div>
<div class="square-container">
<div class="square square1">&nbsp;</div>
<div class="square square2">&nbsp;</div>
<div class="square square3">&nbsp;</div>
<div class="square square4">&nbsp;</div>
<div class="square square5">&nbsp;</div>
</div> </div>
</div> </div>
</div> </div>