Skip to content

Commit 36f917b

Browse files
Merge pull request #159 from mansurskTarento/designations-builk-upload
Designations builk upload
2 parents 8df9df4 + 34f1d55 commit 36f917b

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit {
4848
startIndex = 0
4949
lastIndex: any
5050
pageSize = 0
51+
orgId = ''
5152

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

6667
ngOnInit() {
6768
this.getUserDetails()
69+
this.orgId = _.get(this.activateRoute, 'snapshot.queryParams.roleId', '')
6870
this.getBulkStatusList()
6971
this.activateRoute.data.subscribe(data => {
7072
this.bulkUploadConfig = data.pageData.data.bulkUploadConfig
@@ -99,7 +101,8 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit {
99101
}
100102

101103
getBulkStatusList(): void {
102-
this.fileService.getBulkDesignationUploadData(this.rootOrgId)
104+
const orgId = this.orgId ? this.orgId : this.rootOrgId
105+
this.fileService.getBulkDesignationUploadData(orgId)
103106
.pipe(takeUntil(this.destroySubject$))
104107
.subscribe((res: any) => {
105108
this.lastUploadList = res.result.content.sort((a: IBulkUploadDesignationList, b: IBulkUploadDesignationList) =>
@@ -195,7 +198,7 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit {
195198
if (this.fileSelected) {
196199
const formData: FormData = new FormData()
197200
formData.append('file', this.fileSelected)
198-
this.fileService.bulkUploadDesignation(this.fileName, formData, this.bulkUploadFrameworkId)
201+
this.fileService.bulkUploadDesignation(this.fileName, formData, this.bulkUploadFrameworkId, this.orgId)
199202
.pipe(takeUntil(this.destroySubject$))
200203
.subscribe((_res: any) => {
201204
this.fileUploadDialogInstance.close()

project/ws/app/src/lib/routes/create-mdo/routes/designation/components/designations/designations.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292

9393
.emptyDesignations {
9494
height: calc(100vh - 600px);
95+
min-height: 160px;
9596
}
9697

9798
.empty-desigantions-text {

project/ws/app/src/lib/routes/create-mdo/routes/designation/services/upload.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const API_ENDPOINTS = {
1717
// Bulk Upload Designation
1818
BULK_UPLOAD_SAMPLE_FILE: (frameworkId: string) =>
1919
`/apis/proxies/v8/designation/v1/orgMapping/sample/${frameworkId}`,
20-
BULK_UPLOAD_DESIGNATION: (frameworkId: string) =>
21-
`/apis/proxies/v8/designation/v1/orgMapping/bulkUpload/${frameworkId}`,
20+
BULK_UPLOAD_DESIGNATION: (frameworkId: string, orgId: string) =>
21+
`/apis/proxies/v8/designation/v1/orgMapping/bulkUpload/${orgId}/${frameworkId}`,
2222
GET_BULK_UPLOAD_DESIGNATION_DATA: (rootOrgId: string) =>
2323
`/apis/proxies/v8/designation/v1/orgMapping/bulkUpload/progress/details/${rootOrgId}`,
2424
GET_BULK_UPLOAD_DESIGNATION_STATUS: (filePath: string) =>
@@ -75,7 +75,7 @@ export class FileService {
7575
fileSaver.saveAs(res.body, filename || 'sample.xlsx')
7676
}
7777

78-
}, () => (this.matSnackBar.open('Could not download the file')
78+
}, () => (this.matSnackBar.open('Could not download the file')
7979
))
8080
}
8181

@@ -149,9 +149,9 @@ export class FileService {
149149
return API_ENDPOINTS.BULK_UPLOAD_SAMPLE_FILE(frameworkId)
150150
}
151151

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

0 commit comments

Comments
 (0)