2025-11-23 12:23:28 +07:00
|
|
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
|
|
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
|
|
|
|
import { GeneralService } from '../../services/generalservice';
|
2025-11-21 15:01:21 +07:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-login-register',
|
|
|
|
|
standalone: false,
|
|
|
|
|
templateUrl: './login-register.component.html',
|
|
|
|
|
styleUrl: './login-register.component.css',
|
|
|
|
|
})
|
2025-11-23 12:23:28 +07:00
|
|
|
export class LoginRegisterComponent implements OnInit {
|
|
|
|
|
@Output() registeredEventSubmit = new EventEmitter<any>();
|
|
|
|
|
registerFrm!: FormGroup;
|
|
|
|
|
currentStep = 1;
|
2025-11-21 15:01:21 +07:00
|
|
|
|
2025-11-23 12:23:28 +07:00
|
|
|
constructor(){}
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
|
this.setupFormControl();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setupFormControl(): void {
|
|
|
|
|
this.registerFrm = new FormGroup({
|
|
|
|
|
username: new FormControl('',[Validators.required, Validators.maxLength(100)]),
|
|
|
|
|
userlastname: new FormControl('',[Validators.required, Validators.maxLength(100)]),
|
|
|
|
|
email: new FormControl('',[Validators.required, Validators.email, Validators.maxLength(100)]),
|
|
|
|
|
password: new FormControl('',[Validators.required, Validators.maxLength(50)]),
|
|
|
|
|
confirmPassword: new FormControl('',[Validators.required, Validators.maxLength(50)]),
|
|
|
|
|
terms: new FormControl(false, [Validators.requiredTrue])
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onSubmit(){
|
|
|
|
|
let data = {
|
|
|
|
|
username: this.registerFrm.get('username')?.value,
|
|
|
|
|
userlastname: this.registerFrm.get('userlastname')?.value,
|
|
|
|
|
email: this.registerFrm.get('email')?.value,
|
|
|
|
|
password: this.registerFrm.get('password')?.value
|
|
|
|
|
}
|
|
|
|
|
this.RegisteredEventSubmit(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RegisteredEventSubmit(event: any){
|
|
|
|
|
this.registeredEventSubmit.emit(event);
|
|
|
|
|
}
|
2025-11-21 15:01:21 +07:00
|
|
|
}
|