EchoTex_Payroll/HRM.UI/ClientApp/src/app/_services/employee/employee.service.ts

526 lines
21 KiB
TypeScript

import {Injectable} from '@angular/core';
import {HttpClient, HttpEvent, HttpRequest} from '@angular/common/http';
import {ApiService} from '../../app.api.service';
import {empFileuploads, HrEmployee} from '../../_models/HREmployee/hrEmployee';
import {SearchEmployee} from '../../_models/Employee/searchEmployee';
import {Observable, Subject} from 'rxjs';
import {Occupation} from '../../_models/HRBasic/occupation';
import {BasicService} from '../Basic/basic.service';
import {EducationLevel} from '../../_models/HRBasic/education-level';
import {TrainingType} from '../../_models/Basic/trainingType';
import {EducationType} from '../../_models/HRBasic/education-type';
import {NominationPurpose} from '../../_models/HRBasic/nomination-purpose';
import {Employee} from '../../_models/Employee/employee';
import {EmployeeBankAccount} from '../../_models/Employee/employeeBankAccount';
import {EmployeeCostCenter} from '../../_models/Employee/employeeCostCenter';
import {Relation} from '../../_models/HRBasic/relation';
import {Designation} from '../../_models/HRBasic/designation';
import {Country} from '../../_models/HRBasic/country';
import {NatureOfTraining} from '../../_models/Training/nature-of-training';
import {Institution} from '../../_models/HRBasic/institution';
import {ResultType} from '../../_models/HRBasic/result-type';
import {Discipline} from '../../_models/HRBasic/discipline';
import {EmployeeBasicInfo} from '../../_models/report/employee-basic-info';
import {EmployeeDetailInfo} from '../../_models/report/employeeDetailInfo';
import { EnumBankAccountType, enumEmpFileUploadType } from '../../_models/enums';
import { EmployeeConfirmation } from '../../_models/Payroll/EmployeeConfirmation';
import {EmpExperience} from '../../_models/HREmployee/empExperience';
import { AuthorizedPerson } from 'src/app/adhoc-feature/authorized-persons/authorizedPerson';
import { EmployeeCordinator } from '../../_models/Attendance/employeeCordinator';
@Injectable({
providedIn: 'root'
})
export class EmployeeServices {
baseUrl = ApiService.BASE_URL + 'Employee/';
hrEmployee: HrEmployee;
occupations: Occupation[];
educationLevels: EducationLevel[];
educationTypes: EducationType[];
trainingTypes: TrainingType[];
countries: Country[];
natureOfTrainings: NatureOfTraining[];
institutions: Institution[];
relations: Relation[];
designations: Designation[];
nominationPurposes: NominationPurpose[];
resultTypes: ResultType[];
disciplines: Discipline[];
Employee_Get_Completed: Subject<HrEmployee>;
constructor(public apiService: ApiService, basicService: BasicService,
private http: HttpClient) {
this.Employee_Get_Completed = new Subject<HrEmployee>();
}
getLoginEmployee() {
return this.apiService.httpGet<Employee>('/Employee/getLoginEmployee');
}
getSearchEmployee(params: any) {
return this.apiService.httpPost<SearchEmployee[]>('/Employee/getSearchEmployee', params);
}
getSearchEmployeeForCordinator(params: any) {
return this.apiService.httpPost<SearchEmployee[]>('/Employee/getSearchEmployeeForCordinator', params);
}
getSearchEmployeebyid(empid: number) {
return this.apiService.httpGet<SearchEmployee>('/Employee/getSearchEmployeebyid/' + empid);
}
getSearchEmpbyLoginid() {
return this.apiService.httpGet<SearchEmployee>('/Employee/getSearchEmpbyLoginid');
}
getMyTeamByLoginID() {
return this.apiService.httpGet<SearchEmployee[]>('/Employee/getMyTeamByLoginID');
}
getMyTeamByLoginIDForAttnReguApprove() {
return this.apiService.httpGet<SearchEmployee[]>('/Employee/getMyTeamByLoginIDForAttnReguApprove');
}
getSelectedSearchEmployees(empids: any) {
return this.apiService.httpPost<SearchEmployee[]>('/Employee/getSelectedSearchEmployees/', empids);
}
getSearchEmployeesByIDs(empids: number[]) {
return this.apiService.httpPost<SearchEmployee[]>('/Employee/getSearchEmployeesByIDs/', empids);
}
getEmpCodeName(code?: string, name?: string) {
let nname = this.apiService.getApiDefaultData(name);
let ncode = this.apiService.getApiDefaultData(code);
return this.apiService.httpGet<SearchEmployee[]>('/Employee/getEmpCodeName' + '/' + ncode + '/' + nname);
}
getEmpCodeNameForEmployeePickerInput(code?: string, name?: string) {
let nname = this.apiService.getApiDefaultData(name);
let ncode = this.apiService.getApiDefaultData(code);
return this.apiService.httpGet<SearchEmployee[]>('/Employee/getEmpCodeNameForEmployeePickerInput' + '/' + ncode + '/' + nname);
}
getEmployees() {
return this.apiService.httpGet(this.apiService.base_url + 'getemployees');
}
getLineManager(empId: number) {
return this.apiService.httpGet<Employee>('/Employee/getLineManager' + '/' + empId);
}
getByLineManager(empId: number) {
return this.apiService.httpGet<Employee>('/Employee/getByLineManager' + '/' + empId);
}
getHREmployeeID(empid: number) {
return this.apiService.httpGet<HrEmployee>('/Employee/getHREmployeeID' + '/' + empid);
// return this.http.post(this.baseUrl + 'getHREmployeeID', empid);
}
getEmployeeAttachments(empId: number) {
return this.apiService.httpGet<empFileuploads[]>('/Employee/getEmployeeAttachments' + '/' + empId);
}
getEmployeeAttachmentByType(empId: number, refId: number, type: enumEmpFileUploadType) {
return this.apiService.httpGet<empFileuploads>('/Employee/getEmployeeAttachmentByType' + '/' + empId + '/' + refId + '/' +
type);
}
getHREmployee() {
return this.apiService.httpGet<HrEmployee>('/Employee/getHREmployee');
}
getEmployeeByID(empID: number) {
return this.apiService.httpGet<Employee>('/Employee/getEmployeeByID' + '/' + empID);
}
getEmployeesByEmpIDs(data: any) {
return this.apiService.httpPost<Employee[]>('/Employee/getEmployeesByEmpIDs', data);
}
getEmployeeDetailByEmpIDs(data: any) {
return this.apiService.httpPost<Employee[]>('/Employee/getEmployeeDetailByEmpIDs', data);
}
getCurrentEmployee() {
return this.apiService.httpGet<Employee>('/Employee/getCurrentEmployee');
}
getEmployeeForDashboard() {
return this.apiService.httpGet<any>('/Employee/getEmployeeForDashboard');
}
getUserForLandingPage() {
return this.apiService.httpGet<any>('/Employee/getUserForLandingPage');
}
GetHolidayInfoForDashboard() {
return this.apiService.httpGet<any>('/Employee/GetHolidayInfoForDashboard');
}
saveEmployee(param: any) {
return this.apiService.httpPost<Employee>('/Employee/saveEmployee', param);
}
saveEmployeeList(param: any) {
return this.apiService.httpPost('/Employee/saveEmployeeList', param);
}
saveHrEmployee(param: any) {
return this.apiService.httpPost<HrEmployee>('/Employee/saveHrEmployee', param);
}
saveHrPersonalInfo(param: any) {
return this.apiService.httpPost<HrEmployee>('/Employee/saveHrPersonalInfo', param);
}
saveEmployeeContact(param: any) {
return this.apiService.httpPost<number>('/Employee/saveEmployeeContact', param);
}
saveEmployeeAcademic(param: any) {
return this.apiService.httpPost<number>('/Employee/saveEmployeeAcademic', param);
}
saveEmployeeSpouce(param: any) {
return this.apiService.httpPost<number>('/Employee/saveEmployeeSpouce', param);
}
saveExperience(param: any) {
return this.apiService.httpPost<number>('/Employee/saveExperience', param);
}
saveEmpNominee(param: any) {
return this.apiService.httpPost<number>('/Employee/saveEmpNominee', param);
}
DeleteEmpNominee(param: any) {
return this.apiService.httpPost<number>('/Employee/DeleteEmpNominee', param);
}
saveEployeeTraining(param: any) {
return this.apiService.httpPost<number>('/Employee/saveEployeeTraining', param);
}
saveEmployeechildren(param: any) {
return this.apiService.httpPost<number>('/Employee/saveEmployeechildren', param);
}
// Employee Bank Account
getBankAccountByEmpID(empid: number) {
return this.apiService.httpGet<EmployeeBankAccount[]>('/Employee/getBankAccountByEmpID/' + empid);
}
getBankAccountByEmpIDAndType(empid: number, acctountType: EnumBankAccountType) {
return this.apiService.httpGet<EmployeeBankAccount[]>('/Employee/getBankAccountByEmpIDAndType/' + empid + '/' + acctountType);
}
getAllBankAccount() {
return this.apiService.httpGet<EmployeeBankAccount[]>('/Employee/getAllBankAccount');
}
getBankAccountById(id: number) {
return this.apiService.httpGet<EmployeeBankAccount>('/Employee/getBankAccountById' + '/' + id);
}
getBankAccount(id: number, effectDate: Date, payrollTypeID: number) {
return this.apiService.httpGet<EmployeeBankAccount>('/Employee/getBankAccount' + '/' + id + '/' + effectDate + '/' + payrollTypeID);
}
getBankAccountByDate(param: any) {
return this.apiService.httpPost<EmployeeBankAccount[]>('/Employee/getBankAccountByDate', param);
}
saveBankAccount(params: any) {
return this.apiService.httpPost<number>('/Employee/saveBankAccount', params);
}
deleteBankAccount(empBankAccount: EmployeeBankAccount) {
return this.apiService.httpPost('/Employee/deleteBankAccount', empBankAccount);
}
// Employee Cost Center
getCostCenterById(id: number) {
return this.apiService.httpGet<EmployeeCostCenter>('/Employee/getCostCenterById' + '/' + id);
}
getAllEmployeeCostCenter() {
return this.apiService.httpGet<EmployeeCostCenter[]>('/Employee/getAllEmployeeCostCenter');
}
getCostCenterByEmpId(id: number) {
return this.apiService.httpGet<EmployeeCostCenter[]>('/Employee/getCostCenterByEmpId' + '/' + id);
}
getCostCenterByCCId(id: number) {
return this.apiService.httpGet<EmployeeCostCenter[]>('/Employee/getCostCenterByCCId' + '/' + id);
}
getCostCenterByEmpIdCCId(ccid: number, empId: number) {
return this.apiService.httpGet<EmployeeCostCenter[]>('/Employee/getCostCenterByEmpIdCCId' + '/' + ccid + '/' + empId);
}
saveCostCenter(params: any) {
return this.apiService.httpPost<EmployeeCostCenter>('/Employee/saveCostCenter', params);
}
saveCostCenterList(params: EmployeeCostCenter[]) {
return this.apiService.httpPost<EmployeeCostCenter[]>('/Employee/saveCostCenterList', params);
}
deleteCostCenterById(id: number) {
return this.apiService.httpPost('/Employee/saveCostCenterList', id);
}
getCostCenterByMonthStartEnd(start: Date, end: Date, payrollTypeId: number) {
return this.apiService.httpGet<EmployeeCostCenter[]>('/Employee/getCostCenterByMonthStartEnd' + '/' + start + '/'
+ end + '/' + payrollTypeId);
}
getCostCenter(costCenter: EmployeeCostCenter[], id: number) {
return this.apiService.httpGet<EmployeeCostCenter[]>('/Employee/getCostCenter' + '/' + costCenter + '/' + id);
}
GetEmployeeNotYetUser(payrollTypeid: number) {
return this.apiService.httpGet<SearchEmployee[]>('/Employee/GetEmployeeNotYetUser' + '/' + payrollTypeid);
}
// Hr DashBoard
getMaritalStats() {
return this.apiService.httpGet<any[]>('/Employee/getMaritalStats');
}
getEmployeeMaleAgeStat() {
return this.apiService.httpGet<any[]>('/Employee/getEmployeeMaleAgeStat');
}
getEmployeeFemaleAgeStat() {
return this.apiService.httpGet<any[]>('/Employee/getEmployeeFemaleAgeStat');
}
getChildStatMale() {
return this.apiService.httpGet<any[]>('/Employee/getChildStatMale');
}
getChildStatFemale() {
return this.apiService.httpGet<any[]>('/Employee/getChildStatFemale');
}
getChildrenCount() {
return this.apiService.httpGet<any[]>('/Employee/getChildrenCount');
}
getAcademicStat() {
return this.apiService.httpGet<any[]>('/Employee/getAcademicStat');
}
getProfileCompletePercentage() {
return this.apiService.httpGet<number>('/Employee/getProfileCompletePercentage');
}
getEmpBasicInfo(empIds: string) {
return this.apiService.httpGet<EmployeeBasicInfo[]>('/Employee/getEmpBasicInfo' + '/' + empIds);
}
getEmpDetailInfo(emps: SearchEmployee[]) {
return this.apiService.httpPost<EmployeeDetailInfo[]>('/Employee/getEmpDetailInfo', emps);
}
getCurrentHeadCount(departmentId: number, designationId: number, gradeId: number) {
return this.apiService.httpGet<number>('/Employee/getCurrentHeadCount' + '/' + departmentId + '/' + designationId + '/' + gradeId);
}
getAllEmployees(): Observable<Employee[]> {
return this.apiService.httpGet<Employee[]>('/Employee/getAllEmps');
}
deleteChildData(data: any) {
return this.apiService.httpPost('/Employee/deleteChildData', data);
}
uploadEmpFile(selectedFile: File, empid: number, referenceid: number, filetype: number):
Observable<HttpEvent<any>> {
const formData: FormData = new FormData();
formData.append('empfile', selectedFile);
formData.append('empid', String(empid));
formData.append('referenceid', String(referenceid));
formData.append('filetype', String(filetype));
const req = new HttpRequest('POST', `${this.apiService.base_url + '/'}Employee/uploadEmpFile`, formData, {
reportProgress: true,
responseType: 'json'
});
return this.http.request<any>(req);
}
uploadEmpFileInProfileUpdate(selectedFile: File, empid: number, referenceid: number, filetype: number, fileName: string):
Observable<HttpEvent<any>> {
const formData: FormData = new FormData();
formData.append('empfile', selectedFile);
formData.append('empid', String(empid));
formData.append('referenceid', String(referenceid));
formData.append('filetype', String(filetype));
formData.append('fileName', String(fileName));
const req = new HttpRequest('POST', `${this.apiService.base_url + '/'}Employee/uploadEmpFileInProfileUpdate`, formData, {
reportProgress: true,
responseType: 'json'
});
return this.http.request<any>(req);
}
GetuploadEmpFile(empid: number, referenceid: number, filetype: number):
Observable<HttpEvent<any>> {
return this.apiService.httpGet<any>('/Employee/GetuploadEmpFile' + '/' + empid + '/' + referenceid + '/' + filetype);
}
GetCompanyImage(): Observable<HttpEvent<any>>{
return this.apiService.httpGet<any>('/Employee/GetCompanyImage');
}
getUploadEmpFileInProfileUpdate(empid: number, referenceid: number, filetype: number):
Observable<HttpEvent<any>> {
return this.apiService.httpGet<any>('/Employee/getUploadEmpFileInProfileUpdate' + '/' + empid + '/' + referenceid + '/' + filetype);
}
GetPayrollTypeNameByLoginID(){
return this.apiService.httpGet<any>('/Employee/GetPayrollTypeNameByLoginID');
}
getDashBoardGraphData() {
return this.apiService.httpGet<any>('/Employee/getDashBoardGraphData');
}
getSelfServiceBasicData() {
return this.apiService.httpGet<any>('/Employee/getSelfServiceBasicData');
}
getNomineesForEss(employeeId: number) {
return this.apiService.httpGet<any>('/Employee/getNomineesForEss/' + employeeId);
}
getTrainingForEss(employeeId: number) {
return this.apiService.httpGet<any>('/Employee/getTrainingForEss/' + employeeId);
}
getSelfServiceContactData() {
return this.apiService.httpGet<any>('/Employee/getSelfServiceContactData');
}
getSelfServiceAcademic() {
return this.apiService.httpGet<any>('/Employee/getSelfServiceAcademic');
}
getEmpExperiences(empId: number) {
return this.apiService.httpGet<EmpExperience[]>('/Employee/getEmpExperiences/' + empId);
}
getSelfServiceFamilyInfo() {
return this.apiService.httpGet<any>('/Employee/getSelfServiceFamilyInfo');
}
getLandingPageData(isEmployee: number, isLeave: number, isAttendance: number) {
return this.apiService.httpGet<any>('/Employee/getLandingPageData/' + isEmployee + '/' + isLeave
+ '/' + isAttendance);
}
getOtEligibleEmployees() {
return this.apiService.httpGet<any[]>('/Employee/getOtEligibleEmployees/');
}
getEmployeeConfirmationData(param: any) {
return this.apiService.httpPost<EmployeeConfirmation[]>('/Employee/getEmployeeConfirmationData/', param);
}
getupcomingConfirmation(param: any) {
let datestr = this.apiService.getApiDateString(param);
return this.apiService.httpGet<any>('/Employee/getupcomingConfirmation/' + param);
}
deleteEmployeeConfirmationData(params: EmployeeConfirmation) {
return this.apiService.httpPost<EmployeeConfirmation>('/Employee/deleteEmployeeConfirmationData', params);
}
saveEmployeeConfirmationData(params: any) {
return this.apiService.httpPost<EmployeeConfirmation>('/Employee/saveEmployeeConfirmationData', params);
}
GetMyTeam(){
return this.apiService.httpGet<any[]>('/Employee/getMyTeam');
}
GetCordinatorTeam(){
return this.apiService.httpGet<any[]>('/Employee/GetCordinatorTeam');
}
GetLiveEmployee(){
return this.apiService.httpGet<any[]>('/Employee/getLiveEmployee');
}
GetEmpOrganogramInfo()
{
return this.apiService.httpGet<Employee[]>('/Employee/getEmpOrganogramInfo');
}
getEmpInfoForGateman(id: number)
{
return this.apiService.httpGet<any[]>('/Employee/getEmpInfoForGateman/' + id);
}
getMaternityLeaveEmployee(params : any): Observable<Employee[]> {
return this.apiService.httpPost<Employee[]>('/Employee/GetMaternityLeaveEmployee', params);
}
GetEmployeeByCoordinator(corID: number) {
return this.apiService.httpGet<EmployeeCordinator[]>('/Employee/GetEmployeeByCoordinator' + '/' + corID);
}
GetCoordinatorList() {
return this.apiService.httpGet<any>('/Employee/GetCoordinatorList');
}
DeleteEmpCoordinator(empCordinator: any) {
return this.apiService.httpPost('/Employee/deletecordinator', empCordinator);
}
deletecordinator
GetEmployeeByCoordinatorID() {
return this.apiService.httpGet<Employee[]>('/Employee/GetEmployeeByCoordinatorID');
}
GetLgoinCordinatorEmps() {
return this.apiService.httpGet<EmployeeCordinator[]>('/Employee/GetLgoinCordinatorEmps');
}
GetSchedulerData() {
return this.apiService.httpGet<any[]>('/Employee/GetSchedulerData');
}
GetSchedulerBasedOnType(params : any) {
return this.apiService.httpPost<any[]>('/Employee/GetSchedulerBasedOnType', params);
}
getAuthorizedPerson(): any {
return this.apiService.httpGet<AuthorizedPerson[]>('/Employee/getAuthorizedPerson');
}
getProfilePermission(): any {
return this.apiService.httpGet<string[]>('/Employee/getProfilePermission');
}
getDashboardAttnPermission(): any {
return this.apiService.httpGet<boolean>('/Employee/dashboardAttnRemoved');
}
gethnmdropdownactive(): any {
return this.apiService.httpGet<boolean>('/Employee/hnmdropdownactive');
}
generateEmployeeNo(): any {
return this.apiService.httpGet<string>('/Employee/generateEmployeeNo');
}
updateBanglaInformation(params : any) {
return this.apiService.httpPost('/Employee/updateBanglaInformation', params);
}
updateBanglaContactInformation(params : any) {
return this.apiService.httpPost('/Employee/updateBanglaContactInformation', params);
}
getPFExceptionData() {
return this.apiService.httpGet<any[]>('/Employee/getPFExceptionData');
}
updatePFExceptionData(params: any) {
return this.apiService.httpPost('/Employee/updatePFExceptionData', params);
}
deletePFExceptionById(id: number) {
return this.apiService.httpGet('/Employee/deletePFExceptionById'+'/'+id);
}
saveHnmEmployee(param: any) {
return this.apiService.httpPost<Employee>('/Employee/saveHnmEmployee', param);
}
getEmployeeByIDHNM(empID: number) {
return this.apiService.httpGet<Employee>('/Employee/getEmployeeByIDforHNM' + '/' + empID);
}
getSearchEmployeesByEmpIds(empIds: string) {
return this.apiService.httpGet<SearchEmployee[]>('/Employee/getSearchEmployeesByEmpIds/' + empIds);
}
getAllEmployeeNameAndNo() {
return this.apiService.httpGet<Employee[]>('/Employee/getAllEmployeeNameAndNo');
}
getEmployeeBasicInfo(empIds: string) {
return this.apiService.httpGet<EmployeeBasicInfo[]>('/Employee/GetEmployeeBasicInfo' + '/' + empIds);
}
}