From f418e7ab3d8125e8e3a66885086ab021731f6070 Mon Sep 17 00:00:00 2001 From: mashfiq Date: Tue, 4 Feb 2025 12:12:16 +0600 Subject: [PATCH] employee profile issues upon client requirement --- HRM.BO/HREmployee/HREmployee.cs | 8 +-- HRM.DA/DA/HREmployee/HREmployeeDA.cs | 8 +-- .../Service/HREmployee/HREmployeeService.cs | 4 +- .../academic-entry.component.ts | 18 +++++-- .../contact/contact.component.ts | 6 +-- .../employee-profile.component.html | 2 +- .../employee-profile.component.ts | 51 +++++++++++-------- .../general/general.component.ts | 4 +- 8 files changed, 62 insertions(+), 39 deletions(-) diff --git a/HRM.BO/HREmployee/HREmployee.cs b/HRM.BO/HREmployee/HREmployee.cs index 37c0921..5fc00d4 100644 --- a/HRM.BO/HREmployee/HREmployee.cs +++ b/HRM.BO/HREmployee/HREmployee.cs @@ -1309,8 +1309,8 @@ namespace HRM.BO #endregion //CGPA or Marks #region GPAOrMarks - private double _gpa; - public double GPAOrMarks + private double? _gpa; + public double? GPAOrMarks { get { return _gpa; } set { _gpa = value; } @@ -1319,8 +1319,8 @@ namespace HRM.BO //OutOf #region Property OutOf : double - private double _outOf; - public double OutOf + private double? _outOf; + public double? OutOf { get { return _outOf; } set { _outOf = value; } diff --git a/HRM.DA/DA/HREmployee/HREmployeeDA.cs b/HRM.DA/DA/HREmployee/HREmployeeDA.cs index d481f42..b05dcd4 100644 --- a/HRM.DA/DA/HREmployee/HREmployeeDA.cs +++ b/HRM.DA/DA/HREmployee/HREmployeeDA.cs @@ -588,8 +588,8 @@ namespace HRM.DA academic.ID, academic.EmployeeID, academic.EducationLevelID, DataReader.GetNullValue(academic.DisciplineID, 0), DataReader.GetNullValue(academic.InstitutionID, 0), DataReader.GetNullValue(academic.PassingYear), - DataReader.GetNullValue(academic.ClassOrDivision), academic.GPAOrMarks, academic.LastLevel, - academic.OutOf, DataReader.GetNullValue(academic.ResultTypeID, 0), + DataReader.GetNullValue(academic.ClassOrDivision), DataReader.GetNullValue(academic.GPAOrMarks), academic.LastLevel, + DataReader.GetNullValue(academic.OutOf), DataReader.GetNullValue(academic.ResultTypeID), DataReader.GetNullValue(academic.InstituteName), DataReader.GetNullValue(academic.EducationTypeID, 0), academic.PhotoPath, academic.DocSubmissionDate, academic.ProfileStatus); } @@ -602,8 +602,8 @@ namespace HRM.DA " where AcademicID =%n and EmployeeID =%n ", academic.EducationLevelID, DataReader.GetNullValue(academic.DisciplineID, 0), DataReader.GetNullValue(academic.InstitutionID, 0), DataReader.GetNullValue(academic.PassingYear), - DataReader.GetNullValue(academic.ClassOrDivision), academic.GPAOrMarks, academic.LastLevel, - academic.OutOf, DataReader.GetNullValue(academic.ResultTypeID, 0), + DataReader.GetNullValue(academic.ClassOrDivision), DataReader.GetNullValue(academic.GPAOrMarks), academic.LastLevel, + DataReader.GetNullValue(academic.OutOf), DataReader.GetNullValue(academic.ResultTypeID), DataReader.GetNullValue(academic.InstituteName), DataReader.GetNullValue(academic.EducationTypeID, 0), academic.PhotoPath, academic.DocSubmissionDate, academic.ProfileStatus, academic.ID, academic.EmployeeID); diff --git a/HRM.DA/Service/HREmployee/HREmployeeService.cs b/HRM.DA/Service/HREmployee/HREmployeeService.cs index daf95fc..e9f9459 100644 --- a/HRM.DA/Service/HREmployee/HREmployeeService.cs +++ b/HRM.DA/Service/HREmployee/HREmployeeService.cs @@ -596,8 +596,8 @@ namespace HRM.DA oEmpAcademic.ProfileStatus = (EnumProfileStatus)oReader.GetInt32("ProfileStatus", 0); oEmpAcademic.ResultTypeID = oReader.GetInt32("ResultTypeID", 0); - oEmpAcademic.GPAOrMarks = oReader.GetDouble("GPAOrMarks", 0); - oEmpAcademic.OutOf = oReader.GetDouble("OutOf", 0); + oEmpAcademic.GPAOrMarks = oReader.GetDouble("OutOf").HasValue ? oReader.GetDouble("GPAOrMarks") : null; + oEmpAcademic.OutOf = oReader.GetDouble("OutOf").HasValue ? oReader.GetDouble("OutOf") : null; oEmpAcademic.LastLevel = oReader.GetBoolean("LastLevel", false); oEmpAcademic.InstituteName = oReader.GetString("InstituteName"); oEmpAcademic.PhotoPath = oReader.GetString("PhotoPath"); diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/academic/academic-entry/academic-entry.component.ts b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/academic/academic-entry/academic-entry.component.ts index 33c3221..06299d9 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/academic/academic-entry/academic-entry.component.ts +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/academic/academic-entry/academic-entry.component.ts @@ -187,6 +187,16 @@ export class AcademicEntryComponent implements OnInit { // this.isGrade = false; // } } + + + let educationType = this.educationTypes.find(x => x.description.toLowerCase() == "academic"); + if (this.academic.id == 0 && educationType != undefined) { + this.academic.educationTypeID = educationType.id; + this.selectedEducationTypeID = this.academic.educationTypeID; + this.academic.examDate = new Date().getFullYear(); + this.academic.passingYear = new Date().getFullYear(); + this.selectEducationTypeEvent(educationType.id); + } } ); } @@ -285,7 +295,7 @@ export class AcademicEntryComponent implements OnInit { educationLevelPicker: ['', Validators.required], disciplinePicker: ['', Validators.required], institutionPicker: ['', Validators.required], - resultTypePicker: ['', Validators.required], + resultTypePicker: [''], examHeldOn: ['', Validators.required], passingYear: ['', Validators.required], gpaOrMarks: [''], @@ -304,11 +314,12 @@ export class AcademicEntryComponent implements OnInit { this.selectedResultTypeID = this.academic.resultTypeID; } public onSave(e): void { + debugger; this.academic.educationTypeID = this.selectedEducationTypeID; this.academic.educationLevelID = this.selectedEducationLevelID; this.academic.institutionID = this.selectedInstitutionID; this.academic.disciplineID = this.selectedDisciplineID; - this.academic.resultTypeID = this.selectedResultTypeID; + this.academic.resultTypeID = this.selectedResultTypeID != null ? this.selectedResultTypeID : 0; if (this.employeeService.hrEmployee.id === undefined || this.employeeService.hrEmployee.id === 0) { this.notificationService.showWarning('please select an employee'); this.onCancel(null); @@ -320,10 +331,9 @@ export class AcademicEntryComponent implements OnInit { return; } - this.academic.createdBy = 0; this.academic.employeeID = this.employeeService.hrEmployee.id; - this.academic.createdDate = new Date(this.academic.createdBy); this.academic.createdBy = 0; + this.academic.createdDate = new Date(); this.loadingPanelService.ShowLoadingPanel = true; this.employeeService.saveEmployeeAcademic(this.academic).subscribe( (resp) => { diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/contact/contact.component.ts b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/contact/contact.component.ts index aee7448..dd74c95 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/contact/contact.component.ts +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/contact/contact.component.ts @@ -104,10 +104,10 @@ export class ContactComponent implements OnInit { contactOfficialEmail: new FormControl(''), contactFax: new FormControl(''), - emergencyContactPerson: new FormControl('', Validators.required), - emergencyAddress: new FormControl('', Validators.required), + emergencyContactPerson: new FormControl(''), + emergencyAddress: new FormControl(''), emergencyLandPhone: new FormControl(''), - emergencyMobileNo: new FormControl('', Validators.required), + emergencyMobileNo: new FormControl(''), relation: new FormControl(''), presentPOInBangla: new FormControl(''), diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.html b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.html index 94af919..a8aa423 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.html +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.html @@ -27,7 +27,7 @@ - + diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.ts b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.ts index 0da1a2e..c9e8038 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.ts +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.ts @@ -1,16 +1,17 @@ -import {Component, OnInit} from '@angular/core'; -import {FormBuilder, FormGroup, Validators} from '@angular/forms'; -import {EmployeeServices} from '../../_services/employee/employee.service'; -import {empFileuploads, HrEmployee} from '../../_models/HREmployee/hrEmployee'; -import {SearchEmployee} from '../../_models/Employee/searchEmployee'; -import {DataTransferService} from '../../data.transfer.service'; -import {BasicService} from '../../_services/Basic/basic.service'; -import {enumEmpFileUploadType, EnumExtension, EnumGender, EnumStatus} from '../../_models/enums'; -import {EmpContact} from '../../_models/HREmployee/empContact'; -import {ApiService} from '../../app.api.service'; -import {loadingPanelService} from '../../hrm-loding panel/loding.panel.service'; -import {HRMNotificationService} from '../../app.notification.service'; -import {DomSanitizer} from '@angular/platform-browser'; +import { Component, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { EmployeeServices } from '../../_services/employee/employee.service'; +import { empFileuploads, HrEmployee } from '../../_models/HREmployee/hrEmployee'; +import { SearchEmployee } from '../../_models/Employee/searchEmployee'; +import { DataTransferService } from '../../data.transfer.service'; +import { BasicService } from '../../_services/Basic/basic.service'; +import { enumEmpFileUploadType, EnumExtension, EnumGender, EnumStatus } from '../../_models/enums'; +import { EmpContact } from '../../_models/HREmployee/empContact'; +import { ApiService } from '../../app.api.service'; +import { loadingPanelService } from '../../hrm-loding panel/loding.panel.service'; +import { HRMNotificationService } from '../../app.notification.service'; +import { DomSanitizer } from '@angular/platform-browser'; +import { Nationality } from '../nationality/nationality'; @Component({ selector: 'app-employee-profile', @@ -30,12 +31,13 @@ export class EmployeeProfileComponent implements OnInit { attachment: any; fileType = ''; isDisplay = false; + defaultNationality: Nationality; constructor(private fb: FormBuilder, - public employeeService: EmployeeServices, - public basicService: BasicService, - public dataTransferService: DataTransferService, public apiService: ApiService, - public loadingPanel: loadingPanelService, public notificationService: HRMNotificationService, - private sanitizer: DomSanitizer) { + public employeeService: EmployeeServices, + public basicService: BasicService, + public dataTransferService: DataTransferService, public apiService: ApiService, + public loadingPanel: loadingPanelService, public notificationService: HRMNotificationService, + private sanitizer: DomSanitizer) { this.employeeService.hrEmployee = new HrEmployee(); this.hrEmployeeProfile = new HrEmployee(); this.contact = new EmpContact(); @@ -261,6 +263,11 @@ export class EmployeeProfileComponent implements OnInit { this.employeeService.hrEmployee.passportExpDate = new Date(this.employeeService.hrEmployee.passportExpDate); this.employeeService.hrEmployee.passportIssueDate = new Date(this.employeeService.hrEmployee.passportIssueDate); } + else { + this.hrEmployeeProfile.birthDate = new Date(); + this.hrEmployeeProfile.joiningDate = new Date(); + this.hrEmployeeProfile.nationalityID = this.defaultNationality != null ? this.defaultNationality.id : null; + } this.employeeService.Employee_Get_Completed.next(this.hrEmployeeProfile); } @@ -292,12 +299,12 @@ export class EmployeeProfileComponent implements OnInit { this.contact = item; } - editHandler({dataItem}) { + editHandler({ dataItem }) { this.isDisplay = true; const item = dataItem as empFileuploads; this.attachment = item.fileData; const type = item.fileName.split('.').pop(); - if ( type === 'png' || type === 'jpg' || type === 'jpeg') { + if (type === 'png' || type === 'jpg' || type === 'jpeg') { this.fileType = 'image'; } else if (type === 'pdf') { @@ -308,5 +315,9 @@ export class EmployeeProfileComponent implements OnInit { onPopUpClose() { this.isDisplay = false; } + + defaultNationalityHandler(dataItem: Nationality) { + this.defaultNationality = dataItem; + } } diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts index cfedd67..4b25e67 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { DataTransferService } from '../../../data.transfer.service'; import { EmployeeServices } from '../../../_services/employee/employee.service'; @@ -126,6 +126,7 @@ export class GeneralComponent implements OnInit { permanentThanas: Thana[]; isAccessCard: boolean = false; + @Output() defaultNationalityHandler = new EventEmitter(); constructor(public employeeService: EmployeeServices, public basicService: BasicService, public notificationService: HRMNotificationService, @@ -179,6 +180,7 @@ export class GeneralComponent implements OnInit { this.defaultNationality = this.nationalities.find(x => x.description.toLowerCase() == "bangladeshi"); if (this.defaultNationality) { this.hrEmployee.nationalityID = this.defaultNationality.id; + this.defaultNationalityHandler.emit(this.defaultNationality); } } );