|
@@ -1,3 +1,4 @@
|
|
|
|
+import { ViewChild, ElementRef } from '@angular/core';
|
|
import { Modal } from 'ngx-modialog/plugins/bootstrap';
|
|
import { Modal } from 'ngx-modialog/plugins/bootstrap';
|
|
import { Observable } from 'rxjs/Observable';
|
|
import { Observable } from 'rxjs/Observable';
|
|
import { AuthServiceService } from '../../shared/auth-service.service';
|
|
import { AuthServiceService } from '../../shared/auth-service.service';
|
|
@@ -15,6 +16,8 @@ const WEEKDAYS = ['ن', 'ث', 'ر', 'خ', 'ج', 'س', 'ح'];
|
|
const MONTHS = ['محرم', 'صفر', 'ربيع الأول', 'ربيع الآخر', 'جمادى الأولى', 'جمادى الآخرة', 'رجب', 'شعبان', 'رمضان', 'شوال',
|
|
const MONTHS = ['محرم', 'صفر', 'ربيع الأول', 'ربيع الآخر', 'جمادى الأولى', 'جمادى الآخرة', 'رجب', 'شعبان', 'رمضان', 'شوال',
|
|
'ذو القعدة', 'ذو الحجة'];
|
|
'ذو القعدة', 'ذو الحجة'];
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
@Injectable()
|
|
@Injectable()
|
|
export class IslamicI18n extends NgbDatepickerI18n {
|
|
export class IslamicI18n extends NgbDatepickerI18n {
|
|
getWeekdayShortName(weekday: number) {
|
|
getWeekdayShortName(weekday: number) {
|
|
@@ -96,6 +99,39 @@ export class RegesterComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ birthDate = {
|
|
|
|
+ year: '1410',
|
|
|
|
+ month: '1',
|
|
|
|
+ day: '1'
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ griDate: any = {
|
|
|
|
+ year: '1410',
|
|
|
|
+ month: '1',
|
|
|
|
+ day: '1'
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ higriYears:any = [];
|
|
|
|
+
|
|
|
|
+ higriMonth = [{name: 'محرم', value :"1"},
|
|
|
|
+ {name: 'صفر', value: '2'},
|
|
|
|
+ {name: 'ربيع الأول', value: '3'},
|
|
|
|
+ {name: 'ربيع الآخر', value: '4'},
|
|
|
|
+ {name: 'جمادى الأولى', value: '5'},
|
|
|
|
+ {name: 'جمادى الآخرة', value: '6'},
|
|
|
|
+ {name: 'رجب', value: '7'},
|
|
|
|
+ {name: 'شعبان', value: '8'},
|
|
|
|
+ {namee: 'رمضان', value: '9'},
|
|
|
|
+ {name: 'شوال', value: '10'},
|
|
|
|
+ {name: 'ذو القعدة', value: '11'},
|
|
|
|
+ {name: 'ذو الحجة', value: '12'}];
|
|
|
|
+
|
|
|
|
+ days: any = [];
|
|
|
|
+
|
|
|
|
+ @ViewChild('gerDate') gerDate: ElementRef;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
ngOnInit() {
|
|
ngOnInit() {
|
|
|
|
|
|
this.authSer.showSearchHeader = false;
|
|
this.authSer.showSearchHeader = false;
|
|
@@ -107,6 +143,18 @@ export class RegesterComponent implements OnInit {
|
|
|
|
|
|
this.typeTitle = 'تسجيل الدخول';
|
|
this.typeTitle = 'تسجيل الدخول';
|
|
|
|
|
|
|
|
+ //days array
|
|
|
|
+ for(let i = 1; i <= 31; i++) {
|
|
|
|
+ this.days.push(i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //higr years
|
|
|
|
+ for(let i = 1410; i < 1460; i++) {
|
|
|
|
+ this.higriYears.push(i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
this.route.params.subscribe(
|
|
this.route.params.subscribe(
|
|
(params:Params) => {
|
|
(params:Params) => {
|
|
this.userProfileId = params['idProfile'];
|
|
this.userProfileId = params['idProfile'];
|
|
@@ -131,12 +179,12 @@ export class RegesterComponent implements OnInit {
|
|
password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
phone: new FormControl(null, Validators.required),
|
|
phone: new FormControl(null, Validators.required),
|
|
gender: new FormControl(null, Validators.required),
|
|
gender: new FormControl(null, Validators.required),
|
|
- birthday: new FormControl(null, Validators.required),
|
|
|
|
|
|
+ //birthday: new FormControl(null, Validators.required),
|
|
adminstration_id: new FormControl(null, Validators.required),
|
|
adminstration_id: new FormControl(null, Validators.required),
|
|
department_id: new FormControl(null, Validators.required),
|
|
department_id: new FormControl(null, Validators.required),
|
|
nationality_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_gre: new FormControl(null, Validators.required),
|
|
- date_of_employment_hij: new FormControl(null,Validators.required),
|
|
|
|
|
|
+ //date_of_employment_hij: new FormControl(null,Validators.required),
|
|
job_title_id: new FormControl(null),
|
|
job_title_id: new FormControl(null),
|
|
specialization_id: new FormControl(null),
|
|
specialization_id: new FormControl(null),
|
|
functional_number: new FormControl(null, Validators.required),
|
|
functional_number: new FormControl(null, Validators.required),
|
|
@@ -256,7 +304,7 @@ export class RegesterComponent implements OnInit {
|
|
password: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
password: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
gender: new FormControl(null, Validators.required),
|
|
gender: new FormControl(null, Validators.required),
|
|
- birthday: new FormControl(null, Validators.required),
|
|
|
|
|
|
+ //birthday: new FormControl(null, Validators.required),
|
|
nationality_id: new FormControl(null, Validators.required),
|
|
nationality_id: new FormControl(null, Validators.required),
|
|
});
|
|
});
|
|
|
|
|
|
@@ -267,7 +315,7 @@ export class RegesterComponent implements OnInit {
|
|
identity_number: responce['user'].identity_number,
|
|
identity_number: responce['user'].identity_number,
|
|
email: responce['user'].email,
|
|
email: responce['user'].email,
|
|
gender: responce['user'].gender,
|
|
gender: responce['user'].gender,
|
|
- birthday: responce['user'].birthday,
|
|
|
|
|
|
+ //birthday: responce['user'].birthday,
|
|
nationality_id: responce['user'].nationality_id,
|
|
nationality_id: responce['user'].nationality_id,
|
|
phone: responce['user'].phone,
|
|
phone: responce['user'].phone,
|
|
});
|
|
});
|
|
@@ -289,12 +337,12 @@ export class RegesterComponent implements OnInit {
|
|
password_confirmation: new FormControl(null, [Validators.minLength(6)]),
|
|
password_confirmation: new FormControl(null, [Validators.minLength(6)]),
|
|
phone: new FormControl(null,Validators.required),
|
|
phone: new FormControl(null,Validators.required),
|
|
gender: new FormControl(null, Validators.required),
|
|
gender: new FormControl(null, Validators.required),
|
|
- birthday: new FormControl(null, Validators.required),
|
|
|
|
|
|
+ //birthday: new FormControl(null, Validators.required),
|
|
adminstration_id: new FormControl(null, Validators.required),
|
|
adminstration_id: new FormControl(null, Validators.required),
|
|
department_id: new FormControl(null, Validators.required),
|
|
department_id: new FormControl(null, Validators.required),
|
|
nationality_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_gre: new FormControl(null, Validators.required),
|
|
- date_of_employment_hij: new FormControl(null,Validators.required),
|
|
|
|
|
|
+ //date_of_employment_hij: new FormControl(null,Validators.required),
|
|
job_title_id: new FormControl(null),
|
|
job_title_id: new FormControl(null),
|
|
specialization_id: new FormControl(null),
|
|
specialization_id: new FormControl(null),
|
|
functional_number: new FormControl(null, Validators.required),
|
|
functional_number: new FormControl(null, Validators.required),
|
|
@@ -320,7 +368,7 @@ export class RegesterComponent implements OnInit {
|
|
position: responce['user'].position,
|
|
position: responce['user'].position,
|
|
phone: responce['user'].phone,
|
|
phone: responce['user'].phone,
|
|
gender: responce['user'].gender,
|
|
gender: responce['user'].gender,
|
|
- birthday: responce['user'].birthday,
|
|
|
|
|
|
+ //birthday: responce['user'].birthday,
|
|
adminstration_id: responce['user'].adminstration_id,
|
|
adminstration_id: responce['user'].adminstration_id,
|
|
department_id: responce['user'].department_id,
|
|
department_id: responce['user'].department_id,
|
|
nationality_id: responce['user'].nationality_id,
|
|
nationality_id: responce['user'].nationality_id,
|
|
@@ -331,7 +379,7 @@ export class RegesterComponent implements OnInit {
|
|
staff_id: responce['user'].staff_id,
|
|
staff_id: responce['user'].staff_id,
|
|
functional_number: responce['user'].functional_number,
|
|
functional_number: responce['user'].functional_number,
|
|
status: responce['user'].status,
|
|
status: responce['user'].status,
|
|
- date_of_employment_hij: this.bindingDateSplit, //responce['user'].date_of_employment_hij//
|
|
|
|
|
|
+ //date_of_employment_hij: this.bindingDateSplit, //responce['user'].date_of_employment_hij//
|
|
});
|
|
});
|
|
console.log(this.bindingDateSplit);
|
|
console.log(this.bindingDateSplit);
|
|
|
|
|
|
@@ -438,7 +486,7 @@ export class RegesterComponent implements OnInit {
|
|
password: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
password: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
gender: new FormControl(null, Validators.required),
|
|
gender: new FormControl(null, Validators.required),
|
|
- birthday: new FormControl(null, Validators.required),
|
|
|
|
|
|
+ //birthday: new FormControl(null, Validators.required),
|
|
nationality_id: new FormControl(null, Validators.required),
|
|
nationality_id: new FormControl(null, Validators.required),
|
|
phone: new FormControl(null, Validators.required),
|
|
phone: new FormControl(null, Validators.required),
|
|
});
|
|
});
|
|
@@ -454,12 +502,12 @@ export class RegesterComponent implements OnInit {
|
|
password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
password_confirmation: new FormControl(null, [Validators.required, Validators.minLength(6)]),
|
|
phone: new FormControl(null, Validators.required),
|
|
phone: new FormControl(null, Validators.required),
|
|
gender: new FormControl(null, Validators.required),
|
|
gender: new FormControl(null, Validators.required),
|
|
- birthday: new FormControl(null, Validators.required),
|
|
|
|
|
|
+ //birthday: new FormControl(null, Validators.required),
|
|
adminstration_id: new FormControl(null, Validators.required),
|
|
adminstration_id: new FormControl(null, Validators.required),
|
|
department_id: new FormControl(null, Validators.required),
|
|
department_id: new FormControl(null, Validators.required),
|
|
nationality_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_gre: new FormControl(null, Validators.required),
|
|
- date_of_employment_hij: new FormControl(null,Validators.required),
|
|
|
|
|
|
+ //date_of_employment_hij: new FormControl(null,Validators.required),
|
|
job_title_id: new FormControl(null),
|
|
job_title_id: new FormControl(null),
|
|
specialization_id: new FormControl(null),
|
|
specialization_id: new FormControl(null),
|
|
functional_number: new FormControl(null, Validators.required),
|
|
functional_number: new FormControl(null, Validators.required),
|
|
@@ -469,9 +517,50 @@ export class RegesterComponent implements OnInit {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
+ changeEployeeGre() {
|
|
|
|
+ console.log(this.gerDate.nativeElement.value);
|
|
|
|
+ const dateArray = this.gerDate.nativeElement.value.split('-');
|
|
|
|
+ console.log(dateArray);
|
|
|
|
+ const dateValConvertingSpliting = this.authSer.writeHijri(new Date(this.gerDate.nativeElement.value), 'ar', 'system').split(' ');
|
|
|
|
+
|
|
|
|
+ let dateValExisting: any = {
|
|
|
|
+ year : '',
|
|
|
|
+ month: '',
|
|
|
|
+ day: ''
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ if(dateValConvertingSpliting.length == 5){
|
|
|
|
+ const year = this.authSer.parseArabic(dateValConvertingSpliting[3]);
|
|
|
|
+ const day = this.authSer.parseArabic(dateValConvertingSpliting[0]);
|
|
|
|
+ dateValExisting.year = year;
|
|
|
|
+ dateValExisting.day = day;
|
|
|
|
+ } else {
|
|
|
|
+ const year = this.authSer.parseArabic(dateValConvertingSpliting[2]);
|
|
|
|
+ const day = this.authSer.parseArabic(dateValConvertingSpliting[0]);
|
|
|
|
+ dateValExisting.year = year;
|
|
|
|
+ dateValExisting.day = day;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ MONTHS.forEach((element, index) => {
|
|
|
|
+ if(dateValConvertingSpliting.length == 5){
|
|
|
|
+ if(element == dateValConvertingSpliting[1] + ' ' + dateValConvertingSpliting[2]) {
|
|
|
|
+ dateValExisting.month = index + 1
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if(element == dateValConvertingSpliting[1]) {
|
|
|
|
+ dateValExisting.month = index + 1
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ console.log(dateValConvertingSpliting);
|
|
|
|
+ console.log(dateValExisting);
|
|
|
|
+ this.griDate.year = dateValExisting.year;
|
|
|
|
+ this.griDate.month = dateValExisting.month;
|
|
|
|
+ this.griDate.day = parseInt(dateValExisting.day);
|
|
|
|
+ console.log(this.griDate);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
//submitted form
|
|
//submitted form
|
|
@@ -482,15 +571,15 @@ export class RegesterComponent implements OnInit {
|
|
let joinJobDate;
|
|
let joinJobDate;
|
|
|
|
|
|
if(userDataRegester['type'] == '0') {
|
|
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['birthday'] = userDataRegester['birthday'].year + '-' + userDataRegester['birthday'].month + '-' + userDataRegester['birthday'].day;
|
|
|
|
|
|
+ userDataRegester['date_of_employment_hij'] = this.griDate.year + '-' + this.griDate.month + '-' + this.griDate.day;
|
|
|
|
+ userDataRegester['birthday'] = this.birthDate.year + '-' + this.birthDate.month + '-' + this.birthDate.day;
|
|
|
|
+ } else {
|
|
|
|
+ userDataRegester['birthday'] = this.birthDate.year + '-' + this.birthDate.month + '-' + this.birthDate.day;
|
|
}
|
|
}
|
|
|
|
|
|
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];///to check if birthday > employment date
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -547,7 +636,7 @@ export class RegesterComponent implements OnInit {
|
|
this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 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){
|
|
} else if(this.regesterForm.get('identity_number').value.substring(0,1) != 2 && this.regesterForm.get('identity_type_id').value == 3){
|
|
this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 2');
|
|
this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 2');
|
|
- } else if(birthDate > joinJobDate) {
|
|
|
|
|
|
+ } else if(this.birthDate.year > this.griDate.year) {
|
|
this.toastr.warning('تارخ الميلاد أكبر من تاريخ التوظيف الميلادي !');
|
|
this.toastr.warning('تارخ الميلاد أكبر من تاريخ التوظيف الميلادي !');
|
|
} else if(this.regesterForm.get('phone').value.substring(0,2) != '05') {
|
|
} else if(this.regesterForm.get('phone').value.substring(0,2) != '05') {
|
|
this.toastr.warning('رقم الجوال يجب أن يبدأ ب 05');
|
|
this.toastr.warning('رقم الجوال يجب أن يبدأ ب 05');
|
|
@@ -611,7 +700,7 @@ export class RegesterComponent implements OnInit {
|
|
this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 1');
|
|
this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 1');
|
|
} else if(userDataRegester['identity_number'].substring(0,1) != 2 && this.regesterForm.get('identity_type_id').value == 3){
|
|
} else if(userDataRegester['identity_number'].substring(0,1) != 2 && this.regesterForm.get('identity_type_id').value == 3){
|
|
this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 2');
|
|
this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 2');
|
|
- } else if(birthDate > joinJobDate) {
|
|
|
|
|
|
+ } else if(this.birthDate.year > this.griDate.year) {
|
|
this.toastr.warning('تارخ الميلاد أكبر من تاريخ التوظيف الميلادي !');
|
|
this.toastr.warning('تارخ الميلاد أكبر من تاريخ التوظيف الميلادي !');
|
|
} else if(this.regesterForm.get('phone').value.substring(0,2) != '05') {
|
|
} else if(this.regesterForm.get('phone').value.substring(0,2) != '05') {
|
|
this.toastr.warning('رقم الجوال يجب أن يبدأ ب 05');
|
|
this.toastr.warning('رقم الجوال يجب أن يبدأ ب 05');
|
|
@@ -636,5 +725,6 @@ export class RegesterComponent implements OnInit {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|