From 2f363002854a4f704a9eeccb752831ccc7159b79 Mon Sep 17 00:00:00 2001 From: mansurskTarento Date: Tue, 7 Jan 2025 17:18:18 +0530 Subject: [PATCH 01/39] new ui changes to add spec and map form in cios transforamtions --- .../provider-details.component.ts | 21 ++++--- .../transformations.component.html | 63 +++++++++++-------- .../transformations.component.scss | 12 +++- .../transformations.component.ts | 46 ++++++++++---- 4 files changed, 95 insertions(+), 47 deletions(-) diff --git a/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/provider-details/provider-details.component.ts b/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/provider-details/provider-details.component.ts index b5d93236..552fb128 100644 --- a/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/provider-details/provider-details.component.ts +++ b/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/provider-details/provider-details.component.ts @@ -197,7 +197,7 @@ export class ProviderDetailsComponent implements OnInit, OnChanges { lastModified: Date.now(), }) } - }, 'image/png') + }, 'image/png') this.imageUrl = canvas.toDataURL('image/png') } @@ -316,10 +316,12 @@ export class ProviderDetailsComponent implements OnInit, OnChanges { contentPartnerName: formDetails.contentPartnerName, providerTips: formDetails.providerTips, link: this.thumbNailUrl, - documentUrl: this.uploadedPdfUrl, - documentUploadedDate: this.fileUploadedDate, partnerCode: formDetails.partnerCode.toUpperCase(), } + if (this.uploadedPdfUrl) { + formBody['documentUrl'] = this.uploadedPdfUrl + formBody['documentUploadedDate'] = this.fileUploadedDate + } this.marketPlaceSvc.createProvider(formBody).subscribe({ next: (responce: any) => { @@ -330,7 +332,7 @@ export class ProviderDetailsComponent implements OnInit, OnChanges { this.showSnackBar(successMsg) const providerId = _.get(responce, 'result.id') this.router.navigate([`/app/home/marketplace-providers/onboard-partner/${providerId}`]) - }, 1000) + }, 1000) } }, error: (error: HttpErrorResponse) => { @@ -353,8 +355,13 @@ export class ProviderDetailsComponent implements OnInit, OnChanges { this.providerDetalsBeforUpdate['data']['contentPartnerName'] = formDetails.contentPartnerName this.providerDetalsBeforUpdate['data']['providerTips'] = formDetails.providerTips this.providerDetalsBeforUpdate['data']['link'] = this.thumbNailUrl - this.providerDetalsBeforUpdate['data']['documentUrl'] = this.uploadedPdfUrl - this.providerDetalsBeforUpdate['data']['documentUploadedDate'] = this.fileUploadedDate + if (this.uploadedPdfUrl) { + this.providerDetalsBeforUpdate['data']['documentUrl'] = this.uploadedPdfUrl + this.providerDetalsBeforUpdate['data']['documentUploadedDate'] = this.fileUploadedDate + } else { + delete this.providerDetalsBeforUpdate['data']['documentUrl'] + delete this.providerDetalsBeforUpdate['data']['documentUploadedDate'] + } this.marketPlaceSvc.updateProvider(this.providerDetalsBeforUpdate).subscribe({ next: (responce: any) => { @@ -364,7 +371,7 @@ export class ProviderDetailsComponent implements OnInit, OnChanges { const successMsg = 'Provider details updated successfully.' this.showSnackBar(successMsg) this.sendDetailsUpdateEvent() - }, 1000) + }, 1000) } }, error: (error: HttpErrorResponse) => { diff --git a/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.html b/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.html index 93ee2f87..8537371d 100644 --- a/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.html +++ b/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.html @@ -56,32 +56,43 @@
-
-
- -
- {{transFormControl.lable}} - : - - - - - {{header}} - - - - - {{transforamtionForm.value[transFormControl.controlName]}} - - - - -
-
-
-
+ + Map Form + Spec + + +
+
+ +
+ + + + + {{header}} + + + + + {{transforamtionForm.value[transFormControl.controlName]}} + + + + + : + {{transFormControl.lable}} +
+
+
+
+
+ + + +
diff --git a/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.scss b/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.scss index 0cd6eafa..76f43602 100644 --- a/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.scss +++ b/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.scss @@ -106,7 +106,7 @@ font: 700 14px Lato; /* stylelint-disable */ color: #212529; - width: 180px; + width: 50%; } .colun { @@ -184,6 +184,16 @@ } } +:host ::ng-deep .transformationEditor { + .jsoneditor { + height: 400px; + } +} + +:host ::ng-deep .has-error .jsoneditor { + border: 1px solid red; +} + :host ::ng-deep .transformation-box { .mat-form-field-flex { height: 50px; diff --git a/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.ts b/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.ts index 0931116d..cc066737 100644 --- a/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.ts +++ b/project/ws/app/src/lib/routes/home/routes/marketplace-provider/components/transformations/transformations.component.ts @@ -9,6 +9,7 @@ import { ConformationPopupComponent } from '../../dialogs/conformation-popup/con import { HttpErrorResponse } from '@angular/common/http' import * as XLSX from 'xlsx' import { environment } from '../../../../../../../../../../../src/environments/environment' +import { JsonEditorOptions } from 'ang-jsoneditor' @Component({ selector: 'ws-app-transformations', @@ -35,7 +36,9 @@ export class TransformationsComponent implements OnInit, OnChanges { dialogRef: any //#region (transformation variables) + transforamtionType = 'viaForm' transforamtionForm!: FormGroup + transformationSpecForm!: FormControl providerDetalsBeforUpdate: any transFormContentKeysAndControls: { lable: string, @@ -47,6 +50,7 @@ export class TransformationsComponent implements OnInit, OnChanges { executed = false uploadedFileHeadersList: string[] = [] availableHeadrsList: string[] = [] + editorOptions = new JsonEditorOptions() //#endregion //#endregion @@ -84,7 +88,15 @@ export class TransformationsComponent implements OnInit, OnChanges { } initializTransforamtionControls() { + this.transformationSpecForm = new FormControl( + _.get(this.providerDetalsBeforUpdate, this.transformationType, {}), Validators.required) this.transforamtionForm = this.formBuilder.group({}) + this.editorOptions.mode = 'text' + this.editorOptions.mainMenuBar = false + this.editorOptions.navigationBar = false + this.editorOptions.statusBar = false + this.editorOptions.enableSort = false + this.editorOptions.enableTransform = false this.providerDetalsBeforUpdate['certificateTemplateUrl'] = _.get(this.providerDetalsBeforUpdate, 'certificateTemplateUrl', '').replace(' ', '') let trasformationJson: any = {} @@ -162,7 +174,8 @@ export class TransformationsComponent implements OnInit, OnChanges { reader.onload = () => { const csvData = reader.result const csvRecordsArray = (csvData).split(/\r\n|\n/) - this.availableHeadrsList = this.getHeaderArray(csvRecordsArray) + this.uploadedFileHeadersList = this.getHeaderArray(csvRecordsArray) + this.availableHeadrsList = JSON.parse(JSON.stringify(this.uploadedFileHeadersList)) } const that = this.showSnackBar reader.onerror = function () { @@ -189,20 +202,27 @@ export class TransformationsComponent implements OnInit, OnChanges { this.providerDetalsBeforUpdate['data']['isActive'] = true const hasTransformationAlready = this.providerDetalsBeforUpdate[this.transformationType] ? true : false this.transforamtionForm.markAllAsTouched() - if (this.transforamtionForm.valid) { + this.transformationSpecForm.markAsTouched() + if ((this.transforamtionType === 'viaForm' && this.transforamtionForm.valid) || + (this.transforamtionType === 'viaSpec' && this.transformationSpecForm.valid && this.transformationSpecForm.value !== '{}')) { if (this.transformationType !== 'certificateTemplateUrl') { - const trasformContentSpec: any = {} // contains maped transform spec for db - const specValues = this.transforamtionForm.value - this.transFormContentKeysAndControls.forEach((transFormContent: any) => { - trasformContentSpec[specValues[transFormContent.controlName]] = transFormContent.path - }) - - if (hasTransformationAlready) { - this.providerDetalsBeforUpdate[this.transformationType][0]['spec'] = trasformContentSpec + if (this.transforamtionType === 'viaForm') { + const trasformContentSpec: any = {} // contains maped transform spec for db + const specValues = this.transforamtionForm.value + this.transFormContentKeysAndControls.forEach((transFormContent: any) => { + trasformContentSpec[specValues[transFormContent.controlName]] = transFormContent.path + }) + + if (hasTransformationAlready && _.get(this.providerDetalsBeforUpdate, `${this.transformationType}[0].spec`)) { + this.providerDetalsBeforUpdate[this.transformationType]['0']['spec'] = trasformContentSpec + } else { + const trasformContentJson = this.providerConfiguration.trasformContentJson + trasformContentJson[0]['spec'] = trasformContentSpec + this.providerDetalsBeforUpdate[this.transformationType] = trasformContentJson + this.transformationSpecForm.patchValue(trasformContentJson) + } } else { - const trasformContentJson = this.providerConfiguration.trasformContentJson - trasformContentJson[0]['spec'] = trasformContentSpec - this.providerDetalsBeforUpdate[this.transformationType] = trasformContentJson + this.providerDetalsBeforUpdate[this.transformationType] = this.transformationSpecForm.value } } this.marketPlaceSvc.updateProvider(this.providerDetalsBeforUpdate).subscribe({ From ca4c72a6a9fc706ea98f6a3365b1d17f4e3ed81c Mon Sep 17 00:00:00 2001 From: mansurskTarento Date: Thu, 9 Jan 2025 12:04:52 +0530 Subject: [PATCH 02/39] adding designations bulk upload and new ui changes in import designations --- .../bulk-upload/bulk-upload.component.html | 4 +- .../bulk-upload/bulk-upload.component.scss | 83 +++++++++ .../bulk-upload/bulk-upload.component.ts | 39 +++- .../designations/designations.component.html | 167 +++++++++--------- .../designations/designations.component.ts | 12 +- .../import-designation.component.html | 13 +- .../import-designation.component.scss | 10 +- .../import-designation.component.ts | 24 +-- .../routes/designation/designation.module.ts | 10 ++ .../services/designations.service.ts | 4 - .../create-mdo/services/users.service.ts | 5 + .../verify-otp/verify-otp.component.html | 3 +- .../verify-otp/verify-otp.component.scss | 27 +++ 13 files changed, 278 insertions(+), 123 deletions(-) diff --git a/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.html b/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.html index 1fcc3258..0d17a8a2 100644 --- a/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.html +++ b/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.html @@ -1,6 +1,6 @@
- arrow_back + arrow_back
{{bulkUploadConfig?.mainHeading}}
@@ -29,7 +29,7 @@
- CSV file logo + CSV file logo
{{bulkUploadConfig?.supportedFileTypeText2}}
diff --git a/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.scss b/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.scss index e69de29b..2f88c1c8 100644 --- a/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.scss +++ b/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.scss @@ -0,0 +1,83 @@ + +.bulk-container, .file-container { + box-shadow: 0px 1px 5px 0px #0000001F, 0px 2px 2px 0px #00000024, 0px 3px 1px -2px #00000033; + padding: 24px; + border: 1px solid rgba(0, 0, 0, 0.2); + + .label { + font-size: 12px; + font-weight: 400; + color: rgba($color: #000000, $alpha: 0.6); + } + + .value { + font-size: 14px; + line-height: 18px; + color: rgba($color: #000000, $alpha: 0.88); + word-break: break-all; + } + + .outline-button { + padding: 8px 16px; + color: #1B4CA1; + border: 1px solid #1B4CA1; + background-color: #FFF; + border-radius: 4px; + cursor: pointer; + line-height: 16px; + font-size: 14px; + font-weight: 700; + } +} + +.dashed-card { + border: 1px dashed rgba(0, 0, 0, 0.2); + padding: 20px 24px; + font-size: 14px; + + .custom-ol { + margin: 0px; + padding-left: 12px; + } + + .text-primary { + color: #1B4CA1; + font-weight: bold; + } +} + +.error-msg { + color: #D13924; + font-weight: 600; + font-size: 14px; +} + +.csv-file { + height: 83px; +} + +::ng-deep .common-modal { + width: 420px; + padding: 0px; + + .mat-dialog-container { + border-radius: 12px; + background-color: #EEE !important; + } +} + +::ng-deep .progress-modal { + width: 920px; + height: 420px; + + .mat-dialog-container { + border-radius: 4px; + background-color: #FFF !important; + } +} + +@media screen and (max-width: 641px) { + ::ng-deep .common-modal, ::ng-deep .progress-modal { + max-width: 90vw !important; + } +} \ No newline at end of file diff --git a/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.ts b/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.ts index b5c4ec78..70a6fad1 100644 --- a/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.ts +++ b/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/bulk-upload/bulk-upload.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, OnDestroy, AfterViewInit } from '@angular/core' +import { Component, OnInit, OnDestroy, AfterViewInit, EventEmitter, Output } from '@angular/core' import { HttpErrorResponse } from '@angular/common/http' import { ActivatedRoute } from '@angular/router' @@ -14,6 +14,7 @@ import { UsersService } from '../../../../services/users.service' import { VerifyOtpComponent } from '../../../../../home/components/verify-otp/verify-otp.component' import { FileService } from '../../services/upload.service' import { FileProgressComponent } from '../../../../../home/components/file-progress/file-progress.component' +import { DesignationsService } from '../../services/designations.service' @Component({ selector: 'ws-app-bulk-upload', @@ -21,6 +22,7 @@ import { FileProgressComponent } from '../../../../../home/components/file-progr styleUrls: ['./bulk-upload.component.scss'], }) export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit { + @Output() closeComponent: EventEmitter = new EventEmitter(); lastUploadList: IBulkUploadDesignationList[] = [] private destroySubject$ = new Subject() @@ -35,6 +37,10 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit { public fileType: any fileSelected!: any userProfile: any + userEmailPhone = { + email: '', + mobile: '' + } fileUploadDialogInstance: any bulkUploadConfig: any @@ -49,22 +55,36 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit { public dialog: MatDialog, private usersService: UsersService, private activateRoute: ActivatedRoute, - + private designationsService: DesignationsService ) { this.configSvc = this.activateRoute.snapshot.data['configService'] this.rootOrgId = _.get(this.configSvc, 'userProfile.rootOrgId') this.userProfile = _.get(this.configSvc, 'userProfileV2') - this.bulkUploadFrameworkId = _.get(this.configSvc, 'orgReadData.frameworkid') } ngOnInit() { + this.getUserDetails() this.getBulkStatusList() this.activateRoute.data.subscribe(data => { this.bulkUploadConfig = data.pageData.data.bulkUploadConfig this.pageSize = this.bulkUploadConfig.pageSize this.sizeOptions = this.bulkUploadConfig.pageSizeOptions }) + this.bulkUploadFrameworkId = this.designationsService.frameWorkInfo ? this.designationsService.frameWorkInfo.code : this.bulkUploadFrameworkId + } + + getUserDetails() { + this.usersService.getUserDetails(this.userProfile.userId).subscribe({ + next: (result) => { + if (result) { + this.userEmailPhone = { + email: _.get(result, 'result.response.profileDetails.personalDetails.primaryEmail', this.userProfile.email), + mobile: _.get(result, 'result.response.profileDetails.personalDetails.mobile', this.userProfile.mobile) + } + } + } + }) } ngAfterViewInit(): void { @@ -115,11 +135,11 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit { } sendOTP(): void { - this.generateAndVerifyOTP(this.userProfile.email ? 'email' : 'phone') + this.generateAndVerifyOTP(this.userEmailPhone.email ? 'email' : 'phone') } generateAndVerifyOTP(contactType: string, resendFlag?: string): void { - const postValue = contactType === 'email' ? this.userProfile.email : this.userProfile.mobile + const postValue = contactType === 'email' ? this.userEmailPhone.email : this.userEmailPhone.mobile this.usersService.sendOtp(postValue, contactType) .pipe(takeUntil(this.destroySubject$)) .subscribe((_res: any) => { @@ -144,7 +164,7 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit { this.fileType = file.type this.fileSelected = file if (this.fileService.validateExcelFile(this.fileType)) { - this.verifyOTP(this.userProfile.email ? 'email' : 'phone') + this.verifyOTP(this.userEmailPhone.email ? 'email' : 'phone') // this.showFileUploadProgress() // this.uploadCSVFile() } else { @@ -155,7 +175,7 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit { verifyOTP(contactType: string): void { const dialogRef = this.dialog.open(VerifyOtpComponent, { - data: { type: contactType, email: this.userProfile.email, mobile: this.userProfile.mobile }, + data: { type: contactType, email: this.userEmailPhone.email, mobile: this.userEmailPhone.mobile }, disableClose: false, panelClass: 'common-modal', }) @@ -187,6 +207,7 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit { // tslint:disable-next-line }, (_err: HttpErrorResponse) => { if (!_err.ok) { + this.fileUploadDialogInstance.close() this.matSnackBar.open('Uploading CSV file failed due to some error, please try again later!') } }) @@ -202,6 +223,10 @@ export class BulkUploadComponent implements OnInit, OnDestroy, AfterViewInit { this.lastIndex = this.startIndex + _event.pageSize } + showMyDesignations() { + this.closeComponent.emit(true) + } + ngOnDestroy(): void { this.destroySubject$.unsubscribe() if (this.interval) { diff --git a/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/designations/designations.component.html b/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/designations/designations.component.html index 7e70ef00..e0b57a61 100644 --- a/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/designations/designations.component.html +++ b/project/ws/app/src/lib/routes/create-mdo/routes/designation/components/designations/designations.component.html @@ -1,100 +1,107 @@ - -
-
-
{{designationConfig.mainHeading}}
-
- + + +
+
+
{{designationConfig.mainHeading}}
+
+ - + +
-
- -
- {{designationConfig?.topsection?.heading}} - keyboard_arrow_up - keyboard_arrow_down -
-
-
-
- -
-
error_outline
- -
-
-
-
-
-
- play_arrow -
- Watch how it works + +
+ {{designationConfig?.topsection?.heading}} + keyboard_arrow_up + keyboard_arrow_down +
+
+
+
+ +
+
error_outline
+ +
+
+
+
+
+
+ play_arrow +
+ Watch how it works +
-
- + -
- -
-
-