|
@@ -38,6 +38,16 @@ export class AddNewReportComponent implements OnInit {
|
|
|
disabledVal: boolean = true;
|
|
|
serviceId: number;
|
|
|
userId: number;
|
|
|
+ search: any;
|
|
|
+
|
|
|
+ reportAuthor = {
|
|
|
+ name: '',
|
|
|
+ identity_number: '',
|
|
|
+ functional_number: '',
|
|
|
+ phone: '',
|
|
|
+ id: null,
|
|
|
+ };
|
|
|
+
|
|
|
|
|
|
files = [{
|
|
|
title : null,
|
|
@@ -48,6 +58,7 @@ export class AddNewReportComponent implements OnInit {
|
|
|
|
|
|
dataForm = {
|
|
|
id_number: '',
|
|
|
+ user_id: null,
|
|
|
name : '',
|
|
|
phoneNum: '',
|
|
|
created_date : "",
|
|
@@ -61,9 +72,10 @@ export class AddNewReportComponent implements OnInit {
|
|
|
|
|
|
|
|
|
currentDate: any = Date.now();
|
|
|
+ departmentUserLoginId: number;
|
|
|
|
|
|
//higri date array
|
|
|
- month = ['محرم', 'صفر', 'ربيع الأول', 'ربيع الآخر', 'جمادى الأولى', 'جمادى الآخرة', 'رجب', 'Shaʻban', 'رمضان', 'شوال',
|
|
|
+ month = ['محرم', 'صفر', 'ربيع الأول', 'ربيع الآخر', 'جمادى الأولى', 'جمادى الآخرة', 'رجب', 'Shaʻban', 'Ramadan', 'شوال',
|
|
|
'ذو القعدة', 'ذو الحجة'];
|
|
|
|
|
|
|
|
@@ -146,7 +158,9 @@ export class AddNewReportComponent implements OnInit {
|
|
|
(responce) => {
|
|
|
this.dataForm.id_number = responce['user'].identity_number;
|
|
|
this.dataForm.name = responce['user'].name;
|
|
|
- this.dataForm.phoneNum = responce['user'].phone
|
|
|
+ this.dataForm.phoneNum = responce['user'].phone;
|
|
|
+ this.departmentUserLoginId = responce['user'].adminstration_id;
|
|
|
+ this.dataForm.user_id = responce['user'].id;
|
|
|
console.log('dsf',responce)
|
|
|
},
|
|
|
(error) => {console.log(error)},
|
|
@@ -201,6 +215,28 @@ export class AddNewReportComponent implements OnInit {
|
|
|
console.log(this.files);
|
|
|
console.log('files after change ',this.files);
|
|
|
}
|
|
|
+
|
|
|
+ //onSearchChange function
|
|
|
+ getValue() {
|
|
|
+ console.log(this.search);
|
|
|
+ this.http.get(this.authService.pathApi + '/find_user/' + this.search).subscribe(
|
|
|
+ (response) => {
|
|
|
+ console.log(response);
|
|
|
+ if(response['user'] != null) {
|
|
|
+ this.reportAuthor.name = response['user'].name;
|
|
|
+ this.reportAuthor.phone = response['user'].phone;
|
|
|
+ this.reportAuthor.identity_number = response['user'].identity_number;
|
|
|
+ this.reportAuthor.functional_number = response['user'].functional_number;
|
|
|
+ this.reportAuthor.id = response['user'].id;
|
|
|
+ } else {
|
|
|
+ this.toastr.warning('لا يوجد مستخدم')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (error) => {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
|
|
|
onSubmitted(){
|
|
|
for (let i = 0; i < this.files.length; i++) {
|
|
@@ -218,8 +254,6 @@ export class AddNewReportComponent implements OnInit {
|
|
|
delete this.files[i].nameFile;
|
|
|
this.dataForm.files.push(this.files[i]);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
if(!this.checked){
|
|
|
delete this.dataForm.id_number;
|
|
@@ -228,6 +262,10 @@ export class AddNewReportComponent implements OnInit {
|
|
|
if(this.dataForm.files.length == 0 ){
|
|
|
delete this.dataForm.files;
|
|
|
}
|
|
|
+
|
|
|
+ if(this.reportAuthor.id) {
|
|
|
+ this.dataForm.user_id = this.reportAuthor.id
|
|
|
+ }
|
|
|
console.log(this.dataForm);
|
|
|
this.http.post(this.authService.pathApi + '/add_communication' , this.dataForm )
|
|
|
.subscribe(
|