From 9ca9c376090eb908f37e14a895981728756036f2 Mon Sep 17 00:00:00 2001
From: chiahetcho <leila.bekaddour@student-cs.fr>
Date: Sat, 28 Sep 2019 17:28:33 +0200
Subject: [PATCH] link changed and disabled when unchecked checkbox

---
 .../student-signup.component.html             | 20 ++++---------------
 .../student-signup.component.ts               |  4 +++-
 2 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/src/app/signup/student-signup/student-signup.component.html b/src/app/signup/student-signup/student-signup.component.html
index d991f7c..933a710 100644
--- a/src/app/signup/student-signup/student-signup.component.html
+++ b/src/app/signup/student-signup/student-signup.component.html
@@ -52,34 +52,22 @@
       adminsitrative, dans le strict respect du cadre spécifié ci-dessus :
     </p>
 
-    <mat-checkbox id="checkboxUtilisation" class="checkbox-field" formControlName="acceptedConditions" required onclick='if (document.getElementById("checkboxUtilisation").classList.contains("mat-checkbox-checked")) {
-        document.getElementById("boutonChiant").setAttribute("disabled", "true");
-      }
-      else {
-        document.getElementById("boutonChiant").removeAttribute("disabled");
-      }'>
+    <mat-checkbox id="checkboxUtilisation" class="checkbox-field" formControlName="agree" required>
       J'accepte cette utilisation
     </mat-checkbox>
-
     <p class="text-center">
-      <a mat-raised-button color="accent" disabled id="boutonChiant"
-        href="https://docs.google.com/forms/d/e/1FAIpQLScJnkGaDdXWL-sPyHuq58gJivr5xkZ_M5AASRCBHx4a9wR4-Q/viewform?usp=sf_link"
-        rel="noreferrer" target="_blank">
+      <a mat-raised-button color="accent" [disabled]="formGroup.value.agree == false"
+        href="https://docs.google.com/forms/u/1/d/1mIEy-FVgYvrL0Ntl8YpLKVn0DqpjSl9S_ekjqYo53rI/viewform"
+        target="_blank">
         <mat-icon>launch</mat-icon>
         Remplir le formulaire
       </a>
     </p>
 
 
-
     <mat-checkbox class="checkbox-field" formControlName="filledForm" required>
       J'ai rempli le formulaire
     </mat-checkbox>
-    <!-- ici  -->
-
-
-    <!-- ici  -->
-
     <p>
       Il ne te reste plus qu'à choisir un mot de passe. :-)
     </p>
diff --git a/src/app/signup/student-signup/student-signup.component.ts b/src/app/signup/student-signup/student-signup.component.ts
index ac78486..95a4b36 100644
--- a/src/app/signup/student-signup/student-signup.component.ts
+++ b/src/app/signup/student-signup/student-signup.component.ts
@@ -41,9 +41,11 @@ export class StudentSignupComponent implements OnInit {
       phoneNumber: '',
       password: '',
       passwordConfirm: '',
+      agree: [false, Validators.required],
       filledForm: false,
       acceptedConditions: false,
-    }, { validator: (group) => this.checkPasswords(group)})
+    }, { validator: (group) => this.checkPasswords(group)},)
+    console.log(this.formGroup.value.agree)
   }
 
   private checkPasswords(group: FormGroup): null | any {
-- 
GitLab