Compare commits

..

8 Commits

524 changed files with 4493 additions and 34988 deletions

View File

@ -1,31 +0,0 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test

View File

@ -43,21 +43,9 @@
{ "glob": "axios.min.js", "input": "./node_modules/axios/dist", "output": "swagger-ui" }, { "glob": "axios.min.js", "input": "./node_modules/axios/dist", "output": "swagger-ui" },
{ "glob": "**/*", "input": "src/main/webapp/swagger-ui/", "output": "swagger-ui" } { "glob": "**/*", "input": "src/main/webapp/swagger-ui/", "output": "swagger-ui" }
], ],
"styles": [ "styles": ["src/main/webapp/content/scss/paper-dashboard.scss", "./node_modules/swiper/swiper-bundle.min.css"],
"src/main/webapp/content/scss/paper-dashboard.scss",
"./node_modules/swiper/swiper-bundle.min.css",
"node_modules/chartist/dist/chartist.css"
],
"scripts": [ "scripts": [
"./node_modules/jquery/dist/jquery.min.js", "src/main/webapp/content/js/bootstrap.min.js",
"src/main/webapp/content/js/jquery.bootstrap.wizard.min.js",
"src/main/webapp/content/js/jquery.datatables.js",
"src/main/webapp/content/js/jquery.easypiechart.min.js",
"src/main/webapp/content/js/jquery.validate.min.js",
"src/main/webapp/content/js/jquery-jvectormap.js",
"src/main/webapp/content/js/jquery-ui.min.js",
"src/main/webapp/content/js/bootstrap.bundle.min.js",
"src/main/webapp/content/js/moment.min.js",
"src/main/webapp/content/js/bootstrap-datetimepicker.js", "src/main/webapp/content/js/bootstrap-datetimepicker.js",
"src/main/webapp/content/js/bootstrap-notify.js", "src/main/webapp/content/js/bootstrap-notify.js",
"src/main/webapp/content/js/bootstrap-selectpicker.js", "src/main/webapp/content/js/bootstrap-selectpicker.js",
@ -66,12 +54,19 @@
"src/main/webapp/content/js/chartist.min.js", "src/main/webapp/content/js/chartist.min.js",
"src/main/webapp/content/js/es6-promise-auto.min.js", "src/main/webapp/content/js/es6-promise-auto.min.js",
"src/main/webapp/content/js/fullcalendar.min.js", "src/main/webapp/content/js/fullcalendar.min.js",
"src/main/webapp/content/js/jquery.bootstrap.wizard.min.js",
"src/main/webapp/content/js/jquery.datatables.js",
"src/main/webapp/content/js/jquery.easypiechart.min.js",
"src/main/webapp/content/js/jquery.validate.min.js",
"src/main/webapp/content/js/jquery-3.1.1.min.js",
"src/main/webapp/content/js/jquery-jvectormap.js",
"src/main/webapp/content/js/jquery-ui.min.js",
"src/main/webapp/content/js/moment.min.js",
"src/main/webapp/content/js/nouislider.min.js", "src/main/webapp/content/js/nouislider.min.js",
"src/main/webapp/content/js/paper-dashboard.js",
"src/main/webapp/content/js/perfect-scrollbar.min.js", "src/main/webapp/content/js/perfect-scrollbar.min.js",
"src/main/webapp/content/js/sweetalert2.js", "src/main/webapp/content/js/sweetalert2.js",
"./node_modules/swiper/swiper-bundle.min.js", "./node_modules/swiper/swiper-bundle.min.js"
"src/main/webapp/content/js/paper-dashboard.js",
"src/main/webapp/content/js/api-google-platform.js"
] ]
}, },
"configurations": { "configurations": {

3089
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -58,8 +58,7 @@
"preci:e2e:server:start": "npm run docker:db:await --if-present && npm run docker:others:await --if-present", "preci:e2e:server:start": "npm run docker:db:await --if-present && npm run docker:others:await --if-present",
"ci:e2e:server:start": "java -jar target/e2e.$npm_package_config_packaging --spring.profiles.active=$npm_package_config_default_environment -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.org.datasurvey=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF --logging.level.org.springframework.web=ERROR", "ci:e2e:server:start": "java -jar target/e2e.$npm_package_config_packaging --spring.profiles.active=$npm_package_config_default_environment -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.org.datasurvey=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF --logging.level.org.springframework.web=ERROR",
"ci:frontend:build": "npm run webapp:build:$npm_package_config_default_environment", "ci:frontend:build": "npm run webapp:build:$npm_package_config_default_environment",
"ci:frontend:test": "npm run ci:frontend:build && npm test", "ci:frontend:test": "npm run ci:frontend:build && npm test"
"postinstall": "ngcc"
}, },
"config": { "config": {
"backend_port": 8080, "backend_port": 8080,
@ -67,7 +66,6 @@
"packaging": "jar" "packaging": "jar"
}, },
"dependencies": { "dependencies": {
"@angular/cdk": "^12.1.4",
"@angular/common": "12.0.5", "@angular/common": "12.0.5",
"@angular/compiler": "12.0.5", "@angular/compiler": "12.0.5",
"@angular/core": "12.0.5", "@angular/core": "12.0.5",
@ -76,28 +74,17 @@
"@angular/platform-browser": "12.0.5", "@angular/platform-browser": "12.0.5",
"@angular/platform-browser-dynamic": "12.0.5", "@angular/platform-browser-dynamic": "12.0.5",
"@angular/router": "12.0.5", "@angular/router": "12.0.5",
"@fortawesome/angular-fontawesome": "^0.9.0", "@fortawesome/angular-fontawesome": "0.9.0",
"@fortawesome/fontawesome-svg-core": "^1.2.35", "@fortawesome/fontawesome-svg-core": "1.2.35",
"@fortawesome/free-brands-svg-icons": "^5.15.3", "@fortawesome/free-solid-svg-icons": "5.15.3",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@ng-bootstrap/ng-bootstrap": "9.1.3", "@ng-bootstrap/ng-bootstrap": "9.1.3",
"@ngx-translate/core": "13.0.0", "@ngx-translate/core": "13.0.0",
"@ngx-translate/http-loader": "6.0.0", "@ngx-translate/http-loader": "6.0.0",
"@types/gapi.auth2": "0.0.54", "@types/gapi.auth2": "0.0.54",
"angularx-social-login": "^4.0.1", "angularx-social-login": "^4.0.1",
"bootstrap": "4.6.0", "bootstrap": "4.6.0",
"chart.js": "^3.5.0",
"chartist": "^0.11.4",
"dayjs": "1.10.5", "dayjs": "1.10.5",
"file-saver": "^2.0.5",
"jquery": "^3.6.0",
"jspdf": "^2.3.1",
"jw-angular-social-buttons": "^1.0.0",
"ng-chartist": "^5.0.0",
"ng2-charts": "^2.4.2",
"ngx-infinite-scroll": "10.0.1", "ngx-infinite-scroll": "10.0.1",
"ngx-paypal": "^8.0.0",
"ngx-sharebuttons": "^8.0.5",
"ngx-webstorage": "8.0.0", "ngx-webstorage": "8.0.0",
"rxjs": "6.6.7", "rxjs": "6.6.7",
"sockjs-client": "1.5.0", "sockjs-client": "1.5.0",
@ -105,7 +92,6 @@
"swiper": "^6.7.5", "swiper": "^6.7.5",
"tslib": "2.3.0", "tslib": "2.3.0",
"webstomp-client": "1.2.6", "webstomp-client": "1.2.6",
"xlsx": "^0.17.0",
"zone.js": "0.11.4" "zone.js": "0.11.4"
}, },
"devDependencies": { "devDependencies": {
@ -115,11 +101,7 @@
"@angular/cli": "12.0.4", "@angular/cli": "12.0.4",
"@angular/compiler-cli": "12.0.5", "@angular/compiler-cli": "12.0.5",
"@angular/service-worker": "12.0.5", "@angular/service-worker": "12.0.5",
"@types/bootstrap": "^5.0.17",
"@types/chartist": "^0.11.1",
"@types/file-saver": "^2.0.3",
"@types/jest": "26.0.23", "@types/jest": "26.0.23",
"@types/jquery": "^3.5.6",
"@types/node": "15.12.2", "@types/node": "15.12.2",
"@types/sockjs-client": "1.5.0", "@types/sockjs-client": "1.5.0",
"@typescript-eslint/eslint-plugin": "4.27.0", "@typescript-eslint/eslint-plugin": "4.27.0",

View File

@ -318,12 +318,6 @@
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-messaging</artifactId> <artifactId>spring-security-messaging</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>4.0.0-2</version>
</dependency>
<!-- jhipster-needle-maven-add-dependency --> <!-- jhipster-needle-maven-add-dependency -->
</dependencies> </dependencies>

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(100L)) .newCacheConfigurationBuilder(Object.class, Object.class, ResourcePoolsBuilder.heap(ehcache.getMaxEntries()))
.withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(1))) .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(ehcache.getTimeToLiveSeconds())))
.build() .build()
); );
} }
@ -82,7 +82,6 @@ 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

@ -43,7 +43,10 @@ public class UsuarioEncuesta implements Serializable {
private UsuarioExtra usuarioExtra; private UsuarioExtra usuarioExtra;
@ManyToOne @ManyToOne
@JsonIgnoreProperties(value = { "usuarioEncuestas", "usuarioExtra" }, allowSetters = true) @JsonIgnoreProperties(
value = { "usuarioEncuestas", "ePreguntaAbiertas", "ePreguntaCerradas", "categoria", "usuarioExtra" },
allowSetters = true
)
private Encuesta encuesta; private Encuesta encuesta;
// jhipster-needle-entity-add-field - JHipster will add fields here // jhipster-needle-entity-add-field - JHipster will add fields here

View File

@ -64,7 +64,7 @@ public class UsuarioExtra implements Serializable {
joinColumns = @JoinColumn(name = "usuario_extra_id"), joinColumns = @JoinColumn(name = "usuario_extra_id"),
inverseJoinColumns = @JoinColumn(name = "plantilla_id") inverseJoinColumns = @JoinColumn(name = "plantilla_id")
) )
@JsonIgnoreProperties(value = { "pPreguntaCerradas", "pPreguntaAbiertas", "usuarioExtras" }, allowSetters = true) @JsonIgnoreProperties(value = { "pPreguntaCerradas", "pPreguntaAbiertas", "categoria", "usuarioExtras" }, allowSetters = true)
private Set<Plantilla> plantillas = new HashSet<>(); private Set<Plantilla> plantillas = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here // jhipster-needle-entity-add-field - JHipster will add fields here

View File

@ -1,8 +1,7 @@
package org.datasurvey.repository; package org.datasurvey.repository;
import org.datasurvey.domain.Categoria; import org.datasurvey.domain.Categoria;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.*;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
/** /**

View File

@ -4,10 +4,7 @@ import java.nio.charset.StandardCharsets;
import java.util.Locale; 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.Factura;
import org.datasurvey.domain.User; import org.datasurvey.domain.User;
import org.datasurvey.domain.UsuarioEncuesta;
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;
@ -32,10 +29,6 @@ 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 FACTURA = "factura";
private static final String BASE_URL = "baseUrl"; private static final String BASE_URL = "baseUrl";
private final JHipsterProperties jHipsterProperties; private final JHipsterProperties jHipsterProperties;
@ -99,54 +92,6 @@ 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
public void sendEmailFromTemplateUsuarioEncuesta(User user, UsuarioEncuesta usuarioEncuesta, String templateName, String titleKey) {
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(USER, user);
context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl());
context.setVariable("colaborador", usuarioEncuesta);
String content = templateEngine.process(templateName, context);
String subject = messageSource.getMessage(titleKey, null, locale);
sendEmail(user.getEmail(), subject, content, false, true);
}
@Async
public void sendEmailFromTemplateFactura(User user, Factura factura, String templateName, String titleKey) {
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(USER, user);
context.setVariable(FACTURA, factura);
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());
@ -164,68 +109,4 @@ public class MailService {
log.debug("Sending password reset email to '{}'", user.getEmail()); log.debug("Sending password reset email to '{}'", user.getEmail());
sendEmailFromTemplate(user, "mail/passwordResetEmail", "email.reset.title"); sendEmailFromTemplate(user, "mail/passwordResetEmail", "email.reset.title");
} }
@Async
public void sendPasswordRestoredMail(User user) {
log.debug("Sending password restored email to '{}'", user.getEmail());
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");
}
@Async
public void sendEncuestaDeleted(UsuarioExtra user) {
log.debug("Sending encuesta deletion notification mail to '{}'", user.getUser().getEmail());
sendEmailFromTemplate(user.getUser(), "mail/encuestaDeletedEmail", "email.encuestaDeleted.title");
}
@Async
public void sendInvitationColaborator(UsuarioEncuesta user) {
log.debug("Sending encuesta invitation collaboration notification mail to '{}'", user.getUsuarioExtra().getUser().getEmail());
sendEmailFromTemplateUsuarioEncuesta(
user.getUsuarioExtra().getUser(),
user,
"mail/invitationColaboratorEmail",
"email.invitation.title"
);
}
@Async
public void sendNotifyDeleteColaborator(UsuarioEncuesta user) {
log.debug("Sending delete collaboration notification mail to '{}'", user.getUsuarioExtra().getUser().getEmail());
sendEmailFromTemplateUsuarioEncuesta(
user.getUsuarioExtra().getUser(),
user,
"mail/deleteColaboratorEmail",
"email.deleteColaborator.title"
);
}
@Async
public void sendReceiptUser(UsuarioExtra user, Factura factura) {
log.debug("Sending paypal receipt mail to '{}'", user.getUser().getEmail());
sendEmailFromTemplateFactura(user.getUser(), factura, "mail/facturaPayPalEmail", "email.receipt.title");
}
} }

View File

@ -76,19 +76,6 @@ 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
@ -394,16 +381,11 @@ 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

@ -168,16 +168,11 @@ public class AccountResource {
public void requestPasswordReset(@RequestBody String mail) { public void requestPasswordReset(@RequestBody String mail) {
Optional<User> user = userService.requestPasswordReset(mail); Optional<User> user = userService.requestPasswordReset(mail);
if (user.isPresent()) { if (user.isPresent()) {
if (user.get().getFirstName() == null || (!user.get().getFirstName().equals("IsGoogle"))) { mailService.sendPasswordResetMail(user.get());
mailService.sendPasswordResetMail(user.get());
} else {
throw new UserIsGoogleException();
}
} else { } else {
// Pretend the request has been successful to prevent checking which emails really exist // Pretend the request has been successful to prevent checking which emails really exist
// but log that an invalid attempt has been made // but log that an invalid attempt has been made
log.warn("Password reset requested for non existing mail"); log.warn("Password reset requested for non existing mail");
throw new EmailNotExistException();
} }
} }
@ -197,8 +192,6 @@ public class AccountResource {
if (!user.isPresent()) { if (!user.isPresent()) {
throw new AccountResourceException("No user was found for this reset key"); throw new AccountResourceException("No user was found for this reset key");
} else {
mailService.sendPasswordRestoredMail(user.get());
} }
} }

View File

@ -2,13 +2,11 @@ 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;
@ -60,15 +58,10 @@ 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/{id}") @PostMapping("/e-pregunta-cerrada-opcions")
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");
@ -80,21 +73,10 @@ public class EPreguntaCerradaOpcionResource {
.body(result); .body(result);
} }
@PutMapping("/e-pregunta-cerrada-opcions/count/{id}")
public ResponseEntity<EPreguntaCerradaOpcion> updateOpcionCount(@PathVariable(value = "id", required = false) final Long id) {
System.out.println(id);
EPreguntaCerradaOpcion updatedOpcion = ePreguntaCerradaOpcionService.findOne(id).get();
System.out.println(updatedOpcion);
int cantidad = updatedOpcion.getCantidad() + 1;
updatedOpcion.setCantidad(cantidad);
this.ePreguntaCerradaOpcionService.partialUpdate(updatedOpcion);
return ResponseEntity.ok(updatedOpcion);
}
/** /**
* {@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,
@ -128,7 +110,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,
@ -214,15 +196,4 @@ 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,22 +2,15 @@ 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.*; 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;
@ -48,46 +41,14 @@ 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;
private final PlantillaService plantillaService;
private final PPreguntaCerradaService pPreguntaCerradaService;
private final PPreguntaAbiertaService pPreguntaAbiertaService;
private final PPreguntaCerradaOpcionService pPreguntaCerradaOpcionService;
public EncuestaResource( public EncuestaResource(
EncuestaService encuestaService, EncuestaService encuestaService,
EncuestaRepository encuestaRepository, EncuestaRepository encuestaRepository,
EncuestaQueryService encuestaQueryService, EncuestaQueryService encuestaQueryService
MailService mailService,
EPreguntaCerradaService ePreguntaCerradaService,
EPreguntaAbiertaService ePreguntaAbiertaService,
EPreguntaCerradaOpcionService ePreguntaCerradaOpcionService,
PlantillaService plantillaService,
PPreguntaCerradaService pPreguntaCerradaService,
PPreguntaAbiertaService pPreguntaAbiertaService,
PPreguntaCerradaOpcionService pPreguntaCerradaOpcionService
) { ) {
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;
this.plantillaService = plantillaService;
this.pPreguntaCerradaService = pPreguntaCerradaService;
this.pPreguntaAbiertaService = pPreguntaAbiertaService;
this.pPreguntaCerradaOpcionService = pPreguntaCerradaOpcionService;
} }
/** /**
@ -110,82 +71,10 @@ public class EncuestaResource {
.body(result); .body(result);
} }
@PostMapping("/encuestas/{plantillaId}")
public ResponseEntity<Encuesta> createEncuestaFromTemplate(
@Valid @RequestBody Encuesta encuesta,
@PathVariable(value = "plantillaId", required = false) final Long plantillaId
) throws URISyntaxException {
log.debug("REST request to save Encuesta : {}", encuesta);
if (encuesta.getId() != null) {
throw new BadRequestAlertException("A new encuesta cannot already have an ID", ENTITY_NAME, "idexists");
}
// Copy from survey template to survey
Optional<Plantilla> plantilla = plantillaService.findOne(plantillaId);
if (plantilla.isPresent()) {
encuesta.setNombre(plantilla.get().getNombre());
encuesta.setDescripcion(plantilla.get().getDescripcion());
encuesta.setCategoria(plantilla.get().getCategoria());
Encuesta encuestaCreated = encuestaService.save(encuesta);
// Preguntas cerradas
List<PPreguntaCerrada> preguntasCerradas = pPreguntaCerradaService.findAll();
for (PPreguntaCerrada pPreguntaCerrada : preguntasCerradas) {
if (pPreguntaCerrada.getPlantilla().getId().equals(plantillaId)) {
EPreguntaCerrada newEPreguntaCerrada = new EPreguntaCerrada();
newEPreguntaCerrada.setNombre(pPreguntaCerrada.getNombre());
newEPreguntaCerrada.setTipo(pPreguntaCerrada.getTipo());
newEPreguntaCerrada.setOpcional(pPreguntaCerrada.getOpcional());
newEPreguntaCerrada.setOrden(pPreguntaCerrada.getOrden());
newEPreguntaCerrada.setEncuesta(encuestaCreated);
ePreguntaCerradaService.save(newEPreguntaCerrada);
// Opciones de preguntas cerradas
List<PPreguntaCerradaOpcion> opciones = pPreguntaCerradaOpcionService.findAll();
for (PPreguntaCerradaOpcion pPreguntaCerradaOpcion : opciones) {
if (pPreguntaCerradaOpcion.getPPreguntaCerrada().getId().equals(pPreguntaCerrada.getId())) {
EPreguntaCerradaOpcion newEPreguntaCerradaOpcion = new EPreguntaCerradaOpcion();
newEPreguntaCerradaOpcion.setNombre(pPreguntaCerradaOpcion.getNombre());
newEPreguntaCerradaOpcion.setOrden(pPreguntaCerradaOpcion.getOrden());
newEPreguntaCerradaOpcion.setCantidad(0);
newEPreguntaCerradaOpcion.setEPreguntaCerrada(newEPreguntaCerrada);
ePreguntaCerradaOpcionService.save(newEPreguntaCerradaOpcion);
}
}
}
}
// Preguntas abiertas
List<PPreguntaAbierta> preguntasAbiertas = pPreguntaAbiertaService.findAll();
for (PPreguntaAbierta pPreguntaAbierta : preguntasAbiertas) {
if (pPreguntaAbierta.getPlantilla().getId().equals(plantillaId)) {
EPreguntaAbierta newEPreguntaAbierta = new EPreguntaAbierta();
newEPreguntaAbierta.setNombre(pPreguntaAbierta.getNombre());
newEPreguntaAbierta.setOpcional(pPreguntaAbierta.getOpcional());
newEPreguntaAbierta.setOrden(pPreguntaAbierta.getOrden());
newEPreguntaAbierta.setEncuesta(encuestaCreated);
ePreguntaAbiertaService.save(newEPreguntaAbierta);
}
}
return ResponseEntity
.created(new URI("/api/encuestas/" + encuestaCreated.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, encuestaCreated.getId().toString()))
.body(encuestaCreated);
}
return ResponseEntity.ok().body(null);
}
/** /**
* {@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,
@ -210,66 +99,6 @@ public class EncuestaResource {
} }
Encuesta result = encuestaService.save(encuesta); Encuesta result = encuestaService.save(encuesta);
if (encuesta.getUsuarioExtra().getUser() != null) {
mailService.sendEncuestaDeleted(encuesta.getUsuarioExtra());
}
return ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, encuesta.getId().toString()))
.body(result);
}
@PutMapping("/encuestas/update/{id}")
public ResponseEntity<Encuesta> updateEncuestaReal(
@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);
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()))
@ -279,7 +108,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,
@ -325,55 +154,6 @@ 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.
* *
@ -414,78 +194,4 @@ 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(5.1d);
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

@ -8,12 +8,9 @@ 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.Factura; import org.datasurvey.domain.Factura;
import org.datasurvey.domain.UsuarioExtra;
import org.datasurvey.repository.FacturaRepository; import org.datasurvey.repository.FacturaRepository;
import org.datasurvey.service.FacturaQueryService; import org.datasurvey.service.FacturaQueryService;
import org.datasurvey.service.FacturaService; import org.datasurvey.service.FacturaService;
import org.datasurvey.service.MailService;
import org.datasurvey.service.UsuarioExtraService;
import org.datasurvey.service.criteria.FacturaCriteria; import org.datasurvey.service.criteria.FacturaCriteria;
import org.datasurvey.web.rest.errors.BadRequestAlertException; import org.datasurvey.web.rest.errors.BadRequestAlertException;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -44,22 +41,10 @@ public class FacturaResource {
private final FacturaQueryService facturaQueryService; private final FacturaQueryService facturaQueryService;
private final UsuarioExtraService userExtraService; public FacturaResource(FacturaService facturaService, FacturaRepository facturaRepository, FacturaQueryService facturaQueryService) {
private final MailService mailService;
public FacturaResource(
FacturaService facturaService,
FacturaRepository facturaRepository,
FacturaQueryService facturaQueryService,
UsuarioExtraService userExtraService,
MailService mailService
) {
this.facturaService = facturaService; this.facturaService = facturaService;
this.facturaRepository = facturaRepository; this.facturaRepository = facturaRepository;
this.facturaQueryService = facturaQueryService; this.facturaQueryService = facturaQueryService;
this.userExtraService = userExtraService;
this.mailService = mailService;
} }
/** /**
@ -75,22 +60,11 @@ public class FacturaResource {
if (factura.getId() != null) { if (factura.getId() != null) {
throw new BadRequestAlertException("A new factura cannot already have an ID", ENTITY_NAME, "idexists"); throw new BadRequestAlertException("A new factura cannot already have an ID", ENTITY_NAME, "idexists");
} }
Optional<UsuarioExtra> usuarioExtra = userExtraService.findOne(Long.parseLong(factura.getNombreUsuario()));
factura.setNombreUsuario(usuarioExtra.get().getNombre());
Factura result = facturaService.save(factura); Factura result = facturaService.save(factura);
mailService.sendReceiptUser(usuarioExtra.get(), factura);
return ResponseEntity return ResponseEntity
.created(new URI("/api/facturas/" + result.getId())) .created(new URI("/api/facturas/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result); .body(result);
//retrieve yser
//Enviar el correo
} }
/** /**

View File

@ -2,14 +2,11 @@ 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.PPreguntaCerrada;
import org.datasurvey.domain.PPreguntaCerradaOpcion; import org.datasurvey.domain.PPreguntaCerradaOpcion;
import org.datasurvey.repository.PPreguntaCerradaOpcionRepository; import org.datasurvey.repository.PPreguntaCerradaOpcionRepository;
import org.datasurvey.service.PPreguntaCerradaOpcionQueryService; import org.datasurvey.service.PPreguntaCerradaOpcionQueryService;
@ -61,15 +58,10 @@ public class PPreguntaCerradaOpcionResource {
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new pPreguntaCerradaOpcion, or with status {@code 400 (Bad Request)} if the pPreguntaCerradaOpcion has already an ID. * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new pPreguntaCerradaOpcion, or with status {@code 400 (Bad Request)} if the pPreguntaCerradaOpcion has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect. * @throws URISyntaxException if the Location URI syntax is incorrect.
*/ */
@PostMapping("/p-pregunta-cerrada-opcions/{id}") @PostMapping("/p-pregunta-cerrada-opcions")
public ResponseEntity<PPreguntaCerradaOpcion> createPPreguntaCerradaOpcion( public ResponseEntity<PPreguntaCerradaOpcion> createPPreguntaCerradaOpcion(
@Valid @RequestBody PPreguntaCerradaOpcion pPreguntaCerradaOpcion, @Valid @RequestBody PPreguntaCerradaOpcion pPreguntaCerradaOpcion
@PathVariable(value = "id", required = false) final Long id
) throws URISyntaxException { ) throws URISyntaxException {
PPreguntaCerrada pPreguntaCerrada = new PPreguntaCerrada();
pPreguntaCerrada.setId(id);
pPreguntaCerradaOpcion.setPPreguntaCerrada(pPreguntaCerrada);
log.debug("REST request to save PPreguntaCerradaOpcion : {}", pPreguntaCerradaOpcion); log.debug("REST request to save PPreguntaCerradaOpcion : {}", pPreguntaCerradaOpcion);
if (pPreguntaCerradaOpcion.getId() != null) { if (pPreguntaCerradaOpcion.getId() != null) {
throw new BadRequestAlertException("A new pPreguntaCerradaOpcion cannot already have an ID", ENTITY_NAME, "idexists"); throw new BadRequestAlertException("A new pPreguntaCerradaOpcion cannot already have an ID", ENTITY_NAME, "idexists");
@ -204,15 +196,4 @@ public class PPreguntaCerradaOpcionResource {
.headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString()))
.build(); .build();
} }
@PostMapping("/p-pregunta-cerrada-opcions/deleteMany")
public ResponseEntity<Void> deleteManyPPreguntaCerradaOpcion(@Valid @RequestBody int[] ids) {
for (int id : ids) {
pPreguntaCerradaOpcionService.delete((long) id);
}
return ResponseEntity
.noContent()
.headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, Arrays.toString(ids)))
.build();
}
} }

