long profile issues

This commit is contained in:
mashfiq 2025-07-24 14:35:20 +06:00
parent 748988bcc6
commit 4b26cda07a
8 changed files with 164 additions and 41 deletions

View File

@ -504,7 +504,7 @@ export class EmployeeServices {
return this.apiService.httpPost('/Employee/updateBanglaInformation', params); return this.apiService.httpPost('/Employee/updateBanglaInformation', params);
} }
updateBanglaContactInformation(params : any) { updateBanglaContactInformation(params : any) {
return this.apiService.httpPost('/Employee/updateBanglaContactInformation', params); return this.apiService.httpPost<number>('/Employee/updateBanglaContactInformation', params);
} }
getPFExceptionData() { getPFExceptionData() {
return this.apiService.httpGet<any[]>('/Employee/getPFExceptionData'); return this.apiService.httpGet<any[]>('/Employee/getPFExceptionData');

View File

@ -35,6 +35,7 @@ import { TextBoxModule } from "@progress/kendo-angular-inputs";
import { LabelModule } from "@progress/kendo-angular-label"; import { LabelModule } from "@progress/kendo-angular-label";
import { FloatingLabelModule } from "@progress/kendo-angular-label"; import { FloatingLabelModule } from "@progress/kendo-angular-label";
import { IconsModule } from "@progress/kendo-angular-icons"; import { IconsModule } from "@progress/kendo-angular-icons";
import { UploadModule } from '@progress/kendo-angular-upload';
import { ReactiveFormsModule, FormsModule } from '@angular/forms'; import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { TabViewModule } from 'primeng/tabview'; import { TabViewModule } from 'primeng/tabview';
@ -129,7 +130,8 @@ import { HallOfFameUploaderComponent } from './hall-of-fame-uploader/hall-of-fam
IconsModule, IconsModule,
LabelModule, LabelModule,
PanelModule, PanelModule,
CardManagemnetModule CardManagemnetModule,
UploadModule
], ],
declarations: [ declarations: [
NationalityComponent, NationalityComponent,

View File

@ -45,8 +45,9 @@ export class ContactComponent implements OnInit {
this.basicService.getAllDistricts().subscribe((resp) => { this.basicService.getAllDistricts().subscribe((resp) => {
this.districts = resp; this.districts = resp;
}, },
() => { (err: any) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notificationService.showError(err.error);
}, },
() => { () => {
@ -58,8 +59,9 @@ export class ContactComponent implements OnInit {
this.basicService.getAllThanas(value).subscribe((resp) => { this.basicService.getAllThanas(value).subscribe((resp) => {
this.permanentThanas = resp; this.permanentThanas = resp;
}, },
() => { (err: any) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notificationService.showError(err.error);
}, },
() => { () => {
@ -71,8 +73,9 @@ export class ContactComponent implements OnInit {
this.basicService.getAllThanas(value).subscribe((resp) => { this.basicService.getAllThanas(value).subscribe((resp) => {
this.presentThanas = resp; this.presentThanas = resp;
}, },
() => { (err: any) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notificationService.showError(err.error);
}, },
() => { () => {
@ -135,7 +138,8 @@ export class ContactComponent implements OnInit {
} }
}, },
(err: any) => { (err: any) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notificationService.showError(err.error);
}, },
() => { () => {
if (this.employeeService.hrEmployee.id != undefined && this.employeeService.hrEmployee.id != 0) { if (this.employeeService.hrEmployee.id != undefined && this.employeeService.hrEmployee.id != 0) {
@ -147,7 +151,9 @@ export class ContactComponent implements OnInit {
this.basicService.getAllRelations().subscribe((resp) => { this.basicService.getAllRelations().subscribe((resp) => {
this.relations = resp; this.relations = resp;
}, },
() => { (err) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notificationService.showError(err.error);
}, },
() => { () => {
@ -186,8 +192,9 @@ export class ContactComponent implements OnInit {
(resp) => { (resp) => {
this.contact.id = resp; this.contact.id = resp;
}, },
() => { (err) => {
this.loadingPanel.ShowLoadingPanel = false; this.loadingPanel.ShowLoadingPanel = false;
this.notificationService.showError(err.error);
}, },
() => { () => {
this.loadingPanel.ShowLoadingPanel = false; this.loadingPanel.ShowLoadingPanel = false;
@ -222,8 +229,9 @@ export class ContactComponent implements OnInit {
this.presentThanas = resp; this.presentThanas = resp;
this.contact.presentThanaID = this.contact.permanentThanaID; this.contact.presentThanaID = this.contact.permanentThanaID;
}, },
() => { (err) => {
this.loadingPanel.ShowLoadingPanel = false;
this.notificationService.showError(err.error);
}, },
() => { () => {

View File

@ -40,8 +40,9 @@ export class EmployeeProfileComponent implements OnInit {
activeIndex: number = 0; activeIndex: number = 0;
previousIndex: number = 0; // 👈 track the previous tab index manually previousIndex: number = 0; // 👈 track the previous tab index manually
@ViewChild('general') generalComponent!: GeneralComponent; @ViewChild('general') generalComponent!: GeneralComponent;
@ViewChild('Contact') contactComponent!: ContactComponent; @ViewChild('contact') contactComponent!: ContactComponent;
newEmpSaved: boolean = false; newEmpSaved: boolean = false;
newEmpContactSaved: boolean = false;
constructor(private fb: FormBuilder, constructor(private fb: FormBuilder,
@ -351,7 +352,7 @@ export class EmployeeProfileComponent implements OnInit {
setTimeout(() => { setTimeout(() => {
if (this.generalComponent.personalInfo.valid === false && this.generalComponent.hrEmployee.employeeNo === '') { if (this.generalComponent != undefined && this.generalComponent.personalInfo.valid === false && this.generalComponent.hrEmployee.employeeNo === '') {
this.notificationService.showError('Required Fields Can\'t Be Empty'); this.notificationService.showError('Required Fields Can\'t Be Empty');
this.activeIndex = currentIndex; this.activeIndex = currentIndex;
this.previousIndex = currentIndex; this.previousIndex = currentIndex;
@ -362,30 +363,57 @@ export class EmployeeProfileComponent implements OnInit {
return; return;
}); });
} }
if (currentTab.header.toLowerCase() == 'contacts') { if (currentTab.header.toLowerCase() == 'contacts' && !this.newEmpContactSaved) {
debugger setTimeout(() => {
// this.contactComponent.ngOnInit();
if (!this.contactComponent.contactForm.valid) {
this.notificationService.showWarning('Must Entry field can\'t be Empty');
this.activeIndex = currentIndex;
this.previousIndex = currentIndex;
return;
}
this.contactComponent.SaveContact();
this.newEmpContactSaved = true;
return;
});
} }
} }
if (currentTab.header.toLowerCase() == 'general') {
if (this.generalComponent != undefined && this.contactComponent != undefined) {
if (this.generalComponent.contact.id == 0) {
console.log('Previous Tab:', currentIndex, currentTab.header); this.contactComponent.contact.id = this.generalComponent.contact.id;
console.log('Next Tab:', nextIndex, nextTab.header); }
if (this.generalComponent.contact.presentPOInBangla != null && this.generalComponent.contact.presentPOInBangla != "") {
// // Example validation logic on current tab before switching this.contactComponent.contact.presentPOInBangla = this.generalComponent.contact.presentPOInBangla;
// if (currentIndex === 0 && this.form1.invalid) { }
// this.form1.markAllAsTouched(); if (this.generalComponent.contact.presentAddressInBangla != null && this.generalComponent.contact.presentAddressInBangla != "") {
// setTimeout(() => (this.activeIndex = currentIndex)); // cancel switch this.contactComponent.contact.presentAddressInBangla = this.generalComponent.contact.presentAddressInBangla;
// return; }
// } if (this.generalComponent.contact.parmanentPOInBangla != null && this.generalComponent.contact.parmanentPOInBangla != "") {
this.contactComponent.contact.parmanentPOInBangla = this.generalComponent.contact.parmanentPOInBangla;
// if (currentIndex === 1 && this.form2.invalid) { }
// this.form2.markAllAsTouched(); if (this.generalComponent.contact.permanentAddressInBangla != null && this.generalComponent.contact.permanentAddressInBangla != "") {
// setTimeout(() => (this.activeIndex = currentIndex)); // cancel switch this.contactComponent.contact.permanentAddressInBangla = this.generalComponent.contact.permanentAddressInBangla;
// return; }
// } }
}
if (nextTab.header.toLowerCase() == 'attachments') {
debugger;
this.employeeService.getEmployeeAttachments(this.selectedEmployee.employeeID)
.subscribe(
(resp) => {
this.attachments = resp;
},
(x) => {
console.log(x);
this.loadingPanel.ShowLoadingPanel = false;
},
() => {
this.loadingPanel.ShowLoadingPanel = false;
this.hrEmployeeProfile.attachments = this.attachments;
}
);
}
// ✅ Save current as previous after successful switch // ✅ Save current as previous after successful switch
this.previousIndex = nextIndex; this.previousIndex = nextIndex;
} }

View File

@ -260,8 +260,11 @@
<!-- [readonly]="!active" --> <!-- [readonly]="!active" -->
<button class="k-button k-primary" kendoButton icon="k-i-attachment-45 k-i-clip-45" <button class="k-button k-primary" kendoButton icon="k-i-attachment-45 k-i-clip-45"
style="width: 15.5%; vertical-align: bottom; padding: 16px;" style="width: 15.5%; vertical-align: bottom; padding: 16px;"
(click)="popUpAttachment('NID')"></button> (click)="popUpAttachment('NID')" [disabled]="!active"></button>
<!-- [disabled]="!active" --> <!-- <input [(ngModel)]="NIDFiles" (change)="selectFileNationalId($event)" type="file" pInputText
style="width: 100%;padding: 5px;margin:5px 0;"> -->
<!-- <kendo-upload [saveUrl]="uploadSaveUrl" [removeUrl]="uploadRemoveUrl">
</kendo-upload> -->
</div> </div>
<div class="p-col-12 p-md-12 p-lg-4"> <div class="p-col-12 p-md-12 p-lg-4">
<label for="txtPassportNo">Passport No</label> <label for="txtPassportNo">Passport No</label>
@ -363,7 +366,7 @@
<div class="p-col-12 p-md-12 p-lg-4" ></div> <div class="p-col-12 p-md-12 p-lg-4" ></div>
<div class="p-col-12 p-md-12 p-lg-4" style="margin-top: 11px;" > <div class="p-col-12 p-md-12 p-lg-4" style="margin-top: 11px;" >
<button class="k-button k-primary" kendoButton icon="add" <button class="k-button k-primary" kendoButton icon="add"
(click)="AddAccessCard()"> (click)="AddAccessCard()" [disabled]="!active">
Add Access Card Add Access Card
</button> </button>
</div> </div>
@ -597,7 +600,7 @@
</div> </div>
<div class="p-col-12 p-md-12 p-lg-12" style="margin: auto;" align="right"> <div class="p-col-12 p-md-12 p-lg-12" style="margin: auto;" align="right">
<button class="k-button k-primary" kendoButton icon="save" <button class="k-button k-primary" kendoButton icon="save"
(click)="SaveBanglaContactInformation()"> (click)="saveBanglaInfo()">
Save Save
</button> </button>
</div> </div>

View File

@ -33,6 +33,8 @@ import { Nationality } from '../../nationality/nationality';
import { EmpContact } from 'src/app/_models/HREmployee/empContact'; import { EmpContact } from 'src/app/_models/HREmployee/empContact';
import { Thana } from '../../thana/thana'; import { Thana } from '../../thana/thana';
import { CardManagemnetModule } from 'src/app/attendance/access-card-management/card-management.module'; import { CardManagemnetModule } from 'src/app/attendance/access-card-management/card-management.module';
import { Observable, EMPTY } from 'rxjs';
import { tap, finalize, catchError } from 'rxjs/operators';
@Component({ @Component({
selector: 'app-general', selector: 'app-general',
@ -557,6 +559,75 @@ export class GeneralComponent implements OnInit {
this.NIDFiles = undefined; this.NIDFiles = undefined;
} }
} }
private getSavePersonalInfoObservable(): Observable<HrEmployee> | null {
debugger;
if (this.personalInfo.valid === false && this.hrEmployee.employeeNo === '') {
this.notificationService.showError('Required Fields Can\'t Be Empty');
return null;
}
this.loadingPanel.ShowLoadingPanel = true;
this.hrEmployee.name = this.hrEmployee.firstName;
if (this.hrEmployee.middleName !== null) {
this.hrEmployee.name += ' ' + this.hrEmployee.middleName;
}
if (this.hrEmployee.lastName !== null) {
this.hrEmployee.name += ' ' + this.hrEmployee.lastName;
}
return this.employeeService.saveHrPersonalInfo(this.hrEmployee).pipe(
tap((resp: HrEmployee) => {
debugger;
if (resp != undefined) {
this.hrEmployee.id = resp.id;
if (!this.active) {
this.hrEmployee.employeeNo = resp.employeeNo;
this.employeeService.hrEmployee = resp;
}
if (this.selectedTinFiles?.length > 0) {
this.saveFile(this.hrEmployee.id, this.selectedTinFiles, enumEmpFileUploadType.TIN);
}
if (this.selectedNidFiles?.length > 0) {
this.saveFile(this.hrEmployee.id, this.selectedNidFiles, enumEmpFileUploadType.nationalID);
}
if (this.selectedDlFiles?.length > 0) {
this.saveFile(this.hrEmployee.id, this.selectedDlFiles, enumEmpFileUploadType.DrivingLicense);
}
}
}),
finalize(() => {
this.loadingPanel.ShowLoadingPanel = false;
}),
catchError((err) => {
debugger;
console.error(err);
this.notificationService.showError(err.error);
return EMPTY; // No emission on error
})
);
}
saveBanglaInfo() {
if (!this.active) {
const personalInfo$ = this.getSavePersonalInfoObservable();
if (personalInfo$) {
personalInfo$.subscribe({
next: () => {
debugger;
this.isDisplay = false;
this.notificationService.showSuccess('Data saved successfully');
this.SaveBanglaContactInformation();
}
});
}
else {
this.isDisplay = false;
}
// If null, validation failed — nothing is executed
} else {
this.SaveBanglaContactInformation();
}
}
saveBanglaPersonalInformation() { saveBanglaPersonalInformation() {
const data = { const data = {
employeeNo: this.employeeService.hrEmployee.employeeNo, employeeNo: this.employeeService.hrEmployee.employeeNo,
@ -591,6 +662,14 @@ export class GeneralComponent implements OnInit {
this.loadingPanel.ShowLoadingPanel = true; this.loadingPanel.ShowLoadingPanel = true;
this.employeeService.updateBanglaContactInformation(data).subscribe( this.employeeService.updateBanglaContactInformation(data).subscribe(
(resp: any) => { (resp: any) => {
// debugger
// if(this.contact.id == 0)
// this.employeeService.hrEmployee.contacts[0].id = resp;
// this.employeeService.hrEmployee.contacts[0].presentPOInBangla = this.contact.presentPOInBangla;
// this.employeeService.hrEmployee.contacts[0].presentAddressInBangla = this.contact.presentAddressInBangla,
// this.employeeService.hrEmployee.contacts[0].parmanentPOInBangla = this.contact.parmanentPOInBangla;
// this.employeeService.hrEmployee.contacts[0].permanentAddressInBangla = this.contact.permanentAddressInBangla;
}, (err) => { }, (err) => {
this.loadingPanel.ShowLoadingPanel = false; this.loadingPanel.ShowLoadingPanel = false;
@ -956,4 +1035,6 @@ export class GeneralComponent implements OnInit {
this.passnoPopUp = false; this.passnoPopUp = false;
this.signaturePopUp = false; this.signaturePopUp = false;
} }
// uploadSaveUrl = "saveUrl"; // should represent an actual API endpoint
// uploadRemoveUrl = "removeUrl"; // should represent an actual API endpoint
} }

View File

@ -2165,6 +2165,7 @@ namespace HRM.UI.Controllers
ec.PresentAddressInBangla = presentAddressInBangla; ec.PresentAddressInBangla = presentAddressInBangla;
ec.PermanentAddressInBangla = presentAddressInBangla; ec.PermanentAddressInBangla = presentAddressInBangla;
_hrEmployeeService.SaveContact(ec); _hrEmployeeService.SaveContact(ec);
return Ok(ec.ID);
} }
} }
catch (Exception ex) catch (Exception ex)

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB