Skip to content

Commit

Permalink
Merge pull request #159 from mansurskTarento/designations-builk-upload
Browse files Browse the repository at this point in the history
Designations builk upload
  • Loading branch information
vishnubansaltarento authored Jan 16, 2025
2 parents 8df9df4 + 34f1d55 commit 36f917b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit {
startIndex = 0
lastIndex: any
pageSize = 0
orgId = ''

constructor(
private fileService: FileService,
Expand All @@ -65,6 +66,7 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit {

ngOnInit() {
this.getUserDetails()
this.orgId = _.get(this.activateRoute, 'snapshot.queryParams.roleId', '')
this.getBulkStatusList()
this.activateRoute.data.subscribe(data => {
this.bulkUploadConfig = data.pageData.data.bulkUploadConfig
Expand Down Expand Up @@ -99,7 +101,8 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit {
}

getBulkStatusList(): void {
this.fileService.getBulkDesignationUploadData(this.rootOrgId)
const orgId = this.orgId ? this.orgId : this.rootOrgId
this.fileService.getBulkDesignationUploadData(orgId)
.pipe(takeUntil(this.destroySubject$))
.subscribe((res: any) => {
this.lastUploadList = res.result.content.sort((a: IBulkUploadDesignationList, b: IBulkUploadDesignationList) =>
Expand Down Expand Up @@ -195,7 +198,7 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit {
if (this.fileSelected) {
const formData: FormData = new FormData()
formData.append('file', this.fileSelected)
this.fileService.bulkUploadDesignation(this.fileName, formData, this.bulkUploadFrameworkId)
this.fileService.bulkUploadDesignation(this.fileName, formData, this.bulkUploadFrameworkId, this.orgId)
.pipe(takeUntil(this.destroySubject$))
.subscribe((_res: any) => {
this.fileUploadDialogInstance.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@

.emptyDesignations {
height: calc(100vh - 600px);
min-height: 160px;
}

.empty-desigantions-text {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const API_ENDPOINTS = {
// Bulk Upload Designation
BULK_UPLOAD_SAMPLE_FILE: (frameworkId: string) =>
`/apis/proxies/v8/designation/v1/orgMapping/sample/${frameworkId}`,
BULK_UPLOAD_DESIGNATION: (frameworkId: string) =>
`/apis/proxies/v8/designation/v1/orgMapping/bulkUpload/${frameworkId}`,
BULK_UPLOAD_DESIGNATION: (frameworkId: string, orgId: string) =>
`/apis/proxies/v8/designation/v1/orgMapping/bulkUpload/${orgId}/${frameworkId}`,
GET_BULK_UPLOAD_DESIGNATION_DATA: (rootOrgId: string) =>
`/apis/proxies/v8/designation/v1/orgMapping/bulkUpload/progress/details/${rootOrgId}`,
GET_BULK_UPLOAD_DESIGNATION_STATUS: (filePath: string) =>
Expand Down Expand Up @@ -75,7 +75,7 @@ export class FileService {
fileSaver.saveAs(res.body, filename || 'sample.xlsx')
}

}, () => (this.matSnackBar.open('Could not download the file')
}, () => (this.matSnackBar.open('Could not download the file')
))
}

Expand Down Expand Up @@ -149,9 +149,9 @@ export class FileService {
return API_ENDPOINTS.BULK_UPLOAD_SAMPLE_FILE(frameworkId)
}

public bulkUploadDesignation(_fileName: string, fileContent: FormData, frameworkId: string): Observable<any> {
public bulkUploadDesignation(_fileName: string, fileContent: FormData, frameworkId: string, orgId: string): Observable<any> {
this.displayLoader$.next(true)
return this.http.post<any>(API_ENDPOINTS.BULK_UPLOAD_DESIGNATION(frameworkId), fileContent)
return this.http.post<any>(API_ENDPOINTS.BULK_UPLOAD_DESIGNATION(frameworkId, orgId), fileContent)
.pipe(finalize(() => this.displayLoader$.next(false)))
}

Expand Down

0 comments on commit 36f917b

Please sign in to comment.