Merge branch 'dev' into feature/US-57
This commit is contained in:
		
						commit
						4ccf240bd1
					
				| 
						 | 
				
			
			@ -31,7 +31,7 @@ public interface UserRepository extends JpaRepository<User, Long> {
 | 
			
		|||
    Optional<User> findOneByLogin(String login);
 | 
			
		||||
 | 
			
		||||
    @EntityGraph(attributePaths = "authorities")
 | 
			
		||||
    @Cacheable(cacheNames = USERS_BY_LOGIN_CACHE)
 | 
			
		||||
    //@Cacheable(cacheNames = USERS_BY_LOGIN_CACHE)
 | 
			
		||||
    Optional<User> findOneWithAuthoritiesByLogin(String login);
 | 
			
		||||
 | 
			
		||||
    @EntityGraph(attributePaths = "authorities")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,7 @@ import java.util.Locale;
 | 
			
		|||
import javax.mail.MessagingException;
 | 
			
		||||
import javax.mail.internet.MimeMessage;
 | 
			
		||||
import org.datasurvey.domain.User;
 | 
			
		||||
import org.datasurvey.domain.UsuarioExtra;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.context.MessageSource;
 | 
			
		||||
| 
						 | 
				
			
			@ -115,4 +116,16 @@ public class MailService {
 | 
			
		|||
        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");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,6 +76,19 @@ public class UserService {
 | 
			
		|||
            );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Optional<User> modifyStatus(String login, Boolean estado) {
 | 
			
		||||
        return userRepository
 | 
			
		||||
            .findOneByLogin(login)
 | 
			
		||||
            .map(
 | 
			
		||||
                user -> {
 | 
			
		||||
                    // activate given user for the registration key.
 | 
			
		||||
                    user.setActivated(estado);
 | 
			
		||||
                    log.debug("Activated user: {}", user);
 | 
			
		||||
                    return user;
 | 
			
		||||
                }
 | 
			
		||||
            );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Optional<User> completePasswordReset(String newPassword, String key) {
 | 
			
		||||
        log.debug("Reset user password for reset key {}", key);
 | 
			
		||||
        return userRepository
 | 
			
		||||
| 
						 | 
				
			
			@ -386,6 +399,7 @@ public class UserService {
 | 
			
		|||
    @Transactional(readOnly = true)
 | 
			
		||||
    public Optional<User> getUserWithAuthorities() {
 | 
			
		||||
        return SecurityUtils.getCurrentUserLogin().flatMap(userRepository::findOneWithAuthoritiesByLogin);
 | 
			
		||||
        //findOneWithAuthoritiesByLogin
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,7 @@ public class UserJWTController {
 | 
			
		|||
        Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
 | 
			
		||||
        SecurityContextHolder.getContext().setAuthentication(authentication);
 | 
			
		||||
        String jwt = tokenProvider.createToken(authentication, loginVM.isRememberMe());
 | 
			
		||||
 | 
			
		||||
        HttpHeaders httpHeaders = new HttpHeaders();
 | 
			
		||||
        httpHeaders.add(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt);
 | 
			
		||||
        return new ResponseEntity<>(new JWTToken(jwt), httpHeaders, HttpStatus.OK);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,8 @@ import javax.validation.Valid;
 | 
			
		|||
import javax.validation.constraints.NotNull;
 | 
			
		||||
import org.datasurvey.domain.UsuarioExtra;
 | 
			
		||||
import org.datasurvey.repository.UsuarioExtraRepository;
 | 
			
		||||
import org.datasurvey.service.MailService;
 | 
			
		||||
import org.datasurvey.service.UserService;
 | 
			
		||||
import org.datasurvey.service.UsuarioExtraQueryService;
 | 
			
		||||
import org.datasurvey.service.UsuarioExtraService;
 | 
			
		||||
import org.datasurvey.service.criteria.UsuarioExtraCriteria;
 | 
			
		||||
| 
						 | 
				
			
			@ -41,14 +43,22 @@ public class UsuarioExtraResource {
 | 
			
		|||
 | 
			
		||||
    private final UsuarioExtraQueryService usuarioExtraQueryService;
 | 
			
		||||
 | 
			
		||||
    private final MailService mailService;
 | 
			
		||||
 | 
			
		||||
    private final UserService userService;
 | 
			
		||||
 | 
			
		||||
    public UsuarioExtraResource(
 | 
			
		||||
        UsuarioExtraService usuarioExtraService,
 | 
			
		||||
        UsuarioExtraRepository usuarioExtraRepository,
 | 
			
		||||
        UsuarioExtraQueryService usuarioExtraQueryService
 | 
			
		||||
        UsuarioExtraQueryService usuarioExtraQueryService,
 | 
			
		||||
        MailService mailService,
 | 
			
		||||
        UserService userService
 | 
			
		||||
    ) {
 | 
			
		||||
        this.usuarioExtraService = usuarioExtraService;
 | 
			
		||||
        this.usuarioExtraRepository = usuarioExtraRepository;
 | 
			
		||||
        this.usuarioExtraQueryService = usuarioExtraQueryService;
 | 
			
		||||
        this.mailService = mailService;
 | 
			
		||||
        this.userService = userService;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -99,6 +109,40 @@ public class UsuarioExtraResource {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        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
 | 
			
		||||
            .ok()
 | 
			
		||||
            .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, usuarioExtra.getId().toString()))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,3 +27,15 @@ 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 DatSurvey 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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,3 +28,15 @@ 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 DatSurvey se encuentra temporalmente suspendida. Si cree que es un error por favor responda a este correo
 | 
			
		||||
email.suspended.text2=Saludos,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -264,7 +264,7 @@
 | 
			
		|||
                          th:with="url=(@{|${baseUrl}/account/reset/finish?key=${user.resetKey}|})"
 | 
			
		||||
                          th:href="${url}"
 | 
			
		||||
                          class="btn btn-primary"
 | 
			
		||||
                          >Iniciar sesión</a
 | 
			
		||||
                          >Iniciar Sesión</a
 | 
			
		||||
                        >
 | 
			
		||||
                      </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,322 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en">
 | 
			
		||||
  <head>
 | 
			
		||||
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 | 
			
		||||
    <meta name="viewport" content="width=device-width" />
 | 
			
		||||
    <!-- Forcing initial-scale shouldn't be necessary -->
 | 
			
		||||
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 | 
			
		||||
    <!-- Use the latest (edge) version of IE rendering engine -->
 | 
			
		||||
    <meta name="x-apple-disable-message-reformatting" />
 | 
			
		||||
    <!-- Disable auto-scale in iOS 10 Mail entirely -->
 | 
			
		||||
    <title th:text="#{email.reactivation.title}">JHipster activation</title>
 | 
			
		||||
    <link rel="icon" th:href="@{|${baseUrl}/favicon.ico|}" />
 | 
			
		||||
    <link href="https://fonts.googleapis.com/css?family=NotoSansSP:300,400,700" rel="stylesheet" />
 | 
			
		||||
    <link rel="manifest" href="manifest.webapp" />
 | 
			
		||||
    <style>
 | 
			
		||||
      .bg_white {
 | 
			
		||||
        background: #ffffff;
 | 
			
		||||
      }
 | 
			
		||||
      .bg_light {
 | 
			
		||||
        background: #fafafa;
 | 
			
		||||
      }
 | 
			
		||||
      .bg_black {
 | 
			
		||||
        background: #000000;
 | 
			
		||||
      }
 | 
			
		||||
      .bg_dark {
 | 
			
		||||
        background: rgba(0, 0, 0, 0.8);
 | 
			
		||||
      }
 | 
			
		||||
      .email-section {
 | 
			
		||||
        padding: 2.5em;
 | 
			
		||||
      }
 | 
			
		||||
      /*BUTTON*/
 | 
			
		||||
      .btn {
 | 
			
		||||
        padding: 10px 15px;
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-primary {
 | 
			
		||||
        border-radius: 5px;
 | 
			
		||||
        background: #007bff;
 | 
			
		||||
        color: #ffffff;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-white {
 | 
			
		||||
        border-radius: 5px;
 | 
			
		||||
        background: #ffffff;
 | 
			
		||||
        color: #000000;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-white-outline {
 | 
			
		||||
        border-radius: 5px;
 | 
			
		||||
        background: transparent;
 | 
			
		||||
        border: 1px solid #fff;
 | 
			
		||||
        color: #fff;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-black-outline {
 | 
			
		||||
        border-radius: 0px;
 | 
			
		||||
        background: transparent;
 | 
			
		||||
        border: 2px solid #000;
 | 
			
		||||
        color: #000;
 | 
			
		||||
        font-weight: 700;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      h1,
 | 
			
		||||
      h2,
 | 
			
		||||
      h3,
 | 
			
		||||
      h4,
 | 
			
		||||
      h5,
 | 
			
		||||
      h6 {
 | 
			
		||||
        font-family: 'Lato', sans-serif;
 | 
			
		||||
        color: #000000;
 | 
			
		||||
        margin-top: 0;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      body {
 | 
			
		||||
        font-family: 'Noto Sans JP', sans-serif;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
        font-size: 15px;
 | 
			
		||||
        line-height: 1.8;
 | 
			
		||||
        color: rgba(0, 0, 0, 0.4);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      a {
 | 
			
		||||
        color: #30e3ca;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      table {
 | 
			
		||||
      }
 | 
			
		||||
      /*LOGO*/
 | 
			
		||||
 | 
			
		||||
      .logo h1 {
 | 
			
		||||
        margin: 0;
 | 
			
		||||
      }
 | 
			
		||||
      .logo h1 a {
 | 
			
		||||
        color: #30e3ca;
 | 
			
		||||
        font-size: 24px;
 | 
			
		||||
        font-weight: 700;
 | 
			
		||||
        font-family: 'Lato', sans-serif;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /*HERO*/
 | 
			
		||||
      .hero {
 | 
			
		||||
        position: relative;
 | 
			
		||||
        z-index: 0;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .hero .text {
 | 
			
		||||
        color: rgba(0, 0, 0, 0.3);
 | 
			
		||||
      }
 | 
			
		||||
      .hero .text h2 {
 | 
			
		||||
        color: #000;
 | 
			
		||||
        font-size: 40px;
 | 
			
		||||
        margin-bottom: 0;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
        line-height: 1.4;
 | 
			
		||||
      }
 | 
			
		||||
      .hero .text h3 {
 | 
			
		||||
        font-size: 24px;
 | 
			
		||||
        font-weight: 300;
 | 
			
		||||
      }
 | 
			
		||||
      .hero .text h2 span {
 | 
			
		||||
        font-weight: 600;
 | 
			
		||||
        color: #30e3ca;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /*HEADING SECTION*/
 | 
			
		||||
      .heading-section {
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section h2 {
 | 
			
		||||
        color: #000000;
 | 
			
		||||
        font-size: 28px;
 | 
			
		||||
        margin-top: 0;
 | 
			
		||||
        line-height: 1.4;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section .subheading {
 | 
			
		||||
        margin-bottom: 20px !important;
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        font-size: 13px;
 | 
			
		||||
        text-transform: uppercase;
 | 
			
		||||
        letter-spacing: 2px;
 | 
			
		||||
        color: rgba(0, 0, 0, 0.4);
 | 
			
		||||
        position: relative;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section .subheading::after {
 | 
			
		||||
        position: absolute;
 | 
			
		||||
        left: 0;
 | 
			
		||||
        right: 0;
 | 
			
		||||
        bottom: -10px;
 | 
			
		||||
        content: '';
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        height: 2px;
 | 
			
		||||
        background: #30e3ca;
 | 
			
		||||
        margin: 0 auto;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .heading-section-white {
 | 
			
		||||
        color: rgba(255, 255, 255, 0.8);
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section-white h2 {
 | 
			
		||||
        /*font-family: ;*/
 | 
			
		||||
        line-height: 1;
 | 
			
		||||
        padding-bottom: 0;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section-white h2 {
 | 
			
		||||
        color: #ffffff;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section-white .subheading {
 | 
			
		||||
        margin-bottom: 0;
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        font-size: 13px;
 | 
			
		||||
        text-transform: uppercase;
 | 
			
		||||
        letter-spacing: 2px;
 | 
			
		||||
        color: rgba(255, 255, 255, 0.4);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      ul.social {
 | 
			
		||||
        padding: 0;
 | 
			
		||||
      }
 | 
			
		||||
      ul.social li {
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        margin-right: 10px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .footer {
 | 
			
		||||
        border-top: 1px solid rgba(0, 0, 0, 0.05);
 | 
			
		||||
        color: rgba(0, 0, 0, 0.5);
 | 
			
		||||
      }
 | 
			
		||||
      .footer .heading {
 | 
			
		||||
        color: #000;
 | 
			
		||||
        font-size: 20px;
 | 
			
		||||
      }
 | 
			
		||||
      .footer ul {
 | 
			
		||||
        margin: 0;
 | 
			
		||||
        padding: 0;
 | 
			
		||||
      }
 | 
			
		||||
      .footer ul li {
 | 
			
		||||
        list-style: none;
 | 
			
		||||
        margin-bottom: 10px;
 | 
			
		||||
      }
 | 
			
		||||
      .footer ul li a {
 | 
			
		||||
        color: rgba(0, 0, 0, 1);
 | 
			
		||||
      }
 | 
			
		||||
    </style>
 | 
			
		||||
  </head>
 | 
			
		||||
 | 
			
		||||
  <body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1">
 | 
			
		||||
    <center style="width: 100%; background-color: #f1f1f1">
 | 
			
		||||
      <div
 | 
			
		||||
        style="
 | 
			
		||||
          display: none;
 | 
			
		||||
          font-size: 1px;
 | 
			
		||||
          max-height: 0px;
 | 
			
		||||
          max-width: 0px;
 | 
			
		||||
          opacity: 0;
 | 
			
		||||
          overflow: hidden;
 | 
			
		||||
          mso-hide: all;
 | 
			
		||||
          font-family: sans-serif;
 | 
			
		||||
        "
 | 
			
		||||
      >
 | 
			
		||||
        ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ 
 | 
			
		||||
      </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.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>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,319 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}" lang="en">
 | 
			
		||||
  <head>
 | 
			
		||||
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 | 
			
		||||
    <meta name="viewport" content="width=device-width" />
 | 
			
		||||
    <!-- Forcing initial-scale shouldn't be necessary -->
 | 
			
		||||
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 | 
			
		||||
    <!-- Use the latest (edge) version of IE rendering engine -->
 | 
			
		||||
    <meta name="x-apple-disable-message-reformatting" />
 | 
			
		||||
    <!-- Disable auto-scale in iOS 10 Mail entirely -->
 | 
			
		||||
    <title th:text="#{email.suspended.title}">JHipster activation</title>
 | 
			
		||||
    <link rel="icon" th:href="@{|${baseUrl}/favicon.ico|}" />
 | 
			
		||||
    <link href="https://fonts.googleapis.com/css?family=NotoSansSP:300,400,700" rel="stylesheet" />
 | 
			
		||||
    <link rel="manifest" href="manifest.webapp" />
 | 
			
		||||
    <style>
 | 
			
		||||
      .bg_white {
 | 
			
		||||
        background: #ffffff;
 | 
			
		||||
      }
 | 
			
		||||
      .bg_light {
 | 
			
		||||
        background: #fafafa;
 | 
			
		||||
      }
 | 
			
		||||
      .bg_black {
 | 
			
		||||
        background: #000000;
 | 
			
		||||
      }
 | 
			
		||||
      .bg_dark {
 | 
			
		||||
        background: rgba(0, 0, 0, 0.8);
 | 
			
		||||
      }
 | 
			
		||||
      .email-section {
 | 
			
		||||
        padding: 2.5em;
 | 
			
		||||
      }
 | 
			
		||||
      /*BUTTON*/
 | 
			
		||||
      .btn {
 | 
			
		||||
        padding: 10px 15px;
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-primary {
 | 
			
		||||
        border-radius: 5px;
 | 
			
		||||
        background: #007bff;
 | 
			
		||||
        color: #ffffff;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-white {
 | 
			
		||||
        border-radius: 5px;
 | 
			
		||||
        background: #ffffff;
 | 
			
		||||
        color: #000000;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-white-outline {
 | 
			
		||||
        border-radius: 5px;
 | 
			
		||||
        background: transparent;
 | 
			
		||||
        border: 1px solid #fff;
 | 
			
		||||
        color: #fff;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-black-outline {
 | 
			
		||||
        border-radius: 0px;
 | 
			
		||||
        background: transparent;
 | 
			
		||||
        border: 2px solid #000;
 | 
			
		||||
        color: #000;
 | 
			
		||||
        font-weight: 700;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      h1,
 | 
			
		||||
      h2,
 | 
			
		||||
      h3,
 | 
			
		||||
      h4,
 | 
			
		||||
      h5,
 | 
			
		||||
      h6 {
 | 
			
		||||
        font-family: 'Lato', sans-serif;
 | 
			
		||||
        color: #000000;
 | 
			
		||||
        margin-top: 0;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      body {
 | 
			
		||||
        font-family: 'Noto Sans JP', sans-serif;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
        font-size: 15px;
 | 
			
		||||
        line-height: 1.8;
 | 
			
		||||
        color: rgba(0, 0, 0, 0.4);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      a {
 | 
			
		||||
        color: #30e3ca;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      table {
 | 
			
		||||
      }
 | 
			
		||||
      /*LOGO*/
 | 
			
		||||
 | 
			
		||||
      .logo h1 {
 | 
			
		||||
        margin: 0;
 | 
			
		||||
      }
 | 
			
		||||
      .logo h1 a {
 | 
			
		||||
        color: #30e3ca;
 | 
			
		||||
        font-size: 24px;
 | 
			
		||||
        font-weight: 700;
 | 
			
		||||
        font-family: 'Lato', sans-serif;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /*HERO*/
 | 
			
		||||
      .hero {
 | 
			
		||||
        position: relative;
 | 
			
		||||
        z-index: 0;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .hero .text {
 | 
			
		||||
        color: rgba(0, 0, 0, 0.3);
 | 
			
		||||
      }
 | 
			
		||||
      .hero .text h2 {
 | 
			
		||||
        color: #000;
 | 
			
		||||
        font-size: 40px;
 | 
			
		||||
        margin-bottom: 0;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
        line-height: 1.4;
 | 
			
		||||
      }
 | 
			
		||||
      .hero .text h3 {
 | 
			
		||||
        font-size: 24px;
 | 
			
		||||
        font-weight: 300;
 | 
			
		||||
      }
 | 
			
		||||
      .hero .text h2 span {
 | 
			
		||||
        font-weight: 600;
 | 
			
		||||
        color: #30e3ca;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /*HEADING SECTION*/
 | 
			
		||||
      .heading-section {
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section h2 {
 | 
			
		||||
        color: #000000;
 | 
			
		||||
        font-size: 28px;
 | 
			
		||||
        margin-top: 0;
 | 
			
		||||
        line-height: 1.4;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section .subheading {
 | 
			
		||||
        margin-bottom: 20px !important;
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        font-size: 13px;
 | 
			
		||||
        text-transform: uppercase;
 | 
			
		||||
        letter-spacing: 2px;
 | 
			
		||||
        color: rgba(0, 0, 0, 0.4);
 | 
			
		||||
        position: relative;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section .subheading::after {
 | 
			
		||||
        position: absolute;
 | 
			
		||||
        left: 0;
 | 
			
		||||
        right: 0;
 | 
			
		||||
        bottom: -10px;
 | 
			
		||||
        content: '';
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        height: 2px;
 | 
			
		||||
        background: #30e3ca;
 | 
			
		||||
        margin: 0 auto;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .heading-section-white {
 | 
			
		||||
        color: rgba(255, 255, 255, 0.8);
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section-white h2 {
 | 
			
		||||
        /*font-family: ;*/
 | 
			
		||||
        line-height: 1;
 | 
			
		||||
        padding-bottom: 0;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section-white h2 {
 | 
			
		||||
        color: #ffffff;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section-white .subheading {
 | 
			
		||||
        margin-bottom: 0;
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        font-size: 13px;
 | 
			
		||||
        text-transform: uppercase;
 | 
			
		||||
        letter-spacing: 2px;
 | 
			
		||||
        color: rgba(255, 255, 255, 0.4);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      ul.social {
 | 
			
		||||
        padding: 0;
 | 
			
		||||
      }
 | 
			
		||||
      ul.social li {
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        margin-right: 10px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .footer {
 | 
			
		||||
        border-top: 1px solid rgba(0, 0, 0, 0.05);
 | 
			
		||||
        color: rgba(0, 0, 0, 0.5);
 | 
			
		||||
      }
 | 
			
		||||
      .footer .heading {
 | 
			
		||||
        color: #000;
 | 
			
		||||
        font-size: 20px;
 | 
			
		||||
      }
 | 
			
		||||
      .footer ul {
 | 
			
		||||
        margin: 0;
 | 
			
		||||
        padding: 0;
 | 
			
		||||
      }
 | 
			
		||||
      .footer ul li {
 | 
			
		||||
        list-style: none;
 | 
			
		||||
        margin-bottom: 10px;
 | 
			
		||||
      }
 | 
			
		||||
      .footer ul li a {
 | 
			
		||||
        color: rgba(0, 0, 0, 1);
 | 
			
		||||
      }
 | 
			
		||||
    </style>
 | 
			
		||||
  </head>
 | 
			
		||||
 | 
			
		||||
  <body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1">
 | 
			
		||||
    <center style="width: 100%; background-color: #f1f1f1">
 | 
			
		||||
      <div
 | 
			
		||||
        style="
 | 
			
		||||
          display: none;
 | 
			
		||||
          font-size: 1px;
 | 
			
		||||
          max-height: 0px;
 | 
			
		||||
          max-width: 0px;
 | 
			
		||||
          opacity: 0;
 | 
			
		||||
          overflow: hidden;
 | 
			
		||||
          mso-hide: all;
 | 
			
		||||
          font-family: sans-serif;
 | 
			
		||||
        "
 | 
			
		||||
      >
 | 
			
		||||
        ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ 
 | 
			
		||||
      </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.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>
 | 
			
		||||
| 
						 | 
				
			
			@ -3,3 +3,4 @@ export const EMAIL_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/email-already-used';
 | 
			
		|||
export const LOGIN_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/login-already-used';
 | 
			
		||||
export const 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';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<form *ngIf="encuesta" name="deleteForm" (ngSubmit)="confirmDelete(encuesta.id!)">
 | 
			
		||||
<form *ngIf="encuesta" name="deleteForm" (ngSubmit)="confirmDelete(encuesta)">
 | 
			
		||||
  <div class="modal-header">
 | 
			
		||||
    <h4 class="modal-title" data-cy="encuestaDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -9,7 +9,7 @@
 | 
			
		|||
    <jhi-alert-error></jhi-alert-error>
 | 
			
		||||
 | 
			
		||||
    <p id="jhi-delete-encuesta-heading" jhiTranslate="dataSurveyApp.encuesta.delete.question" [translateValues]="{ id: encuesta.id }">
 | 
			
		||||
      Are you sure you want to delete this Encuesta?
 | 
			
		||||
      Are you sure you want to delete this survey?
 | 
			
		||||
    </p>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,65 +0,0 @@
 | 
			
		|||
jest.mock('@ng-bootstrap/ng-bootstrap');
 | 
			
		||||
 | 
			
		||||
import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing';
 | 
			
		||||
import { HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
 | 
			
		||||
import { of } from 'rxjs';
 | 
			
		||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 | 
			
		||||
 | 
			
		||||
import { EncuestaService } from '../service/encuesta.service';
 | 
			
		||||
 | 
			
		||||
import { EncuestaDeleteDialogComponent } from './encuesta-delete-dialog.component';
 | 
			
		||||
 | 
			
		||||
describe('Component Tests', () => {
 | 
			
		||||
  describe('Encuesta Management Delete Component', () => {
 | 
			
		||||
    let comp: EncuestaDeleteDialogComponent;
 | 
			
		||||
    let fixture: ComponentFixture<EncuestaDeleteDialogComponent>;
 | 
			
		||||
    let service: EncuestaService;
 | 
			
		||||
    let mockActiveModal: NgbActiveModal;
 | 
			
		||||
 | 
			
		||||
    beforeEach(() => {
 | 
			
		||||
      TestBed.configureTestingModule({
 | 
			
		||||
        imports: [HttpClientTestingModule],
 | 
			
		||||
        declarations: [EncuestaDeleteDialogComponent],
 | 
			
		||||
        providers: [NgbActiveModal],
 | 
			
		||||
      })
 | 
			
		||||
        .overrideTemplate(EncuestaDeleteDialogComponent, '')
 | 
			
		||||
        .compileComponents();
 | 
			
		||||
      fixture = TestBed.createComponent(EncuestaDeleteDialogComponent);
 | 
			
		||||
      comp = fixture.componentInstance;
 | 
			
		||||
      service = TestBed.inject(EncuestaService);
 | 
			
		||||
      mockActiveModal = TestBed.inject(NgbActiveModal);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    describe('confirmDelete', () => {
 | 
			
		||||
      it('Should call delete service on confirmDelete', inject(
 | 
			
		||||
        [],
 | 
			
		||||
        fakeAsync(() => {
 | 
			
		||||
          // GIVEN
 | 
			
		||||
          jest.spyOn(service, 'delete').mockReturnValue(of(new HttpResponse({})));
 | 
			
		||||
 | 
			
		||||
          // WHEN
 | 
			
		||||
          comp.confirmDelete(123);
 | 
			
		||||
          tick();
 | 
			
		||||
 | 
			
		||||
          // THEN
 | 
			
		||||
          expect(service.delete).toHaveBeenCalledWith(123);
 | 
			
		||||
          expect(mockActiveModal.close).toHaveBeenCalledWith('deleted');
 | 
			
		||||
        })
 | 
			
		||||
      ));
 | 
			
		||||
 | 
			
		||||
      it('Should not call delete service on clear', () => {
 | 
			
		||||
        // GIVEN
 | 
			
		||||
        jest.spyOn(service, 'delete');
 | 
			
		||||
 | 
			
		||||
        // WHEN
 | 
			
		||||
        comp.cancel();
 | 
			
		||||
 | 
			
		||||
        // THEN
 | 
			
		||||
        expect(service.delete).not.toHaveBeenCalled();
 | 
			
		||||
        expect(mockActiveModal.close).not.toHaveBeenCalled();
 | 
			
		||||
        expect(mockActiveModal.dismiss).toHaveBeenCalled();
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
import { Component } from '@angular/core';
 | 
			
		||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 | 
			
		||||
import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model';
 | 
			
		||||
 | 
			
		||||
import { IEncuesta } from '../encuesta.model';
 | 
			
		||||
import { EncuestaService } from '../service/encuesta.service';
 | 
			
		||||
| 
						 | 
				
			
			@ -16,8 +17,9 @@ export class EncuestaDeleteDialogComponent {
 | 
			
		|||
    this.activeModal.dismiss();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  confirmDelete(id: number): void {
 | 
			
		||||
    this.encuestaService.delete(id).subscribe(() => {
 | 
			
		||||
  confirmDelete(encuesta: IEncuesta): void {
 | 
			
		||||
    encuesta.estado = EstadoEncuesta.DELETED;
 | 
			
		||||
    this.encuestaService.update(encuesta).subscribe(() => {
 | 
			
		||||
      this.activeModal.close('deleted');
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,21 @@
 | 
			
		|||
<form *ngIf="encuesta" name="deleteForm" (ngSubmit)="confirmPublish(encuesta)">
 | 
			
		||||
  <div class="modal-header">
 | 
			
		||||
    <!-- <h4 class="modal-title" data-cy="encuestaDeleteDialogHeading" jhiTranslate="entity.publish.title">Confirm delete operation</h4>-->
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div class="modal-body">
 | 
			
		||||
    <jhi-alert-error></jhi-alert-error>
 | 
			
		||||
 | 
			
		||||
    <p id="jhi-delete-encuesta-heading" jhiTranslate="entity.publish.detail">Are you sure you want to delete this Encuesta?</p>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div class="modal-footer">
 | 
			
		||||
    <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="cancel()">
 | 
			
		||||
      <fa-icon icon="ban"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
 | 
			
		||||
    </button>
 | 
			
		||||
 | 
			
		||||
    <button id="jhi-confirm-delete-encuesta" data-cy="entityConfirmDeleteButton" type="submit" class="ds-btn ds-btn--primary">
 | 
			
		||||
       <span jhiTranslate="entity.action.publish">Delete</span>
 | 
			
		||||
    </button>
 | 
			
		||||
  </div>
 | 
			
		||||
</form>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
import { Component, OnInit } from '@angular/core';
 | 
			
		||||
import { IEncuesta } from '../encuesta.model';
 | 
			
		||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 | 
			
		||||
import { EncuestaService } from '../service/encuesta.service';
 | 
			
		||||
import { EstadoEncuesta } from '../../enumerations/estado-encuesta.model';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'jhi-encuesta-publish-dialog',
 | 
			
		||||
  templateUrl: './encuesta-publish-dialog.component.html',
 | 
			
		||||
  styleUrls: ['./encuesta-publish-dialog.component.scss'],
 | 
			
		||||
})
 | 
			
		||||
export class EncuestaPublishDialogComponent implements OnInit {
 | 
			
		||||
  encuesta?: IEncuesta;
 | 
			
		||||
 | 
			
		||||
  constructor(protected encuestaService: EncuestaService, protected activeModal: NgbActiveModal) {}
 | 
			
		||||
 | 
			
		||||
  cancel(): void {
 | 
			
		||||
    this.activeModal.dismiss();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  confirmPublish(encuesta: IEncuesta): void {
 | 
			
		||||
    debugger;
 | 
			
		||||
    if (encuesta.estado === 'DRAFT') {
 | 
			
		||||
      encuesta.estado = EstadoEncuesta.ACTIVE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.encuestaService.update(encuesta).subscribe(() => {
 | 
			
		||||
      this.activeModal.close('published');
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -6,10 +6,17 @@ import { EncuestaUpdateComponent } from './update/encuesta-update.component';
 | 
			
		|||
import { EncuestaDeleteDialogComponent } from './delete/encuesta-delete-dialog.component';
 | 
			
		||||
import { EncuestaRoutingModule } from './route/encuesta-routing.module';
 | 
			
		||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
 | 
			
		||||
import { EncuestaPublishDialogComponent } from './encuesta-publish-dialog/encuesta-publish-dialog.component';
 | 
			
		||||
 | 
			
		||||
@NgModule({
 | 
			
		||||
  imports: [SharedModule, EncuestaRoutingModule, FontAwesomeModule],
 | 
			
		||||
  declarations: [EncuestaComponent, EncuestaDetailComponent, EncuestaUpdateComponent, EncuestaDeleteDialogComponent],
 | 
			
		||||
  declarations: [
 | 
			
		||||
    EncuestaComponent,
 | 
			
		||||
    EncuestaDetailComponent,
 | 
			
		||||
    EncuestaUpdateComponent,
 | 
			
		||||
    EncuestaDeleteDialogComponent,
 | 
			
		||||
    EncuestaPublishDialogComponent,
 | 
			
		||||
  ],
 | 
			
		||||
  entryComponents: [EncuestaDeleteDialogComponent],
 | 
			
		||||
})
 | 
			
		||||
export class EncuestaModule {}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,14 +29,26 @@
 | 
			
		|||
 | 
			
		||||
  <jhi-alert-error></jhi-alert-error>
 | 
			
		||||
 | 
			
		||||
  <jhi-alert></jhi-alert>
 | 
			
		||||
 | 
			
		||||
  <div class="alert alert-warning" id="no-result" *ngIf="encuestas?.length === 0">
 | 
			
		||||
    <span jhiTranslate="dataSurveyApp.encuesta.home.notFound">No encuestas found</span>
 | 
			
		||||
  <div *ngIf="successPublished" class="alert alert-success alert-dismissible fade show" role="alert">
 | 
			
		||||
    Su encuesta fue publicada exitosamente
 | 
			
		||||
    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
 | 
			
		||||
      <span aria-hidden="true">×</span>
 | 
			
		||||
    </button>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div class="alert alert-warning" id="no-result" *ngIf="encuestas?.length === 0">
 | 
			
		||||
    <span jhiTranslate="dataSurveyApp.encuesta.home.notFound">No surveys found</span>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <form class="ds-form">
 | 
			
		||||
    <div class="input-group">
 | 
			
		||||
      <div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
 | 
			
		||||
      <input type="text" name="searchString" placeholder="Buscar..." [(ngModel)]="searchString" />
 | 
			
		||||
    </div>
 | 
			
		||||
  </form>
 | 
			
		||||
 | 
			
		||||
  <!-- Lista de Encuestas del Usuario -->
 | 
			
		||||
  <div class="ds-list" (contextmenu)="openContextMenu($event)">
 | 
			
		||||
  <div class="ds-list" (contextmenu)="openContextMenu($event)" *ngIf="!isAdmin()">
 | 
			
		||||
    <!-- Context Menu -->
 | 
			
		||||
    <div class="ds-contextmenu ds-contextmenu--closed" id="contextmenu">
 | 
			
		||||
      <ul id="ds-context-menu__list">
 | 
			
		||||
| 
						 | 
				
			
			@ -61,8 +73,17 @@
 | 
			
		|||
            <button type="button" id="contextmenu-duplicate"><fa-icon class="contextmenu__icon" [icon]="faCopy"></fa-icon>Duplicar</button>
 | 
			
		||||
          </li>
 | 
			
		||||
          <li>
 | 
			
		||||
            <button type="button" id="contextmenu-rename">
 | 
			
		||||
              <fa-icon class="contextmenu__icon" [icon]="faFile"></fa-icon>Cambiar nombre
 | 
			
		||||
            <button
 | 
			
		||||
              type="button"
 | 
			
		||||
              id="contextmenu-publish"
 | 
			
		||||
              type="button"
 | 
			
		||||
              (click)="publish()"
 | 
			
		||||
              data-toggle="modal"
 | 
			
		||||
              data-target="#publicarEncuesta"
 | 
			
		||||
              *ngIf="isPublished"
 | 
			
		||||
            >
 | 
			
		||||
              <!--Agarrar  el id de la encuesta -->
 | 
			
		||||
              <fa-icon class="contextmenu__icon" [icon]="faUpload"></fa-icon>Publicar
 | 
			
		||||
            </button>
 | 
			
		||||
          </li>
 | 
			
		||||
          <li>
 | 
			
		||||
| 
						 | 
				
			
			@ -79,7 +100,7 @@
 | 
			
		|||
 | 
			
		||||
    <div
 | 
			
		||||
      class="ds-list--entity"
 | 
			
		||||
      *ngFor="let encuesta of encuestas; trackBy: trackId"
 | 
			
		||||
      *ngFor="let encuesta of encuestas! | filter: 'nombre':searchString; trackBy: trackId"
 | 
			
		||||
      (dblclick)="openSurvey($event)"
 | 
			
		||||
      (click)="selectSurvey($event)"
 | 
			
		||||
      [attr.data-id]="encuesta.id"
 | 
			
		||||
| 
						 | 
				
			
			@ -194,7 +215,7 @@
 | 
			
		|||
            <fa-icon icon="pencil-alt"></fa-icon>
 | 
			
		||||
            <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
 | 
			
		||||
          </button>
 | 
			
		||||
          
 | 
			
		||||
 | 
			
		||||
          <button type="submit" (click)="delete(encuesta)" class="btn btn-danger btn-sm" data-cy="entityDeleteButton">
 | 
			
		||||
            <fa-icon icon="times"></fa-icon>
 | 
			
		||||
            <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
 | 
			
		||||
| 
						 | 
				
			
			@ -205,83 +226,69 @@
 | 
			
		|||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<!-- <div class="table-responsive" id="entities" *ngIf="encuestas && encuestas.length > 0">
 | 
			
		||||
    <table class="table table-striped" aria-describedby="page-heading">
 | 
			
		||||
      <thead>
 | 
			
		||||
        <tr>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="global.field.id">ID</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.nombre">Nombre</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.descripcion">Descripcion</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaCreacion">Fecha Creacion</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaPublicacion">Fecha Publicacion</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaFinalizar">Fecha Finalizar</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaFinalizada">Fecha Finalizada</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.calificacion">Calificacion</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.acceso">Acceso</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.contrasenna">Contrasenna</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.estado">Estado</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.categoria">Categoria</span></th>
 | 
			
		||||
          <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.usuarioExtra">Usuario Extra</span></th>
 | 
			
		||||
          <th scope="col"></th>
 | 
			
		||||
        </tr>
 | 
			
		||||
      </thead>
 | 
			
		||||
      <tbody>
 | 
			
		||||
        <tr *ngFor="let encuesta of encuestas; trackBy: trackId" data-cy="entityTable">
 | 
			
		||||
          <td>
 | 
			
		||||
            <a [routerLink]="['/encuesta', encuesta.id, 'view']">{{ encuesta.id }}</a>
 | 
			
		||||
          </td>
 | 
			
		||||
          <td>{{ encuesta.nombre }}</td>
 | 
			
		||||
          <td>{{ encuesta.descripcion }}</td>
 | 
			
		||||
          <td>{{ encuesta.fechaCreacion | formatMediumDatetime }}</td>
 | 
			
		||||
          <td>{{ encuesta.fechaPublicacion | formatMediumDatetime }}</td>
 | 
			
		||||
          <td>{{ encuesta.fechaFinalizar | formatMediumDatetime }}</td>
 | 
			
		||||
          <td>{{ encuesta.fechaFinalizada | formatMediumDatetime }}</td>
 | 
			
		||||
          <td>{{ encuesta.calificacion }}</td>
 | 
			
		||||
          <td jhiTranslate="{{ 'dataSurveyApp.AccesoEncuesta.' + encuesta.acceso }}">{{ encuesta.acceso }}</td>
 | 
			
		||||
          <td>{{ encuesta.contrasenna }}</td>
 | 
			
		||||
          <td jhiTranslate="{{ 'dataSurveyApp.EstadoEncuesta.' + encuesta.estado }}">{{ encuesta.estado }}</td>
 | 
			
		||||
          <td>
 | 
			
		||||
            <div *ngIf="encuesta.categoria">
 | 
			
		||||
              <a [routerLink]="['/categoria', encuesta.categoria?.id, 'view']">{{ encuesta.categoria?.nombre }}</a>
 | 
			
		||||
            </div>
 | 
			
		||||
          </td>
 | 
			
		||||
          <td>
 | 
			
		||||
            <div *ngIf="encuesta.usuarioExtra">
 | 
			
		||||
              <a [routerLink]="['/usuario-extra', encuesta.usuarioExtra?.id, 'view']">{{ encuesta.usuarioExtra?.id }}</a>
 | 
			
		||||
            </div>
 | 
			
		||||
          </td>
 | 
			
		||||
          <td class="text-right">
 | 
			
		||||
            <div class="btn-group">
 | 
			
		||||
              <button
 | 
			
		||||
                type="submit"
 | 
			
		||||
                [routerLink]="['/encuesta', encuesta.id, 'view']"
 | 
			
		||||
                class="btn btn-info btn-sm"
 | 
			
		||||
                data-cy="entityDetailsButton"
 | 
			
		||||
              >
 | 
			
		||||
                <fa-icon icon="eye"></fa-icon>
 | 
			
		||||
                <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
 | 
			
		||||
              </button>
 | 
			
		||||
<div class="table-responsive" id="entities" *ngIf="isAdmin() && encuestas && encuestas.length > 0">
 | 
			
		||||
  <table class="table table-striped" aria-describedby="page-heading">
 | 
			
		||||
    <thead>
 | 
			
		||||
      <tr>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.nombre">Nombre</span></th>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.fechaCreacion">Fecha Creacion</span></th>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.acceso">Acceso</span></th>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.estado">Estado</span></th>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.categoria">Categoria</span></th>
 | 
			
		||||
        <th scope="col"><span jhiTranslate="dataSurveyApp.encuesta.usuarioExtra">Correo Usuario</span></th>
 | 
			
		||||
        <th scope="col"></th>
 | 
			
		||||
      </tr>
 | 
			
		||||
    </thead>
 | 
			
		||||
    <tbody>
 | 
			
		||||
      <tr *ngFor="let encuesta of encuestas | filter: 'nombre':searchString; trackBy: trackId" data-cy="entityTable">
 | 
			
		||||
        <td>{{ encuesta.nombre }}</td>
 | 
			
		||||
        <td>{{ encuesta.fechaCreacion | formatMediumDatetime }}</td>
 | 
			
		||||
        <td jhiTranslate="{{ 'dataSurveyApp.AccesoEncuesta.' + encuesta.acceso }}">{{ encuesta.acceso }}</td>
 | 
			
		||||
        <td jhiTranslate="{{ 'dataSurveyApp.EstadoEncuesta.' + encuesta.estado }}">{{ encuesta.estado }}</td>
 | 
			
		||||
        <td>
 | 
			
		||||
          <div *ngIf="encuesta.categoria">
 | 
			
		||||
            <a [routerLink]="['/categoria', encuesta.categoria?.id, 'view']">{{ encuesta.categoria?.nombre }}</a>
 | 
			
		||||
          </div>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td>
 | 
			
		||||
          <div *ngIf="encuesta.usuarioExtra">
 | 
			
		||||
            <a [routerLink]="['/usuario-extra', encuesta.usuarioExtra?.nombre, 'view']">
 | 
			
		||||
              {{ encuesta.usuarioExtra?.nombre }}
 | 
			
		||||
            </a>
 | 
			
		||||
          </div>
 | 
			
		||||
        </td>
 | 
			
		||||
        <td class="text-right">
 | 
			
		||||
          <div class="btn-group">
 | 
			
		||||
            <button
 | 
			
		||||
              type="submit"
 | 
			
		||||
              [routerLink]="['/encuesta', encuesta.id, 'view']"
 | 
			
		||||
              class="ds-btn btn-info btn-sm"
 | 
			
		||||
              data-cy="entityDetailsButton"
 | 
			
		||||
            >
 | 
			
		||||
              <fa-icon icon="eye"></fa-icon>
 | 
			
		||||
              <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
 | 
			
		||||
            </button>
 | 
			
		||||
 | 
			
		||||
              <button
 | 
			
		||||
                type="submit"
 | 
			
		||||
                [routerLink]="['/encuesta', encuesta.id, 'edit']"
 | 
			
		||||
                class="btn btn-primary btn-sm"
 | 
			
		||||
                data-cy="entityEditButton"
 | 
			
		||||
              >
 | 
			
		||||
                <fa-icon icon="pencil-alt"></fa-icon>
 | 
			
		||||
                <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
 | 
			
		||||
              </button>
 | 
			
		||||
            <button
 | 
			
		||||
              type="submit"
 | 
			
		||||
              [routerLink]="['/encuesta', encuesta.id, 'edit']"
 | 
			
		||||
              class="ds-btn ds-btn--primary btn-sm"
 | 
			
		||||
              data-cy="entityEditButton"
 | 
			
		||||
            >
 | 
			
		||||
              <fa-icon icon="pencil-alt"></fa-icon>
 | 
			
		||||
              <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
 | 
			
		||||
            </button>
 | 
			
		||||
 | 
			
		||||
              <button type="submit" (click)="delete(encuesta)" class="btn btn-danger btn-sm" data-cy="entityDeleteButton">
 | 
			
		||||
                <fa-icon icon="times"></fa-icon>
 | 
			
		||||
                <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
 | 
			
		||||
              </button>
 | 
			
		||||
            </div>
 | 
			
		||||
          </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
      </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
  </div> -->
 | 
			
		||||
            <button type="submit" (click)="delete(encuesta)" class="ds-btn ds-btn--danger btn-sm" data-cy="entityDeleteButton">
 | 
			
		||||
              <fa-icon icon="times"></fa-icon>
 | 
			
		||||
              <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
 | 
			
		||||
            </button>
 | 
			
		||||
          </div>
 | 
			
		||||
        </td>
 | 
			
		||||
      </tr>
 | 
			
		||||
    </tbody>
 | 
			
		||||
  </table>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<!-- --------------------------------------------------------------------------------------------- -->
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -415,7 +422,7 @@
 | 
			
		|||
 | 
			
		||||
<!-- ------------------------------------------------------------------------------------------------- -->
 | 
			
		||||
 | 
			
		||||
<!-- <div class="row justify-content-center">
 | 
			
		||||
<!-- <div ngIf class="row justify-content-center">
 | 
			
		||||
  <div class="col-8">
 | 
			
		||||
    <form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
 | 
			
		||||
      <h2 id="jhi-encuesta-heading" data-cy="EncuestaCreateUpdateHeading" jhiTranslate="dataSurveyApp.encuesta.home.createOrEditLabel">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,9 +34,11 @@ import {
 | 
			
		|||
  faTrashAlt,
 | 
			
		||||
  faPlus,
 | 
			
		||||
  faStar,
 | 
			
		||||
  faUpload,
 | 
			
		||||
} from '@fortawesome/free-solid-svg-icons';
 | 
			
		||||
 | 
			
		||||
import * as $ from 'jquery';
 | 
			
		||||
import { EncuestaPublishDialogComponent } from '../encuesta-publish-dialog/encuesta-publish-dialog.component';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'jhi-encuesta',
 | 
			
		||||
| 
						 | 
				
			
			@ -54,13 +56,17 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
  faTrashAlt = faTrashAlt;
 | 
			
		||||
  faPlus = faPlus;
 | 
			
		||||
  faStar = faStar;
 | 
			
		||||
 | 
			
		||||
  faUpload = faUpload;
 | 
			
		||||
  isPublished = false;
 | 
			
		||||
  successPublished = false;
 | 
			
		||||
  account: Account | null = null;
 | 
			
		||||
  usuarioExtra: UsuarioExtra | null = null;
 | 
			
		||||
  estadoDeleted = EstadoEncuesta.DELETED;
 | 
			
		||||
  public searchString: string;
 | 
			
		||||
 | 
			
		||||
  encuestas?: IEncuesta[];
 | 
			
		||||
  isLoading = false;
 | 
			
		||||
 | 
			
		||||
  selectedSurvey?: IEncuesta | null = null;
 | 
			
		||||
  isSaving = false;
 | 
			
		||||
 | 
			
		||||
  categoriasSharedCollection: ICategoria[] = [];
 | 
			
		||||
| 
						 | 
				
			
			@ -83,6 +89,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
  });
 | 
			
		||||
 | 
			
		||||
  createAnother: Boolean = false;
 | 
			
		||||
  selectedSurveyId: Number = 0;
 | 
			
		||||
 | 
			
		||||
  constructor(
 | 
			
		||||
    protected encuestaService: EncuestaService,
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +100,9 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
    protected fb: FormBuilder,
 | 
			
		||||
    protected accountService: AccountService,
 | 
			
		||||
    protected router: Router
 | 
			
		||||
  ) {}
 | 
			
		||||
  ) {
 | 
			
		||||
    this.searchString = '';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  resetForm(): void {
 | 
			
		||||
    this.editForm.reset();
 | 
			
		||||
| 
						 | 
				
			
			@ -106,7 +115,13 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
      (res: HttpResponse<IEncuesta[]>) => {
 | 
			
		||||
        this.isLoading = false;
 | 
			
		||||
        const tmpEncuestas = res.body ?? [];
 | 
			
		||||
        this.encuestas = tmpEncuestas.filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id);
 | 
			
		||||
        if (this.isAdmin()) {
 | 
			
		||||
          this.encuestas = tmpEncuestas;
 | 
			
		||||
        } else {
 | 
			
		||||
          this.encuestas = tmpEncuestas
 | 
			
		||||
            .filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id)
 | 
			
		||||
            .filter(e => e.estado !== EstadoEncuesta.DELETED);
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      () => {
 | 
			
		||||
        this.isLoading = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -163,7 +178,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
 | 
			
		||||
  ngAfterViewInit(): void {}
 | 
			
		||||
 | 
			
		||||
  trackId(index: number, item: IEncuesta): number {
 | 
			
		||||
  trackId(_index: number, item: IEncuesta): number {
 | 
			
		||||
    return item.id!;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -193,11 +208,11 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  trackCategoriaById(index: number, item: ICategoria): number {
 | 
			
		||||
  trackCategoriaById(_index: number, item: ICategoria): number {
 | 
			
		||||
    return item.id!;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  trackUsuarioExtraById(index: number, item: IUsuarioExtra): number {
 | 
			
		||||
  trackUsuarioExtraById(_index: number, item: IUsuarioExtra): number {
 | 
			
		||||
    return item.id!;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -328,7 +343,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
    return 5 - something;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  openContextMenu(event: any): void {
 | 
			
		||||
  async openContextMenu(event: any): Promise<void> {
 | 
			
		||||
    document.querySelectorAll('.ds-list--entity').forEach(e => {
 | 
			
		||||
      e.classList.remove('active');
 | 
			
		||||
    });
 | 
			
		||||
| 
						 | 
				
			
			@ -336,12 +351,25 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
    if (event.type === 'contextmenu') {
 | 
			
		||||
      event.preventDefault();
 | 
			
		||||
 | 
			
		||||
      debugger;
 | 
			
		||||
 | 
			
		||||
      this.selectedSurveyId = event.target.dataset.id;
 | 
			
		||||
      console.log(this.selectedSurveyId);
 | 
			
		||||
 | 
			
		||||
      debugger;
 | 
			
		||||
      let res = await this.encuestaService.find(this.selectedSurveyId).toPromise();
 | 
			
		||||
      this.selectedSurvey = res.body;
 | 
			
		||||
      this.isPublished = this.selectedSurvey!.estado === 'DRAFT'; // QUE SE LE MUESTRE CUANDO ESTE EN DRAFT
 | 
			
		||||
 | 
			
		||||
      document.getElementById('contextmenu-create--separator')!.style.display = 'block';
 | 
			
		||||
      document.getElementById('contextmenu-edit--separator')!.style.display = 'block';
 | 
			
		||||
      document.getElementById('contextmenu-delete--separator')!.style.display = 'block';
 | 
			
		||||
      document.getElementById('contextmenu-edit')!.style.display = 'block';
 | 
			
		||||
      document.getElementById('contextmenu-duplicate')!.style.display = 'block';
 | 
			
		||||
      document.getElementById('contextmenu-rename')!.style.display = 'block';
 | 
			
		||||
 | 
			
		||||
      if (this.isPublished) {
 | 
			
		||||
        document.getElementById('contextmenu-publish')!.style.display = 'block'; //cambiar
 | 
			
		||||
      }
 | 
			
		||||
      document.getElementById('contextmenu-share')!.style.display = 'block';
 | 
			
		||||
 | 
			
		||||
      if ((event.target as HTMLElement).classList.contains('ds-list')) {
 | 
			
		||||
| 
						 | 
				
			
			@ -359,4 +387,18 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
      document.getElementById('contextmenu')!.style.maxHeight = '100%';
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  publish() {
 | 
			
		||||
    debugger;
 | 
			
		||||
 | 
			
		||||
    const modalRef = this.modalService.open(EncuestaPublishDialogComponent, { size: 'lg', backdrop: 'static' });
 | 
			
		||||
    modalRef.componentInstance.encuesta = this.selectedSurvey;
 | 
			
		||||
    // unsubscribe not needed because closed completes on modal close
 | 
			
		||||
    modalRef.closed.subscribe(reason => {
 | 
			
		||||
      if (reason === 'published') {
 | 
			
		||||
        this.successPublished = true;
 | 
			
		||||
        this.loadAll();
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ describe('Service Tests', () => {
 | 
			
		|||
    describe('resolve', () => {
 | 
			
		||||
      it('should return IEncuesta returned by find', () => {
 | 
			
		||||
        // GIVEN
 | 
			
		||||
        service.find = jest.fn(id => of(new HttpResponse({ body: { id } })));
 | 
			
		||||
        // service.find = jest.fn(id => of(new HttpResponse({ body: { id } })));
 | 
			
		||||
        mockActivatedRouteSnapshot.params = { id: 123 };
 | 
			
		||||
 | 
			
		||||
        // WHEN
 | 
			
		||||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ export class EncuestaService {
 | 
			
		|||
      .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  find(id: number): Observable<EntityResponseType> {
 | 
			
		||||
  find(id: Number): Observable<EntityResponseType> {
 | 
			
		||||
    return this.http
 | 
			
		||||
      .get<IEncuesta>(`${this.resourceUrl}/${id}`, { observe: 'response' })
 | 
			
		||||
      .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,20 +1,12 @@
 | 
			
		|||
<form *ngIf="usuarioExtra" name="deleteForm" (ngSubmit)="confirmDelete(usuarioExtra.id!)">
 | 
			
		||||
<form *ngIf="usuarioExtra" name="deleteForm" (ngSubmit)="confirmDelete(usuarioExtra)">
 | 
			
		||||
  <div class="modal-header">
 | 
			
		||||
    <h4 class="modal-title" data-cy="usuarioExtraDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
 | 
			
		||||
 | 
			
		||||
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">×</button>
 | 
			
		||||
    <!--<h4 class="modal-title" data-cy="usuarioExtraDeleteDialogHeading" jhiTranslate="entity.delete.status">Confirm delete operation</h4>-->
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div class="modal-body">
 | 
			
		||||
    <jhi-alert-error></jhi-alert-error>
 | 
			
		||||
 | 
			
		||||
    <p
 | 
			
		||||
      id="jhi-delete-usuarioExtra-heading"
 | 
			
		||||
      jhiTranslate="dataSurveyApp.usuarioExtra.delete.question"
 | 
			
		||||
      [translateValues]="{ id: usuarioExtra.id }"
 | 
			
		||||
    >
 | 
			
		||||
      Are you sure you want to delete this Usuario Extra?
 | 
			
		||||
    </p>
 | 
			
		||||
    <p id="jhi-delete-usuarioExtra-heading" jhiTranslate="dataSurveyApp.usuarioExtra.delete.question"></p>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div class="modal-footer">
 | 
			
		||||
| 
						 | 
				
			
			@ -22,8 +14,8 @@
 | 
			
		|||
      <fa-icon icon="ban"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
 | 
			
		||||
    </button>
 | 
			
		||||
 | 
			
		||||
    <button id="jhi-confirm-delete-usuarioExtra" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger">
 | 
			
		||||
      <fa-icon icon="times"></fa-icon> <span jhiTranslate="entity.action.delete">Delete</span>
 | 
			
		||||
    <button id="jhi-confirm-delete-usuarioExtra" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-warning">
 | 
			
		||||
      <span jhiTranslate="entity.action.toggleStatus">Cambiar estado</span>
 | 
			
		||||
    </button>
 | 
			
		||||
  </div>
 | 
			
		||||
</form>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,65 +0,0 @@
 | 
			
		|||
jest.mock('@ng-bootstrap/ng-bootstrap');
 | 
			
		||||
 | 
			
		||||
import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing';
 | 
			
		||||
import { HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
 | 
			
		||||
import { of } from 'rxjs';
 | 
			
		||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 | 
			
		||||
 | 
			
		||||
import { UsuarioExtraService } from '../service/usuario-extra.service';
 | 
			
		||||
 | 
			
		||||
import { UsuarioExtraDeleteDialogComponent } from './usuario-extra-delete-dialog.component';
 | 
			
		||||
 | 
			
		||||
describe('Component Tests', () => {
 | 
			
		||||
  describe('UsuarioExtra Management Delete Component', () => {
 | 
			
		||||
    let comp: UsuarioExtraDeleteDialogComponent;
 | 
			
		||||
    let fixture: ComponentFixture<UsuarioExtraDeleteDialogComponent>;
 | 
			
		||||
    let service: UsuarioExtraService;
 | 
			
		||||
    let mockActiveModal: NgbActiveModal;
 | 
			
		||||
 | 
			
		||||
    beforeEach(() => {
 | 
			
		||||
      TestBed.configureTestingModule({
 | 
			
		||||
        imports: [HttpClientTestingModule],
 | 
			
		||||
        declarations: [UsuarioExtraDeleteDialogComponent],
 | 
			
		||||
        providers: [NgbActiveModal],
 | 
			
		||||
      })
 | 
			
		||||
        .overrideTemplate(UsuarioExtraDeleteDialogComponent, '')
 | 
			
		||||
        .compileComponents();
 | 
			
		||||
      fixture = TestBed.createComponent(UsuarioExtraDeleteDialogComponent);
 | 
			
		||||
      comp = fixture.componentInstance;
 | 
			
		||||
      service = TestBed.inject(UsuarioExtraService);
 | 
			
		||||
      mockActiveModal = TestBed.inject(NgbActiveModal);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    describe('confirmDelete', () => {
 | 
			
		||||
      it('Should call delete service on confirmDelete', inject(
 | 
			
		||||
        [],
 | 
			
		||||
        fakeAsync(() => {
 | 
			
		||||
          // GIVEN
 | 
			
		||||
          jest.spyOn(service, 'delete').mockReturnValue(of(new HttpResponse({})));
 | 
			
		||||
 | 
			
		||||
          // WHEN
 | 
			
		||||
          comp.confirmDelete(123);
 | 
			
		||||
          tick();
 | 
			
		||||
 | 
			
		||||
          // THEN
 | 
			
		||||
          expect(service.delete).toHaveBeenCalledWith(123);
 | 
			
		||||
          expect(mockActiveModal.close).toHaveBeenCalledWith('deleted');
 | 
			
		||||
        })
 | 
			
		||||
      ));
 | 
			
		||||
 | 
			
		||||
      it('Should not call delete service on clear', () => {
 | 
			
		||||
        // GIVEN
 | 
			
		||||
        jest.spyOn(service, 'delete');
 | 
			
		||||
 | 
			
		||||
        // WHEN
 | 
			
		||||
        comp.cancel();
 | 
			
		||||
 | 
			
		||||
        // THEN
 | 
			
		||||
        expect(service.delete).not.toHaveBeenCalled();
 | 
			
		||||
        expect(mockActiveModal.close).not.toHaveBeenCalled();
 | 
			
		||||
        expect(mockActiveModal.dismiss).toHaveBeenCalled();
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 | 
			
		|||
 | 
			
		||||
import { IUsuarioExtra } from '../usuario-extra.model';
 | 
			
		||||
import { UsuarioExtraService } from '../service/usuario-extra.service';
 | 
			
		||||
import { EstadoUsuario } from '../../enumerations/estado-usuario.model';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  templateUrl: './usuario-extra-delete-dialog.component.html',
 | 
			
		||||
| 
						 | 
				
			
			@ -16,8 +17,13 @@ export class UsuarioExtraDeleteDialogComponent {
 | 
			
		|||
    this.activeModal.dismiss();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  confirmDelete(id: number): void {
 | 
			
		||||
    this.usuarioExtraService.delete(id).subscribe(() => {
 | 
			
		||||
  confirmDelete(usuarioExtra: IUsuarioExtra): void {
 | 
			
		||||
    if (usuarioExtra.estado == EstadoUsuario.ACTIVE) {
 | 
			
		||||
      usuarioExtra.estado = EstadoUsuario.SUSPENDED;
 | 
			
		||||
    } else {
 | 
			
		||||
      usuarioExtra.estado = EstadoUsuario.ACTIVE;
 | 
			
		||||
    }
 | 
			
		||||
    this.usuarioExtraService.updateEstado(usuarioExtra).subscribe(() => {
 | 
			
		||||
      this.activeModal.close('deleted');
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,9 +64,8 @@
 | 
			
		|||
                <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
 | 
			
		||||
              </button>
 | 
			
		||||
                
 | 
			
		||||
              <button type="submit" (click)="delete(usuarioExtra)" class="ds-btn ds-btn--danger btn-sm" data-cy="entityDeleteButton">
 | 
			
		||||
                <fa-icon icon="times"></fa-icon>
 | 
			
		||||
                <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
 | 
			
		||||
              <button type="submit" (click)="delete(usuarioExtra)" class="btn-sm ds-btn ds-btn--toggle" data-cy="entityDeleteButton">
 | 
			
		||||
                <span class="d-none d-md-inline" jhiTranslate="entity.action.toggleStatus"></span>
 | 
			
		||||
              </button>
 | 
			
		||||
            </div>
 | 
			
		||||
          </td>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,7 @@ export type EntityArrayUserPublicResponseType = HttpResponse<IUser[]>;
 | 
			
		|||
@Injectable({ providedIn: 'root' })
 | 
			
		||||
export class UsuarioExtraService {
 | 
			
		||||
  protected resourceUrl = this.applicationConfigService.getEndpointFor('api/usuario-extras');
 | 
			
		||||
  protected resourceUrlEstado = this.applicationConfigService.getEndpointFor('api/usuario-extras-estado');
 | 
			
		||||
  protected resourceUrlPublicUser = this.applicationConfigService.getEndpointFor('api');
 | 
			
		||||
 | 
			
		||||
  constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
 | 
			
		||||
| 
						 | 
				
			
			@ -36,6 +37,13 @@ export class UsuarioExtraService {
 | 
			
		|||
      .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateEstado(usuarioExtra: IUsuarioExtra): Observable<EntityResponseType> {
 | 
			
		||||
    const copy = this.convertDateFromClient(usuarioExtra);
 | 
			
		||||
    return this.http
 | 
			
		||||
      .put<IUsuarioExtra>(`${this.resourceUrlEstado}/${getUsuarioExtraIdentifier(usuarioExtra) as number}`, copy, { observe: 'response' })
 | 
			
		||||
      .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  partialUpdate(usuarioExtra: IUsuarioExtra): Observable<EntityResponseType> {
 | 
			
		||||
    const copy = this.convertDateFromClient(usuarioExtra);
 | 
			
		||||
    return this.http
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,15 +74,17 @@
 | 
			
		|||
              <p class="mb-4" style="color: rgba(146, 146, 146, 0.664)">Ingrese su correo electrónico y contraseña</p>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            <div
 | 
			
		||||
              class="alert alert-danger"
 | 
			
		||||
              *ngIf="authenticationError"
 | 
			
		||||
              jhiTranslate="login.messages.error.authentication"
 | 
			
		||||
              data-cy="loginError"
 | 
			
		||||
            >
 | 
			
		||||
            <div class="alert alert-danger" *ngIf="error" jhiTranslate="login.messages.error.authentication" data-cy="loginError">
 | 
			
		||||
              <strong>Failed to sign in!</strong> Please check your credentials and try again.
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            <div
 | 
			
		||||
              class="alert alert-danger"
 | 
			
		||||
              *ngIf="userSuspended"
 | 
			
		||||
              jhiTranslate="login.messages.error.userSuspended"
 | 
			
		||||
              data-cy="loginError"
 | 
			
		||||
            ></div>
 | 
			
		||||
 | 
			
		||||
            <form class="ds-form" role="form" (ngSubmit)="login()" [formGroup]="loginForm">
 | 
			
		||||
              <div class="mb-3">
 | 
			
		||||
                <div class="form-group">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,8 +9,10 @@ import { GoogleLoginProvider } from 'angularx-social-login';
 | 
			
		|||
import { RegisterService } from '../account/register/register.service';
 | 
			
		||||
import { TranslateService } from '@ngx-translate/core';
 | 
			
		||||
import { HttpErrorResponse } from '@angular/common/http';
 | 
			
		||||
import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from '../config/error.constants';
 | 
			
		||||
import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE, USER_IS_SUSPENDED } from '../config/error.constants';
 | 
			
		||||
import { LocalStorageService } from 'ngx-webstorage';
 | 
			
		||||
import { UsuarioExtra } from '../entities/usuario-extra/usuario-extra.model';
 | 
			
		||||
import { Account } from '../core/auth/account.model';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'jhi-login',
 | 
			
		||||
| 
						 | 
				
			
			@ -25,6 +27,8 @@ export class LoginComponent implements OnInit, AfterViewInit {
 | 
			
		|||
  error = false;
 | 
			
		||||
  errorEmailExists = false;
 | 
			
		||||
  errorUserExists = false;
 | 
			
		||||
  userSuspended = false;
 | 
			
		||||
  imprimir = false;
 | 
			
		||||
 | 
			
		||||
  loginForm = this.fb.group({
 | 
			
		||||
    username: [null, [Validators.required, Validators.email, Validators.maxLength(254)]],
 | 
			
		||||
| 
						 | 
				
			
			@ -48,18 +52,6 @@ export class LoginComponent implements OnInit, AfterViewInit {
 | 
			
		|||
  ) {}
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {
 | 
			
		||||
    //Servicio para verificar si el usuario se encuentra loggeado
 | 
			
		||||
    /*this.authService.authState.subscribe(user => {
 | 
			
		||||
      this.user = user;
 | 
			
		||||
      this.loggedIn = user != null;
 | 
			
		||||
 | 
			
		||||
     /!* console.log('correo: ' + user.email);
 | 
			
		||||
      console.log('correo: ' + user.name);
 | 
			
		||||
      console.log('ID: ' + this.user.id);*!/
 | 
			
		||||
 | 
			
		||||
      this.authenticacionGoogle();
 | 
			
		||||
    });
 | 
			
		||||
*/
 | 
			
		||||
    // if already authenticated then navigate to home page
 | 
			
		||||
    this.accountService.identity().subscribe(() => {
 | 
			
		||||
      if (this.accountService.isAuthenticated()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +81,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  authenticacionGoogle(): void {
 | 
			
		||||
    this.loginService.login({ username: this.user.email, password: this.user.id, rememberMe: true }).subscribe(
 | 
			
		||||
    this.loginService.login({ username: this.user.email, password: this.user.id, rememberMe: false }).subscribe(
 | 
			
		||||
      () => {
 | 
			
		||||
        this.authenticationError = false;
 | 
			
		||||
        if (!this.router.getCurrentNavigation()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -98,21 +90,14 @@ export class LoginComponent implements OnInit, AfterViewInit {
 | 
			
		|||
          this.router.navigate(['']);
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      () => this.activateGoogle()
 | 
			
		||||
      /*this.registerService
 | 
			
		||||
          .save({
 | 
			
		||||
            login: this.user.email,
 | 
			
		||||
            email: this.user.email,
 | 
			
		||||
            password: this.user.id,
 | 
			
		||||
            langKey: this.translateService.currentLang,
 | 
			
		||||
            name: this.user.name,
 | 
			
		||||
            profileIcon: this.randomProfilePic(),
 | 
			
		||||
            isAdmin: 0,
 | 
			
		||||
          })
 | 
			
		||||
          .subscribe(
 | 
			
		||||
            () => (this.success = true),
 | 
			
		||||
            response => this.processError(response)
 | 
			
		||||
          ) */ //console.log("Usuario no existe")
 | 
			
		||||
      response => {
 | 
			
		||||
        debugger;
 | 
			
		||||
        if (response.status == 401 && response.error.detail == 'Bad credentials') {
 | 
			
		||||
          this.activateGoogle();
 | 
			
		||||
        } else {
 | 
			
		||||
          this.processError(response);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -121,10 +106,13 @@ export class LoginComponent implements OnInit, AfterViewInit {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  processError(response: HttpErrorResponse): void {
 | 
			
		||||
    debugger;
 | 
			
		||||
    if (response.status === 400 && response.error.type === LOGIN_ALREADY_USED_TYPE) {
 | 
			
		||||
      this.errorUserExists = true;
 | 
			
		||||
    } else if (response.status === 400 && response.error.type === EMAIL_ALREADY_USED_TYPE) {
 | 
			
		||||
      this.errorEmailExists = true;
 | 
			
		||||
    } else if (response.status === 401) {
 | 
			
		||||
      this.userSuspended = true;
 | 
			
		||||
    } else {
 | 
			
		||||
      this.error = true;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -157,6 +145,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  login(): void {
 | 
			
		||||
    debugger;
 | 
			
		||||
    this.loginService
 | 
			
		||||
      .login({
 | 
			
		||||
        username: this.loginForm.get('username')!.value,
 | 
			
		||||
| 
						 | 
				
			
			@ -164,14 +153,24 @@ export class LoginComponent implements OnInit, AfterViewInit {
 | 
			
		|||
        rememberMe: this.loginForm.get('rememberMe')!.value,
 | 
			
		||||
      })
 | 
			
		||||
      .subscribe(
 | 
			
		||||
        () => {
 | 
			
		||||
        value => {
 | 
			
		||||
          debugger;
 | 
			
		||||
          console.log(value);
 | 
			
		||||
 | 
			
		||||
          /*if (value?.activated == false){
 | 
			
		||||
              this.userSuspended = true;
 | 
			
		||||
 | 
			
		||||
              console.log(value.activated)
 | 
			
		||||
            }else {*/
 | 
			
		||||
          this.authenticationError = false;
 | 
			
		||||
          if (!this.router.getCurrentNavigation()) {
 | 
			
		||||
            // There were no routing during login (eg from navigationToStoredUrl)
 | 
			
		||||
            this.router.navigate(['']);
 | 
			
		||||
          }
 | 
			
		||||
          // }
 | 
			
		||||
        },
 | 
			
		||||
        () => (this.authenticationError = true)
 | 
			
		||||
 | 
			
		||||
        response => this.processError(response)
 | 
			
		||||
      );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,7 @@ export class LoginService {
 | 
			
		|||
  constructor(private accountService: AccountService, private authServerProvider: AuthServerProvider) {}
 | 
			
		||||
 | 
			
		||||
  login(credentials: Login): Observable<Account | null> {
 | 
			
		||||
    debugger;
 | 
			
		||||
    return this.authServerProvider.login(credentials).pipe(mergeMap(() => this.accountService.identity(true)));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,15 +4,15 @@
 | 
			
		|||
      "home": {
 | 
			
		||||
        "title": "Encuestas",
 | 
			
		||||
        "refreshListLabel": "Refrescar lista",
 | 
			
		||||
        "createLabel": "Crear nuevo Encuesta",
 | 
			
		||||
        "createOrEditLabel": "Crear o editar Encuesta",
 | 
			
		||||
        "notFound": "Ningún Encuestas encontrado"
 | 
			
		||||
        "createLabel": "Crear nueva encuesta",
 | 
			
		||||
        "createOrEditLabel": "Crear o editar encuesta",
 | 
			
		||||
        "notFound": "Ninguna encuesta fue encontrada"
 | 
			
		||||
      },
 | 
			
		||||
      "created": "Un nuevo Encuesta ha sido creado con el identificador {{ param }}",
 | 
			
		||||
      "updated": "Un Encuesta ha sido actualizado con el identificador {{ param }}",
 | 
			
		||||
      "deleted": "Un Encuesta ha sido eliminado con el identificador {{ param }}",
 | 
			
		||||
      "created": "Una nueva encuesta ha sido creada con el identificador {{ param }}",
 | 
			
		||||
      "updated": "Una encuesta ha sido actualizado con el identificador {{ param }}",
 | 
			
		||||
      "deleted": "Una encuesta ha sido eliminada con el identificador {{ param }}",
 | 
			
		||||
      "delete": {
 | 
			
		||||
        "question": "¿Seguro que quiere eliminar Encuesta {{ id }}?"
 | 
			
		||||
        "question": "¿Seguro que quiere eliminar la encuesta {{ id }}?"
 | 
			
		||||
      },
 | 
			
		||||
      "detail": {
 | 
			
		||||
        "title": "Encuesta"
 | 
			
		||||
| 
						 | 
				
			
			@ -32,7 +32,7 @@
 | 
			
		|||
      "ePreguntaAbierta": "E Pregunta Abierta",
 | 
			
		||||
      "ePreguntaCerrada": "E Pregunta Cerrada",
 | 
			
		||||
      "categoria": "Categoría",
 | 
			
		||||
      "usuarioExtra": "Usuario Extra"
 | 
			
		||||
      "usuarioExtra": "Correo Usuario"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -129,14 +129,16 @@
 | 
			
		|||
      "create": "Crear",
 | 
			
		||||
      "enable": "Habilitar",
 | 
			
		||||
      "disable": "Deshabilitar",
 | 
			
		||||
      "toggleStatus": "Cambiar Estado"
 | 
			
		||||
      "toggleStatus": "Cambiar Estado",
 | 
			
		||||
      "publish": "Publicar"
 | 
			
		||||
    },
 | 
			
		||||
    "detail": {
 | 
			
		||||
      "field": "Campo",
 | 
			
		||||
      "value": "Valor"
 | 
			
		||||
    },
 | 
			
		||||
    "delete": {
 | 
			
		||||
      "title": "Confirmar operación de borrado"
 | 
			
		||||
      "title": "Confirmar operación de borrado",
 | 
			
		||||
      "status": "Confirmar cambio de estado"
 | 
			
		||||
    },
 | 
			
		||||
    "validation": {
 | 
			
		||||
      "required": "Este campo es obligatorio.",
 | 
			
		||||
| 
						 | 
				
			
			@ -150,6 +152,11 @@
 | 
			
		|||
      "number": "Este campo debe ser un número.",
 | 
			
		||||
      "integerNumber": "Este campo debe ser un número entero.",
 | 
			
		||||
      "datetimelocal": "Este campo debe ser una fecha y hora."
 | 
			
		||||
    },
 | 
			
		||||
    "publish": {
 | 
			
		||||
      "title": "Publicar encuesta",
 | 
			
		||||
      "detail": "¿Está seguro de querer publicar esta encuesta?",
 | 
			
		||||
      "success": "Su encuesta fue publicada exitosamente"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "error": {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,8 @@
 | 
			
		|||
    "messages": {
 | 
			
		||||
      "error": {
 | 
			
		||||
        "authentication": "Revise las credenciales e intente de nuevo ",
 | 
			
		||||
        "isGoogle": "Al haber ingresado por medio de Google no cuenta con los permisos para modificar su contraseña"
 | 
			
		||||
        "isGoogle": "Al haber ingresado por medio de Google no cuenta con los permisos para modificar su contraseña",
 | 
			
		||||
        "userSuspended": "No cuenta con los permisos para iniciar sesión. Su cuenta se encuentra suspendida"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "password": {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@
 | 
			
		|||
      "updated": "El usuario con el identificador {{ param }} ha sido actualizado",
 | 
			
		||||
      "deleted": "El usuario con el identificador {{ param }} ha sido eliminado",
 | 
			
		||||
      "delete": {
 | 
			
		||||
        "question": "¿Seguro que quiere eliminar el usuario {{ id }}?"
 | 
			
		||||
        "question": "¿Seguro que quiere modificar el estado del usuario ?"
 | 
			
		||||
      },
 | 
			
		||||
      "detail": {
 | 
			
		||||
        "title": "Usuario"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue