You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.7 KiB
75 lines
2.7 KiB
// Angular imports
|
|
import { Injectable } from "@angular/core";
|
|
import { HttpClient } from "@angular/common/http";
|
|
import { USER_DETAILS_API } from "src/constants/apiConstants";
|
|
import { catchError } from "rxjs/operators";
|
|
import { handleError } from "src/app/shared/utilities/utils";
|
|
|
|
@Injectable({
|
|
providedIn: "root",
|
|
})
|
|
export class ScheduleAppointmentService {
|
|
additionalDetailsArr:any[] = [];
|
|
additonalDependent:string = '';
|
|
addDependentDetailsArr:any = [];
|
|
|
|
constructor(private http: HttpClient) {}
|
|
|
|
getUserDetails(body: any) {
|
|
let response;
|
|
try {
|
|
const saveURL = USER_DETAILS_API;
|
|
response = this.http
|
|
.post(saveURL, body)
|
|
.pipe(catchError(handleError<never>()));
|
|
} catch (error) {
|
|
response = error;
|
|
}
|
|
return response;
|
|
}
|
|
|
|
saveAdditionalDependentDetails(){
|
|
// this.additionalDetailsArr.push(data);
|
|
for(var i=0; i<this.addDependentDetailsArr.length; i++){
|
|
this.additonalDependent +=`<p>Name : ${this.addDependentDetailsArr[i]?.nameOfDependant}</p>
|
|
<p>Relation : ${this.addDependentDetailsArr[i]?.employeeRelation}</p>
|
|
<p>Age : ${this.addDependentDetailsArr[i]?.age}</p>
|
|
<p>Gender : ${this.addDependentDetailsArr[i]?.gender}</p>`;
|
|
}
|
|
return this.additonalDependent;
|
|
}
|
|
|
|
saveDependentDetails(data:any){
|
|
this.addDependentDetailsArr.push(data);
|
|
}
|
|
|
|
getDependentDetails(){
|
|
return this.addDependentDetailsArr;
|
|
}
|
|
|
|
sendMail(res: any) {
|
|
let str = `<html>
|
|
<body><div>
|
|
<p>Hi</p>
|
|
<p>I would like schedule an appointment for Annual Health Check-up. PFB my details and kindly confirm the appointment</p>
|
|
<p>Name : ${res.employeeName}</p>
|
|
<p>Ticket No : 98297</p>
|
|
<p>Level : ${res.level}</p>
|
|
<p>Package : ${res.eligiblePackage}</p>
|
|
<p>Date : ${res.preferredDate}</p>
|
|
<p>Age : </p>
|
|
<p>Hospital Name : ${res.hospitalName}</p>
|
|
<p>Additional Test Details : ${res.additonalTest}</p>
|
|
<p><b>Employee Contact details:</b></p>
|
|
<p>Email: pbpalwe@bajajauto.co.in</p>
|
|
<p>Mobile: ${res.contactNumber}</p>
|
|
<p><b>Additional Member</b></p>
|
|
<div>${this.saveAdditionalDependentDetails()}</div>
|
|
<p>Kindly confirm the date and reporting time for visiting the hospital.</p>
|
|
<p>Thanks & Regards<br>PRADIP PALWE<br>Bajaj Auto Ltd.<br>VP (HR)</p
|
|
</div>
|
|
</body></html>`;
|
|
console.log(str);
|
|
}
|
|
|
|
}
|