|
@@ -84,6 +84,8 @@ export class RegesterComponent implements OnInit {
|
|
checkShowSpanRequired: boolean = true;
|
|
checkShowSpanRequired: boolean = true;
|
|
changesSave:boolean = false;
|
|
changesSave:boolean = false;
|
|
typeMode:boolean = false;
|
|
typeMode:boolean = false;
|
|
|
|
+ checkUserType:number;
|
|
|
|
+ showTypeInput:boolean = true; //to show visitor or employee
|
|
typeTitle:string = '';
|
|
typeTitle:string = '';
|
|
bindingDateSplit: any;
|
|
bindingDateSplit: any;
|
|
data = {
|
|
data = {
|
|
@@ -91,14 +93,14 @@ export class RegesterComponent implements OnInit {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
ngOnInit() {
|
|
ngOnInit() {
|
|
|
|
|
|
this.authSer.showSearchHeader = false;
|
|
this.authSer.showSearchHeader = false;
|
|
this.authSer.notificationLogin = false;
|
|
this.authSer.notificationLogin = false;
|
|
this.authSer.showDashboardHeader = true;
|
|
this.authSer.showDashboardHeader = true;
|
|
-
|
|
|
|
|
|
+ this.authSer.arabicTemplate = true;
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
this.typeTitle = 'تسجيل الدخول';
|
|
this.typeTitle = 'تسجيل الدخول';
|
|
@@ -106,32 +108,41 @@ export class RegesterComponent implements OnInit {
|
|
this.route.params.subscribe(
|
|
this.route.params.subscribe(
|
|
(params:Params) => {
|
|
(params:Params) => {
|
|
this.userProfileId = params['idProfile'];
|
|
this.userProfileId = params['idProfile'];
|
|
|
|
+ if(this.userProfileId) {
|
|
|
|
+ this.showTypeInput = false;
|
|
|
|
+ } else {
|
|
|
|
+ this.showTypeInput = true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
);
|
|
);
|
|
|
|
|
|
|
|
+
|
|
|
|
+ //start regester form with default employee
|
|
|
|
+ this.regesterForm = new FormGroup({
|
|
|
|
+ name: new FormControl(null, Validators.required),
|
|
|
|
+ type: new FormControl('0'),
|
|
|
|
+ identity_type_id: new FormControl(null, [Validators.required]),
|
|
|
|
+ identity_number: new FormControl(null, Validators.required),
|
|
|
|
+ position: new FormControl(null, Validators.required),
|
|
|
|
+ email: new FormControl(null, [Validators.required,Validators.email]),
|
|
|
|
+ password: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
|
|
+ password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
|
|
+ phone: new FormControl(null, Validators.required),
|
|
|
|
+ gender: new FormControl(null, Validators.required),
|
|
|
|
+ birthday: new FormControl(null, Validators.required),
|
|
|
|
+ adminstration_id: new FormControl(null, Validators.required),
|
|
|
|
+ department_id: new FormControl(null, Validators.required),
|
|
|
|
+ nationality_id: new FormControl(null, Validators.required),
|
|
|
|
+ date_of_employment_gre: new FormControl(null, Validators.required),
|
|
|
|
+ date_of_employment_hij: new FormControl(null,Validators.required),
|
|
|
|
+ job_title_id: new FormControl(null),
|
|
|
|
+ specialization_id: new FormControl(null),
|
|
|
|
+ functional_number: new FormControl(null, Validators.required),
|
|
|
|
+ contract_type_id: new FormControl(null),
|
|
|
|
+ staff_id: new FormControl(null),
|
|
|
|
+ });
|
|
|
|
|
|
- this.regesterForm = new FormGroup({
|
|
|
|
- name: new FormControl(null, Validators.required),
|
|
|
|
- identity_type_id: new FormControl(null, [Validators.required]),
|
|
|
|
- identity_number: new FormControl(null, Validators.required),
|
|
|
|
- position: new FormControl(null, Validators.required),
|
|
|
|
- email: new FormControl(null, [Validators.required,Validators.email]),
|
|
|
|
- password: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
|
|
- password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
|
|
- phone: new FormControl(null, Validators.required),
|
|
|
|
- gender: new FormControl(null, Validators.required),
|
|
|
|
- birthday: new FormControl(null, Validators.required),
|
|
|
|
- adminstration_id: new FormControl(null, Validators.required),
|
|
|
|
- department_id: new FormControl(null, Validators.required),
|
|
|
|
- nationality_id: new FormControl(null, Validators.required),
|
|
|
|
- date_of_employment_gre: new FormControl(null, Validators.required),
|
|
|
|
- date_of_employment_hij: new FormControl(null,Validators.required),
|
|
|
|
- job_title_id: new FormControl(null),
|
|
|
|
- specialization_id: new FormControl(null),
|
|
|
|
- functional_number: new FormControl(null, Validators.required),
|
|
|
|
- contract_type_id: new FormControl(null),
|
|
|
|
- staff_id: new FormControl(null),
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
|
|
//get adminstration
|
|
//get adminstration
|
|
this.userService.getAdministration().subscribe(
|
|
this.userService.getAdministration().subscribe(
|
|
@@ -206,6 +217,7 @@ export class RegesterComponent implements OnInit {
|
|
|
|
|
|
//profile edit
|
|
//profile edit
|
|
if(this.userProfileId) {
|
|
if(this.userProfileId) {
|
|
|
|
+
|
|
this.typeTitle = 'صفحتي';
|
|
this.typeTitle = 'صفحتي';
|
|
//show / hide notification search in header
|
|
//show / hide notification search in header
|
|
this.checkShowSpanRequired = false;
|
|
this.checkShowSpanRequired = false;
|
|
@@ -219,29 +231,7 @@ export class RegesterComponent implements OnInit {
|
|
this.showStatus = false;
|
|
this.showStatus = false;
|
|
this.typeMode = true;
|
|
this.typeMode = true;
|
|
this.authSer.notificationLogin = true;
|
|
this.authSer.notificationLogin = true;
|
|
- this.regesterForm = new FormGroup({
|
|
|
|
- name: new FormControl(null, Validators.required),
|
|
|
|
- identity_type_id: new FormControl(null, [Validators.required]),
|
|
|
|
- identity_number: new FormControl(null, Validators.required),
|
|
|
|
- position: new FormControl(null, Validators.required),
|
|
|
|
- email: new FormControl(null, [Validators.required,Validators.email]),
|
|
|
|
- password: new FormControl(null, [Validators.minLength(6)]),
|
|
|
|
- password_confirmation: new FormControl(null, [Validators.minLength(6)]),
|
|
|
|
- phone: new FormControl(null,Validators.required),
|
|
|
|
- gender: new FormControl(null, Validators.required),
|
|
|
|
- birthday: new FormControl(null, Validators.required),
|
|
|
|
- adminstration_id: new FormControl(null, Validators.required),
|
|
|
|
- department_id: new FormControl(null, Validators.required),
|
|
|
|
- nationality_id: new FormControl(null, Validators.required),
|
|
|
|
- date_of_employment_gre: new FormControl(null, Validators.required),
|
|
|
|
- date_of_employment_hij: new FormControl(null,Validators.required),
|
|
|
|
- job_title_id: new FormControl(null),
|
|
|
|
- specialization_id: new FormControl(null),
|
|
|
|
- functional_number: new FormControl(null, Validators.required),
|
|
|
|
- contract_type_id: new FormControl(null),
|
|
|
|
- staff_id: new FormControl(null),
|
|
|
|
- status: new FormControl(null, Validators.required),
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
|
|
this.spinner.show();
|
|
this.spinner.show();
|
|
this.userService.onGetUserData(this.userProfileId, 'editUs').subscribe(
|
|
this.userService.onGetUserData(this.userProfileId, 'editUs').subscribe(
|
|
@@ -251,45 +241,103 @@ export class RegesterComponent implements OnInit {
|
|
|
|
|
|
this.data.name = responce['user'].name;
|
|
this.data.name = responce['user'].name;
|
|
|
|
|
|
- const date = responce['user'].date_of_employment_hij.split('-');
|
|
|
|
- this.bindingDateSplit = {
|
|
|
|
- 'year': parseInt(date[0]),
|
|
|
|
- 'month': parseInt(date[1]),
|
|
|
|
- 'day': parseInt(date[2])
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- console.log('vaaaaaaaaal', this.bindingDateSplit);
|
|
|
|
-
|
|
|
|
- this.regesterForm.patchValue({
|
|
|
|
- name: responce['user'].name,
|
|
|
|
- identity_type_id: responce['user'].identity_type_id,
|
|
|
|
- identity_number: responce['user'].identity_number,
|
|
|
|
- email: responce['user'].email,
|
|
|
|
- position: responce['user'].position,
|
|
|
|
- phone: responce['user'].phone,
|
|
|
|
- gender: responce['user'].gender,
|
|
|
|
- birthday: responce['user'].birthday,
|
|
|
|
- adminstration_id: responce['user'].adminstration_id,
|
|
|
|
- department_id: responce['user'].department_id,
|
|
|
|
- nationality_id: responce['user'].nationality_id,
|
|
|
|
- date_of_employment_gre: responce['user'].date_of_employment_gre,
|
|
|
|
- job_title_id: responce['user'].job_title_id,
|
|
|
|
- specialization_id: responce['user'].specialization_id,
|
|
|
|
- contract_type_id: responce['user'].contract_type_id,
|
|
|
|
- staff_id: responce['user'].staff_id,
|
|
|
|
- functional_number: responce['user'].functional_number,
|
|
|
|
- status: responce['user'].status,
|
|
|
|
- date_of_employment_hij: this.bindingDateSplit, //responce['user'].date_of_employment_hij//
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //this.higriDateVal = responce['user'].date_of_employment_hij;
|
|
|
|
- console.log(this.bindingDateSplit);
|
|
|
|
-
|
|
|
|
- this.getDepartment();
|
|
|
|
- console.log('image profile' , this.authSer.pathImg + responce['user'].photo);
|
|
|
|
- this.urlImg = responce['user'].photo ? this.authSer.pathImg + responce['user'].photo : '../../assets/image/avatar.png';
|
|
|
|
- this.spinner.hide();
|
|
|
|
|
|
+ if(responce['user'].type == 1) {
|
|
|
|
+
|
|
|
|
+ //visitor case
|
|
|
|
+ this.regesterForm = new FormGroup({
|
|
|
|
+ name: new FormControl(null, Validators.required),
|
|
|
|
+ type: new FormControl('1'),
|
|
|
|
+ identity_type_id: new FormControl(null, [Validators.required]),
|
|
|
|
+ identity_number: new FormControl(null, Validators.required),
|
|
|
|
+ email: new FormControl(null, [Validators.required,Validators.email]),
|
|
|
|
+ phone: new FormControl(null,Validators.required),
|
|
|
|
+ password: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
|
|
+ password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
|
|
+ gender: new FormControl(null, Validators.required),
|
|
|
|
+ birthday: new FormControl(null, Validators.required),
|
|
|
|
+ nationality_id: new FormControl(null, Validators.required),
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ this.regesterForm.patchValue({
|
|
|
|
+ name: responce['user'].name,
|
|
|
|
+ type: responce['user'].type,
|
|
|
|
+ identity_type_id: responce['user'].identity_type_id,
|
|
|
|
+ identity_number: responce['user'].identity_number,
|
|
|
|
+ email: responce['user'].email,
|
|
|
|
+ gender: responce['user'].gender,
|
|
|
|
+ birthday: responce['user'].birthday,
|
|
|
|
+ nationality_id: responce['user'].nationality_id,
|
|
|
|
+ phone: responce['user'].phone,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ console.log('image profile' , this.authSer.pathImg + responce['user'].photo);
|
|
|
|
+ this.urlImg = responce['user'].photo ? this.authSer.pathImg + responce['user'].photo : '../../assets/image/avatar.png';
|
|
|
|
+ this.spinner.hide();
|
|
|
|
+
|
|
|
|
+ } else if(responce['user'].type == 0){
|
|
|
|
+ //employee case
|
|
|
|
+ this.regesterForm = new FormGroup({
|
|
|
|
+ name: new FormControl(null, Validators.required),
|
|
|
|
+ type: new FormControl('1'),
|
|
|
|
+ identity_type_id: new FormControl(null, [Validators.required]),
|
|
|
|
+ identity_number: new FormControl(null, Validators.required),
|
|
|
|
+ position: new FormControl(null, Validators.required),
|
|
|
|
+ email: new FormControl(null, [Validators.required,Validators.email]),
|
|
|
|
+ password: new FormControl(null, [Validators.minLength(6)]),
|
|
|
|
+ password_confirmation: new FormControl(null, [Validators.minLength(6)]),
|
|
|
|
+ phone: new FormControl(null,Validators.required),
|
|
|
|
+ gender: new FormControl(null, Validators.required),
|
|
|
|
+ birthday: new FormControl(null, Validators.required),
|
|
|
|
+ adminstration_id: new FormControl(null, Validators.required),
|
|
|
|
+ department_id: new FormControl(null, Validators.required),
|
|
|
|
+ nationality_id: new FormControl(null, Validators.required),
|
|
|
|
+ date_of_employment_gre: new FormControl(null, Validators.required),
|
|
|
|
+ date_of_employment_hij: new FormControl(null,Validators.required),
|
|
|
|
+ job_title_id: new FormControl(null),
|
|
|
|
+ specialization_id: new FormControl(null),
|
|
|
|
+ functional_number: new FormControl(null, Validators.required),
|
|
|
|
+ contract_type_id: new FormControl(null),
|
|
|
|
+ staff_id: new FormControl(null),
|
|
|
|
+ status: new FormControl(null, Validators.required),
|
|
|
|
+ });
|
|
|
|
+ const date = responce['user'].date_of_employment_hij.split('-');
|
|
|
|
+ this.bindingDateSplit = {
|
|
|
|
+ 'year': parseInt(date[0]),
|
|
|
|
+ 'month': parseInt(date[1]),
|
|
|
|
+ 'day': parseInt(date[2])
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ console.log('vaaaaaaaaal', this.bindingDateSplit);
|
|
|
|
+
|
|
|
|
+ this.regesterForm.patchValue({
|
|
|
|
+ name: responce['user'].name,
|
|
|
|
+ type: responce['user'].type,
|
|
|
|
+ identity_type_id: responce['user'].identity_type_id,
|
|
|
|
+ identity_number: responce['user'].identity_number,
|
|
|
|
+ email: responce['user'].email,
|
|
|
|
+ position: responce['user'].position,
|
|
|
|
+ phone: responce['user'].phone,
|
|
|
|
+ gender: responce['user'].gender,
|
|
|
|
+ birthday: responce['user'].birthday,
|
|
|
|
+ adminstration_id: responce['user'].adminstration_id,
|
|
|
|
+ department_id: responce['user'].department_id,
|
|
|
|
+ nationality_id: responce['user'].nationality_id,
|
|
|
|
+ date_of_employment_gre: responce['user'].date_of_employment_gre,
|
|
|
|
+ job_title_id: responce['user'].job_title_id,
|
|
|
|
+ specialization_id: responce['user'].specialization_id,
|
|
|
|
+ contract_type_id: responce['user'].contract_type_id,
|
|
|
|
+ staff_id: responce['user'].staff_id,
|
|
|
|
+ functional_number: responce['user'].functional_number,
|
|
|
|
+ status: responce['user'].status,
|
|
|
|
+ date_of_employment_hij: this.bindingDateSplit, //responce['user'].date_of_employment_hij//
|
|
|
|
+ });
|
|
|
|
+ console.log(this.bindingDateSplit);
|
|
|
|
+
|
|
|
|
+ this.getDepartment();
|
|
|
|
+ console.log('image profile' , this.authSer.pathImg + responce['user'].photo);
|
|
|
|
+ this.urlImg = responce['user'].photo ? this.authSer.pathImg + responce['user'].photo : '../../assets/image/avatar.png';
|
|
|
|
+ this.spinner.hide();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
(error) => {
|
|
(error) => {
|
|
console.log(error);
|
|
console.log(error);
|
|
@@ -369,12 +417,52 @@ export class RegesterComponent implements OnInit {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- //get value date from child component
|
|
|
|
- // public getDate(date: any):void {
|
|
|
|
- // console.log( date);
|
|
|
|
- // this.higriDateVal = date.year + '-' + date.month + '-' + date.day;
|
|
|
|
- // console.log('higrii date', this.higriDateVal);
|
|
|
|
- // }
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ checkTypeUser(typeUser) {
|
|
|
|
+ console.log(typeUser.target.value);
|
|
|
|
+ this.checkUserType = typeUser.target.value;
|
|
|
|
+ if(typeUser.target.value == 1) {
|
|
|
|
+ this.regesterForm = new FormGroup({
|
|
|
|
+ name: new FormControl(null, Validators.required),
|
|
|
|
+ type: new FormControl('1'),
|
|
|
|
+ identity_type_id: new FormControl(null, [Validators.required]),
|
|
|
|
+ identity_number: new FormControl(null, Validators.required),
|
|
|
|
+ email: new FormControl(null, [Validators.required,Validators.email]),
|
|
|
|
+ password: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
|
|
+ password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
|
|
+ gender: new FormControl(null, Validators.required),
|
|
|
|
+ birthday: new FormControl(null, Validators.required),
|
|
|
|
+ nationality_id: new FormControl(null, Validators.required),
|
|
|
|
+ phone: new FormControl(null, Validators.required),
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.regesterForm = new FormGroup({
|
|
|
|
+ name: new FormControl(null, Validators.required),
|
|
|
|
+ type: new FormControl('0'),
|
|
|
|
+ identity_type_id: new FormControl(null, [Validators.required]),
|
|
|
|
+ identity_number: new FormControl(null, Validators.required),
|
|
|
|
+ position: new FormControl(null, Validators.required),
|
|
|
|
+ email: new FormControl(null, [Validators.required,Validators.email]),
|
|
|
|
+ password: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
|
|
+ password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
|
|
+ phone: new FormControl(null, Validators.required),
|
|
|
|
+ gender: new FormControl(null, Validators.required),
|
|
|
|
+ birthday: new FormControl(null, Validators.required),
|
|
|
|
+ adminstration_id: new FormControl(null, Validators.required),
|
|
|
|
+ department_id: new FormControl(null, Validators.required),
|
|
|
|
+ nationality_id: new FormControl(null, Validators.required),
|
|
|
|
+ date_of_employment_gre: new FormControl(null, Validators.required),
|
|
|
|
+ date_of_employment_hij: new FormControl(null,Validators.required),
|
|
|
|
+ job_title_id: new FormControl(null),
|
|
|
|
+ specialization_id: new FormControl(null),
|
|
|
|
+ functional_number: new FormControl(null, Validators.required),
|
|
|
|
+ contract_type_id: new FormControl(null),
|
|
|
|
+ staff_id: new FormControl(null),
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -385,14 +473,19 @@ export class RegesterComponent implements OnInit {
|
|
onSubmittedForm() {
|
|
onSubmittedForm() {
|
|
|
|
|
|
this.changesSave = true;
|
|
this.changesSave = true;
|
|
- console.log(this.regesterForm);
|
|
|
|
const userDataRegester = this.regesterForm.value;
|
|
const userDataRegester = this.regesterForm.value;
|
|
- userDataRegester['date_of_employment_hij'] = userDataRegester['date_of_employment_hij'].year + '-' + userDataRegester['date_of_employment_hij'].month + '-' + userDataRegester['date_of_employment_hij'].day;
|
|
|
|
|
|
+ let joinJobDate;
|
|
|
|
+
|
|
|
|
+ if(userDataRegester['type'] == '0') {
|
|
|
|
+ userDataRegester['date_of_employment_hij'] = userDataRegester['date_of_employment_hij'].year + '-' + userDataRegester['date_of_employment_hij'].month + '-' + userDataRegester['date_of_employment_hij'].day;
|
|
|
|
+ joinJobDate = userDataRegester['date_of_employment_gre'].split('-')[0];
|
|
|
|
+ }
|
|
|
|
+
|
|
userDataRegester['identity_number'] = userDataRegester['identity_number'].toString();
|
|
userDataRegester['identity_number'] = userDataRegester['identity_number'].toString();
|
|
console.log('valueee' , userDataRegester);
|
|
console.log('valueee' , userDataRegester);
|
|
|
|
|
|
const birthDate = userDataRegester['birthday'].split('-')[0];
|
|
const birthDate = userDataRegester['birthday'].split('-')[0];
|
|
- const joinJobDate = userDataRegester['date_of_employment_gre'].split('-')[0];
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
if(this.checkChangeImage) {
|
|
if(this.checkChangeImage) {
|
|
@@ -400,71 +493,139 @@ export class RegesterComponent implements OnInit {
|
|
userDataRegester['photo_type'] = this.photoType[1];
|
|
userDataRegester['photo_type'] = this.photoType[1];
|
|
}
|
|
}
|
|
|
|
|
|
- const userData = this.regesterForm.value;
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ console.log(userDataRegester);
|
|
|
|
|
|
if(this.userProfileId) {
|
|
if(this.userProfileId) {
|
|
userDataRegester['id'] = this.userProfileId;
|
|
userDataRegester['id'] = this.userProfileId;
|
|
console.log('dataaaaaaaaaaaa', userDataRegester);
|
|
console.log('dataaaaaaaaaaaa', userDataRegester);
|
|
- if(this.regesterForm.get('password').value != this.regesterForm.get('password_confirmation').value){
|
|
|
|
- this.toastr.warning(' من فضلك , تأكد أن كلمه المورو نفس تأكيد كلمه المرور!');
|
|
|
|
- }else if(this.regesterForm.get('identity_number').value.substring(0,1) != 1 && this.regesterForm.get('identity_type_id').value == 1){
|
|
|
|
- this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 1');
|
|
|
|
- } else if(this.regesterForm.get('identity_number').value.substring(0,1) != 2 && this.regesterForm.get('identity_type_id').value == 3){
|
|
|
|
- this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 2');
|
|
|
|
- } else if(birthDate > joinJobDate) {
|
|
|
|
- this.toastr.warning('تارخ الميلاد أكبر من تاريخ التوظيف الميلادي !');
|
|
|
|
- } else if(this.regesterForm.get('phone').value.substring(0,2) != '05') {
|
|
|
|
- this.toastr.warning('رقم الجوال يجب أن يبدأ ب 05');
|
|
|
|
|
|
+ if(this.checkUserType == 1) {
|
|
|
|
+ //edit profile visitor submited
|
|
|
|
+ if(this.regesterForm.get('password').value != this.regesterForm.get('password_confirmation').value){
|
|
|
|
+ this.toastr.warning(' من فضلك , تأكد أن كلمه المورو نفس تأكيد كلمه المرور!');
|
|
|
|
+ }else if(this.regesterForm.get('identity_number').value.substring(0,1) != 1 && this.regesterForm.get('identity_type_id').value == 1){
|
|
|
|
+ this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 1');
|
|
|
|
+ } else if(this.regesterForm.get('identity_number').value.substring(0,1) != 2 && this.regesterForm.get('identity_type_id').value == 3){
|
|
|
|
+ this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 2');
|
|
|
|
+ } else if(this.regesterForm.get('phone').value.substring(0,2) != '05') {
|
|
|
|
+ this.toastr.warning('رقم الجوال يجب أن يبدأ ب 05');
|
|
|
|
+ } else {
|
|
|
|
+ this.userService.onEditProfile(userDataRegester).subscribe(
|
|
|
|
+ (responce) => {
|
|
|
|
+ console.log(responce);
|
|
|
|
+ this.toastr.success('تم التعديل بنجاح');
|
|
|
|
+ },
|
|
|
|
+ (error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ this.toastr.error('فشل التعديل');
|
|
|
|
+ if(error.error['error'].email) {
|
|
|
|
+ this.toastr.warning('الايميل تم التسجيل به من قبل !');
|
|
|
|
+ } else if(error.error['error'].identity_number) {
|
|
|
|
+ this.toastr.warning('رقم الهويه تم التسجيل به من قبل !');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- this.userService.onEditProfile(userDataRegester).subscribe(
|
|
|
|
- (responce) => {
|
|
|
|
- console.log(responce);
|
|
|
|
- this.toastr.success('تم التعديل بنجاح');
|
|
|
|
- },
|
|
|
|
- (error) => {
|
|
|
|
- console.log(error);
|
|
|
|
- this.toastr.error('فشل التعديل');
|
|
|
|
- if(error.error['error'].email) {
|
|
|
|
- this.toastr.warning('الايميل تم التسجيل به من قبل !');
|
|
|
|
- } else if(error.error['error'].identity_number) {
|
|
|
|
- this.toastr.warning('رقم الهويه تم التسجيل به من قبل !');
|
|
|
|
|
|
+ //edit profile employee submited
|
|
|
|
+ if(this.regesterForm.get('password').value != this.regesterForm.get('password_confirmation').value){
|
|
|
|
+ this.toastr.warning(' من فضلك , تأكد أن كلمه المورو نفس تأكيد كلمه المرور!');
|
|
|
|
+ }else if(this.regesterForm.get('identity_number').value.substring(0,1) != 1 && this.regesterForm.get('identity_type_id').value == 1){
|
|
|
|
+ this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 1');
|
|
|
|
+ } else if(this.regesterForm.get('identity_number').value.substring(0,1) != 2 && this.regesterForm.get('identity_type_id').value == 3){
|
|
|
|
+ this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 2');
|
|
|
|
+ } else if(birthDate > joinJobDate) {
|
|
|
|
+ this.toastr.warning('تارخ الميلاد أكبر من تاريخ التوظيف الميلادي !');
|
|
|
|
+ } else if(this.regesterForm.get('phone').value.substring(0,2) != '05') {
|
|
|
|
+ this.toastr.warning('رقم الجوال يجب أن يبدأ ب 05');
|
|
|
|
+ } else {
|
|
|
|
+ this.userService.onEditProfile(userDataRegester).subscribe(
|
|
|
|
+ (responce) => {
|
|
|
|
+ console.log(responce);
|
|
|
|
+ this.toastr.success('تم التعديل بنجاح');
|
|
|
|
+ },
|
|
|
|
+ (error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ this.toastr.error('فشل التعديل');
|
|
|
|
+ if(error.error['error'].email) {
|
|
|
|
+ this.toastr.warning('الايميل تم التسجيل به من قبل !');
|
|
|
|
+ } else if(error.error['error'].identity_number) {
|
|
|
|
+ this.toastr.warning('رقم الهويه تم التسجيل به من قبل !');
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
|
|
+
|
|
userDataRegester['photo'] = this.imageBase64;
|
|
userDataRegester['photo'] = this.imageBase64;
|
|
userDataRegester['photo_type'] = this.photoType[1];
|
|
userDataRegester['photo_type'] = this.photoType[1];
|
|
|
|
+
|
|
console.log('dataaaaaaaaaaaa', userDataRegester);
|
|
console.log('dataaaaaaaaaaaa', userDataRegester);
|
|
- if(this.regesterForm.get('password').value != this.regesterForm.get('password_confirmation').value){
|
|
|
|
- this.toastr.warning(' من فضلك تأكد أن كلمه المرور نفس تأكيد كلمه المرور !');
|
|
|
|
- } else if(userDataRegester['identity_number'].substring(0,1) != 1 && this.regesterForm.get('identity_type_id').value == 1){
|
|
|
|
- this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 1');
|
|
|
|
- } else if(userDataRegester['identity_number'].substring(0,1) != 2 && this.regesterForm.get('identity_type_id').value == 3){
|
|
|
|
- this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 2');
|
|
|
|
- } else if(birthDate > joinJobDate) {
|
|
|
|
- this.toastr.warning('تارخ الميلاد أكبر من تاريخ التوظيف الميلادي !');
|
|
|
|
- } else if(this.regesterForm.get('phone').value.substring(0,2) != '05') {
|
|
|
|
- this.toastr.warning('رقم الجوال يجب أن يبدأ ب 05');
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- this.authSer.signUp(userDataRegester).subscribe(
|
|
|
|
- (responce) => {
|
|
|
|
- console.log(responce);
|
|
|
|
- this.toastr.success('تم اضافتك بنجاح ، من فضلك سجل الدخول')
|
|
|
|
- this.router.navigate(['login']);
|
|
|
|
- },
|
|
|
|
- (error) => {
|
|
|
|
- console.log(error);
|
|
|
|
- if(error.error['error'].email) {
|
|
|
|
- this.toastr.warning('الايميل تم التسجيل به من قبل !');
|
|
|
|
- } else if(error.error['error'].identity_number) {
|
|
|
|
- this.toastr.warning('رقم الهويه تم التسجيل به من قبل !');
|
|
|
|
|
|
+ if(this.checkUserType == 1) {
|
|
|
|
+ //visitor added submited
|
|
|
|
+ if(this.regesterForm.get('password').value != this.regesterForm.get('password_confirmation').value){
|
|
|
|
+ this.toastr.warning(' من فضلك تأكد أن كلمه المرور نفس تأكيد كلمه المرور !');
|
|
|
|
+ } else if(this.imageBase64 == '') {
|
|
|
|
+ this.toastr.warning('قم بإختيار صوره شخصيه !');
|
|
|
|
+ } else if(this.regesterForm.get('phone').value.substring(0,2) != '05') {
|
|
|
|
+ this.toastr.warning('رقم الجوال يجب أن يبدأ ب 05');
|
|
|
|
+ } else if(userDataRegester['identity_number'].substring(0,1) != 1 && this.regesterForm.get('identity_type_id').value == 1){
|
|
|
|
+ this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 1');
|
|
|
|
+ } else if(userDataRegester['identity_number'].substring(0,1) != 2 && this.regesterForm.get('identity_type_id').value == 3){
|
|
|
|
+ this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 2');
|
|
|
|
+ } else {
|
|
|
|
+ this.authSer.signUp(userDataRegester).subscribe(
|
|
|
|
+ (responce) => {
|
|
|
|
+ console.log(responce);
|
|
|
|
+ this.toastr.success('تم اضافتك بنجاح ، من فضلك سجل الدخول')
|
|
|
|
+ this.router.navigate(['login']);
|
|
|
|
+ },
|
|
|
|
+ (error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ if(error.error['error'].email) {
|
|
|
|
+ this.toastr.warning('الايميل تم التسجيل به من قبل !');
|
|
|
|
+ } else if(error.error['error'].identity_number) {
|
|
|
|
+ this.toastr.warning('رقم الهويه تم التسجيل به من قبل !');
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //employee added submited
|
|
|
|
+ if(this.regesterForm.get('password').value != this.regesterForm.get('password_confirmation').value){
|
|
|
|
+ this.toastr.warning(' من فضلك تأكد أن كلمه المرور نفس تأكيد كلمه المرور !');
|
|
|
|
+ } else if(this.imageBase64 == '') {
|
|
|
|
+ this.toastr.warning('قم بإختيار صوره شخصيه !');
|
|
|
|
+ } else if(userDataRegester['identity_number'].substring(0,1) != 1 && this.regesterForm.get('identity_type_id').value == 1){
|
|
|
|
+ this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 1');
|
|
|
|
+ } else if(userDataRegester['identity_number'].substring(0,1) != 2 && this.regesterForm.get('identity_type_id').value == 3){
|
|
|
|
+ this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 2');
|
|
|
|
+ } else if(birthDate > joinJobDate) {
|
|
|
|
+ this.toastr.warning('تارخ الميلاد أكبر من تاريخ التوظيف الميلادي !');
|
|
|
|
+ } else if(this.regesterForm.get('phone').value.substring(0,2) != '05') {
|
|
|
|
+ this.toastr.warning('رقم الجوال يجب أن يبدأ ب 05');
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this.authSer.signUp(userDataRegester).subscribe(
|
|
|
|
+ (responce) => {
|
|
|
|
+ console.log(responce);
|
|
|
|
+ this.toastr.success('تم اضافتك بنجاح ، من فضلك سجل الدخول')
|
|
|
|
+ this.router.navigate(['login']);
|
|
|
|
+ },
|
|
|
|
+ (error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ if(error.error['error'].email) {
|
|
|
|
+ this.toastr.warning('الايميل تم التسجيل به من قبل !');
|
|
|
|
+ } else if(error.error['error'].identity_number) {
|
|
|
|
+ this.toastr.warning('رقم الهويه تم التسجيل به من قبل !');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|