|
@@ -14,6 +14,12 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
|
styleUrls: ['./dvrentry.component.css']
|
|
|
})
|
|
|
export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
+ allowOnlyNumber(event: KeyboardEvent) {
|
|
|
+ const charCode = event.charCode;
|
|
|
+ if (charCode < 48 || charCode > 57) {
|
|
|
+ event.preventDefault();
|
|
|
+ }
|
|
|
+ }
|
|
|
public contactEntryForm !: FormGroup;
|
|
|
public xmlItems: any;
|
|
|
|
|
@@ -23,9 +29,11 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
last_login_date: any;
|
|
|
cust_data: any = [];
|
|
|
contact_data: any = [];
|
|
|
+ secondContact_Details: any = [];
|
|
|
stage_data: any = [];
|
|
|
currentDateData: any = [];
|
|
|
currentDateData_flag: boolean = false;
|
|
|
+ currentSecondContact: boolean = false;
|
|
|
cust_name: any;
|
|
|
messages: any;
|
|
|
cust_id: any;
|
|
@@ -51,8 +59,14 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
dvr_id: any;
|
|
|
role: any;
|
|
|
check_date: any;
|
|
|
-
|
|
|
+ est_Date: any;
|
|
|
+ objective: any;
|
|
|
+ deal: any;
|
|
|
nextstep: any;
|
|
|
+ postion: any;
|
|
|
+ person: any;
|
|
|
+ funcDetails: any = [];
|
|
|
+ personDetails: any = [];
|
|
|
|
|
|
checkupdatedelete: boolean;
|
|
|
saveautoData = [];
|
|
@@ -106,13 +120,25 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
this.check_date = response.data[0].created_on;
|
|
|
this.nextstep = response.data[0].nextstep;
|
|
|
this.second_contact = response.data[0].second_contact;
|
|
|
+ this.est_Date = response.data[0].est_Date;
|
|
|
+ this.objective = response.data[0].objective;
|
|
|
+ this.deal = response.data[0].deal;
|
|
|
+ this.postion = response.data[0].func;
|
|
|
+ this.person = response.data[0].person;
|
|
|
+ console.log("functinon::::::::::::::::::", this.contact_name)
|
|
|
+
|
|
|
+
|
|
|
//this.visit_date = datePipetransform(this.visit_date.now(),'dd/MM/yyyy');
|
|
|
this.visit_date = this.formatDate(this.visit_date);
|
|
|
this.check_date = this.formatDate(this.check_date);
|
|
|
+ this.est_Date = this.formatDate(this.est_Date);
|
|
|
+
|
|
|
|
|
|
this.visit_date = String(this.visit_date)
|
|
|
console.log(" this.visit_date", this.visit_date, this.customer_name, this.contact_name, this.stage_des);
|
|
|
console.log("in updatation");
|
|
|
+ this.est_Date = String(this.est_Date)
|
|
|
+
|
|
|
|
|
|
this.contactEntryForm = new FormGroup({
|
|
|
date: new FormControl(this.visit_date, Validators.required),
|
|
@@ -122,7 +148,15 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
stageName: new FormControl(this.stage_des, Validators.required),
|
|
|
ph_meet: new FormControl('yes', Validators.required),
|
|
|
nextstep: new FormControl(this.nextstep, Validators.required),
|
|
|
- secondContact: new FormControl(this.second_contact, Validators.required)
|
|
|
+ secondContact: new FormControl(this.second_contact, Validators.required),
|
|
|
+ estDate: new FormControl(this.est_Date, Validators.required),
|
|
|
+ objective: new FormControl(this.objective, Validators.required),
|
|
|
+ deal: new FormControl(this.deal, Validators.required),
|
|
|
+ postion: new FormControl(this.postion, Validators.required),
|
|
|
+ personData: new FormControl(this.person, Validators.required),
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
});
|
|
@@ -171,8 +205,12 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
stageName: new FormControl(null, Validators.required),
|
|
|
ph_meet: new FormControl('yes', Validators.required),
|
|
|
nextstep: new FormControl(null, Validators.required),
|
|
|
- secondContact: new FormControl(null, Validators.required)
|
|
|
-
|
|
|
+ secondContact: new FormControl(null, Validators.required),
|
|
|
+ estDate: new FormControl(null, Validators.required),
|
|
|
+ objective: new FormControl(null, Validators.required),
|
|
|
+ deal: new FormControl(null, Validators.required),
|
|
|
+ postion: new FormControl(null, Validators.required),
|
|
|
+ personData: new FormControl(null, Validators.required),
|
|
|
|
|
|
});
|
|
|
|
|
@@ -250,7 +288,8 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
this.contact_data = response.data[1].contactData;
|
|
|
console.log(" this.contact_data ", this.contact_data);
|
|
|
this.stage_data = response.data[2].stageData;
|
|
|
-
|
|
|
+ this.personDetails = response.data[3].personData;
|
|
|
+ this.funcDetails = response.data[4].funcDetails;
|
|
|
|
|
|
}
|
|
|
});
|
|
@@ -323,7 +362,11 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
stageName: new FormControl(this.stage_des, Validators.required),
|
|
|
nextstep: new FormControl(this.autofillData["nextstep"], Validators.required),
|
|
|
secondContact: new FormControl(this.second_contact, Validators.required),
|
|
|
-
|
|
|
+ estDate: new FormControl(this.autofillData["estDate"], Validators.required),
|
|
|
+ objective: new FormControl(this.autofillData["objective"], Validators.required),
|
|
|
+ deal: new FormControl(this.autofillData["deal"], Validators.required),
|
|
|
+ postion: new FormControl(this.postion, Validators.required),
|
|
|
+ personData: new FormControl(this.person, Validators.required),
|
|
|
|
|
|
});
|
|
|
}
|
|
@@ -363,7 +406,11 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
ph_meet: new FormControl(this.autofillData["ph_meet"], Validators.required),
|
|
|
nextstep: new FormControl(this.autofillData["nextstep"], Validators.required),
|
|
|
secondContact: new FormControl(this.second_contact, Validators.required),
|
|
|
-
|
|
|
+ estDate: new FormControl(this.autofillData["estDate"], Validators.required),
|
|
|
+ objective: new FormControl(this.autofillData["objective"], Validators.required),
|
|
|
+ deal: new FormControl(this.autofillData["deal"], Validators.required),
|
|
|
+ postion: new FormControl(this.autofillData["postion"], Validators.required),
|
|
|
+ personData: new FormControl(this.person, Validators.required),
|
|
|
|
|
|
});
|
|
|
}
|
|
@@ -378,6 +425,12 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
ngOnchanges() {
|
|
|
console.log("form.value.message", this.contactEntryForm);
|
|
|
+ this.secondContactDetails(this.contactEntryForm)
|
|
|
+ }
|
|
|
+
|
|
|
+ ngDoCheck() {
|
|
|
+ console.log("form.value.message", this.contactEntryForm);
|
|
|
+ this.secondContactDetails(this.contactEntryForm)
|
|
|
}
|
|
|
|
|
|
openPopup() {
|
|
@@ -434,11 +487,16 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
stage_id: this.stage_id,
|
|
|
updated_by: this.login_id,
|
|
|
nextstep: form.value.nextstep,
|
|
|
- second_contact: this.second_contact
|
|
|
+ second_contact: this.second_contact != null ? this.second_contact : '',
|
|
|
+ estDate: form.value.estDate,
|
|
|
+ objective: form.value.objective,
|
|
|
+ deal: form.value.deal,
|
|
|
+ postion: form.value.postion,
|
|
|
+ person: form.value.personData,
|
|
|
|
|
|
}
|
|
|
|
|
|
- console.log("createdvr", createdvr);
|
|
|
+ console.log("createdvr111", createdvr);
|
|
|
|
|
|
this.commonservice.updateData(this.commonservice.projectpath + "/updateDvrEntry", createdvr).subscribe(response => {
|
|
|
this.status_msg = "";
|
|
@@ -481,7 +539,7 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
//in insert
|
|
|
var createdvr;
|
|
|
console.log("this.stage_id", this.stage_id);
|
|
|
- console.log("this.second_contact",this.second_contact,form.value.secondContact);
|
|
|
+ console.log("this.second_contact", this.second_contact, form.value.secondContact);
|
|
|
|
|
|
if (this.stage_id == undefined) {
|
|
|
|
|
@@ -495,7 +553,12 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
stage_id: (form.value.stageName ? form.value.stageName.stage_id : ''),
|
|
|
created_by: this.login_id,
|
|
|
nextstep: form.value.nextstep,
|
|
|
- second_contact: (this.second_contact == undefined ? form.value.secondContact.first_name + ' ' + form.value.secondContact.last_name : this.second_contact),
|
|
|
+ second_contact: (form.value.secondContact == null ? '' : form.value.secondContact.first_name + form.value.secondContact.last_name),
|
|
|
+ estDate: form.value.estDate,
|
|
|
+ objective: form.value.objective,
|
|
|
+ deal: form.value.deal,
|
|
|
+ func: form.value.postion.func_name,
|
|
|
+ person: form.value.personData.person_name,
|
|
|
|
|
|
|
|
|
}
|
|
@@ -511,7 +574,13 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
stage_id: this.stage_id,
|
|
|
created_by: this.login_id,
|
|
|
nextstep: form.value.nextstep,
|
|
|
- second_contact: (this.second_contact == undefined ? form.value.secondContact.first_name + form.value.secondContact.last_name : this.second_contact),
|
|
|
+ second_contact: (form.value.secondContact == null ? '' : form.value.secondContact.first_name + form.value.secondContact.last_name),
|
|
|
+ estDate: form.value.estDate,
|
|
|
+ objective: form.value.objective,
|
|
|
+ deal: form.value.deal,
|
|
|
+ func: form.value.postion.func_name,
|
|
|
+ person: form.value.personData.person_name,
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|
|
@@ -519,6 +588,7 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
|
|
|
console.log("createdvr in insert", createdvr);
|
|
|
+ console.log("estDate", form.value.estDate);
|
|
|
console.log("yyyyyyyy", this.customer_name, form.value.custName, this.stage_id, form.value.stageName, this.username);
|
|
|
this.commonservice.getData(this.commonservice.projectpath + "/createDvrEntry", createdvr).subscribe(response => {
|
|
|
this.status_msg = "";
|
|
@@ -547,6 +617,8 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
this.contact_name = "";
|
|
|
this.stage_id = "";
|
|
|
this.stage_des = "";
|
|
|
+ this.postion = "";
|
|
|
+ this.person = "";
|
|
|
this.second_contact = "";
|
|
|
localStorage.removeItem("autofilldata")
|
|
|
this.contactEntryForm = new FormGroup({
|
|
@@ -557,7 +629,16 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
stageName: new FormControl(null, Validators.required),
|
|
|
ph_meet: new FormControl('yes', Validators.required),
|
|
|
nextstep: new FormControl(null, Validators.required),
|
|
|
- secondContact: new FormControl(null, Validators.required)
|
|
|
+ secondContact: new FormControl(null, Validators.required),
|
|
|
+ estDate: new FormControl(null, Validators.required),
|
|
|
+ objective: new FormControl(null, Validators.required),
|
|
|
+ deal: new FormControl(null, Validators.required),
|
|
|
+ postion: new FormControl(null, Validators.required),
|
|
|
+ personData: new FormControl(null, Validators.required),
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
// console.log("response.data.message", response.data[0].exception.errorid);
|
|
|
if (response.data[0].exception.errorid != '') {
|
|
@@ -609,6 +690,8 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
this.stage_id = "";
|
|
|
this.stage_des = "";
|
|
|
this.second_contact = "";
|
|
|
+ this.postion = "";
|
|
|
+ this.person = "";
|
|
|
this.contactEntryForm = new FormGroup({
|
|
|
date: new FormControl(null, Validators.required),
|
|
|
message: new FormControl(null, Validators.required),
|
|
@@ -617,7 +700,16 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
stageName: new FormControl(null, Validators.required),
|
|
|
ph_meet: new FormControl('yes', Validators.required),
|
|
|
nextstep: new FormControl(null, Validators.required),
|
|
|
- secondContact: new FormControl(null, Validators.required)
|
|
|
+ secondContact: new FormControl(null, Validators.required),
|
|
|
+ estDate: new FormControl(null, Validators.required),
|
|
|
+ objective: new FormControl(null, Validators.required),
|
|
|
+ deal: new FormControl(null, Validators.required),
|
|
|
+ postion: new FormControl(null, Validators.required),
|
|
|
+ personData: new FormControl(null, Validators.required),
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -785,9 +877,9 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
this.contact_name = "";
|
|
|
this.stage_id = "";
|
|
|
this.stage_des = "";
|
|
|
+ this.postion = "";
|
|
|
+ this.person = "";
|
|
|
localStorage.removeItem("contactlastinsert")
|
|
|
-
|
|
|
-
|
|
|
localStorage.removeItem("autofilldata")
|
|
|
this.contactEntryForm = new FormGroup({
|
|
|
date: new FormControl(null, Validators.required),
|
|
@@ -797,7 +889,16 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
stageName: new FormControl(null, Validators.required),
|
|
|
ph_meet: new FormControl('yes', Validators.required),
|
|
|
nextstep: new FormControl(null, Validators.required),
|
|
|
- secondContact: new FormControl(null, Validators.required)
|
|
|
+ secondContact: new FormControl(null, Validators.required),
|
|
|
+ estDate: new FormControl(null, Validators.required),
|
|
|
+ objective: new FormControl(null, Validators.required),
|
|
|
+ deal: new FormControl(null, Validators.required),
|
|
|
+ postion: new FormControl(null, Validators.required),
|
|
|
+ personData: new FormControl(null, Validators.required),
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
//this.router.navigate(['/home'])
|
|
|
// console.log("response.data.message", response.data[0].exception.errorid);
|
|
@@ -813,4 +914,46 @@ export class DvrEntryComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ secondContactDetails(form: FormGroup) {
|
|
|
+ // console.log("form value", form.value);
|
|
|
+ if (form.value.contactName != null) {
|
|
|
+ console.log("first contact is present")
|
|
|
+ console.log("email", form.value.contactName.email_id)
|
|
|
+ if (form.value.contactName.email_id != null) {
|
|
|
+ this.secondContact_Details = this.contact_data.filter((item: { email_id: any; }) => item.email_id != form.value.contactName.email_id)
|
|
|
+ console.log("contact dataqqqqqqqqqqqqqqqqqqq", this.contact_data)
|
|
|
+ this.currentSecondContact = true;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.currentSecondContact = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ console.log("first contact is not present")
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ funcPersonDetails(form: FormGroup) {
|
|
|
+ console.log("form value", form.value);
|
|
|
+ if (form.value.postion != null) {
|
|
|
+ console.log("postion", form.value.postion)
|
|
|
+ this.commonservice.getAllData(this.commonservice.projectpath + "/mappingFuncIDToPersonNames?func_id=" + form.value.postion.func_id).subscribe(response => {
|
|
|
+ if (response.status == 'falsetoken') {
|
|
|
+ this.router.navigate(['/login'])
|
|
|
+ } else {
|
|
|
+ console.log("response:::::::::::::::::::::::::::::::::::::::::::::::::", response.data)
|
|
|
+ this.personDetails = response.data;
|
|
|
+ console.log("personDetails------------>", this.personDetails);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ } else {
|
|
|
+ console.log(" func_id is not present")
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|