|
@@ -64,6 +64,7 @@ export class FormUserComponent implements OnInit {
|
|
|
checkUserType:number;
|
|
|
|
|
|
end:any;
|
|
|
+ higri_birth_date;
|
|
|
|
|
|
ngOnInit() {
|
|
|
this.spineer.show();
|
|
@@ -182,6 +183,8 @@ export class FormUserComponent implements OnInit {
|
|
|
this.userSer.onGetUserData(this.userID, 'editUs').subscribe(
|
|
|
(responce) => {
|
|
|
console.log('data user' , responce);
|
|
|
+
|
|
|
+
|
|
|
if(responce['user'].type == '0') {
|
|
|
this.signupForm.patchValue(
|
|
|
{
|
|
@@ -193,7 +196,7 @@ export class FormUserComponent implements OnInit {
|
|
|
password_confirmation: responce['user'].password_confirmation,
|
|
|
phone: responce['user'].phone,
|
|
|
gender: responce['user'].gender,
|
|
|
- birthday: responce['user'].birthday,
|
|
|
+ //birthday: responce['user'].birthday,
|
|
|
nationality_id: responce['user'].nationality_id,
|
|
|
date_of_employment_gre: responce['user'].date_of_employment_gre,
|
|
|
job_title_id: responce['user'].job_title_id,
|
|
@@ -216,7 +219,7 @@ export class FormUserComponent implements OnInit {
|
|
|
email: responce['user'].email,
|
|
|
phone: responce['user'].phone,
|
|
|
gender: responce['user'].gender,
|
|
|
- birthday: responce['user'].birthday,
|
|
|
+ //birthday: responce['user'].birthday,
|
|
|
nationality_id: responce['user'].nationality_id,
|
|
|
status: responce['user'].status,
|
|
|
identity_type_id: responce['user'].identity_type_id,
|
|
@@ -228,15 +231,22 @@ export class FormUserComponent implements OnInit {
|
|
|
this.urlImg = responce['user'].photo ? this.authSer.pathImg + responce['user'].photo : this.urlImg;
|
|
|
console.log(this.urlImg);
|
|
|
const date = responce['user'].date_of_employment_hij ? responce['user'].date_of_employment_hij.split('-') : '';
|
|
|
-
|
|
|
+ const birthday_val = responce['user'].birthday ? responce['user'].birthday.split('-') : '';
|
|
|
this.bindingDateSplit = {
|
|
|
'year': parseInt(date[0]),
|
|
|
'month': parseInt(date[1]),
|
|
|
'day': parseInt(date[2])
|
|
|
};
|
|
|
+
|
|
|
+ this.higri_birth_date = {
|
|
|
+ 'year': parseInt(birthday_val[0]),
|
|
|
+ 'month': parseInt(birthday_val[1]),
|
|
|
+ 'day': parseInt(birthday_val[2])
|
|
|
+ }
|
|
|
|
|
|
this.higriDateVal = responce['user'].date_of_employment_hij;
|
|
|
console.log(this.bindingDateSplit);
|
|
|
+ console.log('birth day => ', this.higri_birth_date);
|
|
|
|
|
|
this.getDepartment();
|
|
|
this.spineer.hide();
|
|
@@ -261,7 +271,7 @@ export class FormUserComponent implements OnInit {
|
|
|
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),
|
|
|
+ //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),
|
|
@@ -288,7 +298,7 @@ export class FormUserComponent implements OnInit {
|
|
|
password: new FormControl(null, [Validators.minLength(6)]),
|
|
|
phone: 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),
|
|
|
department_id: new FormControl(null, Validators.required),
|
|
|
nationality_id: new FormControl(null, Validators.required),
|
|
@@ -305,10 +315,17 @@ export class FormUserComponent implements OnInit {
|
|
|
}
|
|
|
|
|
|
//get value date from child component
|
|
|
- public getDate(date: any):void {
|
|
|
+ public getDate(date: any, type: string):void {
|
|
|
console.log( date);
|
|
|
- this.higriDateVal = date.year + '-' + date.month + '-' + date.day;
|
|
|
- console.log('higrii date', this.higriDateVal);
|
|
|
+ if(type == 'higri_birthDate'){
|
|
|
+ this.higri_birth_date = date.year + '-' + date.month + '-' + date.day;
|
|
|
+ console.log('higri_birth_date ', this.higri_birth_date);
|
|
|
+ } else if(type == 'higriEmployement') {
|
|
|
+ this.higriDateVal = date.year + '-' + date.month + '-' + date.day;
|
|
|
+ console.log('higrii date', this.higriDateVal);
|
|
|
+ } else {
|
|
|
+ console.log('no date is recieved !');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -320,6 +337,9 @@ export class FormUserComponent implements OnInit {
|
|
|
(responce) => {
|
|
|
console.log(responce);
|
|
|
this.departments = responce['departments'];
|
|
|
+ if(this.departments.length == 0) {
|
|
|
+ this.toastr.warning('لا يوجد أقسام بهذه الإداره !');
|
|
|
+ }
|
|
|
this.showDepart = true;
|
|
|
}
|
|
|
);
|
|
@@ -338,7 +358,7 @@ export class FormUserComponent implements OnInit {
|
|
|
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),
|
|
|
+ //birthday: new FormControl(null, Validators.required),
|
|
|
nationality_id: new FormControl(null, Validators.required),
|
|
|
phone: new FormControl(null, Validators.required),
|
|
|
status: new FormControl(null , Validators.required),
|
|
@@ -355,7 +375,7 @@ export class FormUserComponent implements OnInit {
|
|
|
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),
|
|
|
+ //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),
|
|
@@ -368,7 +388,9 @@ export class FormUserComponent implements OnInit {
|
|
|
staff_id: new FormControl(null),
|
|
|
});
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -381,13 +403,12 @@ export class FormUserComponent implements OnInit {
|
|
|
let birthDate;
|
|
|
if(userData['type'] == 0){
|
|
|
userData['date_of_employment_hij'] = this.higriDateVal;
|
|
|
- birthDate = userData['birthday'].split('-')[0];
|
|
|
+ birthDate = this.higri_birth_date;
|
|
|
+ userData['birthday'] = birthDate;
|
|
|
joinJopYear = userData['date_of_employment_gre'].split('-')[0];
|
|
|
console.log(joinJopYear);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if(this.checkChangeImage) {
|
|
|
userData['photo'] = this.imageBase64;
|
|
|
userData['photo_type'] = this.photoType[1];
|
|
@@ -401,8 +422,10 @@ export class FormUserComponent implements OnInit {
|
|
|
this.toastr.warning('من فضلك تأكد أن كلمه المرور هي نفس تأكيد كلمه المرور ');
|
|
|
this.checkSaveDisabled = false;
|
|
|
} else if(userData['date_of_employment_hij'] == "") {
|
|
|
- this.toastr.warning('من فضلك ، أدخل تاريخ التوظيف الهجري !');
|
|
|
- this.checkSaveDisabled = false;
|
|
|
+ this.toastr.warning('من فضلك ، أدخل تاريخ التوظيف الهجري !');
|
|
|
+ this.checkSaveDisabled = false;
|
|
|
+ } else if(!birthDate){
|
|
|
+ this.toastr.warning('من فضلك أدخل تاريخ الميلاد !');
|
|
|
} else if(this.signupForm.get('identity_number').value.substring(0,1) != 1 && this.signupForm.get('identity_type_id').value == 1){
|
|
|
this.toastr.warning('رقم الهويه يجب ان يبدأ ب رقم 1');
|
|
|
this.checkSaveDisabled = false;
|