All files / app/features/public/pages/register-page register-page.html

60% Statements 93/155
79.16% Branches 19/24
0% Functions 0/5
67.24% Lines 78/116

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 1991x       1x 1x   1x     1x 1x 1x 1x     1x 1x 3x 3x             1x 1x   1x 1x 3x   3x             1x 1x   1x 1x 3x 1x 3x             3x         1x 1x   1x 1x 1x 3x   1x     1x 3x   3x                     1x 1x             1x   1x   3x             1x 1x   1x 1x 1x 3x 3x 1x     1x 3x   3x                     1x 1x             1x   1x   3x             1x 1x     3x   1x 1x   1x 1x   1x 1x       3x             1x   3x                 1x 1x 1x   1x 1x 1x 1x 1x               1x
<main>
  <section class="bg-gradient-to-br from-slate-950 via-slate-900 to-primary-900">
    <div class="flex flex-col items-center justify-center px-6 py-8 mx-auto md:h-screen lg:py-0">
      <a routerLink="/" class="flex items-center mb-6 text-3xl font-semibold text-white">
        <img class="w-14 h-14 mr-2" src="/iconAT.png" alt="logo">
        <span>TaskManager</span>
      </a>
      <div class="w-full rounded-lg shadow border md:mt-0 sm:max-w-2xl xl:p-0 bg-gray-800 border-gray-700">
        <div class="p-6 space-y-4 md:space-y-6 sm:p-8">
          <h1 class="text-xl font-bold leading-tight tracking-tight md:text-2xl text-white text-center">
            Crear una cuenta
          </h1>
          <form class="space-y-4 md:space-y-6" (submit)="onSubmit($event)">
            <div class="grid gap-6 mb-6 md:grid-cols-2">
              <div>
                <label for="name" class="block mb-2 text-sm font-medium text-white">
                  Nombre
                </label>
                <input type="text" [formField]="registerForm.name" id="name" class="my-input" placeholder="Rick">
                @if (registerForm.name().touched() && registerForm.name().invalid()) {
                <ul class="list-disc text-xs text-red-600 dark:text-red-500 mt-1 ml-4">
                  @for (error of registerForm.name().errors(); track $index) {
                  <li>{{ error.message }}</li>
                  }
                </ul>
                }
              </div>
              <div>
                <label for="lastname" class="block mb-2 text-sm font-medium text-white">
                  Apellido
                </label>
                <input type="text" [formField]="registerForm.lastname" id="lastname" class="my-input"
                  placeholder="Sanchez">
                @if (registerForm.lastname().touched() && registerForm.lastname().invalid()) {
                <ul class="list-disc text-xs text-red-600 dark:text-red-500 mt-1 ml-4">
                  @for (error of registerForm.lastname().errors(); track $index) {
                  <li>{{ error.message }}</li>
                  }
                </ul>
                }
              </div>
              <div>
                <label for="email" class="block mb-2 text-sm font-medium text-white">
                  Correo electrónico
                </label>
                <input type="email" [formField]="registerForm.email" id="email" class="my-input"
                  placeholder="name@company.com" (focus)="clearEmailTakenError()" (input)="clearEmailTakenError()">
                @if (registerForm.email().touched() && registerForm.email().invalid()) {
                <ul class="list-disc text-xs text-red-600 dark:text-red-500 mt-1 ml-4">
                  @for (error of registerForm.email().errors(); track $index) {
                  <li>{{ error.message }}</li>
                  }
                </ul>
                }
                @if (emailTaken() && registerForm.email().touched()) {
                <ul class="list-disc text-xs text-red-600 dark:text-red-500 mt-1 ml-4">
                  <li>El email ya a sido registrado!</li>
                </ul>
                }
              </div>
              <div>
                <label for="password" class="block mb-2 text-sm font-medium text-white">
                  Contraseña
                </label>
                <div class="relative">
                  <input [type]="showPassword ? 'text' : 'password'" [formField]="registerForm.password" id="password" class="my-input"
                    placeholder="••••••••">
                  <button
                    type="button"
                    class="absolute inset-y-0 right-0 flex items-center px-3 text-gray-500 dark:text-gray-400 cursor-pointer"
                    (click)="togglePasswordVisibility()"
                    [attr.aria-label]="showPassword ? 'Hide password' : 'Show password'"
                  >
                    @if (showPassword) {
                      <svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" aria-hidden="true">
                        <path
                          d="M3 3l18 18M10.58 10.59A2 2 0 0 0 13.41 13.42M9.88 5.1A10.94 10.94 0 0 1 12 5c5 0 9.27 3.11 11 7a11.8 11.8 0 0 1-4.17 4.91M6.61 6.61A11.83 11.83 0 0 0 1 12a11.82 11.82 0 0 0 7.32 6.45"
                          stroke="currentColor"
                          stroke-width="2"
                          stroke-linecap="round"
                          stroke-linejoin="round"
                        />
                      </svg>
                    } @else {
                      <svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" aria-hidden="true">
                        <path
                          d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12Zm11 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"
                          stroke="currentColor"
                          stroke-width="2"
                          stroke-linecap="round"
                          stroke-linejoin="round"
                        />
                      </svg>
                    }
                  </button>
                </div>
                @if (registerForm.password().touched() && registerForm.password().invalid()) {
                <ul class="list-disc text-xs text-red-600 dark:text-red-500 mt-1 ml-4">
                  @for (error of registerForm.password().errors(); track $index) {
                  <li>{{ error.message }}</li>
                  }
                </ul>
                }
              </div>
              <div>
                <label for="confirm-password" class="block mb-2 text-sm font-medium text-white">
                  Confirmar contraseña
                </label>
                <div class="relative">
                   <input [type]="showPassword2 ? 'text' : 'password'" id="confirm-password" class="my-input"
                    placeholder="••••••••" [formField]="registerForm.confirmPassword">
                  <button
                    type="button"
                    class="absolute inset-y-0 right-0 flex items-center px-3 text-gray-500 dark:text-gray-400 cursor-pointer"
                    (click)="togglePasswordVisibility2()"
                    [attr.aria-label]="showPassword2 ? 'Hide password' : 'Show password'"
                  >
                    @if (showPassword2) {
                      <svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" aria-hidden="true">
                        <path
                          d="M3 3l18 18M10.58 10.59A2 2 0 0 0 13.41 13.42M9.88 5.1A10.94 10.94 0 0 1 12 5c5 0 9.27 3.11 11 7a11.8 11.8 0 0 1-4.17 4.91M6.61 6.61A11.83 11.83 0 0 0 1 12a11.82 11.82 0 0 0 7.32 6.45"
                          stroke="currentColor"
                          stroke-width="2"
                          stroke-linecap="round"
                          stroke-linejoin="round"
                        />
                      </svg>
                    } @else {
                      <svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" aria-hidden="true">
                        <path
                          d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12Zm11 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"
                          stroke="currentColor"
                          stroke-width="2"
                          stroke-linecap="round"
                          stroke-linejoin="round"
                        />
                      </svg>
                    }
                  </button>
                </div>
                @if (registerForm.confirmPassword().touched() && registerForm.confirmPassword().invalid()) {
                <ul class="list-disc text-xs text-red-600 dark:text-red-500 mt-1 ml-4">
                  @for (error of registerForm.confirmPassword().errors(); track $index) {
                  <li>{{ error.message }}</li>
                  }
                </ul>
                }
              </div>
              <div>
                <div class="flex items-start">
                  <div class="flex items-center">
                    <input id="terms" type="checkbox" [formField]="registerForm.termsAndConditions"
                      class="my-input-checkbox">
                  </div>
                  <div class="ml-3 text-sm">
                    <label for="terms" class="font-light text-gray-300">
                      Acepto los
                      <a class="font-medium hover:underline text-primary-500"
                        routerLink="/about/terms">
                        Términos y Condiciones
                      </a>
                    </label>
                  </div>
                </div>
                @if (registerForm.termsAndConditions().touched() && registerForm.termsAndConditions().invalid()) {
                  <ul class="list-disc text-xs text-red-600 dark:text-red-500 mt-1 ml-4">
                  @for (error of registerForm.termsAndConditions().errors(); track $index) {
                    <li>{{ error.message }}</li>
                  }
                  </ul>
                }
              </div>
            </div>
            @if (isLoading()) {
              <button disabled type="submit" class="my-button px-4 py-2.5 w-full flex items-center justify-center">
                <svg aria-hidden="true" role="status" class="w-4 h-4 me-2 text-white animate-spin" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
                  <path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="#E5E7EB"/>
                  <path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentColor"/>
                </svg>
                Loading...
              </button>
            } @else {
              <button type="submit" class="my-button px-4 py-2.5 w-full">
                Crear cuenta
              </button>
            }
            <p class="text-sm font-light text-gray-300">
              ¿Ya tienes una cuenta?
              <a routerLink="/login" class="font-medium text-primary-500 hover:underline">
                Inicia sesión aquí
              </a>
            </p>
          </form>
        </div>
      </div>
    </div>
  </section>
</main>
<app-footer></app-footer>