|
@@ -16,7 +16,7 @@ import { ViewChild } from '@angular/core'
|
|
})
|
|
})
|
|
export class ContactComponent implements OnInit {
|
|
export class ContactComponent implements OnInit {
|
|
|
|
|
|
- @ViewChild(DataTableDirective, {static: false})
|
|
|
|
|
|
+ @ViewChild(DataTableDirective, { static: false })
|
|
dtElement: DataTableDirective;
|
|
dtElement: DataTableDirective;
|
|
|
|
|
|
|
|
|
|
@@ -47,10 +47,10 @@ export class ContactComponent implements OnInit {
|
|
contactList: any = [];
|
|
contactList: any = [];
|
|
contactList1: any = [];
|
|
contactList1: any = [];
|
|
|
|
|
|
- dtOptions= {};
|
|
|
|
|
|
+ dtOptions = {};
|
|
dtTrigger: Subject<any> = new Subject();
|
|
dtTrigger: Subject<any> = new Subject();
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
sucess_flag: boolean = false;
|
|
sucess_flag: boolean = false;
|
|
backtodvr_flag: boolean = false;
|
|
backtodvr_flag: boolean = false;
|
|
@@ -66,7 +66,7 @@ export class ContactComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
constructor(private commonservice: CommonFunctionService, private router: Router, private fb: FormBuilder) {
|
|
constructor(private commonservice: CommonFunctionService, private router: Router, private fb: FormBuilder) {
|
|
-
|
|
|
|
|
|
+
|
|
this.dtOptions = {
|
|
this.dtOptions = {
|
|
pagingType: 'full_numbers',
|
|
pagingType: 'full_numbers',
|
|
pageLength: 15,
|
|
pageLength: 15,
|
|
@@ -76,7 +76,7 @@ export class ContactComponent implements OnInit {
|
|
|
|
|
|
ordering: false,
|
|
ordering: false,
|
|
dom: 'Blfrtip',
|
|
dom: 'Blfrtip',
|
|
-
|
|
|
|
|
|
+
|
|
buttons: [
|
|
buttons: [
|
|
{
|
|
{
|
|
extend: 'print',
|
|
extend: 'print',
|
|
@@ -89,10 +89,10 @@ export class ContactComponent implements OnInit {
|
|
|
|
|
|
]
|
|
]
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
console.log("in contact");
|
|
console.log("in contact");
|
|
console.log(this.router.url);
|
|
console.log(this.router.url);
|
|
var url = this.router.url;
|
|
var url = this.router.url;
|
|
@@ -155,12 +155,12 @@ export class ContactComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
this.contactList = [];
|
|
this.contactList = [];
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
this.loginData.push(JSON.parse(localStorage.getItem("loginData")));
|
|
this.loginData.push(JSON.parse(localStorage.getItem("loginData")));
|
|
console.log("", this.loginData[0]["user_name"]);
|
|
console.log("", this.loginData[0]["user_name"]);
|
|
@@ -188,13 +188,13 @@ export class ContactComponent implements OnInit {
|
|
|
|
|
|
this.commonservice.getAllData(this.commonservice.projectpath + "/getcustcontactdetails?customer_id=0&passid=number").subscribe(response => {
|
|
this.commonservice.getAllData(this.commonservice.projectpath + "/getcustcontactdetails?customer_id=0&passid=number").subscribe(response => {
|
|
if (response.status == 'falsetoken') {
|
|
if (response.status == 'falsetoken') {
|
|
- this.router.navigate(['/login'])
|
|
|
|
- } else {
|
|
|
|
- this.contactList = response.data[0].conrtactData;
|
|
|
|
- console.log("aaaaaaaaaaa------------>", this.contactList);
|
|
|
|
- this.dtTrigger.next(this.dtOptions)
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ this.router.navigate(['/login'])
|
|
|
|
+ } else {
|
|
|
|
+ this.contactList = response.data[0].conrtactData;
|
|
|
|
+ console.log("aaaaaaaaaaa------------>", this.contactList);
|
|
|
|
+ this.dtTrigger.next(this.dtOptions)
|
|
|
|
+
|
|
|
|
+ }
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -208,7 +208,7 @@ export class ContactComponent implements OnInit {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
this.contactForm = new FormGroup({
|
|
this.contactForm = new FormGroup({
|
|
@@ -314,18 +314,29 @@ export class ContactComponent implements OnInit {
|
|
}
|
|
}
|
|
else if (response.data.length > 0) {
|
|
else if (response.data.length > 0) {
|
|
console.log("inside if(response.message== '') 99999999999")
|
|
console.log("inside if(response.message== '') 99999999999")
|
|
- this.backtodvr_flag = true;
|
|
|
|
- console.log("response.data[0].lastinsertedData", response.data[0].lastinsertedData);
|
|
|
|
- localStorage.setItem('contactlastinsert', response.data[0].lastinsertedData);
|
|
|
|
- this.openPopup();
|
|
|
|
- this.status_msg = "Success";
|
|
|
|
- this.error_msg = response.data[0].message;
|
|
|
|
- // console.log("response.data.message", response.data[0].exception.errorid);
|
|
|
|
- if (response.data[0].exception.errorid != '') {
|
|
|
|
|
|
+ if (response.data[0].createStatus == 1 && response.data[0].exception.errorid == 400) {
|
|
|
|
+ console.log("duplicate contact");
|
|
|
|
+ this.openPopup();
|
|
|
|
+ this.status_msg = "Warning";
|
|
|
|
+ this.error_msg = response.data[0].exception.errormessage;
|
|
|
|
+ }else{
|
|
|
|
+ this.backtodvr_flag = true;
|
|
|
|
+ console.log("response.data[0].lastinsertedData", response.data[0].lastinsertedData);
|
|
|
|
+ localStorage.setItem('contactlastinsert', response.data[0].lastinsertedData);
|
|
this.openPopup();
|
|
this.openPopup();
|
|
- this.status_msg = "Warning";
|
|
|
|
- this.error_msg = response.errors;
|
|
|
|
|
|
+ this.status_msg = "Success";
|
|
|
|
+ this.error_msg = response.data[0].message;
|
|
|
|
+ // console.log("response.data.message", response.data[0].exception.errorid);
|
|
|
|
+ if (response.data[0].exception.errorid != '') {
|
|
|
|
+ this.openPopup();
|
|
|
|
+ this.status_msg = "Warning";
|
|
|
|
+ this.error_msg = response.errors;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else if (response.data[0].createStatus == 1 && response.data[0].exception.errorid == 400) {
|
|
|
|
+ this.openPopup();
|
|
|
|
+ this.status_msg = "Warning";
|
|
|
|
+ this.error_msg = response.errors;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
this.status_msg = "";
|
|
this.status_msg = "";
|
|
@@ -415,26 +426,34 @@ export class ContactComponent implements OnInit {
|
|
}
|
|
}
|
|
else if (response.data.length > 0) {
|
|
else if (response.data.length > 0) {
|
|
console.log("inside if(response.message== '')222222222222 ")
|
|
console.log("inside if(response.message== '')222222222222 ")
|
|
- this.openPopup();
|
|
|
|
- this.status_msg = "Success";
|
|
|
|
- this.error_msg = response.data[0].message;
|
|
|
|
- this.checkfirstnm_flag = true;
|
|
|
|
- this.mySelect = "";
|
|
|
|
- this.contactForm = new FormGroup({
|
|
|
|
- first_name: new FormControl('', Validators.required),
|
|
|
|
- last_name: new FormControl('', Validators.required),
|
|
|
|
- mobile_number: new FormControl('', [Validators.required, Validators.maxLength(10)]),
|
|
|
|
- designation: new FormControl(null, Validators.required),
|
|
|
|
- email_Id: new FormControl('', Validators.required),
|
|
|
|
- department: new FormControl('', Validators.required),
|
|
|
|
- function: new FormControl('', Validators.required),
|
|
|
|
- })
|
|
|
|
- // console.log("response.data.message", response.data[0].exception.errorid);
|
|
|
|
- if (response.data[0].exception.errorid != '') {
|
|
|
|
|
|
+ if (response.data[0].createStatus == 1 && response.data[0].exception.errorid == 400) {
|
|
|
|
+ console.log("duplicate contact");
|
|
|
|
+ this.openPopup();
|
|
|
|
+ this.status_msg = "Warning";
|
|
|
|
+ this.error_msg = response.data[0].exception.errormessage;
|
|
|
|
+ } else {
|
|
this.openPopup();
|
|
this.openPopup();
|
|
- this.status_msg = "Warning";
|
|
|
|
- this.error_msg = response.errors;
|
|
|
|
|
|
+ this.status_msg = "Success";
|
|
|
|
+ this.error_msg = response.data[0].message;
|
|
|
|
+ this.checkfirstnm_flag = true;
|
|
|
|
+ this.mySelect = "";
|
|
|
|
+ this.contactForm = new FormGroup({
|
|
|
|
+ first_name: new FormControl('', Validators.required),
|
|
|
|
+ last_name: new FormControl('', Validators.required),
|
|
|
|
+ mobile_number: new FormControl('', [Validators.required, Validators.maxLength(10)]),
|
|
|
|
+ designation: new FormControl(null, Validators.required),
|
|
|
|
+ email_Id: new FormControl('', Validators.required),
|
|
|
|
+ department: new FormControl('', Validators.required),
|
|
|
|
+ function: new FormControl('', Validators.required),
|
|
|
|
+ })
|
|
|
|
+ // console.log("response.data.message", response.data[0].exception.errorid);
|
|
|
|
+ if (response.data[0].exception.errorid != '') {
|
|
|
|
+ this.openPopup();
|
|
|
|
+ this.status_msg = "Warning";
|
|
|
|
+ this.error_msg = response.errors;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
this.status_msg = "";
|
|
this.status_msg = "";
|
|
@@ -520,7 +539,7 @@ export class ContactComponent implements OnInit {
|
|
dtInstance.destroy();
|
|
dtInstance.destroy();
|
|
// Call the dtTrigger to rerender again
|
|
// Call the dtTrigger to rerender again
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+
|
|
console.log("data---->", value);
|
|
console.log("data---->", value);
|
|
console.log("customer_id", value.customer_id);
|
|
console.log("customer_id", value.customer_id);
|
|
|
|
|
|
@@ -542,7 +561,7 @@ export class ContactComponent implements OnInit {
|
|
this.router.navigate(['/login'])
|
|
this.router.navigate(['/login'])
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- this.dtTrigger.next(this.dtOptions)
|
|
|
|
|
|
+ this.dtTrigger.next(this.dtOptions)
|
|
|
|
|
|
//console.log("check length",response.data[0]);
|
|
//console.log("check length",response.data[0]);
|
|
if (response.data[0].getdvrDataStatus == '1') {
|
|
if (response.data[0].getdvrDataStatus == '1') {
|
|
@@ -577,7 +596,7 @@ export class ContactComponent implements OnInit {
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|