add agregar colaborador completo
This commit is contained in:
		
							parent
							
								
									b649ac4d4e
								
							
						
					
					
						commit
						391c4fcb29
					
				| 
						 | 
				
			
			@ -192,4 +192,15 @@ public class MailService {
 | 
			
		|||
            "email.invitation.title"
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Async
 | 
			
		||||
    public void sendNotifyDeleteColaborator(UsuarioEncuesta user) {
 | 
			
		||||
        log.debug("Sending delete collaboration notification mail to '{}'", user.getUsuarioExtra().getUser().getEmail());
 | 
			
		||||
        sendEmailFromTemplateUsuarioEncuesta(
 | 
			
		||||
            user.getUsuarioExtra().getUser(),
 | 
			
		||||
            user,
 | 
			
		||||
            "mail/deleteColaboratorEmail",
 | 
			
		||||
            "email.deleteColaborator.title"
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -205,7 +205,11 @@ public class UsuarioEncuestaResource {
 | 
			
		|||
    @DeleteMapping("/usuario-encuestas/{id}")
 | 
			
		||||
    public ResponseEntity<Void> deleteUsuarioEncuesta(@PathVariable Long id) {
 | 
			
		||||
        log.debug("REST request to delete UsuarioEncuesta : {}", id);
 | 
			
		||||
        Optional<UsuarioEncuesta> usuarioEncuesta = usuarioEncuestaService.findOne(id);
 | 
			
		||||
        usuarioEncuestaService.delete(id);
 | 
			
		||||
        if (usuarioEncuesta != null) {
 | 
			
		||||
            mailService.sendNotifyDeleteColaborator(usuarioEncuesta.get());
 | 
			
		||||
        }
 | 
			
		||||
        return ResponseEntity
 | 
			
		||||
            .noContent()
 | 
			
		||||
            .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString()))
 | 
			
		||||
| 
						 | 
				
			
			@ -232,7 +236,7 @@ public class UsuarioEncuestaResource {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/usuario-encuestas/notify/{id}")
 | 
			
		||||
    public ResponseEntity<Void> notifyEncuestaDeleted(@PathVariable Long id, @Valid @RequestBody UsuarioEncuesta usuarioEncuesta) {
 | 
			
		||||
    public ResponseEntity<Void> notifyInvitationColaborator(@PathVariable Long id, @Valid @RequestBody UsuarioEncuesta usuarioEncuesta) {
 | 
			
		||||
        log.debug("REST request to notify {} of invitation to Encuesta", usuarioEncuesta.getUsuarioExtra().getUser().getEmail());
 | 
			
		||||
        mailService.sendInvitationColaborator(usuarioEncuesta);
 | 
			
		||||
        return ResponseEntity.noContent().build();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,7 +48,7 @@ email.public.text2=Saludos,
 | 
			
		|||
 | 
			
		||||
#PrivateEncuesta
 | 
			
		||||
email.private.title=Su encuesta ha sido publicada de manera privada
 | 
			
		||||
email.private.greeting=<EFBFBD>Felicidades {0}!
 | 
			
		||||
email.private.greeting=¡Felicidades {0}!
 | 
			
		||||
email.private.text1=Su encuesta ha sdo publicada de manera privada. Su contraseña de acceso es: {0}
 | 
			
		||||
email.private.text2=Saludos,
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -56,5 +56,11 @@ email.private.text2=Saludos,
 | 
			
		|||
#Invitation Colaborator
 | 
			
		||||
email.invitation.title=Se le ha invitado a colaborar en una encuesta
 | 
			
		||||
email.invitation.greeting=¡Nueva invitacion, {0}!
 | 
			
		||||
email.invitation.text1=Fue invitado a la encuesta {0}(#{1}). Para aceptar la solicitud de colaborador, ingrese al área de colaboraciones.".
 | 
			
		||||
email.invitation.text1=Fue invitado a la encuesta "{0}(#{1})". Para aceptar la solicitud de colaborador, ingrese al área de colaboraciones.
 | 
			
		||||
email.invitation.text2=Saludos,
 | 
			
		||||
 | 
			
		||||
#Delete Colaborator
 | 
			
		||||
email.deleteColaborator.title=Se le ha expulsado de una encuesta como colaborador
 | 
			
		||||
email.deleteColaborator.greeting=¡Se le ha expulsado, {0}!
 | 
			
		||||
email.deleteColaborator.text1=Fue expulsado de la encuesta {0}(#{1})".
 | 
			
		||||
email.deleteColaborator.text2=Saludos,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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.deleteColaborator.title}">JHipster activation</title>
 | 
			
		||||
    <link rel="icon" th:href="@{|${baseUrl}/favicon.ico|}" />
 | 
			
		||||
    <link href="https://fonts.googleapis.com/css?family=NotoSansSP:300,400,700" rel="stylesheet" />
 | 
			
		||||
    <link rel="manifest" href="manifest.webapp" />
 | 
			
		||||
    <style>
 | 
			
		||||
      .bg_white {
 | 
			
		||||
        background: #ffffff;
 | 
			
		||||
      }
 | 
			
		||||
      .bg_light {
 | 
			
		||||
        background: #fafafa;
 | 
			
		||||
      }
 | 
			
		||||
      .bg_black {
 | 
			
		||||
        background: #000000;
 | 
			
		||||
      }
 | 
			
		||||
      .bg_dark {
 | 
			
		||||
        background: rgba(0, 0, 0, 0.8);
 | 
			
		||||
      }
 | 
			
		||||
      .email-section {
 | 
			
		||||
        padding: 2.5em;
 | 
			
		||||
      }
 | 
			
		||||
      /*BUTTON*/
 | 
			
		||||
      .btn {
 | 
			
		||||
        padding: 10px 15px;
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-primary {
 | 
			
		||||
        border-radius: 5px;
 | 
			
		||||
        background: #007bff;
 | 
			
		||||
        color: #ffffff;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-white {
 | 
			
		||||
        border-radius: 5px;
 | 
			
		||||
        background: #ffffff;
 | 
			
		||||
        color: #000000;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-white-outline {
 | 
			
		||||
        border-radius: 5px;
 | 
			
		||||
        background: transparent;
 | 
			
		||||
        border: 1px solid #fff;
 | 
			
		||||
        color: #fff;
 | 
			
		||||
      }
 | 
			
		||||
      .btn.btn-black-outline {
 | 
			
		||||
        border-radius: 0px;
 | 
			
		||||
        background: transparent;
 | 
			
		||||
        border: 2px solid #000;
 | 
			
		||||
        color: #000;
 | 
			
		||||
        font-weight: 700;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      h1,
 | 
			
		||||
      h2,
 | 
			
		||||
      h3,
 | 
			
		||||
      h4,
 | 
			
		||||
      h5,
 | 
			
		||||
      h6 {
 | 
			
		||||
        font-family: 'Lato', sans-serif;
 | 
			
		||||
        color: #000000;
 | 
			
		||||
        margin-top: 0;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      body {
 | 
			
		||||
        font-family: 'Noto Sans JP', sans-serif;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
        font-size: 15px;
 | 
			
		||||
        line-height: 1.8;
 | 
			
		||||
        color: rgba(0, 0, 0, 0.4);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      a {
 | 
			
		||||
        color: #30e3ca;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      table {
 | 
			
		||||
      }
 | 
			
		||||
      /*LOGO*/
 | 
			
		||||
 | 
			
		||||
      .logo h1 {
 | 
			
		||||
        margin: 0;
 | 
			
		||||
      }
 | 
			
		||||
      .logo h1 a {
 | 
			
		||||
        color: #30e3ca;
 | 
			
		||||
        font-size: 24px;
 | 
			
		||||
        font-weight: 700;
 | 
			
		||||
        font-family: 'Lato', sans-serif;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /*HERO*/
 | 
			
		||||
      .hero {
 | 
			
		||||
        position: relative;
 | 
			
		||||
        z-index: 0;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .hero .text {
 | 
			
		||||
        color: rgba(0, 0, 0, 0.3);
 | 
			
		||||
      }
 | 
			
		||||
      .hero .text h2 {
 | 
			
		||||
        color: #000;
 | 
			
		||||
        font-size: 40px;
 | 
			
		||||
        margin-bottom: 0;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
        line-height: 1.4;
 | 
			
		||||
      }
 | 
			
		||||
      .hero .text h3 {
 | 
			
		||||
        font-size: 24px;
 | 
			
		||||
        font-weight: 300;
 | 
			
		||||
      }
 | 
			
		||||
      .hero .text h2 span {
 | 
			
		||||
        font-weight: 600;
 | 
			
		||||
        color: #30e3ca;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /*HEADING SECTION*/
 | 
			
		||||
      .heading-section {
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section h2 {
 | 
			
		||||
        color: #000000;
 | 
			
		||||
        font-size: 28px;
 | 
			
		||||
        margin-top: 0;
 | 
			
		||||
        line-height: 1.4;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section .subheading {
 | 
			
		||||
        margin-bottom: 20px !important;
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        font-size: 13px;
 | 
			
		||||
        text-transform: uppercase;
 | 
			
		||||
        letter-spacing: 2px;
 | 
			
		||||
        color: rgba(0, 0, 0, 0.4);
 | 
			
		||||
        position: relative;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section .subheading::after {
 | 
			
		||||
        position: absolute;
 | 
			
		||||
        left: 0;
 | 
			
		||||
        right: 0;
 | 
			
		||||
        bottom: -10px;
 | 
			
		||||
        content: '';
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        height: 2px;
 | 
			
		||||
        background: #30e3ca;
 | 
			
		||||
        margin: 0 auto;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .heading-section-white {
 | 
			
		||||
        color: rgba(255, 255, 255, 0.8);
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section-white h2 {
 | 
			
		||||
        /*font-family: ;*/
 | 
			
		||||
        line-height: 1;
 | 
			
		||||
        padding-bottom: 0;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section-white h2 {
 | 
			
		||||
        color: #ffffff;
 | 
			
		||||
      }
 | 
			
		||||
      .heading-section-white .subheading {
 | 
			
		||||
        margin-bottom: 0;
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        font-size: 13px;
 | 
			
		||||
        text-transform: uppercase;
 | 
			
		||||
        letter-spacing: 2px;
 | 
			
		||||
        color: rgba(255, 255, 255, 0.4);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      ul.social {
 | 
			
		||||
        padding: 0;
 | 
			
		||||
      }
 | 
			
		||||
      ul.social li {
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
        margin-right: 10px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .footer {
 | 
			
		||||
        border-top: 1px solid rgba(0, 0, 0, 0.05);
 | 
			
		||||
        color: rgba(0, 0, 0, 0.5);
 | 
			
		||||
      }
 | 
			
		||||
      .footer .heading {
 | 
			
		||||
        color: #000;
 | 
			
		||||
        font-size: 20px;
 | 
			
		||||
      }
 | 
			
		||||
      .footer ul {
 | 
			
		||||
        margin: 0;
 | 
			
		||||
        padding: 0;
 | 
			
		||||
      }
 | 
			
		||||
      .footer ul li {
 | 
			
		||||
        list-style: none;
 | 
			
		||||
        margin-bottom: 10px;
 | 
			
		||||
      }
 | 
			
		||||
      .footer ul li a {
 | 
			
		||||
        color: rgba(0, 0, 0, 1);
 | 
			
		||||
      }
 | 
			
		||||
    </style>
 | 
			
		||||
  </head>
 | 
			
		||||
 | 
			
		||||
  <body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1">
 | 
			
		||||
    <center style="width: 100%; background-color: #f1f1f1">
 | 
			
		||||
      <div
 | 
			
		||||
        style="
 | 
			
		||||
          display: none;
 | 
			
		||||
          font-size: 1px;
 | 
			
		||||
          max-height: 0px;
 | 
			
		||||
          max-width: 0px;
 | 
			
		||||
          opacity: 0;
 | 
			
		||||
          overflow: hidden;
 | 
			
		||||
          mso-hide: all;
 | 
			
		||||
          font-family: sans-serif;
 | 
			
		||||
        "
 | 
			
		||||
      >
 | 
			
		||||
        ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ 
 | 
			
		||||
      </div>
 | 
			
		||||
      <div style="max-width: 600px; margin: 0 auto" class="email-container">
 | 
			
		||||
        <!-- BEGIN BODY -->
 | 
			
		||||
        <table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
 | 
			
		||||
          <tr>
 | 
			
		||||
            <td valign="top" class="bg_white" style="padding: 1em 2.5em 0 2.5em">
 | 
			
		||||
              <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
 | 
			
		||||
                <tr>
 | 
			
		||||
                  <td class="logo" style="text-align: center">
 | 
			
		||||
                    <h1>
 | 
			
		||||
                      <a href="#"
 | 
			
		||||
                        ><img
 | 
			
		||||
                          src="https://res.cloudinary.com/marielascloud/image/upload/v1626333881/DataSurveyLogo2_smr2ok.png"
 | 
			
		||||
                          alt=""
 | 
			
		||||
                          width="300"
 | 
			
		||||
                      /></a>
 | 
			
		||||
                    </h1>
 | 
			
		||||
                  </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
              </table>
 | 
			
		||||
            </td>
 | 
			
		||||
          </tr>
 | 
			
		||||
          <!-- end tr -->
 | 
			
		||||
          <tr>
 | 
			
		||||
            <td valign="middle" class="hero bg_white" style="padding: 3em 0 2em 0">
 | 
			
		||||
              <img
 | 
			
		||||
                src="https://res.cloudinary.com/marielascloud/image/upload/v1626333882/email_v7pjtv.png"
 | 
			
		||||
                alt=""
 | 
			
		||||
                style="width: 250px; max-width: 600px; height: auto; margin: auto; display: block"
 | 
			
		||||
              />
 | 
			
		||||
            </td>
 | 
			
		||||
          </tr>
 | 
			
		||||
          <!-- end tr -->
 | 
			
		||||
          <tr>
 | 
			
		||||
            <td valign="middle" class="hero bg_white" style="padding: 2em 0 4em 0">
 | 
			
		||||
              <table>
 | 
			
		||||
                <tr>
 | 
			
		||||
                  <td>
 | 
			
		||||
                    <div class="text" style="padding: 0 2.5em; text-align: center">
 | 
			
		||||
                      <h2 th:text="#{email.deleteColaborator.greeting(${user.login})}">¡Hola!</h2>
 | 
			
		||||
                      <h3 th:text="#{email.deleteColaborator.text1(${colaborador.encuesta.nombre}, ${colaborador.encuesta.id})}">
 | 
			
		||||
                        Your JHipster account has been created, please click on the URL below to activate it:
 | 
			
		||||
                      </h3>
 | 
			
		||||
                      <p>
 | 
			
		||||
                        <a th:with="url=(@{|${baseUrl}/colaboraciones|})" th:href="${url}" class="btn btn-primary">Ir a Colaboraciones</a>
 | 
			
		||||
                      </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="text" style="padding: 1em 2.5em; text-align: center">
 | 
			
		||||
                      <p>
 | 
			
		||||
                        <span th:text="#{email.deleteColaborator.text2}">Regards, </span>
 | 
			
		||||
                        <br />
 | 
			
		||||
                        <em th:text="#{email.signature}">JHipster.</em>
 | 
			
		||||
                      </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                  </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
              </table>
 | 
			
		||||
            </td>
 | 
			
		||||
          </tr>
 | 
			
		||||
          <!-- end tr -->
 | 
			
		||||
          <!-- 1 Column Text + Button : END -->
 | 
			
		||||
        </table>
 | 
			
		||||
        <table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto">
 | 
			
		||||
          <tr>
 | 
			
		||||
            <td valign="middle" class="bg_light footer email-section">
 | 
			
		||||
              <table>
 | 
			
		||||
                <tr>
 | 
			
		||||
                  <td valign="top" width="33.333%" style="padding-top: 20px">
 | 
			
		||||
                    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
 | 
			
		||||
                      <tr>
 | 
			
		||||
                        <td style="text-align: left; padding-right: 10px">
 | 
			
		||||
                          <h3 class="heading">Acerca de</h3>
 | 
			
		||||
                          <p>DataSurvey es su compañero más cercano para poder recolectar información valiosa para usted</p>
 | 
			
		||||
                        </td>
 | 
			
		||||
                      </tr>
 | 
			
		||||
                    </table>
 | 
			
		||||
                  </td>
 | 
			
		||||
                  <td valign="top" width="33.333%" style="padding-top: 20px">
 | 
			
		||||
                    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
 | 
			
		||||
                      <tr>
 | 
			
		||||
                        <td style="text-align: left; padding-left: 5px; padding-right: 5px">
 | 
			
		||||
                          <h3 class="heading">Información de contacto</h3>
 | 
			
		||||
                          <ul>
 | 
			
		||||
                            <li><span href="mailto:datasurveyapp@gmail.com" class="text">datasurveyapp@gmail.com</span></li>
 | 
			
		||||
                          </ul>
 | 
			
		||||
                        </td>
 | 
			
		||||
                      </tr>
 | 
			
		||||
                    </table>
 | 
			
		||||
                  </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
              </table>
 | 
			
		||||
            </td>
 | 
			
		||||
          </tr>
 | 
			
		||||
          <!-- end: tr -->
 | 
			
		||||
          <tr>
 | 
			
		||||
            <td class="bg_light" style="text-align: center">
 | 
			
		||||
              <p><a href="https://datasurvey.org" style="color: rgba(0, 0, 0, 0.8)">DataSurvey.org</a></p>
 | 
			
		||||
            </td>
 | 
			
		||||
          </tr>
 | 
			
		||||
        </table>
 | 
			
		||||
      </div>
 | 
			
		||||
    </center>
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
| 
						 | 
				
			
			@ -518,21 +518,59 @@
 | 
			
		|||
    <div class="modal-content">
 | 
			
		||||
      <form class="ds-form" name="editFormAddCollab" role="form" (ngSubmit)="saveAddCollab()" [formGroup]="editFormAddCollab">
 | 
			
		||||
        <div class="modal-header">
 | 
			
		||||
          <h1 class="modal-title" id="modalAddColaboradores">Colaborador</h1>
 | 
			
		||||
          <h1 class="modal-title" id="modalAddColaboradores">Añadir Colaborador</h1>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="modal-body">
 | 
			
		||||
          <div *ngIf="userCollabNotExist" class="alert alert-danger alert-dismissible fade show" role="alert">
 | 
			
		||||
            No existe un usuario con ese correo
 | 
			
		||||
          </div>
 | 
			
		||||
          <div>
 | 
			
		||||
            <div class="mb-5">
 | 
			
		||||
              <p class="ds-subtitle">Correo electrónico</p>
 | 
			
		||||
              <input type="email" class="form-control" name="email" id="field_add_email" data-cy="email" formControlName="email" />
 | 
			
		||||
              <input type="email" class="form-control" name="email_add" id="field_add_email" data-cy="email" formControlName="email_add" />
 | 
			
		||||
              <div
 | 
			
		||||
                *ngIf="
 | 
			
		||||
                  editFormAddCollab.get('email_add')!.invalid &&
 | 
			
		||||
                  (editFormAddCollab.get('email_add')!.dirty || editFormAddCollab.get('email_add')!.touched)
 | 
			
		||||
                "
 | 
			
		||||
              >
 | 
			
		||||
                <small
 | 
			
		||||
                  class="form-text text-danger"
 | 
			
		||||
                  *ngIf="editFormAddCollab.get('email_add')?.errors?.required"
 | 
			
		||||
                  jhiTranslate="entity.validation.required"
 | 
			
		||||
                >
 | 
			
		||||
                  This field is required.
 | 
			
		||||
                </small>
 | 
			
		||||
                <small
 | 
			
		||||
                  class="form-text text-danger"
 | 
			
		||||
                  *ngIf="editFormAddCollab.get('email_add')?.errors?.invalid"
 | 
			
		||||
                  jhiTranslate="global.messages.validate.email.invalid"
 | 
			
		||||
                >
 | 
			
		||||
                  Your email is invalid.
 | 
			
		||||
                </small>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div>
 | 
			
		||||
              <label for="field_update_rol">Rol</label>
 | 
			
		||||
              <select class="form-control" name="rol" formControlName="rol" id="field_rol_add" data-cy="rol">
 | 
			
		||||
              <select class="form-control" name="rol_add" formControlName="rol_add" id="field_rol_add" data-cy="rol_add">
 | 
			
		||||
                <option value="" selected disabled>Seleccione un rol</option>
 | 
			
		||||
                <option value="READ">Lector</option>
 | 
			
		||||
                <option value="WRITE">Escritor</option>
 | 
			
		||||
              </select>
 | 
			
		||||
              <div
 | 
			
		||||
                *ngIf="
 | 
			
		||||
                  editFormAddCollab.get('rol_add')!.invalid &&
 | 
			
		||||
                  (editFormAddCollab.get('rol_add')!.dirty || editFormAddCollab.get('rol_add')!.touched)
 | 
			
		||||
                "
 | 
			
		||||
              >
 | 
			
		||||
                <small
 | 
			
		||||
                  class="form-text text-danger"
 | 
			
		||||
                  *ngIf="editFormAddCollab.get('rol_add')?.errors?.required"
 | 
			
		||||
                  jhiTranslate="entity.validation.required"
 | 
			
		||||
                >
 | 
			
		||||
                  This field is required.
 | 
			
		||||
                </small>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -545,9 +583,9 @@
 | 
			
		|||
            type="submit"
 | 
			
		||||
            class="ds-btn ds-btn--primary"
 | 
			
		||||
            data-cy="entityAddButton"
 | 
			
		||||
            [disabled]="isSavingCollab"
 | 
			
		||||
            [disabled]="editFormAddCollab.invalid || isSavingAddCollab"
 | 
			
		||||
          >
 | 
			
		||||
            <span>Guardar</span>
 | 
			
		||||
            <span>Añadir</span>
 | 
			
		||||
          </button>
 | 
			
		||||
        </div>
 | 
			
		||||
      </form>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,11 +38,7 @@ import { IUsuarioEncuesta, UsuarioEncuesta } from '../../usuario-encuesta/usuari
 | 
			
		|||
import { RolColaborador } from '../../enumerations/rol-colaborador.model';
 | 
			
		||||
import { Account } from '../../../core/auth/account.model';
 | 
			
		||||
import { AccountService } from 'app/core/auth/account.service';
 | 
			
		||||
 | 
			
		||||
import { EncuestaPublishDialogComponent } from '../encuesta-publish-dialog/encuesta-publish-dialog.component';
 | 
			
		||||
import { EncuestaFinalizarDialogComponent } from '../encuesta-finalizar-dialog/encuesta-finalizar-dialog.component';
 | 
			
		||||
 | 
			
		||||
import { EncuestaDeleteDialogComponent } from '../delete/encuesta-delete-dialog.component';
 | 
			
		||||
import { EncuestaDeleteColaboratorDialogComponent } from '../encuesta-delete-colaborator-dialog/encuesta-delete-colaborator-dialog.component';
 | 
			
		||||
import { IUser } from '../../user/user.model';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -64,6 +60,7 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
 | 
			
		|||
  isSaving = false;
 | 
			
		||||
  isSavingQuestion = false;
 | 
			
		||||
  isSavingCollab = false;
 | 
			
		||||
  isSavingAddCollab = false;
 | 
			
		||||
  finalizada = false;
 | 
			
		||||
  public rolSeleccionado: RolColaborador | undefined = undefined;
 | 
			
		||||
  categoriasSharedCollection: ICategoria[] = [];
 | 
			
		||||
| 
						 | 
				
			
			@ -109,9 +106,10 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
 | 
			
		|||
  editFormUpdateCollab = this.fb.group({
 | 
			
		||||
    rol: [null, [Validators.required]],
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  editFormAddCollab = this.fb.group({
 | 
			
		||||
    email: [null, [Validators.required, Validators.email]],
 | 
			
		||||
    rol: [null, [Validators.required]],
 | 
			
		||||
    email_add: [null, [Validators.required, Validators.email]],
 | 
			
		||||
    rol_add: [null, [Validators.required]],
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  ePreguntas?: any[];
 | 
			
		||||
| 
						 | 
				
			
			@ -641,7 +639,7 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
 | 
			
		|||
  protected createFromFormCollab(): UsuarioEncuesta {
 | 
			
		||||
    return {
 | 
			
		||||
      id: undefined,
 | 
			
		||||
      rol: this.editFormAddCollab.get(['rol'])!.value,
 | 
			
		||||
      rol: this.editFormAddCollab.get(['rol_add'])!.value,
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -666,9 +664,15 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  saveAddCollab(): void {
 | 
			
		||||
    this.isSavingCollab = true;
 | 
			
		||||
    this.isSavingAddCollab = true;
 | 
			
		||||
    const collab = this.createFromFormCollab();
 | 
			
		||||
    let correoCollab = this.editFormAddCollab.get('email')!.value;
 | 
			
		||||
    let rol = this.editFormAddCollab.get('rol_add')!.value;
 | 
			
		||||
    if (rol === 'READ') {
 | 
			
		||||
      collab.rol = RolColaborador.READ;
 | 
			
		||||
    } else if (rol === 'WRITE') {
 | 
			
		||||
      collab.rol = RolColaborador.WRITE;
 | 
			
		||||
    }
 | 
			
		||||
    let correoCollab = this.editFormAddCollab.get('email_add')!.value;
 | 
			
		||||
 | 
			
		||||
    this.userService
 | 
			
		||||
      .retrieveAllPublicUsers()
 | 
			
		||||
| 
						 | 
				
			
			@ -683,8 +687,7 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
 | 
			
		|||
              collab.estado = EstadoColaborador.PENDING;
 | 
			
		||||
              collab.encuesta = this.encuesta;
 | 
			
		||||
              let id = 0;
 | 
			
		||||
              this.subscribeToSaveResponseUpdateCollab(this.usuarioEncuestaService.create(collab));
 | 
			
		||||
              // this.sendInvitation(correoCollab);
 | 
			
		||||
              this.subscribeToSaveResponseAddCollab(this.usuarioEncuestaService.create(collab));
 | 
			
		||||
            });
 | 
			
		||||
          } else {
 | 
			
		||||
            this.userCollabNotExist = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -720,6 +723,25 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
 | 
			
		|||
    this.isSavingCollab = false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected subscribeToSaveResponseAddCollab(result: Observable<HttpResponse<IUsuarioEncuesta>>): void {
 | 
			
		||||
    result.pipe(finalize(() => this.onSaveFinalizeAddCollab())).subscribe(
 | 
			
		||||
      () => this.onSaveSuccessAddCollab(),
 | 
			
		||||
      () => this.onSaveErrorAddCollab()
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected onSaveSuccessAddCollab(): void {
 | 
			
		||||
    this.loadAll();
 | 
			
		||||
    $('#btnCancelAddColaboradores').click();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected onSaveErrorAddCollab(): void {
 | 
			
		||||
    // Api for inheritance.
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected onSaveFinalizeAddCollab(): void {
 | 
			
		||||
    this.isSavingAddCollab = false;
 | 
			
		||||
  }
 | 
			
		||||
  deleteCollab(collab: IUsuarioEncuesta) {
 | 
			
		||||
    //$('#btnCancelUbdateColaboradores').click();
 | 
			
		||||
    //setTimeout(() => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,6 +64,7 @@
 | 
			
		|||
          <td class="text-right">
 | 
			
		||||
            <div class="btn-group" *ngIf="usuarioEncuesta.encuesta">
 | 
			
		||||
              <button
 | 
			
		||||
                *ngIf="usuarioEncuesta.estado === 'ACTIVE'"
 | 
			
		||||
                type="button"
 | 
			
		||||
                [routerLink]="['/encuesta', usuarioEncuesta.encuesta.id, 'edit']"
 | 
			
		||||
                class="ds-btn ds-btn--primary"
 | 
			
		||||
| 
						 | 
				
			
			@ -71,6 +72,15 @@
 | 
			
		|||
              >
 | 
			
		||||
                <span>Editar encuesta</span>
 | 
			
		||||
              </button>
 | 
			
		||||
              <button
 | 
			
		||||
                *ngIf="usuarioEncuesta.estado === 'PENDING'"
 | 
			
		||||
                type="button"
 | 
			
		||||
                (click)="aceptarInvitacion(usuarioEncuesta)"
 | 
			
		||||
                class="ds-btn btn-success"
 | 
			
		||||
                [disabled]="isLoading"
 | 
			
		||||
              >
 | 
			
		||||
                <span>Aceptar invitación</span>
 | 
			
		||||
              </button>
 | 
			
		||||
              <button type="submit" (click)="delete(usuarioEncuesta)" class="ds-btn ds-btn--danger btn-sm" data-cy="entityDeleteButton">
 | 
			
		||||
                <fa-icon icon="sign-out-alt"></fa-icon>
 | 
			
		||||
                <span class="d-none d-md-inline" jhiTranslate="dataSurveyApp.usuarioEncuesta.delete.getOut">Get Out</span>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import { IUsuarioEncuesta } from '../usuario-encuesta.model';
 | 
			
		|||
import { UsuarioEncuestaService } from '../service/usuario-encuesta.service';
 | 
			
		||||
import { UsuarioEncuestaDeleteDialogComponent } from '../delete/usuario-encuesta-delete-dialog.component';
 | 
			
		||||
import * as dayjs from 'dayjs';
 | 
			
		||||
import { faPollH, faPencilAlt } from '@fortawesome/free-solid-svg-icons';
 | 
			
		||||
import { faPencilAlt, faPollH } from '@fortawesome/free-solid-svg-icons';
 | 
			
		||||
 | 
			
		||||
import { AccountService } from 'app/core/auth/account.service';
 | 
			
		||||
import { Account } from 'app/core/auth/account.model';
 | 
			
		||||
import { IUsuarioExtra, UsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model';
 | 
			
		||||
import { IUsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model';
 | 
			
		||||
import { IUser } from '../../user/user.model';
 | 
			
		||||
import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-extra.service';
 | 
			
		||||
import { ActivatedRoute, Router } from '@angular/router';
 | 
			
		||||
import { EstadoColaborador } from '../../enumerations/estado-colaborador.model';
 | 
			
		||||
import { Observable } from 'rxjs';
 | 
			
		||||
import { finalize } from 'rxjs/operators';
 | 
			
		||||
import * as $ from 'jquery';
 | 
			
		||||
import { DATE_TIME_FORMAT } from '../../../config/input.constants';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'jhi-usuario-encuesta',
 | 
			
		||||
| 
						 | 
				
			
			@ -27,7 +31,7 @@ export class UsuarioEncuestaComponent implements OnInit {
 | 
			
		|||
  isLoading = false;
 | 
			
		||||
  usuarioExtra: IUsuarioExtra | null = null;
 | 
			
		||||
  user: IUser | null = null;
 | 
			
		||||
 | 
			
		||||
  isSavingCollab = false;
 | 
			
		||||
  public searchRol: string;
 | 
			
		||||
  public searchEstado: string;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -93,4 +97,29 @@ export class UsuarioEncuestaComponent implements OnInit {
 | 
			
		|||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  aceptarInvitacion(usuarioEncuesta: IUsuarioEncuesta) {
 | 
			
		||||
    usuarioEncuesta.estado = EstadoColaborador.ACTIVE;
 | 
			
		||||
    usuarioEncuesta.fechaAgregado = dayjs(usuarioEncuesta.fechaAgregado, DATE_TIME_FORMAT);
 | 
			
		||||
    this.subscribeToSaveResponseCollab(this.usuarioEncuestaService.update(usuarioEncuesta));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected subscribeToSaveResponseCollab(result: Observable<HttpResponse<IUsuarioEncuesta>>): void {
 | 
			
		||||
    result.pipe(finalize(() => this.onSaveFinalizeCollab())).subscribe(
 | 
			
		||||
      () => this.onSaveSuccessCollab(),
 | 
			
		||||
      () => this.onSaveErrorCollab()
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected onSaveSuccessCollab(): void {
 | 
			
		||||
    this.loadAll();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected onSaveErrorCollab(): void {
 | 
			
		||||
    // Api for inheritance.
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected onSaveFinalizeCollab(): void {
 | 
			
		||||
    this.isSavingCollab = false;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,8 +8,8 @@
 | 
			
		|||
        "createOrEditLabel": "Crear o editar Colaborador",
 | 
			
		||||
        "notFound": "Ningún Colaborador encontrado"
 | 
			
		||||
      },
 | 
			
		||||
      "created": "Un nuevo Usuario Encuesta ha sido creado con el identificador {{ param }}",
 | 
			
		||||
      "updated": "Un Usuario Encuesta ha sido actualizado con el identificador {{ param }}",
 | 
			
		||||
      "created": "Un Colaborador ha sido creado con el identificador {{ param }}",
 | 
			
		||||
      "updated": "Ha aceptado la colaboración en la encuesta #{{ param }}",
 | 
			
		||||
      "deleted": "Un Colaborador ha sido expulsado de la encuesta",
 | 
			
		||||
      "delete": {
 | 
			
		||||
        "question": "¿Seguro que quiere expulsar al colaborador de la encuesta?",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue