validation date register ok

thierry
Tmadkaud 7 years ago
parent 16482c0275
commit 0fcdd105f2

@ -82,7 +82,7 @@
</div>
</div>
<div class="subCard1-row d-flex flex-row">
<div class="operation-data flex-center"><p class="white-text info-text font-bold">{{((cartePar.operationCommercialCarte.avantageFilleul === '0') || (cartePar.operationCommercialCarte.avantageFilleul === ''))? '' : 'Avantage filleul : ' + cartePar.operationCommercialCarte.avantageFilleul + ' €'}}</p></div>
<div class="operation-data flex-center"><p class="white-text info-text font-bold">{{ ((cartePar.operationCommercialCarte.avantageFilleul == 0)) ? '' : 'Avantage filleul : ' + cartePar.operationCommercialCarte.avantageFilleul + ' €'}}</p></div>
<div class="operation-id flex-center"><p class="white-text info-text font-bold">Parrain: {{parrain.familyname}} {{parrain.firstname}}</p></div>
</div>
<div class="text-center" id="dateFin">
@ -176,7 +176,7 @@
</div>
</div>
<div class="subCard1-row d-flex flex-row">
<div class="operation-data flex-center"><p class="white-text info-text font-bold">{{((cartePar.operationCommercialCarte.avantageFilleul === '0') || (cartePar.operationCommercialCarte.avantageFilleul === ''))? '' : 'Avantage filleul : ' + cartePar.operationCommercialCarte.avantageFilleul + ' €'}}</p></div>
<div class="operation-data flex-center"><p class="white-text info-text font-bold">{{ ((cartePar.operationCommercialCarte.avantageFilleul == 0)) ? '' : 'Avantage filleul : ' + cartePar.operationCommercialCarte.avantageFilleul + ' €'}}</p></div>
<div class="operation-id flex-center"><p class="white-text info-text font-bold">Parrain : {{cartePar.parrainCarte.familyname}} {{cartePar.parrainCarte.firstname}}</p></div>
</div>
<div class="text-center" id="dateFin">

@ -44,8 +44,8 @@
<div class="md-form birthdayPar">
<i class="fa fa-birthday-cake prefix grey-text"></i>
<input type="date" id="orangeForm-Birthday" class="col-md-2" [(ngModel)]="parrain.birthday" placeholder="Date de naissance" required min="minDateTimeTest" max="maxDateTimeTest" name="birthday" #birthday="ngModel">
<div *ngIf="(validationBirthdayParrain()) && (birthday.dirty || birthday.touched)" class="alert alert-danger">
<input type="date" id="orangeForm-Birthday" class="col-md-2" #query (keyup)="validationBirthdayParrain()" [(ngModel)]="parrain.birthday" placeholder="Date de naissance" required min="minDateTimeTest" max="maxDateTimeTest" name="birthday" #birthday="ngModel">
<div *ngIf="validationBirthdayP && (birthday.dirty || birthday.touched)" class="alert alert-danger">
Votre date de naissance doit être comprise entre <strong><i>01/01/1917 et 01/01/2117</i></strong>.
</div>
</div>
@ -90,8 +90,8 @@
données, y compris notre Utilisation des cookies.
</label>
<div class="text-center" style="margin-top:5%">
<button class="btn btn-deep-orange" [disabled]="filePar || !birthday.touched || (birthday.touched && validationBirthdayParrain()) || email.errors || password.errors || (parrain.password != ConfirmPasswordParrain) || parrain.familyname == '' || parrain.firstname == '' || parrain.sex == '' || test" (click)="register()">S'inscrire</button>
<!--<button class="btn btn-cyan" (click)="loadHomeComponent()">Back</button>-->
<button class="btn btn-deep-orange" [disabled]="filePar || (validationBirthdayP) || email.errors || password.errors || (parrain.password != ConfirmPasswordParrain) || parrain.familyname == '' || parrain.firstname == '' || parrain.sex == '' || test" (click)="register()">S'inscrire</button>
<!--<button class="btn btn-deep-orange" [disabled]="filePar || !birthday.touched || validationBirthdayParrain() || (birthday.touched && validationBirthdayParrain()) || email.errors || password.errors || (parrain.password != ConfirmPasswordParrain) || parrain.familyname == '' || parrain.firstname == '' || parrain.sex == '' || test" (click)="register()">S'inscrire</button>-->
<div *ngIf="echecRegisterPar" class="alert alert-danger">
Erreur: Un compte avec cet <strong>email</strong> existe déjà.
</div>

@ -27,9 +27,11 @@ export class RegisterComponent implements OnInit, OnDestroy {
filePar: boolean;
echecRegisterPar: boolean;
echecRegisterCom: boolean;
validationBirthdayP: boolean;
constructor(private router: Router, private authService: AuthService) {
this.fileCom = true;
this.filePar = true;
this.validationBirthdayP = true;
this.echecRegisterPar = false;
this.echecRegisterCom = false;
this.currentUser = new User();
@ -39,6 +41,7 @@ export class RegisterComponent implements OnInit, OnDestroy {
this.minDateTimeTest = new Date('1917-01-01');
this.maxDateTimeTest = new Date('2117-01-01');
this.parrainDateTimeTest = new Date(this.parrain.birthday);
//console.log(this.validationBirthdayParrain());
}
@ -76,6 +79,7 @@ export class RegisterComponent implements OnInit, OnDestroy {
}
register() {
if (this.currentUser.status === 'Parrain') {
this.parrain.status = this.currentUser.status;
this.parrain.secretCode = this.getRandomArbitrary(1111, 9999).toString();
@ -96,6 +100,7 @@ export class RegisterComponent implements OnInit, OnDestroy {
this.echecRegisterCom = false;
this.test = true;
}
}
clean() {
@ -111,12 +116,29 @@ export class RegisterComponent implements OnInit, OnDestroy {
}
validationBirthdayParrain(){
let dateTempB = new Date(Date.now());
this.parrainDateTimeTest = new Date(this.parrain.birthday);
if (this.parrainDateTimeTest.getTime() <= this.minDateTimeTest.getTime()
|| this.parrainDateTimeTest.getTime() >= this.maxDateTimeTest.getTime()) {
return true;
} else {
return false;
console.log(dateTempB.getFullYear());
console.log(this.parrainDateTimeTest.getFullYear());
if (this.parrainDateTimeTest.getFullYear() > this.minDateTimeTest.getFullYear()
&& (this.parrainDateTimeTest.getFullYear() !== dateTempB.getFullYear())
&& this.parrainDateTimeTest.getFullYear() < this.maxDateTimeTest.getFullYear()
&& this.parrainDateTimeTest.getFullYear() !== NaN){
if (!isNaN(this.parrainDateTimeTest.getTime())){
this.validationBirthdayP = false;
}else{
this.validationBirthdayP = true;
}
}else{
this.validationBirthdayP = true;
}
}

Loading…
Cancel
Save