View File

@ -2,17 +2,15 @@ package org.datasurvey.web.rest;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
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.*; import org.datasurvey.domain.Plantilla;
import org.datasurvey.repository.PlantillaRepository; import org.datasurvey.repository.PlantillaRepository;
import org.datasurvey.service.*; import org.datasurvey.service.PlantillaQueryService;
import org.datasurvey.service.PlantillaService;
import org.datasurvey.service.criteria.PlantillaCriteria; import org.datasurvey.service.criteria.PlantillaCriteria;
import org.datasurvey.web.rest.errors.BadRequestAlertException; import org.datasurvey.web.rest.errors.BadRequestAlertException;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -43,26 +41,14 @@ public class PlantillaResource {
private final PlantillaQueryService plantillaQueryService; private final PlantillaQueryService plantillaQueryService;
private final PPreguntaCerradaService pPreguntaCerradaService;
private final PPreguntaAbiertaService pPreguntaAbiertaService;
private final PPreguntaCerradaOpcionService pPreguntaCerradaOpcionService;
public PlantillaResource( public PlantillaResource(
PlantillaService plantillaService, PlantillaService plantillaService,
PlantillaRepository plantillaRepository, PlantillaRepository plantillaRepository,
PlantillaQueryService plantillaQueryService, PlantillaQueryService plantillaQueryService
PPreguntaCerradaService pPreguntaCerradaService,
PPreguntaAbiertaService pPreguntaAbiertaService,
PPreguntaCerradaOpcionService ePreguntaCerradaOpcionService
) { ) {
this.plantillaService = plantillaService; this.plantillaService = plantillaService;
this.plantillaRepository = plantillaRepository; this.plantillaRepository = plantillaRepository;
this.plantillaQueryService = plantillaQueryService; this.plantillaQueryService = plantillaQueryService;
this.pPreguntaCerradaService = pPreguntaCerradaService;
this.pPreguntaAbiertaService = pPreguntaAbiertaService;
this.pPreguntaCerradaOpcionService = ePreguntaCerradaOpcionService;
} }
/** /**
@ -168,55 +154,6 @@ public class PlantillaResource {
return ResponseEntity.ok().body(entityList); return ResponseEntity.ok().body(entityList);
} }
@GetMapping("/plantillas/preguntas/{id}")
public ResponseEntity<List<Object>> getPreguntasByIdPlantilla(@PathVariable Long id) {
List<PPreguntaCerrada> preguntasCerradas = pPreguntaCerradaService.findAll();
List<PPreguntaAbierta> preguntasAbiertas = pPreguntaAbiertaService.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() == PPreguntaCerrada.class) {
if (((PPreguntaCerrada) obj).getPlantilla() != null) {
if (((PPreguntaCerrada) obj).getPlantilla().getId().equals(id)) {
preguntasFiltered.add(obj);
}
}
} else if (obj.getClass() == PPreguntaAbierta.class) {
if (((PPreguntaAbierta) obj).getPlantilla() != null) {
if (((PPreguntaAbierta) obj).getPlantilla().getId().equals(id)) {
preguntasFiltered.add(obj);
}
}
}
}
return ResponseEntity.ok().body(preguntasFiltered);
}
@GetMapping("/plantillas/preguntas-opciones/{id}")
public ResponseEntity<List<List<PPreguntaCerradaOpcion>>> getPreguntaCerradaOpcionByIdPlantilla(@PathVariable Long id) {
List<List<PPreguntaCerradaOpcion>> res = new ArrayList<>();
List<PPreguntaCerrada> preguntasCerradas = pPreguntaCerradaService.findAll();
List<PPreguntaCerrada> preguntasCerradasFiltered = preguntasCerradas
.stream()
.filter(p -> Objects.nonNull(p.getPlantilla()))
.filter(p -> p.getPlantilla().getId().equals(id))
.collect(Collectors.toList());
List<PPreguntaCerradaOpcion> opciones = pPreguntaCerradaOpcionService.findAll();
for (PPreguntaCerrada pPreguntaCerrada : preguntasCerradasFiltered) {
long preguntaCerradaId = pPreguntaCerrada.getId();
List<PPreguntaCerradaOpcion> opcionesFiltered = opciones
.stream()
.filter(o -> Objects.nonNull(o.getPPreguntaCerrada()))
.filter(o -> o.getPPreguntaCerrada().getId().equals(preguntaCerradaId))
.collect(Collectors.toList());
res.add(opcionesFiltered);
}
return ResponseEntity.ok().body(res);
}
/** /**
* {@code GET /plantillas/count} : count all the plantillas. * {@code GET /plantillas/count} : count all the plantillas.
* *

View File

@ -40,7 +40,6 @@ 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

@ -2,18 +2,15 @@ package org.datasurvey.web.rest;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
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 javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.datasurvey.domain.Encuesta;
import org.datasurvey.domain.UsuarioEncuesta; import org.datasurvey.domain.UsuarioEncuesta;
import org.datasurvey.domain.UsuarioExtra;
import org.datasurvey.repository.UsuarioEncuestaRepository; import org.datasurvey.repository.UsuarioEncuestaRepository;
import org.datasurvey.service.*; import org.datasurvey.service.UsuarioEncuestaQueryService;
import org.datasurvey.service.UsuarioEncuestaService;
import org.datasurvey.service.criteria.UsuarioEncuestaCriteria; import org.datasurvey.service.criteria.UsuarioEncuestaCriteria;
import org.datasurvey.web.rest.errors.BadRequestAlertException; import org.datasurvey.web.rest.errors.BadRequestAlertException;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -39,29 +36,19 @@ public class UsuarioEncuestaResource {
private String applicationName; private String applicationName;
private final UsuarioEncuestaService usuarioEncuestaService; private final UsuarioEncuestaService usuarioEncuestaService;
private final UsuarioExtraService usuarioExtraService;
private final EncuestaService encuestaService;
private final UsuarioEncuestaRepository usuarioEncuestaRepository; private final UsuarioEncuestaRepository usuarioEncuestaRepository;
private final UsuarioEncuestaQueryService usuarioEncuestaQueryService; private final UsuarioEncuestaQueryService usuarioEncuestaQueryService;
private final MailService mailService;
public UsuarioEncuestaResource( public UsuarioEncuestaResource(
UsuarioEncuestaService usuarioEncuestaService, UsuarioEncuestaService usuarioEncuestaService,
UsuarioEncuestaRepository usuarioEncuestaRepository, UsuarioEncuestaRepository usuarioEncuestaRepository,
UsuarioEncuestaQueryService usuarioEncuestaQueryService, UsuarioEncuestaQueryService usuarioEncuestaQueryService
UsuarioExtraService usuarioExtraService,
EncuestaService encuestaService,
MailService mailService
) { ) {
this.usuarioEncuestaService = usuarioEncuestaService; this.usuarioEncuestaService = usuarioEncuestaService;
this.usuarioEncuestaRepository = usuarioEncuestaRepository; this.usuarioEncuestaRepository = usuarioEncuestaRepository;
this.usuarioEncuestaQueryService = usuarioEncuestaQueryService; this.usuarioEncuestaQueryService = usuarioEncuestaQueryService;
this.usuarioExtraService = usuarioExtraService;
this.encuestaService = encuestaService;
this.mailService = mailService;
} }
/** /**
@ -79,9 +66,6 @@ public class UsuarioEncuestaResource {
throw new BadRequestAlertException("A new usuarioEncuesta cannot already have an ID", ENTITY_NAME, "idexists"); throw new BadRequestAlertException("A new usuarioEncuesta cannot already have an ID", ENTITY_NAME, "idexists");
} }
UsuarioEncuesta result = usuarioEncuestaService.save(usuarioEncuesta); UsuarioEncuesta result = usuarioEncuestaService.save(usuarioEncuesta);
if (result.getId() != null) {
mailService.sendInvitationColaborator(usuarioEncuesta);
}
return ResponseEntity return ResponseEntity
.created(new URI("/api/usuario-encuestas/" + result.getId())) .created(new URI("/api/usuario-encuestas/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
@ -205,40 +189,10 @@ public class UsuarioEncuestaResource {
@DeleteMapping("/usuario-encuestas/{id}") @DeleteMapping("/usuario-encuestas/{id}")
public ResponseEntity<Void> deleteUsuarioEncuesta(@PathVariable Long id) { public ResponseEntity<Void> deleteUsuarioEncuesta(@PathVariable Long id) {
log.debug("REST request to delete UsuarioEncuesta : {}", id); log.debug("REST request to delete UsuarioEncuesta : {}", id);
Optional<UsuarioEncuesta> usuarioEncuesta = usuarioEncuestaService.findOne(id);
usuarioEncuestaService.delete(id); usuarioEncuestaService.delete(id);
if (usuarioEncuesta != null) {
mailService.sendNotifyDeleteColaborator(usuarioEncuesta.get());
}
return ResponseEntity return ResponseEntity
.noContent() .noContent()
.headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString()))
.build(); .build();
} }
@GetMapping("/usuario-encuestas/encuesta/{id}")
public ResponseEntity<List<UsuarioEncuesta>> getColaboradores(@PathVariable Long id) {
List<UsuarioExtra> usuariosExtras = usuarioExtraService.findAll();
List<UsuarioEncuesta> usuariosEncuestas = usuarioEncuestaService
.findAll()
.stream()
.filter(uE -> Objects.nonNull(uE.getEncuesta()))
.filter(uE -> uE.getEncuesta().getId().equals(id))
.collect(Collectors.toList());
for (UsuarioEncuesta usuarioEncuesta : usuariosEncuestas) {
long usuarioExtraId = usuarioEncuesta.getUsuarioExtra().getId();
UsuarioExtra usuarioExtra = usuariosExtras.stream().filter(u -> u.getId() == usuarioExtraId).findFirst().get();
usuarioEncuesta.getUsuarioExtra().setNombre(usuarioExtra.getNombre());
usuarioEncuesta.getUsuarioExtra().setIconoPerfil(usuarioExtra.getIconoPerfil());
}
return ResponseEntity.ok().body(usuariosEncuestas);
}
@PostMapping("/usuario-encuestas/notify/{id}")
public ResponseEntity<Void> notifyInvitationColaborator(@PathVariable Long id, @Valid @RequestBody UsuarioEncuesta usuarioEncuesta) {
log.debug("REST request to notify {} of invitation to Encuesta", usuarioEncuesta.getUsuarioExtra().getUser().getEmail());
mailService.sendInvitationColaborator(usuarioEncuesta);
return ResponseEntity.noContent().build();
}
} }

View File

@ -9,8 +9,6 @@ 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;
@ -43,22 +41,14 @@ 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;
} }
/** /**
@ -109,40 +99,6 @@ 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

@ -1,10 +0,0 @@
package org.datasurvey.web.rest.errors;
public class EmailNotExistException extends BadRequestAlertException {
private static final long serialVersionUID = 1L;
public EmailNotExistException() {
super(ErrorConstants.EMAIL_NOT_EXISTS_TYPE, "Email not exists!", "userManagement", "emailnotexists");
}
}

View File

@ -12,8 +12,6 @@ public final class ErrorConstants {
public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password"); public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password");
public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used"); public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used");
public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used"); public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used");
public static final URI EMAIL_NOT_EXISTS_TYPE = URI.create(PROBLEM_BASE_URL + "/email-not-exists");
public static final URI USER_IS_GOOGLE_TYOE = URI.create(PROBLEM_BASE_URL + "/user-is-google");
private ErrorConstants() {} private ErrorConstants() {}
} }

View File

@ -1,10 +0,0 @@
package org.datasurvey.web.rest.errors;
public class UserIsGoogleException extends BadRequestAlertException {
private static final long serialVersionUID = 1L;
public UserIsGoogleException() {
super(ErrorConstants.USER_IS_GOOGLE_TYOE, "User Is Google", "userManagement", "userisgoogle");
}
}

View File

@ -95,7 +95,7 @@ jhipster:
token-validity-in-seconds: 86400 token-validity-in-seconds: 86400
token-validity-in-seconds-for-remember-me: 2592000 token-validity-in-seconds-for-remember-me: 2592000
mail: # specific JHipster mail property, for standard properties see MailProperties mail: # specific JHipster mail property, for standard properties see MailProperties
base-url: http://localhost:9000 base-url: http://127.0.0.1:8080
logging: logging:
use-json-format: false # By default, logs are not in Json format use-json-format: false # By default, logs are not in Json format
logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration

View File

@ -19,56 +19,3 @@ email.reset.title=DataSurvey password reset
email.reset.greeting=Dear {0} email.reset.greeting=Dear {0}
email.reset.text1=For your DataSurvey account a password reset was requested, please click on the URL below to reset it: email.reset.text1=For your DataSurvey account a password reset was requested, please click on the URL below to reset it:
email.reset.text2=Regards, email.reset.text2=Regards,
# Password Restored Mail
email.restored.title=Your password was reset in DataSurvey
email.restored.greeting=Hello, {0}!
email.restored.text1=Your DataSurvey password has been successfully reset..
email.restored.text2=Regards,
email.restored.text3=If you did not make this change, please notify the following email immediately:
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,
#Invitation Colaborator
email.invitation.title=Se le ha invitado a colaborar en una encuesta
email.invitation.greeting=¡Nueva invitación, {0}!
email.invitation.text1=Fue invitado a la encuesta "{0}(#{1})". Para aceptar la solicitud de colaborador, ingrese al área de colaboraciones
email.invitation.text2=Saludos,
#Delete Colaborator
email.deleteColaborator.title=Eliminado de colaboración
email.deleteColaborator.greeting=Hola, {0}
email.deleteColaborator.text1=Le informamos que ya no cuenta con los permisos de colaborador para la encuesta {0}(#{1}), ya que su colaboración ha sido eliminada por el dueño de la encuesta"
email.deleteColaborator.text2=Saludos,
email.receipt.title=Comprobante de pago
email.receipt.user={0}
email.receipt.fecha=Fecha de pago: {0}
email.receipt.plantilla={0}
email.receipt.precio=${0}

View File

@ -5,56 +5,17 @@ error.status=Estado:
error.message=Mensaje: error.message=Mensaje:
# Activation email # Activation email
email.activation.title=Confirmación de correo con DataSurvey email.activation.title=Activación de DataSurvey
email.activation.greeting=¡Hola, {0}! email.activation.greeting=Estimado/a {0}
email.activation.text1=¡Nos alegra que sea parte de DataSurvey! Como último paso debe confirmar su dirección de correo haciendo clic en el siguiente enlace: email.activation.text1=Su cuenta en DataSurvey ha sido creada. Por favor, haga clic en el siguiente enlace para activarla:
email.activation.text2=Saludos, email.activation.text2=Saludos,
email.signature=Equipo de DataSurvey email.signature=Equipo de DataSurvey.
# Creation email # Creation email
email.creation.text1=Su cuenta en DataSurvey ha sido creada. Por favor, haga clic en el siguiente enlace para utilizarla: email.creation.text1=Su cuenta en DataSurvey ha sido creada. Por favor, haga clic en el siguiente enlace para utilizarla:
# Reset email # Reset email
email.reset.title=Restablecer contraseña de DataSurvey email.reset.title=Reinicio de contraseña de DataSurvey
email.reset.greeting=¡Hola, {0}! email.reset.greeting=Estimado/a {0}
email.reset.text1=Se ha solicitado una modificación de contraseña para su cuenta en DataSurvey. Por favor haga clic en el siguiente enlace para restablecerla: email.reset.text1=Se ha solicitado el reinicio de la contraseña para su cuenta en DataSurvey. Por favor, haga clic en el siguiente enlace para reiniciarla:
email.reset.text2=Saludos, email.reset.text2=Saludos,
# Password Restored Mail
email.restored.title=Modificación de contraseña exitosa
email.restored.greeting=¡Hola, {0}!
email.restored.text1=¡Se ha restablecido correctamente su contraseña en DataSurvey!
email.restored.text2=Saludos,
email.restored.text3=Si usted no realizó este cambio, favor notifique inmediatamente al siguiente correo:
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

@ -1,327 +1,20 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en"> <html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en">
<head> <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.activation.title}">JHipster activation</title> <title th:text="#{email.activation.title}">JHipster activation</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="icon" th:href="@{|${baseUrl}/favicon.ico|}" /> <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> </head>
<body>
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1"> <p th:text="#{email.activation.greeting(${user.login})}">Dear</p>
<center style="width: 100%; background-color: #f1f1f1"> <p th:text="#{email.activation.text1}">Your JHipster account has been created, please click on the URL below to activate it:</p>
<div <p>
style=" <a th:with="url=(@{|${baseUrl}/account/activate?key=${user.activationKey}|})" th:href="${url}" th:text="${url}">Activation link</a>
display: none; </p>
font-size: 1px; <p>
max-height: 0px; <span th:text="#{email.activation.text2}">Regards, </span>
max-width: 0px; <br />
opacity: 0; <em th:text="#{email.signature}">JHipster.</em>
overflow: hidden; </p>
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.activation.greeting(${user.login})}">¡Hola!</h2>
<h3 th:text="#{email.activation.text1}">
Your JHipster account has been created, please click on the URL below to activate it:
</h3>
<p>
<a
th:with="url=(@{|${baseUrl}/account/activate?key=${user.activationKey}|})"
th:href="${url}"
class="btn btn-primary"
>Confirmar correo electrónico</a
>
</p>
</div>
<div class="text" style="padding: 1em 2.5em; text-align: center">
<p>
<span th:text="#{email.activation.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> </body>
</html> </html>

View File

@ -1,327 +1,20 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en"> <html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en">
<head> <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.activation.title}">JHipster creation</title> <title th:text="#{email.activation.title}">JHipster creation</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="icon" th:href="@{|${baseUrl}/favicon.ico|}" /> <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> </head>
<body>
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1"> <p th:text="#{email.activation.greeting(${user.login})}">Dear</p>
<center style="width: 100%; background-color: #f1f1f1"> <p th:text="#{email.creation.text1}">Your JHipster account has been created, please click on the URL below to access it:</p>
<div <p>
style=" <a th:with="url=(@{|${baseUrl}/account/reset/finish?key=${user.resetKey}|})" th:href="${url}" th:text="${url}">Login link</a>
display: none; </p>
font-size: 1px; <p>
max-height: 0px; <span th:text="#{email.activation.text2}">Regards, </span>
max-width: 0px; <br />
opacity: 0; <em th:text="#{email.signature}">JHipster.</em>
overflow: hidden; </p>
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.activation.greeting(${user.login})}">¡Hola!</h2>
<h3 th:text="#{email.creation.text1}">
Your JHipster account has been created, please click on the URL below to access it:
</h3>
<p>
<a
th:with="url=(@{|${baseUrl}/account/reset/finish?key=${user.resetKey}|})"
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.activation.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> </body>
</html> </html>

View File

@ -1,322 +0,0 @@
<!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.deleteColaborator.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.deleteColaborator.greeting(${user.login})}">¡Hola!</h2>
<h3 th:text="#{email.deleteColaborator.text1(${colaborador.encuesta.nombre}, ${colaborador.encuesta.id})}">
Your JHipster account has been created, please click on the URL below to activate it:
</h3>
<p>
<a th:with="url=(@{|${baseUrl}/colaboraciones|})" th:href="${url}" class="btn btn-primary">Ir a Colaboraciones</a>
</p>
</div>
<div class="text" style="padding: 1em 2.5em; text-align: center">
<p>
<span th:text="#{email.deleteColaborator.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,310 +0,0 @@
<!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

@ -1,319 +0,0 @@
<!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

@ -1,319 +0,0 @@
<!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

@ -1,285 +0,0 @@
<!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.receipt.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" />
<link
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
crossorigin="anonymous"
/>
<style>
body {
margin-top: 20px;
color: #484b51;
}
.brc-default-l1 {
border-color: #dce9f0 !important;
}
.ml-n1,
.mx-n1 {
margin-left: -0.25rem !important;
}
.mr-n1,
.mx-n1 {
margin-right: -0.25rem !important;
}
.mb-4,
.my-4 {
margin-bottom: 1.5rem !important;
}
hr {
margin-top: 1rem;
margin-bottom: 1rem;
border: 0;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.text-grey-m2 {
color: #888a8d !important;
}
.font-bolder,
.text-600 {
font-weight: 600 !important;
}
.text-110 {
font-size: 110% !important;
}
.text-blue {
color: #478fcc !important;
}
.pb-25,
.py-25 {
padding-bottom: 0.75rem !important;
}
.pt-25,
.py-25 {
padding-top: 0.75rem !important;
}
.bgc-default-tp1 {
background-color: rgba(121, 169, 197, 0.92) !important;
}
.page-header .page-tools {
-ms-flex-item-align: end;
align-self: flex-end;
}
.text-blue-m2 {
color: #68a3d5 !important;
}
.text-150 {
font-size: 150% !important;
}
</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 -->
<!-- end tr -->
<div class="page-content container">
<div class="container px-0">
<div class="row mt-4">
<div>
<!-- .row -->
<div class="row">
<div class="col-sm-6">
<div>
<span class="text-sm text-grey-m2 align-middle">Usuario:</span>
<span
class="text-600 text-110 text-blue align-middle"
th:text="#{email.receipt.user(${factura.getNombreUsuario()})}"
></span>
</div>
</div>
<!-- /.col -->
<div class="text-95 col-sm-6 align-self-start d-sm-flex justify-content-end">
<div class="text-grey-m2">
<div class="my-2">
<i class="text-blue-m2 text-xs mr-1"></i>
<span class="text-600 text-90" th:text="#{email.receipt.fecha(${factura.getFecha()}, 'dd-MM-yyyy HH:mm' )}"
>Fecha:</span
>
</div>
</div>
</div>
<hr class="d-sm-none" />
<!-- /.col -->
</div>
<div class="container">
<div class="row">
<div class="col-lg-10 mt-5 mb-5">
<table class="table table-bordered" style="width: 100%">
<thead>
<tr class="text-uppercase font-weight-bold text-blue">
<th>Plantilla</th>
<th>Cantidad</th>
<th>Precio</th>
</tr>
</thead>
<tbody style="text-align: center">
<tr class="text-95 text-secondary-d3">
<td th:text="#{email.receipt.plantilla(${factura.getNombrePlantilla()})}"></td>
<td>1</td>
<td th:text="#{email.receipt.precio(${factura.getCosto()})}"></td>
</tr>
</tbody>
</table>
<hr />
<!-- <div class="row text-600 text-white bgc-default-tp1 d-flex flex-row" >
<div class="col-9 col-sm-5">Plantilla</div>
<div class="d-none d-sm-block col-4 col-sm-2">Cantidad</div>
<div class="d-none d-sm-block col-sm-2">Precio</div>
</div>
<div class="text-95 text-secondary-d3">
<div class="row mb-2 mb-sm-0 py-25">
<div class="col-9 col-sm-5" th:text="#{email.receipt.plantilla(${factura.getNombrePlantilla()})}"></div>
<div class="d-none d-sm-block col-2">1</div>
<div class="d-none d-sm-block col-2 text-95" th:text="#{email.receipt.precio(${factura.getCosto()})}"></div>
</div>
</div>-->
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-sm-5 text-grey text-90 order-first order-sm-last">
<div class="row my-2 align-items-center bgc-primary-l3 p-2">
<div class="col-7 text-600 text-110 text-blue text-right">Monto total:</div>
<div class="col-5">
<span class="text-150 text-success-d3 opacity-2" th:text="#{email.receipt.precio(${factura.getCosto()})}"></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 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>
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.4.1/cjs/popper.min.js"
integrity="sha256-T3bYsIPyOLpEfeZOX4M7J59ZoDMzuYFUsPiSN3Xcc2M="
crossorigin="anonymous"
></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
crossorigin="anonymous"
></script>
</body>
</html>

View File

@ -1,322 +0,0 @@
<!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.invitation.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.invitation.greeting(${user.login})}">¡Hola!</h2>
<h3 th:text="#{email.invitation.text1(${colaborador.encuesta.nombre}, ${colaborador.encuesta.id})}">
Your JHipster account has been created, please click on the URL below to activate it:
</h3>
<p>
<a th:with="url=(@{|${baseUrl}/colaboraciones|})" th:href="${url}" class="btn btn-primary">Ir a Colaboraciones</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

@ -1,327 +1,22 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en"> <html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en">
<head> <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.reset.title}">JHipster password reset</title> <title th:text="#{email.reset.title}">JHipster password reset</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="icon" th:href="@{|${baseUrl}/favicon.ico|}" /> <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> </head>
<body>
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1"> <p th:text="#{email.reset.greeting(${user.login})}">Dear</p>
<center style="width: 100%; background-color: #f1f1f1"> <p th:text="#{email.reset.text1}">
<div For your JHipster account a password reset was requested, please click on the URL below to reset it:
style=" </p>
display: none; <p>
font-size: 1px; <a th:with="url=(@{|${baseUrl}/account/reset/finish?key=${user.resetKey}|})" th:href="${url}" th:text="${url}">Login link</a>
max-height: 0px; </p>
max-width: 0px; <p>
opacity: 0; <span th:text="#{email.reset.text2}">Regards, </span>
overflow: hidden; <br />
mso-hide: all; <em th:text="#{email.signature}">JHipster.</em>
font-family: sans-serif; </p>
"
>
&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.reset.greeting(${user.login})}">¡Hola!</h2>
<h3 th:text="#{email.reset.text1}">
For your JHipster account a password reset was requested, please click on the URL below to reset it:
</h3>
<p>
<a
th:with="url=(@{|${baseUrl}/account/reset/finish?key=${user.resetKey}|})"
th:href="${url}"
class="btn btn-primary"
>Restablecer contraseña</a
>
</p>
</div>
<div class="text" style="padding: 1em 2.5em; text-align: center">
<p>
<span th:text="#{email.reset.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> </body>
</html> </html>

View File

@ -1,329 +0,0 @@
<!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.restored.title}">JHipster password restored</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.restored.greeting(${user.login})}">Hello!</h2>
<h3 th:text="#{email.restored.text1}">For your JHipster account a password has been successfully reset</h3>
<p style="cursor: pointer">
<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.restored.text3}"
>If you did not make this change, please notify the following email immediately</span
>
<a href="mailto:datasurveyapp@gmail.com" th:text="#{email.restored.email}">datasurveyapp@gmail.com</a>
</p>
</div>
<div class="text" style="padding: 0.2em 2.5em 0.5em; text-align: center">
<p>
<span th:text="#{email.restored.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,322 +0,0 @@
<!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

@ -1,319 +0,0 @@
<!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,52 +1,16 @@
<div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5" style="height: 100vh; background-color: #f1f5f9"> <div>
<div class="container"> <div class="row justify-content-center">
<div class="row justify-content-center"> <div class="col-md-8">
<div class="col-xxl-4 col-lg-5"> <h1 jhiTranslate="activate.title">Activation</h1>
<div class="card mt-5">
<!-- Logo -->
<div class="pl-4 pt-4 pr-4 pb-1 text-center">
<img src="../../content/img_datasurvey/datasurvey-logo-text-black.svg" alt="" />
</div>
<div class="card-body p-4"> <div class="alert alert-success" *ngIf="success">
<div class="text-center w-75 m-auto"> <span jhiTranslate="activate.messages.success"><strong>Your user account has been activated.</strong> Please </span>
<h4 <a class="alert-link" routerLink="/login" jhiTranslate="global.messages.info.authenticated.link">sign in</a>.
class="text-dark-50 text-center pb-0 fw-bold p-0 m-0" </div>
style="color: #727070; font-weight: 700; font-size: 1.3rem"
jhiTranslate="activate.title" <div class="alert alert-danger" *ngIf="error" jhiTranslate="activate.messages.error">
> <strong>Your user could not be activated.</strong> Please use the registration form to sign up.
Registro Completado
</h4>
</div>
<div *ngIf="success">
<div class="alert alert-success text-center my-2">
<span jhiTranslate="activate.messages.success"></span>
</div>
<div class="d-flex justify-content-center">
<button class="ds-btn ds-btn--primary" routerLink="/login" jhiTranslate="global.messages.info.authenticated.link">
sign in
</button>
</div>
</div>
<div *ngIf="error">
<div class="alert alert-danger text-center my-2" jhiTranslate="activate.messages.error"></div>
<div class="d-flex justify-content-center">
<button class="ds-btn ds-btn--primary" routerLink="/account/register" jhiTranslate="global.registerLink">
create account
</button>
</div>
</div>
</div>
<!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> </div>
<!-- end col -->
</div> </div>
<!-- end row -->
</div> </div>
<!-- end container -->
</div> </div>
<!-- end page -->

View File

@ -1,171 +1,137 @@
<div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5" style="height: 100vh; background-color: #f1f5f9"> <div>
<div class="container"> <div class="row justify-content-center">
<div class="row justify-content-center"> <div class="col-md-4">
<div class="col-xxl-4 col-lg-5"> <h1 jhiTranslate="reset.finish.title">Reset password</h1>
<div class="card mt-5">
<!-- Logo -->
<div class="pl-4 pt-4 pr-4 pb-1 text-center">
<img src="../../content/img_datasurvey/datasurvey-logo-text-black.svg" alt="" />
</div>
<div class="card-body p-4"> <div class="alert alert-danger" jhiTranslate="reset.finish.messages.keymissing" *ngIf="initialized && !key">
<div class="text-center w-75 m-auto"> <strong>The password reset key is missing.</strong>
<h4 </div>
class="text-dark-50 text-center pb-0 fw-bold p-0 m-0"
style="color: #727070; font-weight: 700; font-size: 1.3rem" <div class="alert alert-warning" *ngIf="key && !success">
jhiTranslate="reset.finish.title" <span jhiTranslate="reset.finish.messages.info">Choose a new password</span>
> </div>
Reset password
</h4> <div class="alert alert-danger" *ngIf="error">
<span jhiTranslate="reset.finish.messages.error"
<p class="mb-4" style="color: rgba(146, 146, 146, 0.664)" *ngIf="key && !success" jhiTranslate="reset.finish.messages.info"> >Your password couldn't be reset. Remember a password request is only valid for 24 hours.</span
Choose a new password >
</p> </div>
</div>
<div> <div class="alert alert-success" *ngIf="success">
<div class="alert alert-danger" jhiTranslate="reset.finish.messages.keymissing" *ngIf="initialized && !key"> <span jhiTranslate="reset.finish.messages.success"><strong>Your password has been reset.</strong> Please </span>
<strong>The password reset key is missing.</strong> <a class="alert-link" routerLink="/login" jhiTranslate="global.messages.info.authenticated.link">sign in</a>.
</div> </div>
<div class="alert alert-danger" *ngIf="error"> <div class="alert alert-danger" *ngIf="doNotMatch" jhiTranslate="global.messages.error.dontmatch">
<span jhiTranslate="reset.finish.messages.error" The password and its confirmation do not match!
>Your password couldn't be reset. Remember a password request is only valid for 24 hours.</span </div>
>
</div> <div *ngIf="key && !success">
<div *ngIf="success"> <form name="form" role="form" (ngSubmit)="finishReset()" [formGroup]="passwordForm">
<div class="alert alert-success text-center my-2"> <div class="form-group">
<span jhiTranslate="reset.finish.messages.success"><strong>Your password has been reset.</strong></span> <label class="form-control-label" for="newPassword" jhiTranslate="global.form.newpassword.label">New password</label>
</div> <input
<div class="d-flex justify-content-center"> type="password"
<button class="ds-btn ds-btn--primary" routerLink="/login" jhiTranslate="global.messages.info.authenticated.botonInicio"> class="form-control"
sign in id="newPassword"
</button> name="newPassword"
</div> placeholder="{{ 'global.form.newpassword.placeholder' | translate }}"
</div> formControlName="newPassword"
data-cy="resetPassword"
<div class="alert alert-danger" *ngIf="doNotMatch" jhiTranslate="global.messages.error.dontmatch"> #newPassword
The password and its confirmation do not match! />
</div>
</div> <div
<div *ngIf="key && !success"> *ngIf="
<form name="form" class="ds-form" role="form" (ngSubmit)="finishReset()" [formGroup]="passwordForm"> passwordForm.get('newPassword')!.invalid &&
<div class="form-group"> (passwordForm.get('newPassword')!.dirty || passwordForm.get('newPassword')!.touched)
<label class="form-control-label" for="newPassword" jhiTranslate="global.form.newpassword.label">New password</label> "
<input >
type="password" <small
class="form-control" class="form-text text-danger"
id="newPassword" *ngIf="passwordForm.get('newPassword')?.errors?.required"
name="newPassword" jhiTranslate="global.messages.validate.newpassword.required"
placeholder="{{ 'global.form.newpassword.placeholder' | translate }}" >
formControlName="newPassword" Your password is required.
data-cy="resetPassword" </small>
#newPassword
/> <small
class="form-text text-danger"
<div *ngIf="passwordForm.get('newPassword')?.errors?.minlength"
*ngIf=" jhiTranslate="global.messages.validate.newpassword.minlength"
passwordForm.get('newPassword')!.invalid && >
(passwordForm.get('newPassword')!.dirty || passwordForm.get('newPassword')!.touched) Your password is required to be at least 4 characters.
" </small>
>
<small <small
class="form-text text-danger" class="form-text text-danger"
*ngIf="passwordForm.get('newPassword')?.errors?.required" *ngIf="passwordForm.get('newPassword')?.errors?.maxlength"
jhiTranslate="global.messages.validate.newpassword.required" jhiTranslate="global.messages.validate.newpassword.maxlength"
> >
Your password is required. Your password cannot be longer than 50 characters.
</small> </small>
</div>
<small
class="form-text text-danger" <jhi-password-strength-bar [passwordToCheck]="passwordForm.get('newPassword')!.value"></jhi-password-strength-bar>
*ngIf="passwordForm.get('newPassword')?.errors?.minlength" </div>
jhiTranslate="global.messages.validate.newpassword.minlength"
> <div class="form-group">
Your password is required to be at least 8 characters. <label class="form-control-label" for="confirmPassword" jhiTranslate="global.form.confirmpassword.label"
</small> >New password confirmation</label
>
<small <input
class="form-text text-danger" type="password"
*ngIf="passwordForm.get('newPassword')?.errors?.maxlength" class="form-control"
jhiTranslate="global.messages.validate.newpassword.maxlength" id="confirmPassword"
> name="confirmPassword"
Your password cannot be longer than 50 characters. placeholder="{{ 'global.form.confirmpassword.placeholder' | translate }}"
</small> formControlName="confirmPassword"
</div> data-cy="confirmResetPassword"
/>
<!--<jhi-password-strength-bar [passwordToCheck]="passwordForm.get('newPassword')!.value"></jhi-password-strength-bar>-->
</div> <div
*ngIf="
<div class="form-group"> passwordForm.get('confirmPassword')!.invalid &&
<label class="form-control-label" for="confirmPassword" jhiTranslate="global.form.confirmpassword.label" (passwordForm.get('confirmPassword')!.dirty || passwordForm.get('confirmPassword')!.touched)
>New password confirmation</label "
> >
<input <small
type="password" class="form-text text-danger"
class="form-control" *ngIf="passwordForm.get('confirmPassword')?.errors?.required"
id="confirmPassword" jhiTranslate="global.messages.validate.confirmpassword.required"
name="confirmPassword" >
placeholder="{{ 'global.form.confirmpassword.placeholder' | translate }}" Your password confirmation is required.
formControlName="confirmPassword" </small>
data-cy="confirmResetPassword"
/> <small
class="form-text text-danger"
<div *ngIf="passwordForm.get('confirmPassword')?.errors?.minlength"
*ngIf=" jhiTranslate="global.messages.validate.confirmpassword.minlength"
passwordForm.get('confirmPassword')!.invalid && >
(passwordForm.get('confirmPassword')!.dirty || passwordForm.get('confirmPassword')!.touched) Your password confirmation is required to be at least 4 characters.
" </small>
>
<small <small
class="form-text text-danger" class="form-text text-danger"
*ngIf="passwordForm.get('confirmPassword')?.errors?.required" *ngIf="passwordForm.get('confirmPassword')?.errors?.maxlength"
jhiTranslate="global.messages.validate.confirmpassword.required" jhiTranslate="global.messages.validate.confirmpassword.maxlength"
> >
Your password confirmation is required. Your password confirmation cannot be longer than 50 characters.
</small> </small>
</div>
<small </div>
class="form-text text-danger"
*ngIf="passwordForm.get('confirmPassword')?.errors?.minlength" <button
jhiTranslate="global.messages.validate.confirmpassword.minlength" type="submit"
> [disabled]="passwordForm.invalid"
Your password confirmation is required to be at least 8 characters. class="btn btn-primary"
</small> jhiTranslate="reset.finish.form.button"
data-cy="submit"
<small >
class="form-text text-danger" Reset Password
*ngIf="passwordForm.get('confirmPassword')?.errors?.maxlength" </button>
jhiTranslate="global.messages.validate.confirmpassword.maxlength" </form>
>
Your password confirmation cannot be longer than 50 characters.
</small>
</div>
</div>
<div class="row justify-content-center">
<button
type="submit"
[disabled]="passwordForm.invalid"
class="ds-btn ds-btn--primary"
jhiTranslate="reset.finish.form.button"
data-cy="submit"
>
Reset Password
</button>
</div>
</form>
</div>
</div>
<!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> </div>
<!-- end col -->
</div> </div>
<!-- end row -->
</div> </div>
<!-- end container -->
</div> </div>
<!-- end page -->

View File

@ -19,8 +19,8 @@ export class PasswordResetFinishComponent implements OnInit, AfterViewInit {
key = ''; key = '';
passwordForm = this.fb.group({ passwordForm = this.fb.group({
newPassword: ['', [Validators.required, Validators.minLength(8), Validators.maxLength(50)]], newPassword: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(50)]],
confirmPassword: ['', [Validators.required, Validators.minLength(8), Validators.maxLength(50)]], confirmPassword: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(50)]],
}); });
constructor(private passwordResetFinishService: PasswordResetFinishService, private route: ActivatedRoute, private fb: FormBuilder) {} constructor(private passwordResetFinishService: PasswordResetFinishService, private route: ActivatedRoute, private fb: FormBuilder) {}

View File

@ -1,116 +1,81 @@
<div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5" style="height: 100vh; background-color: #f1f5f9"> <div>
<div class="container"> <div class="row justify-content-center">
<div class="row justify-content-center"> <div class="col-md-8">
<div class="col-xxl-4 col-lg-5"> <h1 jhiTranslate="reset.request.title">Reset your password</h1>
<div class="card mt-5">
<!-- Logo -->
<div class="pl-4 pt-4 pr-4 pb-1 text-center">
<img src="../../content/img_datasurvey/datasurvey-logo-text-black.svg" alt="" />
</div>
<div class="card-body p-4"> <jhi-alert-error></jhi-alert-error>
<div class="text-center w-75 m-auto">
<h4
class="text-dark-50 text-center pb-0 fw-bold p-0 m-0"
style="color: #727070; font-weight: 700; font-size: 1.3rem"
jhiTranslate="reset.request.title"
>
RESET YOUR PASSWORD
</h4>
<p class="mb-4" style="color: rgba(146, 146, 146, 0.664)" jhiTranslate="reset.request.messages.info">
Enter the email address you used to register.
</p>
</div>
<div>
<div class="alert alert-success" *ngIf="success">
<span jhiTranslate="reset.request.messages.success">Check your emails for details on how to reset your password.</span>
</div>
<div class="alert alert-danger" *ngIf="errorEmailNotExists" jhiTranslate="reset.request.messages.error.emailnotexists"> <div class="alert alert-warning" *ngIf="!success">
<strong>Email no exists!</strong> <span jhiTranslate="reset.request.messages.info">Enter the email address you used to register.</span>
</div>
<div class="alert alert-danger" *ngIf="errorUserIsGoogle" jhiTranslate="reset.request.messages.error.userisgoogle">
<strong>No cuenta con el permiso de restablecer su contraseña al haber activado su cuenta por medio de Google</strong>
</div>
</div>
<form *ngIf="!success" name="form" class="ds-form" role="form" (ngSubmit)="requestReset()" [formGroup]="resetRequestForm">
<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="emailResetPassword"
#email
/>
<div
*ngIf="
resetRequestForm.get('email')!.invalid &&
(resetRequestForm.get('email')!.dirty || resetRequestForm.get('email')!.touched)
"
>
<small
class="form-text text-danger"
*ngIf="resetRequestForm.get('email')?.errors?.required"
jhiTranslate="global.messages.validate.email.required"
>
Your email is required.
</small>
<small
class="form-text text-danger"
*ngIf="resetRequestForm.get('email')?.errors?.email"
jhiTranslate="global.messages.validate.email.invalid"
>
Your email is invalid.
</small>
</div>
</div>
<div class="row justify-content-center">
<button
type="button"
id="cancel-save"
data-cy="entityCreateCancelButton"
class="ds-btn ds-btn--secondary"
(click)="previousState()"
>
<fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;<span jhiTranslate="entity.action.back">Volver</span>
</button>
<button
type="submit"
[disabled]="resetRequestForm.invalid"
class="ds-btn ds-btn--primary"
jhiTranslate="reset.request.form.button"
data-cy="submit"
>
Reset
</button>
</div>
</form>
</div>
<!-- end card-body -->
</div>
<!-- end card -->
<div class="row mt-3">
<div class="col-12 text-center">
<p class="text-muted">
¿Aún no es parte de DataSurvey?
<a routerLink="/account/register" class="text-muted ms-1"><b>Crea una cuenta</b></a>
</p>
</div>
<!-- end col -->
</div>
<!-- end row -->
</div> </div>
<!-- end col -->
<div class="alert alert-success" *ngIf="success">
<span jhiTranslate="reset.request.messages.success">Check your emails for details on how to reset your password.</span>
</div>
<form *ngIf="!success" name="form" role="form" (ngSubmit)="requestReset()" [formGroup]="resetRequestForm">
<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="emailResetPassword"
#email
/>
<div
*ngIf="
resetRequestForm.get('email')!.invalid && (resetRequestForm.get('email')!.dirty || resetRequestForm.get('email')!.touched)
"
>
<small
class="form-text text-danger"
*ngIf="resetRequestForm.get('email')?.errors?.required"
jhiTranslate="global.messages.validate.email.required"
>
Your email is required.
</small>
<small
class="form-text text-danger"
*ngIf="resetRequestForm.get('email')?.errors?.email"
jhiTranslate="global.messages.validate.email.invalid"
>
Your email is invalid.
</small>
<small
class="form-text text-danger"
*ngIf="resetRequestForm.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="resetRequestForm.get('email')?.errors?.maxlength"
jhiTranslate="global.messages.validate.email.maxlength"
>
Your email cannot be longer than 100 characters.
</small>
</div>
</div>
<button
type="submit"
[disabled]="resetRequestForm.invalid"
class="btn btn-primary"
jhiTranslate="reset.request.form.button"
data-cy="submit"
>
Reset
</button>
</form>
</div> </div>
<!-- end row -->
</div> </div>
<!-- end container -->
</div> </div>
<!-- end page -->

View File

@ -2,8 +2,6 @@ import { Component, AfterViewInit, ElementRef, ViewChild } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { PasswordResetInitService } from './password-reset-init.service'; import { PasswordResetInitService } from './password-reset-init.service';
import { HttpErrorResponse } from '@angular/common/http';
import { EMAIL_NOT_EXISTS_TYPE, USER_IS_GOOGLE_TYPE } from '../../../config/error.constants';
@Component({ @Component({
selector: 'jhi-password-reset-init', selector: 'jhi-password-reset-init',
@ -12,9 +10,7 @@ import { EMAIL_NOT_EXISTS_TYPE, USER_IS_GOOGLE_TYPE } from '../../../config/erro
export class PasswordResetInitComponent implements AfterViewInit { export class PasswordResetInitComponent implements AfterViewInit {
@ViewChild('email', { static: false }) @ViewChild('email', { static: false })
email?: ElementRef; email?: ElementRef;
errorEmailNotExists = false;
errorUserIsGoogle = false;
error = false;
success = false; success = false;
resetRequestForm = this.fb.group({ resetRequestForm = this.fb.group({
email: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(254), Validators.email]], email: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(254), Validators.email]],
@ -29,25 +25,6 @@ export class PasswordResetInitComponent implements AfterViewInit {
} }
requestReset(): void { requestReset(): void {
this.errorEmailNotExists = false; this.passwordResetInitService.save(this.resetRequestForm.get(['email'])!.value).subscribe(() => (this.success = true));
this.errorUserIsGoogle = false;
this.passwordResetInitService.save(this.resetRequestForm.get(['email'])!.value).subscribe(
() => (this.success = true),
response => this.processError(response)
);
}
previousState(): void {
window.history.back();
}
processError(response: HttpErrorResponse): void {
if (response.status === 400 && response.error.type === EMAIL_NOT_EXISTS_TYPE) {
this.errorEmailNotExists = true;
} else if (response.status === 400 && response.error.type === USER_IS_GOOGLE_TYPE) {
this.errorUserIsGoogle = true;
} else {
this.error = true;
}
} }
} }

View File

@ -1,4 +1,4 @@
<div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5" style="/*height: 100vh;*/ height: 100%; background-color: #f1f5f9"> <div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5" style="height: 100vh; background-color: #f1f5f9">
<div class="container"> <div class="container">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-xxl-4 col-lg-5"> <div class="col-xxl-4 col-lg-5">
@ -8,21 +8,13 @@
</div> </div>
<div class="card-body p-4"> <div class="card-body p-4">
<div class="text-center w-75 m-auto" *ngIf="!success"> <div class="text-center w-75 m-auto">
<h4 class="text-dark-50 text-center pb-0 fw-bold p-0 m-0" style="color: #727070; font-weight: 700; font-size: 1.3rem"> <h4 class="text-dark-50 text-center pb-0 fw-bold p-0 m-0" style="color: #727070; font-weight: 700; font-size: 1.3rem">
REGISTRARSE REGISTRARSE
</h4> </h4>
<p class="mb-4" style="color: rgba(146, 146, 146, 0.664)">Ingrese sus datos para registrarse</p> <p class="mb-4" style="color: rgba(146, 146, 146, 0.664)">Ingrese sus datos para registrarse.</p>
</div> </div>
<div class="text-center w-75 m-auto" *ngIf="success">
<h4 class="text-dark-50 text-center pb-0 fw-bold p-0 m-0" style="color: #727070; font-weight: 700; font-size: 1.3rem">
¡Gracias por registrarse en DataSurvey!
</h4>
</div>
<hr />
<div class="alert alert-success" *ngIf="success" jhiTranslate="register.messages.success"> <div class="alert alert-success" *ngIf="success" jhiTranslate="register.messages.success">
<strong>Registration saved!</strong> Please check your email for confirmation. <strong>Registration saved!</strong> Please check your email for confirmation.
</div> </div>
@ -31,10 +23,6 @@
<strong>Registration failed!</strong> Please try again later. <strong>Registration failed!</strong> Please try again later.
</div> </div>
<div class="alert alert-danger" *ngIf="errorUserExists" jhiTranslate="register.messages.error.userexists">
<strong>Login name already registered!</strong> Please choose another one.
</div>
<div class="alert alert-danger" *ngIf="errorEmailExists" jhiTranslate="register.messages.error.emailexists"> <div class="alert alert-danger" *ngIf="errorEmailExists" jhiTranslate="register.messages.error.emailexists">
<strong>Email is already in use!</strong> Please choose another one. <strong>Email is already in use!</strong> Please choose another one.
</div> </div>
@ -46,7 +34,7 @@
<form <form
name="form" name="form"
role="form" role="form"
class="ds-form" class="form"
(ngSubmit)="register()" (ngSubmit)="register()"
[formGroup]="registerForm" [formGroup]="registerForm"
*ngIf="!success" *ngIf="!success"
@ -54,7 +42,7 @@
> >
<div class="mb-3"> <div class="mb-3">
<div class="form-group"> <div class="form-group">
<label for="name" class="form-label">Nombre completo</label> <label for="name" class="form-label">Nombre</label>
<input <input
type="text" type="text"
class="form-control" class="form-control"
@ -148,17 +136,13 @@
> >
Your email cannot be longer than 100 characters. Your email cannot be longer than 100 characters.
</small> </small>
<small class="form-text text-danger" *ngIf="registerForm.get('email')?.errors?.email">
Se requiere un correo electrónico válido.
</small>
</div> </div>
</div> </div>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<div class="form-group"> <div class="form-group">
<label for="password">Nueva contraseña</label> <label for="password" jhiTranslate="global.form.newpassword.label">Password</label>
<input <input
type="password" type="password"
class="form-control" class="form-control"
@ -204,7 +188,7 @@
<div class="mb-3"> <div class="mb-3">
<div class="form-group"> <div class="form-group">
<label for="password">Repetir nueva contraseña</label> <label for="password" jhiTranslate="global.form.newpassword.label">Password</label>
<input <input
type="password" type="password"
class="form-control" class="form-control"
@ -259,7 +243,7 @@
<button <button
type="submit" type="submit"
[disabled]="registerForm.invalid" [disabled]="registerForm.invalid"
class="ds-btn ds-btn--primary w-100" class="btn btn-primary w-100"
jhiTranslate="register.form.button" jhiTranslate="register.form.button"
data-cy="submit" data-cy="submit"
> >

View File

@ -63,7 +63,6 @@ describe('Component Tests', () => {
login: '', login: '',
langKey: 'es', langKey: 'es',
name: '', name: '',
firstName: 'normalUser',
profileIcon: 1, profileIcon: 1,
isAdmin: 0, isAdmin: 0,
isGoogle: 0, isGoogle: 0,

View File

@ -59,8 +59,8 @@ export class RegisterComponent implements AfterViewInit {
registerForm = this.fb.group({ registerForm = this.fb.group({
name: ['', [Validators.required, Validators.minLength(2), Validators.maxLength(254)]], name: ['', [Validators.required, Validators.minLength(2), Validators.maxLength(254)]],
email: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(254), Validators.email]], email: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(254), Validators.email]],
password: ['', [Validators.required, Validators.minLength(8), Validators.maxLength(50)]], password: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(50)]],
confirmPassword: ['', [Validators.required, Validators.minLength(8), Validators.maxLength(50)]], confirmPassword: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(50)]],
}); });
constructor(private translateService: TranslateService, private registerService: RegisterService, private fb: FormBuilder) {} constructor(private translateService: TranslateService, private registerService: RegisterService, private fb: FormBuilder) {}
@ -84,16 +84,15 @@ export class RegisterComponent implements AfterViewInit {
const login = this.registerForm.get(['email'])!.value; const login = this.registerForm.get(['email'])!.value;
const email = this.registerForm.get(['email'])!.value; const email = this.registerForm.get(['email'])!.value;
const name = this.registerForm.get(['name'])!.value; const name = this.registerForm.get(['name'])!.value;
const firstName = 'normalUser'; console.log(name);
this.registerService this.registerService
.save({ .save({
login, login,
email, email,
password, password,
langKey: this.translateService.currentLang!, langKey: this.translateService.currentLang,
name, name,
firstName,
profileIcon: this.profileIcon, profileIcon: this.profileIcon,
isAdmin: 0, isAdmin: 0,
isGoogle: 0, isGoogle: 0,

View File

@ -7,7 +7,6 @@ export class Registration {
public name: string, public name: string,
public profileIcon: number, public profileIcon: number,
public isAdmin: number, public isAdmin: number,
public isGoogle: number, public isGoogle: number
public firstName: string
) {} ) {}
} }

View File

@ -1,3 +1,172 @@
<!-- <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">
@ -6,12 +175,12 @@
<p class="ds-title">Perfil</p> <p class="ds-title">Perfil</p>
</div> </div>
<div> <div>
<p class="ds-subtitle">Información general de su usuario, el correo electrónico es su identificador en DataSurvey</p> <p class="ds-subtitle">Información general de su usuario, el correo electrónico es su identificador en DataSurvey.</p>
</div> </div>
</div> </div>
</div> </div>
<!-- Form de info usuario --> <!-- Form -->
<form <form
autocomplete="off" autocomplete="off"
class="ds-form col-lg ml-lg-5 mr-lg-5 pr-lg-5" class="ds-form col-lg ml-lg-5 mr-lg-5 pr-lg-5"
@ -22,20 +191,6 @@
[formGroup]="editForm" [formGroup]="editForm"
> >
<div class="row mb-2"> <div class="row mb-2">
<div
class="alert alert-danger"
*ngIf="error"
jhiTranslate="global.messages.info.authenticated.updateForm"
data-cy="loginError"
></div>
<div *ngIf="success" class="alert alert-success alert-dismissible fade show" role="alert">
Sus datos fueron actualizados de manera exitosa
<!--<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>-->
</div>
<div class="form-group w-100"> <div class="form-group w-100">
<label class="form-control-label" for="field_email">Correo electrónico</label> <label class="form-control-label" for="field_email">Correo electrónico</label>
<input type="text" class="form-control" name="email" id="field_email" data-cy="email" formControlName="email" [readonly]="true" /> <input type="text" class="form-control" name="email" id="field_email" data-cy="email" formControlName="email" [readonly]="true" />
@ -66,7 +221,7 @@
<input <input
id="field_fechaNacimiento" id="field_fechaNacimiento"
data-cy="fechaNacimiento" data-cy="fechaNacimiento"
type="date" type="datetime-local"
class="form-control" class="form-control"
name="fechaNacimiento" name="fechaNacimiento"
formControlName="fechaNacimiento" formControlName="fechaNacimiento"
@ -77,7 +232,7 @@
</div> </div>
<div class="row mb-4"> <div class="row mb-4">
<div class="form-group w-100"> <div class="form-group w-100">
<label>Ícono de perfil</label> <label for="iconoPerfil">Ícono de perfil</label>
<div class="d-flex"> <div class="d-flex">
<jhi-swiper style="width: 22.5rem !important" [data]="profileIcons" (onSelectEvent)="selectIcon($event)"></jhi-swiper> <jhi-swiper style="width: 22.5rem !important" [data]="profileIcons" (onSelectEvent)="selectIcon($event)"></jhi-swiper>
</div> </div>
@ -101,7 +256,7 @@
[disabled]="editForm.invalid || isSaving" [disabled]="editForm.invalid || isSaving"
class="ds-btn ds-btn--primary" class="ds-btn ds-btn--primary"
> >
<span jhiTranslate="entity.action.save">Save</span> &nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button> </button>
</div> </div>
</form> </form>
@ -115,78 +270,36 @@
</div> </div>
<div> <div>
<p class="ds-subtitle"> <p class="ds-subtitle">
Utilice una contraseña segura al realizar el cambio, este dato debe ser secreto ya que provee acceso a su cuenta Utilice una contraseña segura al realizar el cambio, este dato debe ser secreto ya que provee acceso a su cuenta.
</p> </p>
</div> </div>
<div class="alert alert-danger" *ngIf="isGoogle" jhiTranslate="login.messages.error.isGoogle" data-cy="loginError"></div>
</div> </div>
</div> </div>
<!-- Form de password--> <!-- Form -->
<form <form
autocomplete="off" autocomplete="off"
class="ds-form col-lg ml-lg-5 mr-lg-5 pr-lg-5" class="ds-form col-lg ml-lg-5 mr-lg-5 pr-lg-5"
name="passwordForm" name="passwordForm"
role="form" role="form"
novalidate novalidate
(ngSubmit)="savePassword()" (ngSubmit)="save()"
[formGroup]="passwordForm" [formGroup]="passwordForm"
> >
<div class="row mb-3 pb-3" style="border-bottom: 1px solid #e7ebf3"> <div class="row mb-3 pb-3" style="border-bottom: 1px solid #e7ebf3">
<div
class="alert alert-danger"
*ngIf="errorPassword && !doNotMatch && !successPassword && !samePassword"
jhiTranslate="global.messages.info.authenticated.passwordForm"
data-cy="loginError"
></div>
<div
*ngIf="successPassword && !errorPassword && !samePassword && !doNotMatch"
class="alert alert-success alert-dismissible fade show"
role="alert"
>
Sus contraseña fue actualizada de manera exitosa
<!-- <button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>-->
</div>
<div
class="alert alert-danger"
*ngIf="doNotMatch && !successPassword && !errorPassword"
jhiTranslate="global.messages.error.dontmatch"
>
The password and its confirmation do not match!
</div>
<div
class="alert alert-danger"
*ngIf="samePassword && !successPassword && !errorPassword && !doNotMatch"
jhiTranslate="global.messages.error.samePassword"
>
The password and its confirmation do not match!
</div>
<div class="form-group w-100"> <div class="form-group w-100">
<label class="form-control-label" for="field_password">Contraseña actual</label> <label class="form-control-label" for="field_password">Contraseña actual</label>
<input <input
type="password" type="text"
class="form-control" class="form-control"
name="password" name="password"
id="field_password" id="field_password"
data-cy="password" data-cy="password"
formControlName="password" formControlName="password"
placeholder="Su contraseña actual" placeholder="Su contraseña actual"
[readOnly]="isGoogle"
/> />
<div <div
*ngIf=" *ngIf="passwordForm.get('password')!.invalid && (passwordForm.get('password')!.dirty || passwordForm.get('password')!.touched)"
passwordForm.get('password')!.invalid &&
(passwordForm.get('password')!.dirty || passwordForm.get('password')!.touched) &&
!isGoogle
"
> >
<small <small
class="form-text text-danger" class="form-text text-danger"
@ -195,22 +308,6 @@
> >
This field is required. This field is required.
</small> </small>
<small
class="form-text text-danger"
*ngIf="passwordForm.get('password')?.errors?.minlength"
jhiTranslate="global.messages.validate.newpassword.minlength"
>
Your password is required to be at least 4 characters.
</small>
<small
class="form-text text-danger"
*ngIf="passwordForm.get('password')?.errors?.maxlength"
jhiTranslate="global.messages.validate.newpassword.maxlength"
>
Your password cannot be longer than 50 characters.
</small>
</div> </div>
</div> </div>
</div> </div>
@ -218,20 +315,18 @@
<div class="form-group w-100"> <div class="form-group w-100">
<label class="form-control-label" for="field_passwordNew">Contraseña nueva</label> <label class="form-control-label" for="field_passwordNew">Contraseña nueva</label>
<input <input
type="password" type="text"
class="form-control" class="form-control"
name="passwordNew" name="passwordNew"
id="field_passwordNew" id="field_passwordNew"
data-cy="passwordNew" data-cy="passwordNew"
formControlName="passwordNew" formControlName="passwordNew"
placeholder="Contraseña nueva" placeholder="Contraseña nueva"
[readOnly]="isGoogle"
/> />
<div <div
*ngIf=" *ngIf="
passwordForm.get('passwordNew')!.invalid && passwordForm.get('passwordNew')!.invalid &&
(passwordForm.get('passwordNew')!.dirty || passwordForm.get('passwordNew')!.touched) && (passwordForm.get('passwordNew')!.dirty || passwordForm.get('passwordNew')!.touched)
!isGoogle
" "
> >
<small <small
@ -241,22 +336,6 @@
> >
This field is required. This field is required.
</small> </small>
<small
class="form-text text-danger"
*ngIf="passwordForm.get('passwordNew')?.errors?.minlength"
jhiTranslate="global.messages.validate.newpassword.minlength"
>
Your password is required to be at least 4 characters.
</small>
<small
class="form-text text-danger"
*ngIf="passwordForm.get('passwordNew')?.errors?.maxlength"
jhiTranslate="global.messages.validate.newpassword.maxlength"
>
Your password cannot be longer than 50 characters.
</small>
</div> </div>
</div> </div>
</div> </div>
@ -265,20 +344,18 @@
<div class="form-group w-100"> <div class="form-group w-100">
<label class="form-control-label" for="field_passwordNewConfirm">Confirmar contraseña nueva</label> <label class="form-control-label" for="field_passwordNewConfirm">Confirmar contraseña nueva</label>
<input <input
type="password" type="text"
class="form-control" class="form-control"
name="passwordNewConfirm" name="passwordNewConfirm"
id="field_passwordNewConfirm" id="field_passwordNewConfirm"
data-cy="passwordNewConfirm" data-cy="passwordNewConfirm"
formControlName="passwordNewConfirm" formControlName="passwordNewConfirm"
placeholder="Contraseña nueva" placeholder="Contraseña nueva"
[readOnly]="isGoogle"
/> />
<div <div
*ngIf=" *ngIf="
passwordForm.get('passwordNewConfirm')!.invalid && passwordForm.get('passwordNewConfirm')!.invalid &&
(passwordForm.get('passwordNewConfirm')!.dirty || passwordForm.get('passwordNewConfirm')!.touched) && (passwordForm.get('passwordNewConfirm')!.dirty || passwordForm.get('passwordNewConfirm')!.touched)
!isGoogle
" "
> >
<small <small
@ -288,28 +365,12 @@
> >
This field is required. This field is required.
</small> </small>
<small
class="form-text text-danger"
*ngIf="passwordForm.get('passwordNewConfirm')?.errors?.minlength"
jhiTranslate="global.messages.validate.newpassword.minlength"
>
Your password is required to be at least 4 characters.
</small>
<small
class="form-text text-danger"
*ngIf="passwordForm.get('passwordNewConfirm')?.errors?.maxlength"
jhiTranslate="global.messages.validate.newpassword.maxlength"
>
Your password cannot be longer than 50 characters.
</small>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<button <button
*ngIf="!isGoogle"
type="button" type="button"
id="cancel-save" id="cancel-save"
data-cy="entityCreateCancelButton" data-cy="entityCreateCancelButton"
@ -320,14 +381,13 @@
</button> </button>
<button <button
*ngIf="!isGoogle"
type="submit" type="submit"
id="save-entity" id="save-entity"
data-cy="entityCreateSaveButton" data-cy="entityCreateSaveButton"
[disabled]="passwordForm.invalid || isSaving" [disabled]="passwordForm.invalid || isSaving"
class="ds-btn ds-btn--primary" class="ds-btn ds-btn--primary"
> >
<span jhiTranslate="entity.action.save">Save</span> <fa-icon icon="save"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button> </button>
</div> </div>
</form> </form>

View File

@ -1,5 +1,3 @@
import { LocalStorageService } from 'ngx-webstorage';
jest.mock('@ngx-translate/core'); jest.mock('@ngx-translate/core');
jest.mock('app/core/auth/account.service'); jest.mock('app/core/auth/account.service');
@ -21,7 +19,6 @@ describe('Component Tests', () => {
let comp: SettingsComponent; let comp: SettingsComponent;
let fixture: ComponentFixture<SettingsComponent>; let fixture: ComponentFixture<SettingsComponent>;
let mockAccountService: AccountService; let mockAccountService: AccountService;
let localStorage: LocalStorageService;
const account: Account = { const account: Account = {
id: 0, id: 0,
firstName: 'John', firstName: 'John',
@ -39,23 +36,17 @@ describe('Component Tests', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [RouterTestingModule, HttpClientTestingModule], imports: [RouterTestingModule, HttpClientTestingModule],
declarations: [SettingsComponent], declarations: [SettingsComponent],
providers: [FormBuilder, TranslateService, AccountService, LocalStorageService], providers: [FormBuilder, TranslateService, AccountService],
}) })
.overrideTemplate(SettingsComponent, '') .overrideTemplate(SettingsComponent, '')
.compileComponents(); .compileComponents();
localStorage = TestBed.inject(LocalStorageService);
}) })
); );
it('should be created', () => {
expect(localStorage).toBeTruthy();
});
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(SettingsComponent); fixture = TestBed.createComponent(SettingsComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
mockAccountService = TestBed.inject(AccountService); mockAccountService = TestBed.inject(AccountService);
localStorage = TestBed.inject(LocalStorageService);
mockAccountService.identity = jest.fn(() => of(account)); mockAccountService.identity = jest.fn(() => of(account));
mockAccountService.getAuthenticationState = jest.fn(() => of(account)); mockAccountService.getAuthenticationState = jest.fn(() => of(account));
}); });
@ -72,10 +63,6 @@ describe('Component Tests', () => {
// expect(comp.success).toBe(true); // expect(comp.success).toBe(true);
}); });
it('should be created', () => {
expect(localStorage).toBeTruthy();
});
it('should notify of error upon failed save', () => { it('should notify of error upon failed save', () => {
// GIVEN // GIVEN
mockAccountService.save = jest.fn(() => throwError('ERROR')); mockAccountService.save = jest.fn(() => throwError('ERROR'));

View File

@ -1,11 +1,12 @@
import { Component, ContentChild, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { HttpErrorResponse, HttpResponse } from '@angular/common/http'; import { HttpResponse } from '@angular/common/http';
import { FormBuilder, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { finalize, map } from 'rxjs/operators'; import { finalize, map } from 'rxjs/operators';
import * as dayjs from 'dayjs'; import * as dayjs from 'dayjs';
import { DATE_FORMAT, DATE_TIME_FORMAT } from 'app/config/input.constants'; import { DATE_TIME_FORMAT } from 'app/config/input.constants';
import { IUser } from 'app/entities/user/user.model'; import { IUser } from 'app/entities/user/user.model';
import { UserService } from 'app/entities/user/user.service'; import { UserService } from 'app/entities/user/user.service';
import { IPlantilla } from 'app/entities/plantilla/plantilla.model'; import { IPlantilla } from 'app/entities/plantilla/plantilla.model';
@ -13,30 +14,17 @@ import { PlantillaService } from 'app/entities/plantilla/service/plantilla.servi
import { IUsuarioExtra, UsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model'; import { IUsuarioExtra, UsuarioExtra } 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 { AccountService } from 'app/core/auth/account.service'; import { AccountService } from 'app/core/auth/account.service';
import { LocalStorageService } from 'ngx-webstorage';
import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from '../../config/error.constants';
import { PasswordService } from '../password/password.service';
@Component({ @Component({
selector: 'jhi-settings', selector: 'jhi-settings',
templateUrl: './settings.component.html', templateUrl: './settings.component.html',
}) })
export class SettingsComponent implements OnInit { export class SettingsComponent implements OnInit {
currentUrl = this.router.url;
isSaving = false; isSaving = false;
success = false;
successPassword = false;
samePassword = false;
error = false;
errorPassword = false;
doNotMatch = false;
usersSharedCollection: IUser[] = []; usersSharedCollection: IUser[] = [];
plantillasSharedCollection: IPlantilla[] = []; plantillasSharedCollection: IPlantilla[] = [];
showPassword = false;
isGoogle = this.localStorageService.retrieve('IsGoogle');
//Form info del usuario
editForm = this.fb.group({ editForm = this.fb.group({
email: [null, [Validators.required]], email: [null, [Validators.required]],
id: [], id: [],
@ -48,11 +36,10 @@ export class SettingsComponent implements OnInit {
plantillas: [], plantillas: [],
}); });
//form de la contraseña
passwordForm = this.fb.group({ passwordForm = this.fb.group({
password: [null, [Validators.required, Validators.minLength(8), Validators.maxLength(50)]], password: [null, [Validators.required]],
passwordNew: [null, [Validators.required, Validators.minLength(8), Validators.maxLength(50)]], passwordNew: [null, [Validators.required]],
passwordNewConfirm: [null, [Validators.required, Validators.minLength(8), Validators.maxLength(50)]], passwordNewConfirm: [null, [Validators.required]],
}); });
usuarioExtra: UsuarioExtra | null = null; usuarioExtra: UsuarioExtra | null = null;
@ -88,18 +75,13 @@ export class SettingsComponent implements OnInit {
{ name: 'C28' }, { name: 'C28' },
]; ];
/* @ContentChild(IonInput) input: IonInput;*/
constructor( constructor(
protected usuarioExtraService: UsuarioExtraService, protected usuarioExtraService: UsuarioExtraService,
protected userService: UserService, protected userService: UserService,
protected plantillaService: PlantillaService, protected plantillaService: PlantillaService,
protected activatedRoute: ActivatedRoute, protected activatedRoute: ActivatedRoute,
protected fb: FormBuilder, protected fb: FormBuilder,
protected accountService: AccountService, protected accountService: AccountService
private localStorageService: LocalStorageService,
protected passwordService: PasswordService,
private router: Router
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
@ -121,8 +103,6 @@ export class SettingsComponent implements OnInit {
} }
}); });
//console.log(this.isGoogle);
// this.activatedRoute.data.subscribe(({ usuarioExtra }) => { // this.activatedRoute.data.subscribe(({ usuarioExtra }) => {
// }); // });
@ -132,33 +112,13 @@ export class SettingsComponent implements OnInit {
window.history.back(); window.history.back();
} }
//Se manda la info a guardar
save(): void { save(): void {
this.isSaving = true; this.isSaving = true;
const usuarioExtra = this.createFromForm(); const usuarioExtra = this.createFromForm();
this.subscribeToSaveResponse(this.usuarioExtraService.update(usuarioExtra)); if (usuarioExtra.id !== undefined) {
} this.subscribeToSaveResponse(this.usuarioExtraService.update(usuarioExtra));
savePassword(): void {
this.successPassword = false;
this.doNotMatch = false;
this.samePassword = false;
this.errorPassword = false;
const passwordNew = this.passwordForm.get(['passwordNew'])!.value;
const passwordOld = this.passwordForm.get(['password'])!.value;
if (passwordOld == passwordNew) {
this.samePassword = true;
} else { } else {
if (passwordNew !== this.passwordForm.get(['passwordNewConfirm'])!.value) { this.subscribeToSaveResponse(this.usuarioExtraService.create(usuarioExtra));
(this.doNotMatch = true), (this.samePassword = false);
} else {
this.passwordService.save(passwordNew, passwordOld).subscribe(
() => (this.successPassword = true),
() => (this.errorPassword = true)
);
}
} }
} }
@ -183,21 +143,10 @@ export class SettingsComponent implements OnInit {
protected subscribeToSaveResponse(result: Observable<HttpResponse<IUsuarioExtra>>): void { protected subscribeToSaveResponse(result: Observable<HttpResponse<IUsuarioExtra>>): void {
result.pipe(finalize(() => this.onSaveFinalize())).subscribe( result.pipe(finalize(() => this.onSaveFinalize())).subscribe(
() => ((this.success = true), this.windowReload()), () => this.onSaveSuccess(),
response => this.processError(response) () => this.onSaveError()
); );
} }
windowReload() {
this.router.navigate(['account/settings']).then(() => {
window.location.reload();
});
}
processError(response: HttpErrorResponse): void {
if (response.status === 400) {
this.error = true;
}
}
protected onSaveSuccess(): void { protected onSaveSuccess(): void {
this.previousState(); this.previousState();
@ -211,28 +160,26 @@ export class SettingsComponent implements OnInit {
this.isSaving = false; this.isSaving = false;
} }
//Llena el formulario para que se vea en pantalla
protected updateForm(usuarioExtra: IUsuarioExtra): void { protected updateForm(usuarioExtra: IUsuarioExtra): void {
this.editForm.patchValue({ this.editForm.patchValue({
email: usuarioExtra.user?.login, email: usuarioExtra.user?.login,
id: usuarioExtra.id, id: usuarioExtra.id,
nombre: usuarioExtra.nombre, nombre: usuarioExtra.nombre,
iconoPerfil: usuarioExtra.iconoPerfil, iconoPerfil: usuarioExtra.iconoPerfil,
fechaNacimiento: usuarioExtra.fechaNacimiento ? usuarioExtra.fechaNacimiento.format(DATE_FORMAT) : null, fechaNacimiento: usuarioExtra.fechaNacimiento ? usuarioExtra.fechaNacimiento.format(DATE_TIME_FORMAT) : null,
estado: usuarioExtra.estado, estado: usuarioExtra.estado,
user: usuarioExtra.user, user: usuarioExtra.user,
plantillas: usuarioExtra.plantillas, plantillas: usuarioExtra.plantillas,
}); });
// Update swiper // Update swiper
this.profileIcon = usuarioExtra.iconoPerfil!; this.profileIcon = parseInt(usuarioExtra.iconoPerfil!);
console.log(this.profileIcon);
this.profileIcons.forEach(icon => { this.profileIcons.forEach(icon => {
if (icon.name.split('C')[1] === this.profileIcon) { if (parseInt(icon.name.split('C')[1]) === this.profileIcon) {
icon.class = 'active'; icon.class = 'active';
} }
}); });
console.log(this.profileIcons);
this.usersSharedCollection = this.userService.addUserToCollectionIfMissing(this.usersSharedCollection, usuarioExtra.user); this.usersSharedCollection = this.userService.addUserToCollectionIfMissing(this.usersSharedCollection, usuarioExtra.user);
this.plantillasSharedCollection = this.plantillaService.addPlantillaToCollectionIfMissing( this.plantillasSharedCollection = this.plantillaService.addPlantillaToCollectionIfMissing(
@ -264,9 +211,9 @@ export class SettingsComponent implements OnInit {
...new UsuarioExtra(), ...new UsuarioExtra(),
id: this.editForm.get(['id'])!.value, id: this.editForm.get(['id'])!.value,
nombre: this.editForm.get(['nombre'])!.value, nombre: this.editForm.get(['nombre'])!.value,
iconoPerfil: this.profileIcon, iconoPerfil: this.editForm.get(['iconoPerfil'])!.value,
fechaNacimiento: this.editForm.get(['fechaNacimiento'])!.value fechaNacimiento: this.editForm.get(['fechaNacimiento'])!.value
? dayjs(this.editForm.get(['fechaNacimiento'])!.value, DATE_FORMAT) ? dayjs(this.editForm.get(['fechaNacimiento'])!.value, DATE_TIME_FORMAT)
: undefined, : undefined,
estado: this.editForm.get(['estado'])!.value, estado: this.editForm.get(['estado'])!.value,
user: this.editForm.get(['user'])!.value, user: this.editForm.get(['user'])!.value,
@ -279,8 +226,6 @@ export class SettingsComponent implements OnInit {
document.querySelectorAll('.active').forEach(e => e.classList.remove('active')); document.querySelectorAll('.active').forEach(e => e.classList.remove('active'));
event.target.classList.add('active'); event.target.classList.add('active');
this.profileIcon = +event.target.getAttribute('id')! + 1; this.profileIcon = +event.target.getAttribute('id')! + 1;
//console.log(this.profileIcon);
} }
} }
} }

View File

@ -9,7 +9,7 @@ import { TranslateModule, TranslateService, TranslateLoader, MissingTranslationH
import { NgxWebstorageModule, SessionStorageService } from 'ngx-webstorage'; import { NgxWebstorageModule, SessionStorageService } from 'ngx-webstorage';
import * as dayjs from 'dayjs'; import * as dayjs from 'dayjs';
import { NgbDateAdapter, NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap'; import { NgbDateAdapter, NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap';
import { LocalStorageService } from 'ngx-webstorage';
import { SERVER_API_URL } from './app.constants'; import { SERVER_API_URL } from './app.constants';
import { ApplicationConfigService } from 'app/core/config/application-config.service'; import { ApplicationConfigService } from 'app/core/config/application-config.service';
import './config/dayjs'; import './config/dayjs';
@ -18,7 +18,7 @@ import { AppRoutingModule } from './app-routing.module';
import { HomeModule } from './home/home.module'; import { HomeModule } from './home/home.module';
import { EntityRoutingModule } from './entities/entity-routing.module'; import { EntityRoutingModule } from './entities/entity-routing.module';
import { ReactiveFormsModule } from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms';
import { PaginaPrincipalModule } from './pagina-principal/pagina-principal.module';
import { SocialLoginModule, SocialAuthServiceConfig } from 'angularx-social-login'; import { SocialLoginModule, SocialAuthServiceConfig } from 'angularx-social-login';
import { GoogleLoginProvider } from 'angularx-social-login'; import { GoogleLoginProvider } from 'angularx-social-login';
// jhipster-needle-angular-add-module-import JHipster will add new module here // jhipster-needle-angular-add-module-import JHipster will add new module here
@ -32,22 +32,12 @@ import { FooterComponent } from './layouts/footer/footer.component';
import { PageRibbonComponent } from './layouts/profiles/page-ribbon.component'; import { PageRibbonComponent } from './layouts/profiles/page-ribbon.component';
import { ErrorComponent } from './layouts/error/error.component'; import { ErrorComponent } from './layouts/error/error.component';
import { SidebarComponent } from './layouts/sidebar/sidebar.component'; import { SidebarComponent } from './layouts/sidebar/sidebar.component';
import { PaginaPrincipalComponent } from './pagina-principal/pagina-principal.component';
import { ChartistModule } from 'ng-chartist';
import { ListarPlantillaTiendaModule } from './entities/tienda/listar-tienda-plantilla/listar-plantilla-tienda.module';
import { PaypalDialogComponent } from './entities/tienda/paypal-dialog/paypal-dialog.component';
import { NgxPayPalModule } from 'ngx-paypal';
import { ShareButtonsModule } from 'ngx-sharebuttons/buttons';
import { ShareIconsModule } from 'ngx-sharebuttons/icons';
@NgModule({ @NgModule({
imports: [ imports: [
NgxWebstorageModule.forRoot(),
BrowserModule, BrowserModule,
SharedModule, SharedModule,
HomeModule, HomeModule,
PaginaPrincipalModule,
ListarPlantillaTiendaModule,
// jhipster-needle-angular-add-module JHipster will add new module here // jhipster-needle-angular-add-module JHipster will add new module here
EntityRoutingModule, EntityRoutingModule,
AppRoutingModule, AppRoutingModule,
@ -67,10 +57,6 @@ import { ShareIconsModule } from 'ngx-sharebuttons/icons';
useFactory: missingTranslationHandler, useFactory: missingTranslationHandler,
}, },
}), }),
ChartistModule, // add ChartistModule to your imports
ShareButtonsModule,
ShareIconsModule,
NgxPayPalModule,
], ],
providers: [ providers: [
Title, Title,
@ -90,15 +76,7 @@ import { ShareIconsModule } from 'ngx-sharebuttons/icons';
} as SocialAuthServiceConfig, } as SocialAuthServiceConfig,
}, },
], ],
declarations: [ declarations: [MainComponent, NavbarComponent, ErrorComponent, PageRibbonComponent, FooterComponent, SidebarComponent],
MainComponent,
NavbarComponent,
ErrorComponent,
PageRibbonComponent,
FooterComponent,
SidebarComponent,
PaypalDialogComponent,
],
bootstrap: [MainComponent], bootstrap: [MainComponent],
}) })
export class AppModule { export class AppModule {

View File

@ -1,6 +1,3 @@
export const PROBLEM_BASE_URL = 'https://www.jhipster.tech/problem'; export const PROBLEM_BASE_URL = 'https://www.jhipster.tech/problem';
export const EMAIL_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/email-already-used'; 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 USER_IS_GOOGLE_TYPE = PROBLEM_BASE_URL + '/user-is-google';
export const USER_IS_SUSPENDED = PROBLEM_BASE_URL + '/user-is-suspended';

View File

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

View File

@ -36,7 +36,6 @@ export class AuthServerProvider {
return new Observable(observer => { return new Observable(observer => {
this.localStorageService.clear('authenticationToken'); this.localStorageService.clear('authenticationToken');
this.sessionStorageService.clear('authenticationToken'); this.sessionStorageService.clear('authenticationToken');
this.localStorageService.clear('IsGoogle');
observer.complete(); observer.complete();
}); });
} }

View File

@ -22,7 +22,7 @@ export interface Alert {
providedIn: 'root', providedIn: 'root',
}) })
export class AlertService { export class AlertService {
timeout = 3000; timeout = 5000;
toast = false; toast = false;
position = 'top right'; position = 'top right';
@ -65,7 +65,7 @@ export class AlertService {
alert.timeout = alert.timeout ?? this.timeout; alert.timeout = alert.timeout ?? this.timeout;
alert.toast = alert.toast ?? this.toast; alert.toast = alert.toast ?? this.toast;
alert.position = alert.position ?? this.position; alert.position = alert.position ?? this.position;
//alert.close = (alertsArray: Alert[]) => this.closeAlert(alert.id!, alertsArray); alert.close = (alertsArray: Alert[]) => this.closeAlert(alert.id!, alertsArray);
(extAlerts ?? this.alerts).push(alert); (extAlerts ?? this.alerts).push(alert);

View File

@ -1,27 +1,25 @@
<form class="ds-form" *ngIf="categoria" name="deleteForm" (ngSubmit)="confirmDelete(categoria!)"> <form *ngIf="categoria" name="deleteForm" (ngSubmit)="confirmDelete(categoria.id!)">
<div class="modal-header"></div> <div class="modal-header">
<h4 class="modal-title" data-cy="categoriaDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">&times;</button>
</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 id="jhi-delete-categoria-heading" jhiTranslate="dataSurveyApp.categoria.delete.question" [translateValues]="{ id: categoria.id }">
class="ds-subtitle" Are you sure you want to delete this Categoria?
id="jhi-delete-categoria-heading"
jhiTranslate="dataSurveyApp.categoria.delete.question"
[translateValues]="{ nombre: categoria.nombre }"
>
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="ds-btn ds-btn--secondary" data-dismiss="modal" (click)="cancel()"> <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="cancel()">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span> <fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button> </button>
<button id="jhi-confirm-delete-categoria" data-cy="entityConfirmDeleteButton" type="submit" class="ds-btn ds-btn--toggle"> <button id="jhi-confirm-delete-categoria" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger">
<fa-icon [icon]="faExchangeAlt"></fa-icon> <fa-icon icon="times"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
<span jhiTranslate="entity.action.toggleStatus">Toggle Status</span>
</button> </button>
</div> </div>
</form> </form>

View File

@ -0,0 +1,65 @@
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 { CategoriaService } from '../service/categoria.service';
import { CategoriaDeleteDialogComponent } from './categoria-delete-dialog.component';
describe('Component Tests', () => {
describe('Categoria Management Delete Component', () => {
let comp: CategoriaDeleteDialogComponent;
let fixture: ComponentFixture<CategoriaDeleteDialogComponent>;
let service: CategoriaService;
let mockActiveModal: NgbActiveModal;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [CategoriaDeleteDialogComponent],
providers: [NgbActiveModal],
})
.overrideTemplate(CategoriaDeleteDialogComponent, '')
.compileComponents();
fixture = TestBed.createComponent(CategoriaDeleteDialogComponent);
comp = fixture.componentInstance;
service = TestBed.inject(CategoriaService);
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,79 +1,24 @@
import { HttpResponse } from '@angular/common/http';
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 'app/entities/encuesta/encuesta.model';
import { EncuestaService } from 'app/entities/encuesta/service/encuesta.service';
import { EstadoCategoria } from 'app/entities/enumerations/estado-categoria.model';
import { Observable } from 'rxjs';
import { finalize } from 'rxjs/operators';
import { Categoria, ICategoria } from '../categoria.model'; import { 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[];
encuestasFiltradas?: IEncuesta[];
constructor( constructor(protected categoriaService: CategoriaService, protected activeModal: NgbActiveModal) {}
protected categoriaService: CategoriaService,
protected activeModal: NgbActiveModal,
protected encuestaService: EncuestaService
) {
this.getEncuestas();
}
cancel(): void { cancel(): void {
this.activeModal.dismiss(); this.activeModal.dismiss();
} }
confirmDelete(categoria: ICategoria): void { confirmDelete(id: number): void {
const categoriaNula = new Categoria(0, 'Otra', EstadoCategoria.ACTIVE); this.categoriaService.delete(id).subscribe(() => {
this.getEncuestas();
if (categoria.estado == EstadoCategoria.INACTIVE) {
categoria.estado = EstadoCategoria.ACTIVE;
} else {
this.encuestas!.forEach(encuesta => {
if (encuesta.categoria != null && encuesta.categoria!.id === categoria.id) {
encuesta.categoria = categoriaNula;
this.subscribeToSaveResponse(this.encuestaService.updateSurvey(encuesta));
}
});
categoria.estado = EstadoCategoria.INACTIVE;
}
this.categoriaService.update(categoria).subscribe(() => {
this.activeModal.close('deleted'); this.activeModal.close('deleted');
}); });
} }
getEncuestas(): void {
this.encuestaService.query().subscribe(res => {
this.encuestas = res.body ?? [];
});
}
protected subscribeToSaveResponse(result: Observable<HttpResponse<IEncuesta>>): void {
result.pipe(finalize(() => this.onSaveFinalize())).subscribe(
() => this.onSaveSuccess(),
() => this.onSaveError()
);
}
protected onSaveFinalize(): void {
// this.isSaving = false;
}
protected onSaveSuccess(): void {
// this.previousState();
}
protected onSaveError(): void {
// Api for inheritance.
}
} }

View File

@ -24,17 +24,12 @@
</dd> </dd>
</dl> </dl>
<button type="submit" (click)="previousState()" class="btn btn-ds btn-info" data-cy="entityDetailsBackButton"> <button type="submit" (click)="previousState()" class="btn btn-info" data-cy="entityDetailsBackButton">
&nbsp;<span jhiTranslate="entity.action.back">Back</span> <fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back">Back</span>
</button> </button>
<button <button type="button" [routerLink]="['/categoria', categoria.id, 'edit']" class="btn btn-primary">
*ngIf="categoria.id != 0" <fa-icon icon="pencil-alt"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit">Edit</span>
type="button"
[routerLink]="['/categoria', categoria.id, 'edit']"
class="btn btn-ds btn-ds-primary btn-primary"
>
&nbsp;<span jhiTranslate="entity.action.edit">Edit</span>
</button> </button>
</div> </div>
</div> </div>

View File

@ -1,15 +1,17 @@
<div> <div>
<h2 id="page-heading" data-cy="CategoriaHeading"> <h2 id="page-heading" data-cy="CategoriaHeading">
<div> <span jhiTranslate="dataSurveyApp.categoria.home.title">Categorias</span>
<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 class="btn btn-info mr-2" (click)="loadAll()" [disabled]="isLoading">
<fa-icon icon="sync" [spin]="isLoading"></fa-icon>
<span jhiTranslate="dataSurveyApp.categoria.home.refreshListLabel">Refresh List</span>
</button>
<button <button
id="jh-create-entity" id="jh-create-entity"
data-cy="entityCreateButton" data-cy="entityCreateButton"
class="jh-create-entity create-categoria ds-btn ds-btn--primary" class="btn btn-primary jh-create-entity create-categoria"
[routerLink]="['/categoria/new']" [routerLink]="['/categoria/new']"
> >
<fa-icon icon="plus"></fa-icon> <fa-icon icon="plus"></fa-icon>
@ -18,63 +20,56 @@
</div> </div>
</h2> </h2>
<!-- <div class="alert alert-success" *ngIf="success" jhiTranslate="dataSurveyApp.categoria.delete.error"> <jhi-alert-error></jhi-alert-error>
</div>--> <jhi-alert></jhi-alert>
<div <div class="alert alert-warning" id="no-result" *ngIf="categorias?.length === 0">
*ngIf="success" <span jhiTranslate="dataSurveyApp.categoria.home.notFound">No categorias found</span>
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 class="ds-survey" id="entities" *ngIf="categorias?.length === 0">
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No existen categorías</p>
<p class="ds-subtitle text-center">Inicie creando categorías para identificar las encuestas de los usuarios</p>
</ng-container>
</div>
</div> </div>
<div class="table-responsive" id="entities" *ngIf="categorias && categorias.length > 0"> <div class="table-responsive" id="entities" *ngIf="categorias && categorias.length > 0">
<form class="ds-form"> <table class="table table-striped" aria-describedby="page-heading">
<div class="input-group">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<input type="text" name="searchString" placeholder="Buscar..." [(ngModel)]="searchString" />
</div>
</form>
<table class="ds-table table table-striped" aria-describedby="page-heading">
<thead> <thead>
<tr> <tr>
<th scope="col"><span jhiTranslate="global.field.id">ID</span></th>
<th scope="col"><span jhiTranslate="dataSurveyApp.categoria.nombre">Nombre</span></th> <th scope="col"><span jhiTranslate="dataSurveyApp.categoria.nombre">Nombre</span></th>
<th scope="col"><span jhiTranslate="dataSurveyApp.categoria.estado">Estado</span></th> <th scope="col"><span jhiTranslate="dataSurveyApp.categoria.estado">Estado</span></th>
<th scope="col"></th> <th scope="col"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let categoria of categorias | filter: 'nombre':searchString; trackBy: trackId" data-cy="entityTable"> <tr *ngFor="let categoria of categorias; trackBy: trackId" data-cy="entityTable">
<td *ngIf="categoria.id != 0">{{ categoria.nombre }}</td> <td>
<td *ngIf="categoria.id != 0" jhiTranslate="{{ 'dataSurveyApp.EstadoCategoria.' + categoria.estado }}">{{ categoria.estado }}</td> <a [routerLink]="['/categoria', categoria.id, 'view']">{{ categoria.id }}</a>
<td *ngIf="categoria.id != 0" class="text-right"> </td>
<td>{{ categoria.nombre }}</td>
<td jhiTranslate="{{ 'dataSurveyApp.EstadoCategoria.' + categoria.estado }}">{{ categoria.estado }}</td>
<td class="text-right">
<div class="btn-group"> <div class="btn-group">
<button
type="submit"
[routerLink]="['/categoria', categoria.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" type="submit"
[routerLink]="['/categoria', categoria.id, 'edit']" [routerLink]="['/categoria', categoria.id, 'edit']"
class="btn-sm ds-btn ds-btn--primary" class="btn btn-primary btn-sm"
data-cy="entityEditButton" data-cy="entityEditButton"
> >
<fa-icon icon="pencil-alt"></fa-icon>
<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="ds-btn ds-btn--toggle" data-cy="entityDeleteButton"> <button type="submit" (click)="delete(categoria)" class="btn btn-danger btn-sm" data-cy="entityDeleteButton">
<fa-icon [icon]="faExchangeAlt"></fa-icon> <fa-icon icon="times"></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.delete">Delete</span>
</button> </button>
</div> </div>
</td> </td>

View File

@ -6,23 +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;
success = false;
constructor(protected categoriaService: CategoriaService, protected modalService: NgbModal) { constructor(protected categoriaService: CategoriaService, protected modalService: NgbModal) {}
this.searchString = '';
}
loadAll(): void { loadAll(): void {
this.isLoading = true; this.isLoading = true;
@ -39,21 +31,19 @@ export class CategoriaComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.searchString = '';
this.loadAll(); this.loadAll();
} }
trackId(_index: number, item: ICategoria): number { trackId(index: number, item: ICategoria): number {
return item.id!; return item.id!;
} }
toggleStatus(categoria: ICategoria): void { delete(categoria: ICategoria): void {
const modalRef = this.modalService.open(CategoriaDeleteDialogComponent, { size: 'lg', backdrop: 'static' }); const modalRef = this.modalService.open(CategoriaDeleteDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.categoria = categoria; modalRef.componentInstance.categoria = categoria;
// 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.success = true;
this.loadAll(); this.loadAll();
} }
}); });

View File

@ -1,15 +1,12 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-8"> <div class="col-8">
<form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm" class="ds-form"> <form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
<h2 id="jhi-categoria-heading" data-cy="CategoriaCreateUpdateHeading" jhiTranslate="dataSurveyApp.categoria.home.createOrEditLabel"> <h2 id="jhi-categoria-heading" data-cy="CategoriaCreateUpdateHeading" jhiTranslate="dataSurveyApp.categoria.home.createOrEditLabel">
Create or edit a Category Create or edit a Categoria
</h2> </h2>
<div> <div>
<jhi-alert-error></jhi-alert-error> <jhi-alert-error></jhi-alert-error>
<div class="alert alert-danger" *ngIf="duplicateName" jhiTranslate="dataSurveyApp.categoria.errors.duplicateName">
A category with that name already exists.
</div>
<div class="form-group" [hidden]="editForm.get('id')!.value == null"> <div class="form-group" [hidden]="editForm.get('id')!.value == null">
<label class="form-control-label" jhiTranslate="global.field.id" for="field_id">ID</label> <label class="form-control-label" jhiTranslate="global.field.id" for="field_id">ID</label>
@ -42,25 +39,18 @@
</div> </div>
<div> <div>
<button <button type="button" id="cancel-save" data-cy="entityCreateCancelButton" class="btn btn-secondary" (click)="previousState()">
type="button" <fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
id="cancel-save"
data-cy="entityCreateCancelButton"
class="ds-btn ds-btn--secondary"
(click)="previousState()"
>
<fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button> </button>
<button <button
*ngIf="this.id != 0"
type="submit" type="submit"
id="save-entity" id="save-entity"
data-cy="entityCreateSaveButton" data-cy="entityCreateSaveButton"
[disabled]="editForm.invalid || isSaving" [disabled]="editForm.invalid || isSaving"
class="ds-btn ds-btn--primary" class="btn btn-primary"
> >
&nbsp;<span jhiTranslate="entity.action.save">Save</span> <fa-icon icon="save"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button> </button>
</div> </div>
</form> </form>

View File

@ -14,33 +14,19 @@ import { CategoriaService } from '../service/categoria.service';
}) })
export class CategoriaUpdateComponent implements OnInit { export class CategoriaUpdateComponent implements OnInit {
isSaving = false; isSaving = false;
public categorias?: ICategoria[];
editForm = this.fb.group({ editForm = this.fb.group({
id: [], id: [],
nombre: [null, [Validators.required]], nombre: [null, [Validators.required]],
estado: [null, [Validators.required]], estado: [null, [Validators.required]],
}); });
public duplicateName: boolean;
id: number | undefined;
constructor(protected categoriaService: CategoriaService, protected activatedRoute: ActivatedRoute, protected fb: FormBuilder) { constructor(protected categoriaService: CategoriaService, protected activatedRoute: ActivatedRoute, protected fb: FormBuilder) {}
this.duplicateName = false;
this.categorias = [];
this.loadAll();
}
ngOnInit(): void { ngOnInit(): void {
this.activatedRoute.data.subscribe(({ categoria }) => { this.activatedRoute.data.subscribe(({ categoria }) => {
this.updateForm(categoria); this.updateForm(categoria);
}); });
this.loadAll();
}
loadAll(): void {
this.categoriaService.query().subscribe(res => {
this.categorias = res.body ?? [];
});
} }
previousState(): void { previousState(): void {
@ -50,25 +36,13 @@ export class CategoriaUpdateComponent implements OnInit {
save(): void { save(): void {
this.isSaving = true; this.isSaving = true;
const categoria = this.createFromForm(); const categoria = this.createFromForm();
const condicion = this.categoryExists(categoria); if (categoria.id !== undefined) {
if (!condicion) { this.subscribeToSaveResponse(this.categoriaService.update(categoria));
if (categoria.id !== undefined) {
this.subscribeToSaveResponse(this.categoriaService.update(categoria));
} else {
this.subscribeToSaveResponse(this.categoriaService.create(categoria));
}
} else { } else {
this.duplicateName = true; this.subscribeToSaveResponse(this.categoriaService.create(categoria));
this.isSaving = false;
} }
} }
protected categoryExists(categoria: ICategoria): boolean {
this.loadAll();
var condicion = this.categorias!.some(cat => cat.nombre!.toLowerCase() === categoria.nombre!.toLowerCase() && cat.id !== categoria.id);
return condicion;
}
protected subscribeToSaveResponse(result: Observable<HttpResponse<ICategoria>>): void { protected subscribeToSaveResponse(result: Observable<HttpResponse<ICategoria>>): void {
result.pipe(finalize(() => this.onSaveFinalize())).subscribe( result.pipe(finalize(() => this.onSaveFinalize())).subscribe(
() => this.onSaveSuccess(), () => this.onSaveSuccess(),
@ -89,7 +63,6 @@ export class CategoriaUpdateComponent implements OnInit {
} }
protected updateForm(categoria: ICategoria): void { protected updateForm(categoria: ICategoria): void {
this.id = categoria.id;
this.editForm.patchValue({ this.editForm.patchValue({
id: categoria.id, id: categoria.id,
nombre: categoria.nombre, nombre: categoria.nombre,

View File

@ -1,246 +0,0 @@
<div class="content">
<div class="py-2">
<button type="button" class="ds-btn ds-btn--primary" (click)="exportReportesGeneralesAdministradorExcel()">Export as Excel</button>
<button type="button" class="ds-btn ds-btn--primary" (click)="exportReportesGeneralesAdministradorPDF()">Export as PDF</button>
<button type="button" [hidden]="reportsGeneral" class="ds-btn ds-btn--primary" style="float: right" (click)="cambiarVista()">
Ver Reporte de Usuarios
</button>
<button type="button" [hidden]="reportForUsers" class="ds-btn ds-btn--primary" style="float: right" (click)="cambiarVista()">
Ver Reporte Generales
</button>
</div>
<div class="container-fluid py-5" [hidden]="reportsGeneral">
<div class="row justify-content-around">
<div class="col-lg-3 col-sm-6">
<div class="card">
<div class="card-content">
<div class="row">
<div class="col-xs-5 w-25 px-1">
<div class="icon-big icon-success text-center">
<fa-icon [icon]="faWallet"></fa-icon>
</div>
</div>
<div class="col-xs-7 w-50">
<div class="numbers">
<p class="ds-title">Ganancias por plantillas</p>
${{ gananciasTotales | number: '1.2' }}
</div>
</div>
</div>
</div>
<div class="card-footer">
<hr />
<br />
</div>
</div>
</div>
<div class="col-lg-3 col-sm-6">
<div class="card">
<div class="card-content">
<div class="row justify-content-center">
<div class="col-xs-5 w-25 px-1">
<div class="icon-big icon-users-active text-center">
<fa-icon [icon]="faUsers"></fa-icon>
</div>
</div>
<div class="col-xs-7 w-75">
<div class="numbers">
<p class="ds-title">Cantidad usuarios activos</p>
{{ cantUsuarioActivos }}
</div>
</div>
</div>
</div>
<div class="card-footer">
<hr />
<br />
</div>
</div>
</div>
<div class="col-lg-3 col-sm-6">
<div class="card">
<div class="card-content">
<div class="row justify-content-center">
<div class="col-xs-4 w-25 px-1">
<div class="icon-big icon-users-block text-center">
<fa-icon [icon]="faUsersSlash"></fa-icon>
</div>
</div>
<div class="col-xs-5 w-75">
<div class="numbers">
<p class="ds-title">Cantidad usuarios bloqueados</p>
{{ cantUsuarioBloqueados }}
</div>
</div>
</div>
</div>
<div class="card-footer">
<hr />
<br />
</div>
</div>
</div>
</div>
<div class="row justify-content-around por-categoria">
<div class="col-md-5">
<div class="grafico-encuestas-fecha">
<div class="card">
<h1 class="ds-title">Cantidad de encuestas publicadas por mes</h1>
<div class="ct-chart ct-chart-line"></div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card encuestas-por-categoria">
<div class="card-header w-100">
<h4 class="ds-title">Cantidad de Encuestas Publicadas por Categoria</h4>
</div>
<div class="card-content">
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="ds-table table">
<tbody>
<tr *ngFor="let categoria of categorias; let i = index; trackBy: trackId">
<td>{{ categoria.nombre }}</td>
<td class="text-right">
{{ encuestasPublicadasCategoria[i] }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card encuestas-por-categoria">
<div class="card-header w-100">
<h4 class="ds-title">Cantidad de Encuestas Finalizadas por Categoria</h4>
</div>
<div class="card-content">
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="ds-table table">
<tbody>
<tr *ngFor="let categoria of categorias; let i = index; trackBy: trackId">
<td>{{ categoria.nombre }}</td>
<td class="text-right">
{{ encuestasFinalzadasCategoria[i] }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-sm-6">
<div class="card card-circle-chart" data-background-color="blue" style="background-color: #88c5d6eb">
<div class="card-header text-center">
<h5 class="card-title ds-subtitle" style="color: #082463">Encuestas En Borrador</h5>
</div>
<div class="card-content">
<div id="surveyDraft" class="chart-circle">{{ encuestasBorrador }}<canvas height="160" width="160"></canvas></div>
</div>
</div>
</div>
<div class="col-lg-3 col-sm-6">
<div class="card card-circle-chart" data-background-color="green" style="background-color: #67ceb6">
<div class="card-header text-center">
<h5 class="card-title ds-subtitle" style="color: #0a2922">Encuestas Publicadas</h5>
</div>
<div class="card-content">
<div id="surveyActive" class="chart-circle">{{ encuestasPublicadas }}<canvas height="160" width="160"></canvas></div>
</div>
</div>
</div>
<div class="col-lg-3 col-sm-6">
<div class="card card-circle-chart" style="background-color: #de8e78">
<div class="card-header text-center">
<h5 class="card-title ds-subtitle" style="color: #671a04">Encuestas Finalizadas</h5>
</div>
<div class="card-content">
<div id="surveyFinished" class="chart-circle">{{ encuestasFinalizadas }}<canvas height="160" width="160"></canvas></div>
</div>
</div>
</div>
<div class="col-lg-3 col-sm-6">
<div class="card card-circle-chart" data-background-color="brown" style="background-color: #d6c1ab">
<div class="card-header text-center">
<h5 class="card-title ds-subtitle" style="color: #252422">Encuestas Completadas por Usuarios</h5>
</div>
<div class="card-content">
<div id="surveyCountCompletede" class="chart-circle">{{ encuestasCompletadas }}<canvas height="160" width="160"></canvas></div>
</div>
</div>
</div>
</div>
</div>
<div class="container-fluid" [hidden]="reportForUsers">
<div class="row justify-content-around">
<div class="col-md-10">
<div class="card encuestas-por-usuario">
<div class="card-header w-100">
<h4 class="ds-title">Reporte de Encuestas Usuarios</h4>
</div>
<div class="card-content">
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="ds-table table">
<thead>
<tr>
<th>Usuario</th>
<th></th>
<th>Total de encuestas</th>
<th>Encuestas en borrador</th>
<th>Encuestas publicadas</th>
<th>Encuestas finalizadas</th>
<th>Encuestas completadas por usuario</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let usuario of usuarios; let j = index; trackBy: trackIdUsuario">
<td>
<div class="photo mb-2"><img src="../../../../content/profile_icons/C{{ usuario.iconoPerfil }}.png" /></div>
</td>
<td>{{ usuario.nombre }}</td>
<td class="text-center">
{{ encuestasUsuario[j] }}
</td>
<td class="text-center">
{{ encuestasUsuarioBorrador[j] }}
</td>
<td class="text-center">
{{ encuestasUsuarioPublicadas[j] }}
</td>
<td class="text-center">
{{ encuestasUsuarioFinalizadas[j] }}
</td>
<td class="text-center">
{{ encuestasUsuarioCompletadas[j] }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,46 +0,0 @@
.ct-chart {
width: 100%;
height: 400px;
overflow-x: scroll;
}
.grafico-encuestas-fecha .card {
width: 100%;
}
.card .icon-big {
font-size: 3em;
}
.icon-success {
color: #00b88d;
}
.icon-users-active {
color: #018adf;
}
.icon-users-block {
color: #da1b2b;
}
.encuestas-por-categoria .table-responsive {
height: 300px;
max-height: 300px;
}
.por-categoria {
padding: 5% 0;
}
.encuestas-por-usuario .table-responsive {
height: 500px;
max-height: 500px;
}
.encuestas-por-usuario .photo {
width: 40px;
height: 40px;
}
.encuestas-por-usuario .photo img {
border-radius: 100%;
}

View File

@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DashboardAdminComponent } from './dashboard-admin.component';
describe('DashboardAdminComponent', () => {
let component: DashboardAdminComponent;
let fixture: ComponentFixture<DashboardAdminComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DashboardAdminComponent],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(DashboardAdminComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,534 +0,0 @@
import { Component, OnInit } from '@angular/core';
import * as XLSX from 'xlsx';
import * as FileSaver from 'file-saver';
import { jsPDF } from 'jspdf';
import { exportAsExcelFile, exportAsExcelTable } from '../export/export_excel';
import { generatePDFTableData, createPDFTableHeaders, generatePDFTable, saveGeneratedPDF } from '../export/export_pdf';
import { FacturaService } from '../../factura/service/factura.service';
import { UsuarioExtraService } from '../../usuario-extra/service/usuario-extra.service';
import { CategoriaService } from '../../categoria/service/categoria.service';
import { EncuestaService } from '../../encuesta/service/encuesta.service';
import { ICategoria } from '../../categoria/categoria.model';
import { IEncuesta } from '../../encuesta/encuesta.model';
import { finalize } from 'rxjs/operators';
import * as Chartist from 'chartist';
import { faWallet, faUsers, faUsersSlash } from '@fortawesome/free-solid-svg-icons';
import { IUsuarioExtra } from '../../usuario-extra/usuario-extra.model';
import { IUser } from '../../user/user.model';
@Component({
selector: 'jhi-dashboard-admin',
templateUrl: './dashboard-admin.component.html',
styleUrls: ['./dashboard-admin.component.scss'],
})
export class DashboardAdminComponent implements OnInit {
cantUsuarioActivos: number | undefined = 0;
cantUsuarioBloqueados: number | undefined = 0;
encuestasPublicadasCategoria: number[] = [];
encuestasFinalzadasCategoria: number[] = [];
encuestasPublicadasMesAnno: number[] = [];
listaMesesAnnos: string[] = [];
gananciasTotales: number = 0;
categorias: ICategoria[] | undefined = [];
encuestas: IEncuesta[] | undefined = [];
usuarios: IUsuarioExtra[] | undefined = [];
faWallet = faWallet;
faUsers = faUsers;
faUsersSlash = faUsersSlash;
encuestasPublicadas: number = 0;
encuestasFinalizadas: number = 0;
encuestasBorrador: number = 0;
encuestasCompletadas: number = 0;
encuestasUsuario: number[] = [];
encuestasUsuarioPublicadas: number[] = [];
encuestasUsuarioFinalizadas: number[] = [];
encuestasUsuarioBorrador: number[] = [];
encuestasUsuarioCompletadas: number[] = [];
usuariosGenerales: IUser[] | null = [];
reportsGeneral = false;
reportForUsers = true;
chartFechas = [];
constructor(
protected facturaService: FacturaService,
protected usuarioExtraService: UsuarioExtraService,
protected encuestaService: EncuestaService,
protected categoriaService: CategoriaService
) {}
ngOnInit(): void {
this.loadAll();
}
trackId(_index: number, item: ICategoria): number {
return item.id!;
}
trackIdUsuario(_index: number, item: IUsuarioExtra): number {
return item.id!;
}
cambiarVista() {
if (this.reportsGeneral) {
this.reportsGeneral = false;
this.reportForUsers = true;
} else if (this.reportForUsers) {
this.reportsGeneral = true;
this.reportForUsers = false;
}
}
loadAll() {
this.cargarGananciasTotales();
this.cargarUsers();
}
cargarGananciasTotales() {
this.facturaService.query().subscribe(res => {
const tempFacturas = res.body;
tempFacturas?.forEach(f => {
if (f.costo != undefined) {
this.gananciasTotales += f.costo;
}
});
});
}
cargarUsers() {
this.usuarioExtraService
.retrieveAllPublicUsers()
.pipe(finalize(() => this.cargarCantidadUsuarios()))
.subscribe(res => {
res.forEach(user => {
let rolList: string[] | undefined;
rolList = user.authorities;
let a = rolList?.pop();
if (a == 'ROLE_ADMIN') {
user.authorities = ['Admin'];
} else if (a == 'ROLE_USER') {
user.authorities = ['Usuario'];
}
});
this.usuariosGenerales = res;
});
}
cargarCantidadUsuarios() {
this.usuarioExtraService
.query()
.pipe(finalize(() => this.cargarEncuestas()))
.subscribe(res => {
const tmpUsuarios = res.body;
if (tmpUsuarios) {
tmpUsuarios.forEach(u => {
u.user = this.usuariosGenerales?.find(g => g.id == u.user?.id);
});
}
this.usuarios = tmpUsuarios?.filter(u => u.user?.authorities && u.user?.authorities[0] === 'Usuario');
this.cantUsuarioActivos = tmpUsuarios?.filter(u => u.estado === 'ACTIVE').length;
this.cantUsuarioBloqueados = tmpUsuarios?.filter(u => u.estado === 'SUSPENDED').length;
});
}
cargarEncuestas() {
this.encuestaService
.query()
.pipe(finalize(() => this.cargarCategorias()))
.subscribe(res => {
const tmpEncuestas = res.body;
this.encuestas = tmpEncuestas?.filter(e => e.estado === 'ACTIVE' || e.estado === 'FINISHED' || e.estado === 'DRAFT');
if (tmpEncuestas) {
this.encuestasPublicadas = tmpEncuestas.filter(e => e.estado === 'ACTIVE').length;
this.encuestasFinalizadas = tmpEncuestas.filter(e => e.estado === 'FINISHED').length;
this.encuestasBorrador = tmpEncuestas.filter(e => e.estado === 'DRAFT').length;
let cantidadCompletadas: number = 0;
tmpEncuestas
.filter(e => e.estado === 'ACTIVE')
.forEach(e => {
const _contadorCompletadas = e.calificacion;
cantidadCompletadas = cantidadCompletadas + (Number(_contadorCompletadas?.toString().split('.')[1]) - 1);
});
this.encuestasCompletadas = cantidadCompletadas;
//reportes generales de todos los usuarios
const publicadasUser: number[] | null = [];
const finalizadasUser: number[] | null = [];
const borradoresUser: number[] | null = [];
const encuestasUser: number[] | null = [];
const encuestasCompletadasUser: number[] | null = [];
if (this.usuarios) {
this.usuarios.forEach(u => {
let cantEncuestas = 0;
let cantPublicadas = 0;
let cantFinalizadas = 0;
let cantBorradores = 0;
cantEncuestas = tmpEncuestas.filter(e => e.estado !== 'DELETED' && e.usuarioExtra?.id === u.id).length;
cantPublicadas = tmpEncuestas.filter(e => e.estado === 'ACTIVE' && e.usuarioExtra?.id === u.id).length;
cantFinalizadas = tmpEncuestas.filter(e => e.estado === 'FINISHED' && e.usuarioExtra?.id === u.id).length;
cantBorradores = tmpEncuestas.filter(e => e.estado === 'DRAFT' && e.usuarioExtra?.id === u.id).length;
encuestasUser.push(cantEncuestas);
borradoresUser.push(cantBorradores);
publicadasUser.push(cantPublicadas);
finalizadasUser.push(cantFinalizadas);
let cantidadCompletadasUser: number = 0;
tmpEncuestas
.filter(e => e.estado === 'ACTIVE' && e.usuarioExtra?.id === u.id)
.forEach(e => {
const _contadorCompletadas = e.calificacion;
cantidadCompletadasUser = cantidadCompletadasUser + (Number(_contadorCompletadas?.toString().split('.')[1]) - 1);
});
encuestasCompletadasUser.push(cantidadCompletadasUser);
});
this.encuestasUsuarioCompletadas = encuestasCompletadasUser;
this.encuestasUsuario = encuestasUser;
this.encuestasUsuarioBorrador = borradoresUser;
this.encuestasUsuarioPublicadas = publicadasUser;
this.encuestasUsuarioFinalizadas = finalizadasUser;
}
}
});
}
cargarCategorias() {
this.categoriaService
.query()
.pipe(finalize(() => this.acomodarMesesYAnnos()))
.subscribe(res => {
const tmpCategorias = res.body;
this.categorias = tmpCategorias?.filter(c => c.estado === 'ACTIVE');
const publicadas: number[] | null = [];
const finalizadas: number[] | null = [];
this.categorias?.forEach(c => {
let cantPublicadas = 0;
let cantFinalizadas = 0;
this.encuestas?.forEach(e => {
if (e.categoria?.id === c.id && e.estado === 'ACTIVE') {
cantPublicadas = cantPublicadas + 1;
}
if (e.categoria?.id === c.id && e.estado === 'FINISHED') {
cantFinalizadas = cantFinalizadas + 1;
}
});
publicadas.push(cantPublicadas);
finalizadas.push(cantFinalizadas);
});
this.encuestasPublicadasCategoria = publicadas;
this.encuestasFinalzadasCategoria = finalizadas;
});
}
acomodarMesesYAnnos() {
const fechas: string[] | null = [];
const cantEncuestasFechas: number[] | null = [];
var encuestasPublicadas = this.encuestas?.filter(e => e.estado === 'ACTIVE');
if (encuestasPublicadas) {
encuestasPublicadas = this.ordenarFechas(encuestasPublicadas);
encuestasPublicadas.forEach(e => {
if (e.fechaPublicacion) {
let fecha = this.formatoFecha(e.fechaPublicacion);
if (!fechas.includes(fecha)) {
fechas.push(fecha);
}
}
});
this.listaMesesAnnos = fechas;
this.listaMesesAnnos.forEach(f => {
let contEncuestaDeFecha = 0;
if (encuestasPublicadas) {
encuestasPublicadas.forEach(e => {
if (e.fechaPublicacion) {
let fecha = this.formatoFecha(e.fechaPublicacion);
if (f === fecha) {
contEncuestaDeFecha++;
}
}
});
}
cantEncuestasFechas.push(contEncuestaDeFecha);
});
this.encuestasPublicadasMesAnno = cantEncuestasFechas;
}
this.llenarGraficoEncuestasXFechas();
}
llenarGraficoEncuestasXFechas() {
if (this.listaMesesAnnos && this.encuestasPublicadasMesAnno) {
var data = {
// A labels array that can contain any sort of values
labels: this.listaMesesAnnos,
// Our series array that contains series objects or in this case series data arrays
series: [this.encuestasPublicadasMesAnno],
};
var options = {
low: 0,
showArea: true,
showLabel: true,
axisY: {
onlyInteger: true,
},
};
new Chartist.Line('.ct-chart', data, options);
}
}
formatoFecha(fecha: any): string {
return fecha.month() + 1 + '/' + fecha.year();
}
ordenarFechas(encuestasPublicadas: IEncuesta[]): IEncuesta[] {
if (encuestasPublicadas) {
encuestasPublicadas.sort((e1, e2) => {
if (e1.fechaPublicacion && e2.fechaPublicacion) {
return e1.fechaPublicacion < e2.fechaPublicacion ? -1 : e1.fechaPublicacion > e2.fechaPublicacion ? 1 : 0;
}
return 0;
});
}
return encuestasPublicadas;
}
exportReportesGeneralesAdministradorExcel(): void {
/*
Cantidad de usuarios activos
Cantidad de usuarios bloqueados
Cantidad de encuestas publicadas por categoría
Cantidad de encuestas finalizadas por categoría
Cantidad de encuestas publicadas por mes y año
Cantidad de encuestas
Cantidad de personas que han completado sus encuestas
Cantidad de encuestas activas
Cantidad de encuestas finalizadas
Cantidad de comentarios de retroalimentación
*/
const _sheets = [
'usuarios generales',
'enc. publicadas',
'enc. publicadas categoría',
'enc. finalizadas categoría',
'encuestas generales',
'reporte de usuarios',
];
const _reporteUsuarios = [
{
ganancias_plantillas: this.gananciasTotales,
usuarios_activos: this.cantUsuarioActivos,
usuarios_bloqueados: this.cantUsuarioBloqueados,
},
];
// listaMesesAnnos
// encuestasPublicadasMesAnno
const _reporteEncuestasPublicadas: any[] = [];
this.listaMesesAnnos.forEach((date: any, index) => {
let _report: any = {};
_report['fecha'] = date;
_report['cantidad'] = this.encuestasPublicadasMesAnno[index];
_reporteEncuestasPublicadas.push(_report);
});
// this.categorias
// this.encuestasPublicadasCategoria
const _reporteCantidadEncuestasPublicadasCategoria: any[] = [];
this.categorias!.forEach((categoria: any, index) => {
let _report: any = {};
_report['categoria'] = categoria.nombre;
_report['cantidad'] = this.encuestasPublicadasCategoria[index];
_reporteCantidadEncuestasPublicadasCategoria.push(_report);
});
// this.categorias
// this.encuestasFinalzadasCategoria
const _reporteCantidadEncuestasFinalizadasCategoria: any[] = [];
this.categorias!.forEach((categoria: any, index) => {
let _report: any = {};
_report['categoria'] = categoria.nombre;
_report['cantidad'] = this.encuestasFinalzadasCategoria[index];
_reporteCantidadEncuestasFinalizadasCategoria.push(_report);
});
// this.encuestasPublicadas
// this.encuestasFinalizadas
// this.encuestasBorrador
// this.encuestasCompletadas
const _reporteEncuestasReportesGenerales = [
{
encuestas_borrador: this.encuestasBorrador,
encuestas_publicadas: this.encuestasPublicadas,
encuestas_finalizadas: this.encuestasFinalizadas,
encuestas_completadas: this.encuestasCompletadas,
},
];
// this.encuestasUsuario;
// this.encuestasUsuarioPublicadas;
// this.encuestasUsuarioFinalizadas;
// this.encuestasUsuarioBorrador;
// this.encuestasUsuarioCompletadas;
// this.usuarios;
const _reporteEncuestasUsuarios: any[] = [];
this.usuarios!.forEach((user, index) => {
let _report: any = {};
_report['usuario_nombre'] = user.nombre;
_report['usuario_encuestas'] = this.encuestasUsuario[index];
_report['encuestas_borrador'] = this.encuestasUsuarioBorrador[index];
_report['encuestas_publicadas'] = this.encuestasUsuarioPublicadas[index];
_report['encuestas_finalizadas'] = this.encuestasUsuarioFinalizadas[index];
_report['encuestas_completadas_usuarios'] = this.encuestasUsuarioCompletadas[index];
_reporteEncuestasUsuarios.push(_report);
});
const _excelFinalData = [
_reporteUsuarios,
_reporteEncuestasPublicadas,
_reporteCantidadEncuestasPublicadasCategoria,
_reporteCantidadEncuestasFinalizadasCategoria,
_reporteEncuestasReportesGenerales,
_reporteEncuestasUsuarios,
];
const _fileName = 'reportes_datasurvey';
exportAsExcelFile(_sheets, _excelFinalData, _fileName);
}
exportReportesGeneralesAdministradorPDF(): void {
/*
Cantidad de usuarios activos
Cantidad de usuarios bloqueados
Cantidad de encuestas publicadas por categoría
Cantidad de encuestas finalizadas por categoría
Cantidad de encuestas publicadas por mes y año
Cantidad de encuestas
Cantidad de personas que han completado sus encuestas
Cantidad de encuestas activas
Cantidad de encuestas finalizadas
Cantidad de comentarios de retroalimentación
*/
const doc = new jsPDF();
const _fileName = 'reportes_datasurvey';
let _docData, _headers, _docHeaders, _docTitle;
// Usuarios Generales
const _reporteUsuarios = [
{
ganancias_plantillas: this.gananciasTotales!.toString(),
usuarios_activos: this.cantUsuarioActivos!.toString(),
usuarios_bloqueados: this.cantUsuarioBloqueados!.toString(),
},
];
_docData = generatePDFTableData(_reporteUsuarios);
_headers = ['ganancias_plantillas', 'usuarios_activos', 'usuarios_bloqueados'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte Usuarios Generales';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('p');
// Encuestas Publicadas
const _reporteEncuestasPublicadas: any[] = [];
this.listaMesesAnnos.forEach((date: any, index) => {
let _report: any = {};
_report['fecha'] = date;
_report['cantidad'] = this.encuestasPublicadasMesAnno[index].toString();
_reporteEncuestasPublicadas.push(_report);
});
_docData = generatePDFTableData(_reporteEncuestasPublicadas);
_headers = ['fecha', 'cantidad'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte Encuestas Publicadas';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('p');
// Encuestas Publicadas
const _reporteCantidadEncuestasPublicadasCategoria: any[] = [];
this.categorias!.forEach((categoria: any, index) => {
let _report: any = {};
_report['categoria'] = categoria.nombre;
_report['cantidad'] = this.encuestasPublicadasCategoria[index].toString();
_reporteCantidadEncuestasPublicadasCategoria.push(_report);
});
_docData = generatePDFTableData(_reporteCantidadEncuestasPublicadasCategoria);
_headers = ['categoria', 'cantidad'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte Encuestas Publicadas por Categoría';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('p');
// Encuestas Publicadas
const _reporteCantidadEncuestasFinalizadasCategoria: any[] = [];
this.categorias!.forEach((categoria: any, index) => {
let _report: any = {};
_report['categoria'] = categoria.nombre;
_report['cantidad'] = this.encuestasFinalzadasCategoria[index].toString();
_reporteCantidadEncuestasFinalizadasCategoria.push(_report);
});
_docData = generatePDFTableData(_reporteCantidadEncuestasFinalizadasCategoria);
_headers = ['categoria', 'cantidad'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte Encuestas Finalizadas por Categoría';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('', 'l');
// Encuestas Generales
const _reporteEncuestasReportesGenerales = [
{
encuestas_borrador: this.encuestasBorrador.toString(),
encuestas_publicadas: this.encuestasPublicadas.toString(),
encuestas_finalizadas: this.encuestasFinalizadas.toString(),
encuestas_completadas: this.encuestasCompletadas.toString(),
},
];
_docData = generatePDFTableData(_reporteEncuestasReportesGenerales);
_headers = ['encuestas_borrador', 'encuestas_publicadas', 'encuestas_finalizadas', 'encuestas_completadas'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte Encuestas Generales';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('', 'l');
// Usuarios
const _reporteEncuestasUsuarios: any[] = [];
this.usuarios!.forEach((user, index) => {
let _report: any = {};
_report['usuario_nombre'] = user.nombre;
_report['usuario_encuestas'] = this.encuestasUsuario[index].toString();
_report['encuestas_borrador'] = this.encuestasUsuarioBorrador[index].toString();
_report['encuestas_publicadas'] = this.encuestasUsuarioPublicadas[index].toString();
_report['encuestas_finalizadas'] = this.encuestasUsuarioFinalizadas[index].toString();
_report['encuestas_completadas_usuarios'] = this.encuestasUsuarioCompletadas[index].toString();
_reporteEncuestasUsuarios.push(_report);
});
_docData = generatePDFTableData(_reporteEncuestasUsuarios);
_headers = [
'usuario_nombre',
'usuario_encuestas',
'encuestas_borrador',
'encuestas_publicadas',
'encuestas_finalizadas',
'encuestas_completadas_usuarios',
];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte de Usuarios';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
saveGeneratedPDF(doc, _fileName);
}
}

View File

@ -1,468 +0,0 @@
<div class="content">
<div class="py-2">
<button type="button" class="ds-btn ds-btn--primary" (click)="exportReportesGeneralesUserExcel()">Exportar como Excel</button>
<button type="button" class="ds-btn ds-btn--primary" (click)="exportReportesGeneralesUserPDF()">Exportar como PDF</button>
<button
type="button"
[hidden]="!reportsGeneral || (reportForEncuestas && reportColaboraciones)"
class="ds-btn ds-btn--primary"
style="float: right"
(click)="cambiarVista()"
>
Ver reportes generales
</button>
<button
type="button"
[hidden]="!reportForEncuestas || (reportsGeneral && reportColaboraciones)"
class="ds-btn ds-btn--primary"
style="float: right"
(click)="cambiarVista()"
>
Ver reportes por encuestas
</button>
<button
type="button"
[hidden]="!reportColaboraciones || (reportsGeneral && reportForEncuestas)"
class="ds-btn ds-btn--primary"
style="float: right"
(click)="cambiarVistaColaboracion('colaboracion')"
>
Ver reportes de colaboraciones
</button>
<button type="button" [hidden]="reportPreguntas" class="ds-btn ds-btn--secondary" style="float: right" (click)="cambiarVista()">
<fa-icon icon="arrow-left"></fa-icon>&nbsp; Volver
</button>
<button
type="button"
[hidden]="reportColaboracionPreguntas"
class="ds-btn ds-btn--secondary"
style="float: right"
(click)="cambiarVista()"
>
<fa-icon icon="arrow-left"></fa-icon>&nbsp; Volver
</button>
</div>
<div class="container-fluid">
<div class="py-2" [hidden]="reportsGeneral">
<h1>Reportes generales</h1>
<h2>En esta sección encontrará los reportes generales de todas sus encuestas</h2>
</div>
<div class="py-2" [hidden]="reportForEncuestas">
<h1>Reportes por encuesta</h1>
<h2>En esta sección encontrará los reportes de cada una de sus encuestas</h2>
</div>
<div class="py-2" [hidden]="reportPreguntas">
<h1>Detalles de la encuesta</h1>
<h2>En esta sección encontrará los reportes con respecto al contenido de las preguntas de su encuesta</h2>
</div>
<div class="py-2" [hidden]="reportColaboraciones">
<h1>Reportes de colaboraciones</h1>
<h2>En esta sección encontrará los reportes generales de todas las colaboraciones en las que esté participando</h2>
</div>
<div class="py-2" [hidden]="reportColaboracionPreguntas">
<h1>Detalles de la encuesta en la que colabora</h1>
<h2>En esta sección encontrará los reportes con respecto al contenido de las preguntas de la encuesta a la que colabora</h2>
</div>
<hr />
<!--REPORTES GENERALES-->
<div class="container-fluid py-5" [hidden]="reportsGeneral">
<div class="">
<div class="row justify-content-around">
<div class="col-lg-3 col-sm-6">
<div class="card">
<div class="card-content">
<div class="row">
<div class="col-xs-5 w-25 px-1">
<div class="icon-big icon-success text-center">
<fa-icon [icon]="faListAlt"></fa-icon>
</div>
</div>
<div class="col-xs-7 w-50">
<div class="numbers">
<p class="ds-title--small">Cantidad de encuestas creadas</p>
{{ cantEncuestas }}
</div>
</div>
</div>
</div>
<div class="card-footer">
<hr />
<br />
</div>
</div>
</div>
<div class="col-lg-3 col-sm-6">
<div class="card">
<div class="card-content">
<div class="row">
<div class="col-xs-5 w-25 px-1">
<div class="icon-big icon-users-active text-center">
<fa-icon [icon]="faUser"></fa-icon>
</div>
</div>
<div class="col-xs-7 w-50">
<div class="numbers">
<p class="ds-title--small">Cantidad de usuario que han completado las encuestas</p>
{{ cantPersonas }}
</div>
</div>
</div>
</div>
<div class="card-footer">
<hr />
<br />
</div>
</div>
</div>
</div>
<div class="row justify-content-around por-categoria">
<div class="col-md-5">
<div class="grafico-encuestas-fecha">
<div class="card" height="300" width="300">
<h1 class="ds-title">Cantidad de encuestas por estado</h1>
<div id="chartEstado" class="ct-chart ct-major-tenth"></div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="grafico-encuestas-fecha">
<div class="card" height="300" width="300">
<h1 class="ds-title">Cantidad de encuestas por acceso</h1>
<div id="chartAcceso" class="ct-chart ct-major-tenth"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--REPORTE POR ENCUESTA-->
<div class="container-fluid" [hidden]="reportForEncuestas">
<div class="ds-survey" id="entitiesEncuestas" *ngIf="encuestas && encuestas?.length === 0">
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No posee encuestas</p>
</ng-container>
</div>
</div>
<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 encuestas">
<div class="card-encuesta lift h-100" [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&#45;&#45;row m-2" *ngFor="let d of duracionArray">
<span class="mt-2" *ngIf="d! > 0"
><fa-icon class="entity-icon&#45;&#45;access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;{{
d
}}</span
>
<span class="mt-2" *ngIf="d! == 0"
><fa-icon class="entity-icon&#45;&#45;access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;Un día o
menos</span
>
<span class="mt-2" *ngIf="d! == -1"
><fa-icon class="entity-icon&#45;&#45;access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;No ha
finalizado</span
>
</div>-->
<div class="entity-body--row m-2">
<p>Calificación:</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 (click)="detallesPreguntas(encuesta)" class="ds-btn btn-card ds-btn--primary">
<fa-icon [icon]="faEye"></fa-icon>&nbsp;&nbsp;Detalle
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--REPORTES DE LAS PREGUNTAS-->
<div class="container-fluid" *ngIf="encuesta" [hidden]="reportPreguntas">
<div class="ds-survey" id="entitiesPreguntas" *ngIf="ePreguntas && ePreguntas?.length === 0">
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No se encontraron preguntas</p>
</ng-container>
</div>
</div>
<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" *ngFor="let ePregunta of ePreguntas; let i = index">
<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">
<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="text"
readonly
style="border-radius: 3px"
name="{{ 'radio' + ePregunta.id }}"
id="'radio'"
/>-->
<label>{{
ePreguntaOpcionFinal.nombre + ' / Cantidad de veces seleccionada: ' + ePreguntaOpcionFinal.cantidad
}}</label>
</div>
<div class="checkbox" *ngIf="ePregunta.tipo === 'MULTIPLE'">
<!--<input
type="checkbox"
style="border-radius: 3px"
id="{{ 'checkbox' + ePreguntaOpcionFinal.id }}"
/>-->
<label>{{
ePreguntaOpcionFinal.nombre + ' / Cantidad de veces seleccionada: ' + ePreguntaOpcionFinal.cantidad
}}</label>
</div>
</div>
</ng-container>
</ng-container>
</ng-container>
</ng-container>
<div *ngIf="!ePregunta.tipo">
<div *ngFor="let res of respuestaAbierta">
<!-- <ul>
<li *ngIf="res.epreguntaAbierta?.id == preguntaId"> {{ res.respuesta }}</li>
</ul>-->
<!-- <textarea readonly class="ds-survey&#45;&#45;textarea" cols="33" rows="10" *ngIf="res.epreguntaAbierta?.id == preguntaId" > {{ res.respuesta }} </textarea>-->
<div *ngIf="res.epreguntaAbierta?.id == ePregunta.id">
<label> {{ '- ' + res.respuesta }}</label> <br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--REPORTE POR COLABORACION-->
<div class="container-fluid" [hidden]="reportColaboraciones">
<div class="ds-survey" id="entitiesColaboraciones" *ngIf="usuarioEncuestas && usuarioEncuestas?.length === 0">
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No posee colaboraciones</p>
</ng-container>
</div>
</div>
<div class="row gx-5" *ngIf="usuarioEncuestas && usuarioEncuestas.length > 0">
<div class="col-xl-4 col-lg-4 col-md-6 mb-5" *ngFor="let colaboracion of usuarioEncuestas">
<div class="card-encuesta lift h-100" *ngIf="colaboracion.encuesta" [attr.data-id]="colaboracion.encuesta.id">
<div class="card-body p-3">
<div class="card-title mb-0">{{ colaboracion.encuesta.nombre }}</div>
<div class="entity-body--row m-2">
<span class="tag mt-2">{{ colaboracion.encuesta.categoria?.nombre | lowercase }}</span>
</div>
<div class="entity-body--row m-2">
<span class="subtitle mt-2">{{ colaboracion.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" *ngIf="duracionColaboracion! > 0"
><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;{{
duracionColaboracion
}}</span
>
<span class="mt-2" *ngIf="duracionColaboracion! == 0"
><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;Un día o
menos</span
>
<span class="mt-2" *ngIf="duracionColaboracion! == -1"
><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;No ha
finalizado</span
>
</div>
<div class="entity-body--row m-2">
<p>Calificación:</p>
<fa-icon
*ngFor="let i of [].constructor(colaboracion.encuesta.calificacion)"
class="entity-icon--star"
[icon]="faStar"
></fa-icon>
<fa-icon
*ngFor="let i of [].constructor(5 - colaboracion.encuesta.calificacion!)"
class="entity-icon--star--off"
[icon]="faStar"
></fa-icon>
</div>
<div class="entity-body--row m-2">
<button (click)="detallesPreguntasColaboracion(colaboracion.encuesta)" class="ds-btn btn-card ds-btn--primary">
<fa-icon [icon]="faEye"></fa-icon>&nbsp;&nbsp;Detalle
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--REPORTES DE LAS PREGUNTAS DE LA COLABORACION-->
<div class="container-fluid" *ngIf="colaboracion" [hidden]="reportColaboracionPreguntas">
<div>
<div
class="ds-survey"
id="entitiesPreguntasColaboracion"
*ngIf="ePreguntasOpcionesColaboracion && ePreguntasOpcionesColaboracion?.length === 0"
>
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No se encontraron preguntas</p>
</ng-container>
</div>
</div>
<div
class="ds-survey preview-survey"
id="entitiesColaboration"
*ngIf="ePreguntasOpcionesColaboracion && ePreguntasOpcionesColaboracion.length > 0"
>
<div class="ds-survey--all-question-wrapper col-8">
<div class="ds-survey--question-wrapper card-encuesta" *ngFor="let ePregunta of ePreguntasOpcionesColaboracion; let i = index">
<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 ePreguntasOpcionesColaboracion; let j = index">
<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="text"
readonly
style="border-radius: 3px"
name="{{ 'radio' + ePregunta.id }}"
id="'radio'"
/>-->
<label>{{
ePreguntaOpcionFinal.nombre + ' / Cantidad de veces seleccionada: ' + ePreguntaOpcionFinal.cantidad
}}</label>
</div>
<div class="checkbox" *ngIf="ePregunta.tipo === 'MULTIPLE'">
<!--<input
type="checkbox"
style="border-radius: 3px"
id="{{ 'checkbox' + ePreguntaOpcionFinal.id }}"
/>-->
<label>{{
ePreguntaOpcionFinal.nombre + ' / Cantidad de veces seleccionada: ' + ePreguntaOpcionFinal.cantidad
}}</label>
</div>
</div>
</ng-container>
</ng-container>
</ng-container>
</ng-container>
<div *ngIf="!ePregunta.tipo">
<div *ngFor="let res of respuestaAbiertaColaboracion">
<!-- <ul>
<li *ngIf="res.epreguntaAbierta?.id == preguntaId"> {{ res.respuesta }}</li>
</ul>-->
<!-- <textarea readonly class="ds-survey&#45;&#45;textarea" cols="33" rows="10" *ngIf="res.epreguntaAbierta?.id == preguntaId" > {{ res.respuesta }} </textarea>-->
<div *ngIf="res.epreguntaAbierta?.id == ePregunta.id">
<label> {{ '- ' + res.respuesta }}</label> <br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DashboardUserComponent } from './dashboard-user.component';
describe('DashboardUserComponent', () => {
let component: DashboardUserComponent;
let fixture: ComponentFixture<DashboardUserComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DashboardUserComponent],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(DashboardUserComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,593 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { UsuarioEncuestaService } from '../../usuario-encuesta/service/usuario-encuesta.service';
import { IUser } from '../../user/user.model';
import { HttpResponse } from '@angular/common/http';
import { IEncuesta } from '../../encuesta/encuesta.model';
import { EstadoEncuesta } from '../../enumerations/estado-encuesta.model';
import { EncuestaService } from '../../encuesta/service/encuesta.service';
import { UsuarioExtra } from '../../usuario-extra/usuario-extra.model';
import { Account } from '../../../core/auth/account.model';
import { AccountService } from '../../../core/auth/account.service';
import { UsuarioExtraService } from '../../usuario-extra/service/usuario-extra.service';
import { faListAlt, faUser, faEye, faStar, faCalendarAlt } from '@fortawesome/free-solid-svg-icons';
import * as Chartist from 'chartist';
import { finalize } from 'rxjs/operators';
import { EPreguntaAbiertaRespuestaService } from '../../e-pregunta-abierta-respuesta/service/e-pregunta-abierta-respuesta.service';
import { IEPreguntaAbiertaRespuesta } from '../../e-pregunta-abierta-respuesta/e-pregunta-abierta-respuesta.model';
import { IUsuarioEncuesta } from '../../usuario-encuesta/usuario-encuesta.model';
import { exportAsExcelFile } from '../export/export_excel';
import { jsPDF } from 'jspdf';
import { createPDFTableHeaders, generatePDFTable, generatePDFTableData, saveGeneratedPDF } from '../export/export_pdf';
@Component({
selector: 'jhi-dashboard-user',
templateUrl: './dashboard-user.component.html',
styleUrls: ['./dashboard-user.component.scss'],
})
export class DashboardUserComponent implements OnInit {
user: IUser | null = null;
cantEncuestas: number = 0;
cantPersonas: number = 0;
cantActivas: number = 0;
cantFinalizadas: number = 0;
cantDraft: number = 0;
cantPublicas: number = 0;
cantPrivadas: number = 0;
faListAlt = faListAlt;
faUser = faUser;
faEye = faEye;
faStar = faStar;
faCalendarAlt = faCalendarAlt;
reportsGeneral = false;
reportForEncuestas = true;
reportPreguntas = true;
reportColaboraciones = true;
reportColaboracionPreguntas = true;
duracion?: number = 0;
ePreguntas?: any[];
ePreguntasOpciones?: any[];
respuestaAbierta?: IEPreguntaAbiertaRespuesta[];
isLoading = false;
encuestas?: IEncuesta[];
usuarioExtra: UsuarioExtra | null = null;
account: Account | null = null;
encuesta: IEncuesta | null = null;
colaboracion: IEncuesta | null = null;
preguntaId?: number = 0;
usuarioEncuestas?: IUsuarioEncuesta[];
colaboraciones?: IEncuesta[];
duracionColaboracion?: number = 0;
ePreguntasColaboracion?: any[];
ePreguntasOpcionesColaboracion?: any[];
respuestaAbiertaColaboracion?: IEPreguntaAbiertaRespuesta[];
preguntaIdColaboracion?: number = 0;
duracionArray?: number[] | null = null;
constructor(
protected encuestaService: EncuestaService,
protected accountService: AccountService,
protected usuarioExtraService: UsuarioExtraService,
protected usuarioEncuestaService: UsuarioEncuestaService,
protected resAbierta: EPreguntaAbiertaRespuestaService
) {}
ngOnInit(): void {
this.loadUser();
}
cambiarVista() {
if (this.reportsGeneral) {
this.reportsGeneral = false;
this.reportForEncuestas = true;
this.reportPreguntas = true;
this.reportColaboraciones = true;
this.reportColaboracionPreguntas = true;
} else if (this.reportForEncuestas) {
this.reportsGeneral = true;
this.reportForEncuestas = false;
this.reportPreguntas = true;
this.reportColaboraciones = true;
this.reportColaboracionPreguntas = true;
} else if (this.reportPreguntas) {
this.reportForEncuestas = false;
this.reportPreguntas = true;
this.reportsGeneral = true;
this.reportColaboraciones = true;
this.reportColaboracionPreguntas = true;
}
}
cambiarVistaColaboracion(cambio: string) {
if (cambio === 'colaboracion') {
this.reportForEncuestas = true;
this.reportPreguntas = true;
this.reportsGeneral = true;
this.reportColaboraciones = false;
this.reportColaboracionPreguntas = true;
} else if (cambio === 'preguntasColaboracion') {
this.reportForEncuestas = true;
this.reportPreguntas = true;
this.reportsGeneral = true;
this.reportColaboraciones = true;
this.reportColaboracionPreguntas = false;
}
}
loadEncuestas() {
this.encuestaService.query().subscribe(
(res: HttpResponse<IEncuesta[]>) => {
this.isLoading = false;
const tmpEncuestas = res.body ?? [];
this.encuestas = tmpEncuestas.filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id && e.estado !== 'DELETED');
this.cantEncuestas = this.encuestas.length;
this.cantActivas = tmpEncuestas.filter(e => e.estado === 'ACTIVE' && e.usuarioExtra?.id === this.usuarioExtra?.id).length;
this.cantDraft = tmpEncuestas.filter(e => e.estado === 'DRAFT' && e.usuarioExtra?.id === this.usuarioExtra?.id).length;
this.cantFinalizadas = tmpEncuestas.filter(e => e.estado === 'FINISHED' && e.usuarioExtra?.id === this.usuarioExtra?.id).length;
this.cantPublicas = tmpEncuestas.filter(
e => e.acceso === 'PUBLIC' && e.usuarioExtra?.id === this.usuarioExtra?.id && e.estado !== 'DELETED'
).length;
this.cantPrivadas = tmpEncuestas.filter(
e => e.acceso === 'PRIVATE' && e.usuarioExtra?.id === this.usuarioExtra?.id && e.estado !== 'DELETED'
).length;
let cantidadCompletadas: number = 0;
tmpEncuestas
.filter(e => e.estado === 'ACTIVE')
.forEach(e => {
const _contadorCompletadas = e.calificacion;
cantidadCompletadas = cantidadCompletadas + (Number(_contadorCompletadas?.toString().split('.')[1]) - 1);
});
this.cantPersonas = cantidadCompletadas;
tmpEncuestas.forEach(encuesta => {
const _calificacion = encuesta.calificacion;
encuesta.calificacion = Number(_calificacion?.toString().split('.')[0]);
/* if (encuesta.fechaFinalizada == null) {
this.duracion = -1;
this.duracionArray?.push(this.duracion);
} else {
this.duracion = encuesta.fechaPublicacion?.diff(encuesta.fechaFinalizada!, 'days');
this.duracionArray?.push(this.duracion!);
}*/
});
/*this.cantPersonas = tmpEncuestas.filter(
e => e.calificacion && e.usuarioExtra?.id === this.usuarioExtra?.id && e.estado !== 'DELETED'
).length;*/
//cantidad de personas que han completado la encuesta
this.loadFirstChart();
this.loadSecondChart();
},
() => {
this.isLoading = false;
}
);
}
loadUser(): void {
this.accountService.getAuthenticationState().subscribe(account => {
if (account !== null) {
this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => {
this.usuarioExtra = usuarioExtra.body;
});
}
});
this.loadEncuestas();
this.loadAllColaboraciones();
}
loadFirstChart(): void {
var dataEstado = {
labels: ['ACTIVOS', 'BORRADOR', 'FINALIZADOS'],
series: [this.cantActivas, this.cantDraft, this.cantFinalizadas],
};
new Chartist.Pie('#chartEstado', dataEstado);
}
loadSecondChart(): void {
var dataAcceso = {
labels: ['PÚBLICA', 'PRIVADA'],
series: [this.cantPublicas, this.cantPrivadas],
};
new Chartist.Pie('#chartAcceso', dataAcceso);
}
detallesPreguntas(encuesta: IEncuesta): void {
if (!this.reportForEncuestas) {
this.reportPreguntas = false;
this.reportForEncuestas = true;
this.reportsGeneral = true;
}
this.encuesta = encuesta;
debugger;
this.isLoading = true;
this.encuestaService
.findQuestions(encuesta?.id!)
.pipe(
finalize(() =>
this.encuestaService.findQuestionsOptions(encuesta?.id!).subscribe(
(res: any) => {
this.isLoading = false;
this.ePreguntasOpciones = res.body ?? [];
debugger;
this.getOpenQuestionAnswers();
},
() => {
this.isLoading = false;
}
)
)
)
.subscribe(
(res: any) => {
this.isLoading = false;
this.ePreguntas = res.body ?? [];
},
() => {
this.isLoading = false;
}
);
if (this.ePreguntas!.length == 0) {
this.previousState();
}
}
previousState(): void {
window.history.back();
}
getOpenQuestionAnswers() {
this.ePreguntas!.forEach(pregunta => {
debugger;
if (!pregunta.tipo) {
this.resAbierta.query().subscribe(res => {
debugger;
this.preguntaId = pregunta.id;
this.respuestaAbierta = res.body ?? [];
/* const respuesta = res.body ?? [];
respuesta.forEach( e => {
debugger
if (e.epreguntaAbierta?.id == pregunta.id){
this.respuestaAbierta?.push(e);
}
/!*debugger
this.eRespuestaAbierta?.push(respuesta.filter(e.ePreguntaAbierta?.id == pregunta.id));*!/
})
*/
console.log(this.respuestaAbierta);
});
}
});
}
loadAllColaboraciones(): void {
this.usuarioEncuestaService.query().subscribe((res: HttpResponse<IUsuarioEncuesta[]>) => {
const tempUsuarioEncuestas = res.body ?? [];
this.usuarioEncuestas = tempUsuarioEncuestas
.filter(c => c.usuarioExtra?.id === this.usuarioExtra?.id)
.filter(c => c.encuesta?.estado !== 'DELETED');
// Fix calificacion
tempUsuarioEncuestas.forEach(colaboracion => {
if (colaboracion.encuesta) {
const _calificacion = colaboracion.encuesta.calificacion;
colaboracion.encuesta.calificacion = Number(_calificacion?.toString().split('.')[0]);
if (colaboracion.encuesta.fechaFinalizada == null) {
this.duracionColaboracion = -1;
} else {
this.duracionColaboracion = colaboracion.encuesta.fechaPublicacion?.diff(colaboracion.encuesta.fechaFinalizada!, 'days');
}
}
});
});
}
detallesPreguntasColaboracion(encuesta: IEncuesta): void {
if (!this.reportColaboraciones) {
this.reportPreguntas = true;
this.reportForEncuestas = true;
this.reportsGeneral = true;
this.reportColaboraciones = true;
this.reportColaboracionPreguntas = false;
}
this.colaboracion = encuesta;
debugger;
this.isLoading = true;
this.encuestaService
.findQuestions(encuesta?.id!)
.pipe(
finalize(() =>
this.encuestaService.findQuestionsOptions(encuesta?.id!).subscribe(
(res: any) => {
this.isLoading = false;
this.ePreguntasOpcionesColaboracion = res.body ?? [];
//debugger;
this.getOpenQuestionAnswersColaboracion();
},
() => {
this.isLoading = false;
}
)
)
)
.subscribe(
(res: any) => {
this.isLoading = false;
this.ePreguntasColaboracion = res.body ?? [];
},
() => {
this.isLoading = false;
}
);
}
getOpenQuestionAnswersColaboracion() {
this.ePreguntasColaboracion!.forEach(pregunta => {
debugger;
if (!pregunta.tipo) {
this.resAbierta.query().subscribe(res => {
debugger;
this.preguntaIdColaboracion = pregunta.id;
this.respuestaAbiertaColaboracion = res.body ?? [];
/* const respuesta = res.body ?? [];
respuesta.forEach( e => {
debugger
if (e.epreguntaAbierta?.id == pregunta.id){
this.respuestaAbierta?.push(e);
}
/!*debugger
this.eRespuestaAbierta?.push(respuesta.filter(e.ePreguntaAbierta?.id == pregunta.id));*!/
})
*/
console.log(this.respuestaAbiertaColaboracion);
});
}
});
}
exportReportesGeneralesUserExcel(): void {
/*REPORTES GENERALES:
*Cantidad de encuestas creadas
* cantidad de personas que han completado las encuestas
*Cantidad de encuestas por estado
* Cantidad de encuestas por acceso
* */
if (!this.reportsGeneral) {
const _sheets = [
'Cantidad encuestas creadas',
'Cantidad usuarios encuestas',
'Cantidad encuestas por estado',
'Cantidad encuestas por acceso',
];
const _reporteEncuestasCreadas = [{ total_encuestas: this.cantEncuestas }];
const _reporteUsuariosCompletadas = [{ total_usuarios: this.cantPersonas }];
const _reporteEncuestasEstado = [
{ total_borrador: this.cantPersonas, total_activas: this.cantActivas, total_finalizadas: this.cantFinalizadas },
];
const _reporteEncuestasAcceso = [{ total_publicas: this.cantPublicas, total_privadas: this.cantPrivadas }];
const _excelFinalData = [_reporteEncuestasCreadas, _reporteUsuariosCompletadas, _reporteEncuestasEstado, _reporteEncuestasAcceso];
const _fileName = 'reportes_generales_encuestas_DataSurvey';
exportAsExcelFile(_sheets, _excelFinalData, _fileName);
} else if (!this.reportPreguntas) {
/*REPORTES POR ENCUESTA:
* Nombre encuesta
* categoria encuesta
* calificacion encuesta
*
* preguntas:
* contenido/ cantidad*/
const _sheets = ['Datos de encuesta', 'Contenido de preguntas cerradas', 'Contenido de preguntas abiertas'];
const _reporteDatosEncuesta = [
{
nombre_encuesta: this.encuesta?.nombre,
categoria_encuesta: this.encuesta?.categoria?.nombre,
calificacion_encuesta: this.encuesta?.calificacion,
},
];
const _reporteContenidoPreguntasCerradas: any[] = [];
const _reporteContenidoPreguntasAbiertas: any[] = [];
this.ePreguntas!.forEach((pregunta: any, index) => {
debugger;
let _report: any = {};
let _reportAbierta: any = {};
if (!pregunta.tipo) {
this.respuestaAbierta!.forEach((respuesta: any) => {
if (respuesta.epreguntaAbierta?.id == pregunta.id) {
// _reportAbierta['pregunta_abierta'] = pregunta.nombre;
_reportAbierta['contenido'] = respuesta.respuesta;
_reporteContenidoPreguntasAbiertas.push(_reportAbierta);
}
});
} else {
debugger;
this.ePreguntasOpciones!.forEach((respuesta: any, index) => {
console.log(respuesta.epreguntaCerrada);
if (respuesta[index].epreguntaCerrada.id == pregunta.id) {
_report['opcion_pregunta'] = respuesta[index].nombre;
_report['cantidad'] = respuesta[index].cantidad;
_reporteContenidoPreguntasCerradas.push(_report);
}
});
}
});
const _excelFinalData = [_reporteDatosEncuesta, _reporteContenidoPreguntasCerradas, _reporteContenidoPreguntasAbiertas];
const _fileName = 'reportes_detalle_encuesta_datasurvey';
exportAsExcelFile(_sheets, _excelFinalData, _fileName);
}
}
exportReportesGeneralesUserPDF(): void {
/*REPORTES GENERALES:
*Cantidad de encuestas creadas
* cantidad de personas que han completado las encuestas
*Cantidad de encuestas por estado
* Cantidad de encuestas por acceso
* */
if (!this.reportsGeneral) {
const doc = new jsPDF();
const _fileName = 'reportes_generales_encuestas_datasurvey';
let _docData, _headers, _docHeaders, _docTitle;
debugger;
const _reporteEncuestasCreadas = [{ total_encuestas_creadas: this.cantEncuestas!.toString() }];
debugger;
_docData = generatePDFTableData(_reporteEncuestasCreadas);
_headers = ['total_encuestas_creadas'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte General Cantidad Encuestas Creadas';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('p');
const _reporteUsuariosCompletadas = [{ total_usuarios_completados: this.cantPersonas.toString() }];
_docData = generatePDFTableData(_reporteUsuariosCompletadas);
_headers = ['total_usuarios_completados'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte General Cantidad Usuarios';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('p');
const _reporteEncuestasEstado = [
{
total_borrador: this.cantPersonas.toString(),
total_activas: this.cantActivas.toString(),
total_finalizadas: this.cantFinalizadas.toString(),
},
];
_docData = generatePDFTableData(_reporteEncuestasEstado);
_headers = ['total_borrador', 'total_activas', 'total_finalizadas'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte General Cantidad Encuestas Por Estado';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('p');
const _reporteEncuestasAcceso = [{ total_publicas: this.cantPublicas.toString(), total_privadas: this.cantPrivadas.toString() }];
_docData = generatePDFTableData(_reporteEncuestasAcceso);
_headers = ['total_publicas', 'total_privadas'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte General Cantidad Encuestas Por Acceso';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('p');
saveGeneratedPDF(doc, _fileName);
} else {
/*REPORTES POR ENCUESTA:
* Nombre encuesta
* categoria encuesta
* calificacion encuesta
*
* preguntas:
* contenido/ cantidad*/
const doc = new jsPDF();
const _fileName = 'reportes_detalles_encuestas_datasurvey';
let _docData, _headers, _docHeaders, _docTitle;
const _reporteDatosEncuesta = [
{
nombre_encuesta: this.encuesta?.nombre,
categoria_encuesta: this.encuesta?.categoria?.nombre,
calificacion_encuesta: this.encuesta?.calificacion!.toString(),
},
];
_docData = generatePDFTableData(_reporteDatosEncuesta);
_headers = ['nombre_encuesta', 'categoria_encuesta', 'calificacion_encuesta'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte Detalle Encuesta';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('l');
const _reporteContenidoPreguntasCerradas: any[] = [];
const _reporteContenidoPreguntasAbiertas: any[] = [];
this.ePreguntas!.forEach((pregunta: any, index) => {
debugger;
let _report: any = {};
let _reportAbierta: any = {};
if (!pregunta.tipo) {
this.respuestaAbierta!.forEach((respuesta: any) => {
if (respuesta.epreguntaAbierta?.id == pregunta.id) {
_reportAbierta['pregunta_abierta'] = 'Contenido';
_reportAbierta['contenido'] = respuesta.respuesta;
_reporteContenidoPreguntasAbiertas.push(_reportAbierta);
}
});
} else {
debugger;
this.ePreguntasOpciones!.forEach((respuesta: any, index) => {
console.log(respuesta.epreguntaCerrada);
if (respuesta[index].epreguntaCerrada.id == pregunta.id) {
_report['opcion_pregunta'] = respuesta[index].nombre;
_report['cantidad'] = respuesta[index].cantidad.toString();
_reporteContenidoPreguntasCerradas.push(_report);
}
});
}
});
_docData = generatePDFTableData(_reporteContenidoPreguntasCerradas);
_headers = ['opcion_pregunta', 'cantidad'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte de Cantidad Seleccion Opciones Cerradas';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('l');
_docData = generatePDFTableData(_reporteContenidoPreguntasAbiertas);
_headers = ['pregunta_abierta', 'contenido'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte Respuesta Pregunta Abierta';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('l');
saveGeneratedPDF(doc, _fileName);
}
}
}

View File

@ -1,14 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DashboardUserComponent } from './dashboard-user/dashboard-user.component';
import { DashboardAdminComponent } from './dashboard-admin/dashboard-admin.component';
import { SharedModule } from '../../shared/shared.module';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { DashboardRoutingModule } from './route/dashboard-routing.module';
@NgModule({
declarations: [DashboardUserComponent, DashboardAdminComponent],
imports: [CommonModule, SharedModule, DashboardRoutingModule, FontAwesomeModule],
})
export class DashboardModule {}

View File

@ -1,10 +0,0 @@
export const generateFileName = (fileName: string, extension: string): string => {
return (
fileName +
'_' +
new Date().toLocaleDateString().substr(0, 10).split('/').join('-') +
'_' +
Math.random().toString().substring(2) +
extension
);
};

View File

@ -1,37 +0,0 @@
import * as XLSX from 'xlsx';
import * as FileSaver from 'file-saver';
import { generateFileName } from './export_common';
const EXCEL_TYPE: string = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
const EXCEL_EXTENSION: string = '.xlsx';
export const exportAsExcelFile = (sheetNames: string[], arrayOfData: any[], excelFileName: any) => {
const workbook = XLSX.utils.book_new();
arrayOfData.forEach((data, index) => {
let sheetName = sheetNames[index];
let worksheet = XLSX.utils.json_to_sheet(data);
XLSX.utils.book_append_sheet(workbook, worksheet, sheetName);
});
const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
saveAsExcelFile(excelBuffer, excelFileName);
};
const saveAsExcelFile = (buffer: any, fileName: any) => {
const data = new Blob([buffer], { type: EXCEL_EXTENSION });
const generatedFileName = generateFileName(fileName, EXCEL_EXTENSION);
FileSaver.saveAs(data, generatedFileName);
};
export const exportAsExcelTable = () => {
const workbook = XLSX.utils.book_new();
let worksheet = XLSX.utils.json_to_sheet([{ test: 1 }, { test: 2 }]);
XLSX.utils.book_append_sheet(workbook, worksheet, 'test');
const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
saveAsExcelFile(excelBuffer, 'test');
};

View File

@ -1,42 +0,0 @@
import { jsPDF } from 'jspdf';
import { generateFileName } from './export_common';
const PDF_EXTENSION: string = '.pdf';
export const generatePDFTableData = (data: any): any => {
const result: any = [];
data.forEach((item: any) => {
result.push(Object.assign({}, item));
});
return result;
};
export const createPDFTableHeaders = (keys: any): any[] => {
let result = [];
for (let i = 0; i < keys.length; i += 1) {
result.push({
id: keys[i],
name: keys[i],
prompt: keys[i],
align: 'left',
padding: 0,
});
}
return result;
};
export const generatePDFTable = (doc: jsPDF, _docData: any, _docHeaders: string[], _docTitle: string): void => {
doc.setFontSize(20);
doc.setFont('helvetica', 'bold');
doc.text(_docTitle, 20, 20);
doc.setFont('helvetica');
doc.table(20, 30, _docData, _docHeaders, { fontSize: 10, autoSize: true });
};
export const saveGeneratedPDF = (doc: jsPDF, _fileName: string) => {
const generatedFileName = generateFileName(_fileName, PDF_EXTENSION);
doc.save(generatedFileName);
};

View File

@ -1,25 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DashboardUserComponent } from '../dashboard-user/dashboard-user.component';
import { DashboardAdminComponent } from '../dashboard-admin/dashboard-admin.component';
import { UserRouteAccessService } from '../../../core/auth/user-route-access.service';
const dashboardRoute: Routes = [
{
path: 'admin',
component: DashboardAdminComponent,
canActivate: [UserRouteAccessService],
},
{
path: 'user',
component: DashboardUserComponent,
canActivate: [UserRouteAccessService],
},
];
@NgModule({
imports: [RouterModule.forChild(dashboardRoute)],
exports: [RouterModule],
})
export class DashboardRoutingModule {}

View File

@ -22,9 +22,9 @@
</dd> </dd>
<dt><span jhiTranslate="dataSurveyApp.ePreguntaAbiertaRespuesta.ePreguntaAbierta">E Pregunta Abierta</span></dt> <dt><span jhiTranslate="dataSurveyApp.ePreguntaAbiertaRespuesta.ePreguntaAbierta">E Pregunta Abierta</span></dt>
<dd> <dd>
<div *ngIf="ePreguntaAbiertaRespuesta.epreguntaAbierta"> <div *ngIf="ePreguntaAbiertaRespuesta.ePreguntaAbierta">
<a [routerLink]="['/e-pregunta-abierta', ePreguntaAbiertaRespuesta.epreguntaAbierta?.id, 'view']">{{ <a [routerLink]="['/e-pregunta-abierta', ePreguntaAbiertaRespuesta.ePreguntaAbierta?.id, 'view']">{{
ePreguntaAbiertaRespuesta.epreguntaAbierta?.id ePreguntaAbiertaRespuesta.ePreguntaAbierta?.id
}}</a> }}</a>
</div> </div>
</dd> </dd>

View File

@ -3,11 +3,11 @@ import { IEPreguntaAbierta } from 'app/entities/e-pregunta-abierta/e-pregunta-ab
export interface IEPreguntaAbiertaRespuesta { export interface IEPreguntaAbiertaRespuesta {
id?: number; id?: number;
respuesta?: string; respuesta?: string;
epreguntaAbierta?: IEPreguntaAbierta | null; ePreguntaAbierta?: IEPreguntaAbierta | null;
} }
export class EPreguntaAbiertaRespuesta implements IEPreguntaAbiertaRespuesta { export class EPreguntaAbiertaRespuesta implements IEPreguntaAbiertaRespuesta {
constructor(public respuesta?: string, public epreguntaAbierta?: IEPreguntaAbierta | null) {} constructor(public id?: number, public respuesta?: string, public ePreguntaAbierta?: IEPreguntaAbierta | null) {}
} }
export function getEPreguntaAbiertaRespuestaIdentifier(ePreguntaAbiertaRespuesta: IEPreguntaAbiertaRespuesta): number | undefined { export function getEPreguntaAbiertaRespuestaIdentifier(ePreguntaAbiertaRespuesta: IEPreguntaAbiertaRespuesta): number | undefined {

View File

@ -45,9 +45,9 @@
</td> </td>
<td>{{ ePreguntaAbiertaRespuesta.respuesta }}</td> <td>{{ ePreguntaAbiertaRespuesta.respuesta }}</td>
<td> <td>
<div *ngIf="ePreguntaAbiertaRespuesta.epreguntaAbierta"> <div *ngIf="ePreguntaAbiertaRespuesta.ePreguntaAbierta">
<a [routerLink]="['/e-pregunta-abierta', ePreguntaAbiertaRespuesta.epreguntaAbierta?.id, 'view']">{{ <a [routerLink]="['/e-pregunta-abierta', ePreguntaAbiertaRespuesta.ePreguntaAbierta?.id, 'view']">{{
ePreguntaAbiertaRespuesta.epreguntaAbierta?.id ePreguntaAbiertaRespuesta.ePreguntaAbierta?.id
}}</a> }}</a>
</div> </div>
</td> </td>

View File

@ -17,7 +17,6 @@ export class EPreguntaAbiertaRespuestaService {
constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {} constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
create(ePreguntaAbiertaRespuesta: IEPreguntaAbiertaRespuesta): Observable<EntityResponseType> { create(ePreguntaAbiertaRespuesta: IEPreguntaAbiertaRespuesta): Observable<EntityResponseType> {
debugger;
return this.http.post<IEPreguntaAbiertaRespuesta>(this.resourceUrl, ePreguntaAbiertaRespuesta, { observe: 'response' }); return this.http.post<IEPreguntaAbiertaRespuesta>(this.resourceUrl, ePreguntaAbiertaRespuesta, { observe: 'response' });
} }

View File

@ -43,7 +43,7 @@ describe('Component Tests', () => {
it('Should call EPreguntaAbierta query and add missing value', () => { it('Should call EPreguntaAbierta query and add missing value', () => {
const ePreguntaAbiertaRespuesta: IEPreguntaAbiertaRespuesta = { id: 456 }; const ePreguntaAbiertaRespuesta: IEPreguntaAbiertaRespuesta = { id: 456 };
const ePreguntaAbierta: IEPreguntaAbierta = { id: 35011 }; const ePreguntaAbierta: IEPreguntaAbierta = { id: 35011 };
ePreguntaAbiertaRespuesta.epreguntaAbierta = ePreguntaAbierta; ePreguntaAbiertaRespuesta.ePreguntaAbierta = ePreguntaAbierta;
const ePreguntaAbiertaCollection: IEPreguntaAbierta[] = [{ id: 58318 }]; const ePreguntaAbiertaCollection: IEPreguntaAbierta[] = [{ id: 58318 }];
jest.spyOn(ePreguntaAbiertaService, 'query').mockReturnValue(of(new HttpResponse({ body: ePreguntaAbiertaCollection }))); jest.spyOn(ePreguntaAbiertaService, 'query').mockReturnValue(of(new HttpResponse({ body: ePreguntaAbiertaCollection })));
@ -65,7 +65,7 @@ describe('Component Tests', () => {
it('Should update editForm', () => { it('Should update editForm', () => {
const ePreguntaAbiertaRespuesta: IEPreguntaAbiertaRespuesta = { id: 456 }; const ePreguntaAbiertaRespuesta: IEPreguntaAbiertaRespuesta = { id: 456 };
const ePreguntaAbierta: IEPreguntaAbierta = { id: 40814 }; const ePreguntaAbierta: IEPreguntaAbierta = { id: 40814 };
ePreguntaAbiertaRespuesta.epreguntaAbierta = ePreguntaAbierta; ePreguntaAbiertaRespuesta.ePreguntaAbierta = ePreguntaAbierta;
activatedRoute.data = of({ ePreguntaAbiertaRespuesta }); activatedRoute.data = of({ ePreguntaAbiertaRespuesta });
comp.ngOnInit(); comp.ngOnInit();

View File

@ -81,12 +81,12 @@ export class EPreguntaAbiertaRespuestaUpdateComponent implements OnInit {
this.editForm.patchValue({ this.editForm.patchValue({
id: ePreguntaAbiertaRespuesta.id, id: ePreguntaAbiertaRespuesta.id,
respuesta: ePreguntaAbiertaRespuesta.respuesta, respuesta: ePreguntaAbiertaRespuesta.respuesta,
ePreguntaAbierta: ePreguntaAbiertaRespuesta.epreguntaAbierta, ePreguntaAbierta: ePreguntaAbiertaRespuesta.ePreguntaAbierta,
}); });
this.ePreguntaAbiertasSharedCollection = this.ePreguntaAbiertaService.addEPreguntaAbiertaToCollectionIfMissing( this.ePreguntaAbiertasSharedCollection = this.ePreguntaAbiertaService.addEPreguntaAbiertaToCollectionIfMissing(
this.ePreguntaAbiertasSharedCollection, this.ePreguntaAbiertasSharedCollection,
ePreguntaAbiertaRespuesta.epreguntaAbierta ePreguntaAbiertaRespuesta.ePreguntaAbierta
); );
} }
@ -110,7 +110,7 @@ export class EPreguntaAbiertaRespuestaUpdateComponent implements OnInit {
...new EPreguntaAbiertaRespuesta(), ...new EPreguntaAbiertaRespuesta(),
id: this.editForm.get(['id'])!.value, id: this.editForm.get(['id'])!.value,
respuesta: this.editForm.get(['respuesta'])!.value, respuesta: this.editForm.get(['respuesta'])!.value,
epreguntaAbierta: this.editForm.get(['ePreguntaAbierta'])!.value, ePreguntaAbierta: this.editForm.get(['ePreguntaAbierta'])!.value,
}; };
} }
} }

View File

@ -30,9 +30,9 @@
</dd> </dd>
<dt><span jhiTranslate="dataSurveyApp.ePreguntaCerradaOpcion.ePreguntaCerrada">E Pregunta Cerrada</span></dt> <dt><span jhiTranslate="dataSurveyApp.ePreguntaCerradaOpcion.ePreguntaCerrada">E Pregunta Cerrada</span></dt>
<dd> <dd>
<div *ngIf="ePreguntaCerradaOpcion.epreguntaCerrada"> <div *ngIf="ePreguntaCerradaOpcion.ePreguntaCerrada">
<a [routerLink]="['/e-pregunta-cerrada', ePreguntaCerradaOpcion.epreguntaCerrada?.id, 'view']">{{ <a [routerLink]="['/e-pregunta-cerrada', ePreguntaCerradaOpcion.ePreguntaCerrada?.id, 'view']">{{
ePreguntaCerradaOpcion.epreguntaCerrada?.id ePreguntaCerradaOpcion.ePreguntaCerrada?.id
}}</a> }}</a>
</div> </div>
</dd> </dd>

View File

@ -5,7 +5,7 @@ export interface IEPreguntaCerradaOpcion {
nombre?: string; nombre?: string;
orden?: number; orden?: number;
cantidad?: number; cantidad?: number;
epreguntaCerrada?: IEPreguntaCerrada | null; ePreguntaCerrada?: IEPreguntaCerrada | null;
} }
export class EPreguntaCerradaOpcion implements IEPreguntaCerradaOpcion { export class EPreguntaCerradaOpcion implements IEPreguntaCerradaOpcion {
@ -14,7 +14,7 @@ export class EPreguntaCerradaOpcion implements IEPreguntaCerradaOpcion {
public nombre?: string, public nombre?: string,
public orden?: number, public orden?: number,
public cantidad?: number, public cantidad?: number,
public epreguntaCerrada?: IEPreguntaCerrada | null public ePreguntaCerrada?: IEPreguntaCerrada | null
) {} ) {}
} }

View File

@ -49,9 +49,9 @@
<td>{{ ePreguntaCerradaOpcion.orden }}</td> <td>{{ ePreguntaCerradaOpcion.orden }}</td>
<td>{{ ePreguntaCerradaOpcion.cantidad }}</td> <td>{{ ePreguntaCerradaOpcion.cantidad }}</td>
<td> <td>
<div *ngIf="ePreguntaCerradaOpcion.epreguntaCerrada"> <div *ngIf="ePreguntaCerradaOpcion.ePreguntaCerrada">
<a [routerLink]="['/e-pregunta-cerrada', ePreguntaCerradaOpcion.epreguntaCerrada?.id, 'view']">{{ <a [routerLink]="['/e-pregunta-cerrada', ePreguntaCerradaOpcion.ePreguntaCerrada?.id, 'view']">{{
ePreguntaCerradaOpcion.epreguntaCerrada?.id ePreguntaCerradaOpcion.ePreguntaCerrada?.id
}}</a> }}</a>
</div> </div>
</td> </td>

View File

@ -16,13 +16,8 @@ export class EPreguntaCerradaOpcionService {
constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {} constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
updateCount(id: number) { create(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion): Observable<EntityResponseType> {
debugger; return this.http.post<IEPreguntaCerradaOpcion>(this.resourceUrl, ePreguntaCerradaOpcion, { observe: 'response' });
return this.http.put(`${this.resourceUrl}/count/${id}`, id, { observe: 'response' });
}
create(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion, preguntaId?: number): Observable<EntityResponseType> {
return this.http.post<IEPreguntaCerradaOpcion>(`${this.resourceUrl}/${preguntaId}`, ePreguntaCerradaOpcion, { observe: 'response' });
} }
update(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion): Observable<EntityResponseType> { update(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion): Observable<EntityResponseType> {
@ -54,10 +49,6 @@ 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

@ -43,7 +43,7 @@ describe('Component Tests', () => {
it('Should call EPreguntaCerrada query and add missing value', () => { it('Should call EPreguntaCerrada query and add missing value', () => {
const ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion = { id: 456 }; const ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion = { id: 456 };
const ePreguntaCerrada: IEPreguntaCerrada = { id: 2192 }; const ePreguntaCerrada: IEPreguntaCerrada = { id: 2192 };
ePreguntaCerradaOpcion.epreguntaCerrada = ePreguntaCerrada; ePreguntaCerradaOpcion.ePreguntaCerrada = ePreguntaCerrada;
const ePreguntaCerradaCollection: IEPreguntaCerrada[] = [{ id: 89287 }]; const ePreguntaCerradaCollection: IEPreguntaCerrada[] = [{ id: 89287 }];
jest.spyOn(ePreguntaCerradaService, 'query').mockReturnValue(of(new HttpResponse({ body: ePreguntaCerradaCollection }))); jest.spyOn(ePreguntaCerradaService, 'query').mockReturnValue(of(new HttpResponse({ body: ePreguntaCerradaCollection })));
@ -65,7 +65,7 @@ describe('Component Tests', () => {
it('Should update editForm', () => { it('Should update editForm', () => {
const ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion = { id: 456 }; const ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion = { id: 456 };
const ePreguntaCerrada: IEPreguntaCerrada = { id: 64500 }; const ePreguntaCerrada: IEPreguntaCerrada = { id: 64500 };
ePreguntaCerradaOpcion.epreguntaCerrada = ePreguntaCerrada; ePreguntaCerradaOpcion.ePreguntaCerrada = ePreguntaCerrada;
activatedRoute.data = of({ ePreguntaCerradaOpcion }); activatedRoute.data = of({ ePreguntaCerradaOpcion });
comp.ngOnInit(); comp.ngOnInit();

View File

@ -85,12 +85,12 @@ export class EPreguntaCerradaOpcionUpdateComponent implements OnInit {
nombre: ePreguntaCerradaOpcion.nombre, nombre: ePreguntaCerradaOpcion.nombre,
orden: ePreguntaCerradaOpcion.orden, orden: ePreguntaCerradaOpcion.orden,
cantidad: ePreguntaCerradaOpcion.cantidad, cantidad: ePreguntaCerradaOpcion.cantidad,
ePreguntaCerrada: ePreguntaCerradaOpcion.epreguntaCerrada, ePreguntaCerrada: ePreguntaCerradaOpcion.ePreguntaCerrada,
}); });
this.ePreguntaCerradasSharedCollection = this.ePreguntaCerradaService.addEPreguntaCerradaToCollectionIfMissing( this.ePreguntaCerradasSharedCollection = this.ePreguntaCerradaService.addEPreguntaCerradaToCollectionIfMissing(
this.ePreguntaCerradasSharedCollection, this.ePreguntaCerradasSharedCollection,
ePreguntaCerradaOpcion.epreguntaCerrada ePreguntaCerradaOpcion.ePreguntaCerrada
); );
} }
@ -116,7 +116,7 @@ export class EPreguntaCerradaOpcionUpdateComponent implements OnInit {
nombre: this.editForm.get(['nombre'])!.value, nombre: this.editForm.get(['nombre'])!.value,
orden: this.editForm.get(['orden'])!.value, orden: this.editForm.get(['orden'])!.value,
cantidad: this.editForm.get(['cantidad'])!.value, cantidad: this.editForm.get(['cantidad'])!.value,
epreguntaCerrada: this.editForm.get(['ePreguntaCerrada'])!.value, ePreguntaCerrada: this.editForm.get(['ePreguntaCerrada'])!.value,
}; };
} }
} }

View File

@ -1,193 +0,0 @@
<div class="container-fluid" *ngIf="encuesta">
<div>
<h2 id="page-heading" data-cy="EPreguntaCerradaHeading">
<div class="d-flex align-items-center">
<p class="ds-title">Encuesta: {{ encuesta!.nombre }}</p>
<!-- &nbsp;&nbsp;<fa-icon class="ds-info&#45;&#45;icon" [icon]="faQuestion" data-toggle="modal" data-target="#verParametros"></fa-icon>-->
</div>
<p class="ds-subtitle">Fecha de inicio: {{ encuesta!.fechaPublicacion | 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>
</div>
</h2>
<jhi-alert-error></jhi-alert-error>
<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" *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"
(change)="onCheck(ePreguntaOpcionFinal)"
[value]="ePreguntaOpcionFinal.id"
style="border-radius: 3px"
name="{{ 'radio' + ePregunta.id }}"
id="{{ 'radio' + ePreguntaOpcionFinal.id }}"
/>
<label for="{{ 'radio' + ePreguntaOpcionFinal.id }}">{{ ePreguntaOpcionFinal.nombre }}</label>
</div>
<div class="checkbox" *ngIf="ePregunta.tipo === 'MULTIPLE'">
<input
(change)="toggleOption(ePreguntaOpcionFinal)"
type="checkbox"
style="border-radius: 3px"
id="{{ 'checkbox' + ePreguntaOpcionFinal.id }}"
/>
<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 class="ds-survey--textarea" id="{{ ePregunta.id }}" cols="33" rows="10"></textarea>
</div>
</div>
</div>
<div class="ds-survey--question-wrapper card-encuesta">
<div class="ds-survey--question">
<div class="ds-survey--rating">
<div class="ds-survey--titulo">
<span class="ds-survey--titulo--name">Calificación</span>
</div>
<div class="ds-survey--option ds-survey--option--base">
<fa-icon
*ngFor="let starNumber of this.stars"
id="{{ 'star-' + starNumber }}"
class="entity-icon--star--off"
[icon]="faStar"
(click)="updateRating(starNumber)"
></fa-icon>
</div>
</div>
</div>
</div>
<button class="ds-btn ds-btn--primary" (click)="finish()">Finalizar</button>
</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 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.fechaPublicacion | formatShortDatetime | lowercase)
}}
</P>
</div>
<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>
<div>
<fa-icon *ngFor="let i of [].constructor(this.avgCalificacion)" class="entity-icon--star" [icon]="faStar"></fa-icon
><fa-icon
*ngFor="let i of [].constructor(5 - this.avgCalificacion)"
class="entity-icon--star--off"
[icon]="faStar"
></fa-icon>
</div>
</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>

View File

@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { EncuestaCompleteComponent } from './complete.component';
describe('EncuestaCompleteComponent', () => {
let component: EncuestaCompleteComponent;
let fixture: ComponentFixture<EncuestaCompleteComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [EncuestaCompleteComponent],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(EncuestaCompleteComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,291 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { finalize } from 'rxjs/operators';
import { IEncuesta } from '../encuesta.model';
import { EncuestaService } from '../service/encuesta.service';
import { ICategoria } from 'app/entities/categoria/categoria.model';
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 { EPreguntaAbiertaService } from '../../e-pregunta-abierta/service/e-pregunta-abierta.service';
import { EPreguntaAbiertaRespuestaService } from '../../e-pregunta-abierta-respuesta/service/e-pregunta-abierta-respuesta.service';
import { EPreguntaCerradaOpcionService } from '../../e-pregunta-cerrada-opcion/service/e-pregunta-cerrada-opcion.service';
import { faStar, faQuestion } from '@fortawesome/free-solid-svg-icons';
import { AccesoEncuesta } from 'app/entities/enumerations/acceso-encuesta.model';
import { EncuestaPasswordDialogComponent } from '../encuesta-password-dialog/encuesta-password-dialog.component';
import { PreguntaCerradaTipo } from 'app/entities/enumerations/pregunta-cerrada-tipo.model';
import { EPreguntaAbiertaRespuesta } from 'app/entities/e-pregunta-abierta-respuesta/e-pregunta-abierta-respuesta.model';
import { Observable } from 'rxjs/internal/Observable';
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model';
@Component({
selector: 'jhi-complete',
templateUrl: './complete.component.html',
})
export class EncuestaCompleteComponent implements OnInit {
categoriasSharedCollection: ICategoria[] = [];
usuarioExtrasSharedCollection: IUsuarioExtra[] = [];
faStar = faStar;
faQuestion = faQuestion;
encuesta?: IEncuesta;
isLoading = false;
ePreguntas?: any[];
ePreguntasOpciones?: any[];
isLocked?: boolean;
selectedOpenOptions: any;
selectedSingleOptions: any;
selectedMultiOptions: any;
error: boolean;
calificacion: number;
stars: number[] = [1, 2, 3, 4, 5];
cantidadCalificaciones: number = 0;
avgCalificacion: number = 0;
sumCalificacion: number = 0;
constructor(
protected activatedRoute: ActivatedRoute,
protected encuestaService: EncuestaService,
protected usuarioExtraService: UsuarioExtraService,
protected fb: FormBuilder,
protected modalService: NgbModal,
protected ePreguntaCerradaService: EPreguntaCerradaService,
protected ePreguntaCerradaOpcionService: EPreguntaCerradaOpcionService,
protected ePreguntaAbiertaService: EPreguntaAbiertaService,
protected ePreguntaAbiertaRespuestaService: EPreguntaAbiertaRespuestaService
) {
this.selectedOpenOptions = {};
this.selectedSingleOptions = {};
this.selectedMultiOptions = [];
this.error = false;
this.calificacion = 0;
}
ngOnInit(): void {
this.activatedRoute.data.subscribe(({ encuesta }) => {
if (encuesta) {
this.encuesta = encuesta;
if (this.encuesta!.estado !== EstadoEncuesta.ACTIVE) {
this.previousState();
}
this.avgCalificacion = parseInt(this.encuesta!.calificacion!.toString().split('.')[0]);
this.cantidadCalificaciones = parseInt(this.encuesta!.calificacion!.toString().split('.')[1]);
this.sumCalificacion = this.avgCalificacion * this.cantidadCalificaciones;
}
this.verifyPassword();
});
for (let pregunta of this.ePreguntas!) {
if (pregunta.tipo && pregunta.tipo === PreguntaCerradaTipo.SINGLE) {
this.selectedSingleOptions[pregunta.id] = null;
}
}
}
verifyPassword(): void {
if (this.encuesta!.acceso === AccesoEncuesta.PUBLIC) {
this.loadAll();
this.isLocked = false;
} else {
const modalRef = this.modalService.open(EncuestaPasswordDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.encuesta = this.encuesta;
modalRef.closed.subscribe(reason => {
this.isLocked = reason != 'success';
if (this.isLocked) {
this.previousState();
} else {
this.loadAll();
}
});
}
}
ngAfterViewChecked(): void {
this.initListeners();
}
initListeners(): void {
const questions = document.getElementsByClassName('ds-survey--question-wrapper');
for (let i = 0; i < questions.length; i++) {
if (questions[i].classList.contains('ds-survey--closed-option')) {
questions[i].addEventListener('click', e => {
if ((e.target as HTMLInputElement).checked) {
(e.target as HTMLElement).offsetParent!.classList.add('ds-survey--closed-option--active');
(e.target as HTMLElement).id;
} 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!;
}
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;
}
);
if (this.ePreguntas!.length == 0) {
this.previousState();
}
}
previousState(): void {
window.history.back();
}
onCheck(preguntaOpcion: { epreguntaCerrada: any; id: any }): void {
this.selectedSingleOptions[preguntaOpcion.epreguntaCerrada!.id!] = preguntaOpcion.id;
}
toggleOption(ePreguntaOpcionFinal: { id: any }): void {
if (this.selectedMultiOptions.includes(ePreguntaOpcionFinal.id)) {
for (let i = 0; i < this.selectedMultiOptions.length; i++) {
if (this.selectedMultiOptions[i] === ePreguntaOpcionFinal.id) {
this.selectedMultiOptions.splice(i, 1);
}
}
} else {
this.selectedMultiOptions.push(ePreguntaOpcionFinal.id);
}
}
finish(): void {
this.updateClosedOptionsCount();
this.getOpenQuestionAnswers();
this.registerOpenQuestionAnswers();
this.updateEncuestaRating();
this.previousState();
}
updateEncuestaRating() {
if (this.calificacion !== 0) {
const newSumCalificacion = this.sumCalificacion + this.calificacion;
const newCantidadCalificacion = this.cantidadCalificaciones + 1;
const newAvgCalificacion = Math.round(newSumCalificacion / newCantidadCalificacion);
const newRating = Number(this.joinRatingValues(newAvgCalificacion, newCantidadCalificacion));
this.encuesta!.calificacion = newRating;
this.encuestaService.updateSurvey(this.encuesta!).subscribe(() => {
console.log('success');
});
}
}
updateClosedOptionsCount() {
debugger;
for (let key in this.selectedSingleOptions) {
this.ePreguntaCerradaOpcionService.updateCount(this.selectedSingleOptions[key]).subscribe(() => {
console.log('success');
});
}
this.selectedMultiOptions.forEach((option: any) => {
this.ePreguntaCerradaOpcionService.updateCount(option).subscribe(() => {
console.log('success');
});
});
}
registerOpenQuestionAnswers() {
debugger;
for (let id in this.selectedOpenOptions) {
let pregunta = this.ePreguntas!.find(p => {
return p.id == id;
});
debugger;
/*
let newRespuesta = new EPreguntaAbiertaRespuesta(this.selectedOpenOptions[id], pregunta);
this.subscribeToSaveResponse(this.ePreguntaAbiertaRespuestaService.create(newRespuesta));
*/
let newRespuesta = new EPreguntaAbiertaRespuesta(this.selectedOpenOptions[id], pregunta);
this.ePreguntaAbiertaRespuestaService.create(newRespuesta).subscribe(() => {
console.log('success');
});
}
}
protected onSaveFinalize(): void {
// this.isSaving = false;
}
processError(response: HttpErrorResponse): void {
if (response.status === 400) {
this.error = true;
}
}
protected subscribeToSaveResponse(result: Observable<HttpResponse<any>>): void {
result.pipe(finalize(() => this.onSaveFinalize())).subscribe(
() => this.previousState(),
response => this.processError(response)
);
}
getOpenQuestionAnswers() {
this.ePreguntas!.forEach(pregunta => {
if (!pregunta.tipo) {
let textValue = (document.getElementById(pregunta.id) as HTMLInputElement).value;
this.selectedOpenOptions[pregunta.id] = textValue;
}
});
}
joinRatingValues(totalValue: number, ratingCount: number): Number {
const result = totalValue.toString() + '.' + ratingCount.toString();
return parseFloat(result);
}
updateRating(value: number) {
this.calificacion = value;
this.stars.forEach(starNumber => {
let starElement = document.getElementById(`star-${starNumber}`);
if (starNumber > this.calificacion!) {
starElement!.classList.add('entity-icon--star--off');
starElement!.classList.remove('entity-icon--star');
} else {
starElement!.classList.add('entity-icon--star');
starElement!.classList.remove('entity-icon--star--off');
}
});
}
}

View File

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

Some files were not shown because too many files have changed in this diff Show More