3v4l.org

run code in 300+ PHP versions simultaneously
<?php import { AfterViewChecked, ChangeDetectorRef, Component, EventEmitter, HostListener, Input, OnDestroy, OnInit, Output, ViewChild, ViewChildren, ViewEncapsulation, } from "@angular/core"; import { SanctioningService } from "../sanctioning/sanctioning.service"; import { HttpErrorResponse } from "@angular/common/http"; import { DomSanitizer } from "@angular/platform-browser"; import { BehaviorSubject, EMPTY, Observable, Subject, Subscription, catchError, filter, forkJoin, iif, of, switchMap, takeUntil, throwError, } from "rxjs"; import { Attributes, InterimReviewCASections, InterimReviewSections, Parameters, TemplateEnum, TemplateReviewSections, } from "../enums/template-enum"; import { MasterTemplateModel, ParameterDataModel, ReviewSectionModel, } from "../models/master-template-model"; import { ReviewSectionEnum } from "../enums/review-section-enum"; import { ActivatedRoute, Router } from "@angular/router"; import { editorDataInput } from "../models/editor-data-input-model"; import { ParameterEnum } from "../enums/parameter-enum"; import { ProgressTimelineService } from "@sw/shared/progress-timeline/progress-timeline.service"; import { CASectionService } from "../sections/credit-analysis/ca-section/ca-section.service"; import { CreditAnalysisService } from "../sections/credit-analysis/credit-analysis.service"; import { ReviewStatus } from "../enums/review-status-enum"; import { UserService } from "@sw/shared/services/user.service"; import { User } from "sw-rft-shell/lib/user/user.model"; import { ModalComponent } from "@sw/shared/modal/modal.component"; import { ApprovalWorkflowStatusEnum, DiscardTypeEnum, } from "../enums/approval-workflow-status-enum"; import { ToastrService } from "ngx-toastr"; import { ReviewContext, ReviewContextService, } from "@sw/shared/services/review-context.service"; import { ApiConstant, InterimReviewConstants, RBARConstants, StandardReviewConstants, WatchlistConstant, } from "@sw/shared/utils/api.constant"; import { offlineapproverrequestparam } from "../models/offline-approval-request-param"; import { CreditAnalysisComponent } from "../sections/credit-analysis/credit-analysis.component"; import { ApprovalDecisionModel } from "../models/approval-decision-model"; import { ProgressTimelineComponent } from "@sw/shared/progress-timeline/progress-timeline.component"; import { ApprovalDecisionsOfflineModel } from "../models/approval-decisions-offline-model"; import { ReviewAttachmentFile } from "../models/reviewAttachmentFile-model"; import { ApprovalRequestService } from "../sections/approval-request/approval-request.service"; import { TemplateSharedService } from "@sw/shared/template-shared-service/template-shared-service"; import { LoadingSpinnerService } from "@sw/shared/loading-spinner.service"; import { ApprovalLifeCycleEnum } from "../enums/approval-life-cycle-enum"; import { ApprovalRequestModel } from "../models/approval-request-model"; import { legalEntityEnum } from "../enums/legal-entity-enum"; import { SaveReviewModel } from "../models/save-review-model"; import { RuleEngineActionType } from "../enums/rule-engine-actiontype"; import { RuleEngineApprovalTaskAction } from "../models/ruleEngineApprovalTaskAction"; import { MultiApprovalModelItem } from "../models/multi-approval-model"; import { CspService } from "../review-parameters/credit-sanction-point/credit-sanction-point.service"; import { CreditSanctionPointComponent } from "../review-parameters/credit-sanction-point/credit-sanction-point.component"; import { InterimReviewService } from "../interim-review/interim-review.service"; import { ApiConfig } from "@sw/shared/utils/api.config"; import { InterimReviewComparisonModel } from "../models/InterimReviewComparison.model"; import { RaiseQueryHistoryComponent } from "@sw/shared/raise-query/raise-query-history.component"; import { RaiseQueryComponent } from "@sw/shared/raise-query/raise-query.component"; import { AttachmentParametersComponent } from "../sections/attachment-parameters/attachment-parameters.component"; import { ReviewVersionModel } from "../models/review-version-model"; import { EditRetainStatusEnum } from "../enums/edit-retain-status-enum"; import introJs from "intro.js"; import { TooltipPosition } from "intro.js/src/core/steps"; import { Reviewattestation } from "../models/review-attestation"; import { RbarStateServiceService } from "../rbar/state-service/rbar-state-service.service"; import { CollateralStatusType } from "../enums/collateral-status-enum"; import { ApprovalWorkflowResponseEnum } from "../enums/approval-workflow-response-enum"; import { InterimReviewAppendicesSectionDocumentType } from "../models/interim-review-model"; import { AutoApprovalDetailsModel } from "../models/auto-approval-details-model"; import { SecurityConfig } from "sw-common-services"; import { MandateScaleComponent } from "../sections/mandate-scale/mandate-scale.component"; import { StpValidationModel } from "../models/stp-validation-model"; import { LGDService } from "./services/lgd-service"; import { DatePipe } from "@angular/common"; import { RBARReviewRefreshService } from "../rbar/rbar-review-parameter/rbar-review-refresh-service"; import { HelpersService } from "@sw/shared/services/helpers.service"; import { StatusCodes } from "../enums/status-codes.enum"; @Component({ selector: "master-review", templateUrl: "master-review.component.html", styleUrls: ["master-review.component.scss"], encapsulation: ViewEncapsulation.None, providers: [CASectionService], }) export class MasterReviewComponent implements OnInit, OnDestroy, AfterViewChecked { public refreshAllExecuted: Boolean = false; public reviewData: MasterTemplateModel; public reviewSectionData: ReviewSectionModel[]; public reviewSectionEnum = ReviewSectionEnum; public showMasterTimeline: boolean = true; public masterTimelineData$ = new BehaviorSubject<any[]>([]); sectionData: any; creditAnalysisData: any; limitsData: any; appendicesData: any; commentsData: any; interimReviewType: any; submissionSection: any; public interimReviewTriggerDetails: any; public showCreditPaper: boolean = false; sectionStatuses: boolean[] = []; enabledSections: boolean[] = []; activeSectionIndex: number = 0; @Input() public groupId; @Input() public reviewId; public reviewUId: number; public status: string; rbarReviewParameterDataRefresh: any; public workFlowId: number; public templateId: number; @ViewChildren("reviewSections") reviewSections: any; @ViewChild("interimDiscardModal") interimDiscardModal: ModalComponent; @ViewChild("autoApproveEligibleModal") autoApproveEligibleModal: ModalComponent; public autoApproveEligibleMessage; public statusId: any; public statusChangeSub!: Subscription; public sectionIndexSub!: Subscription; public detectBreach!: Subscription; public reviewTypeObj: any; public attachmentObj: any; public assessmentData: any; public manuallySelectedParametersMap: { [sectionId: number]: any[] } = {}; public assetURL = ApiConfig.CREDIT_REVIEW_MFE_URL + ApiConfig.UIASSET; public assessmentStatus: any = { isCompleted: false, }; public utpParams: any; public keyMetricsRetainStatus!: Subscription; public cspStatus: Subscription; public isKeyRiskMetricsRetain: number = 0; discardMessage = ApiConstant.DISCARD_WARNING_MESSAGE; isDropdownVisible: boolean = false; reviewTypeSectionData: any; csSectionData: any; kerRiskMatricsData: any; cspTableHeaders = ["Minimum Approval Requirements", "BBPLC", "BE", "BUK"]; CSPSectionTitle = "Credit Sanction Point"; cspData: any; public user: User; public approvalWorkFlow: any; public approvalWorkFlowData: any; public disableOfflineAttachment: boolean; public isProposed = true; public agreegatedSelectedOptions: ApprovalDecisionModel[] = []; public exceptionSelectedOptions: ApprovalDecisionModel[] = []; public isApprovalSelected = false; public cspLevel: any; public isExceptionApprovalRequired: Boolean = false; public isOfflineRecordCount = false; public reviewStatus = ReviewStatus; public revSections = TemplateReviewSections; public approveActionText: string = InterimReviewConstants.APPROVE; public raisequery: string = InterimReviewConstants.RAISEQUERY; public isExceptioneApprovalSelected = false; public isReadOnlyEnableApprover: boolean = false; public fetchApprovalData: ApprovalDecisionsOfflineModel = null; public isReadOnlyModeRequired: boolean = true; public isPendingForApprovalException = false; public fetchReviewAttachmentFiles: ReviewAttachmentFile = null; public isExceptionApprovalRequest: boolean = false; @ViewChild(ProgressTimelineComponent) public progressTimelineComponent: ProgressTimelineComponent; @ViewChild(CreditAnalysisComponent) creditAnalysisComponent: CreditAnalysisComponent; public text: String; public currentApprovalRequestData: any; public returnToSubmitterComment: any; public authoriseResponse: any; public isMultiApprovalMode: boolean = false; public saveReviewData: SaveReviewModel; public submissionObj: any; public disableSubmit: boolean = false; public approveConstant: string = InterimReviewConstants.APPROVE; public validationMessages = []; public multiApprovalGridData: MultiApprovalModelItem[]; public creditPaperUrl: any; public aggregatedData: any; public autoApprovalEntitiesList: AutoApprovalDetailsModel[] = []; @ViewChild("creditPaperModal") public creditPaperModal: ModalComponent; @ViewChild("wlValidationModal") wlValidationModal: ModalComponent; retrunToSubmitterCMessage = ApiConstant.MSG_CONFIRMATION_RETURNTOSUBMITTER; @ViewChild("returnToSubmitterModal") public returnToSubmitterModal: ModalComponent; isBreachDetected: boolean = false; @ViewChild("interimBreachValidationModal") interimBreachValidationModal: ModalComponent; @ViewChild("dataComparisonWarningModal") dataComparisonWarningModal: ModalComponent; @ViewChild("gradeSubmittedToCRE") gradeSubmittedToCRE: ModalComponent; gradeSubmittedToCreMessage = ApiConstant.GRADE_SUBMITTED_TO_CRE; @ViewChild("stpValidation") stpValidation: ModalComponent; public collateralFacilityMessage: string; updatedCSPData: any; breachValidationMessage = []; public stpValidationMessages: StpValidationModel; cspOriginalTableData: any; interimReviewSections = InterimReviewSections; @ViewChild("CSPData") creditSanctionPointComponent: CreditSanctionPointComponent; mandateScaleComponent: MandateScaleComponent; approvalRequestData: any = {}; public dataComparisonWarningMessage = "Please reload."; public compareDataresult: InterimReviewComparisonModel; public isDataChanged: boolean = false; public virtualTourShown: boolean = false; public receivedAttestationData: Reviewattestation; public clientGradeResponse: any; public facilitesLgdEadResponse: any; public collateralResponse: any; attestationParam: any = { data: {} }; activeTabId: any; reviewSection: any; public showCollapsed: boolean = true; public isRBARAssesmentCompleted: boolean = false; private destroy$ = new Subject<void>(); public facilityId = []; public aggregatedEntityCsp: any[] = []; @ViewChild("collateralForFacilitiesWarningModal") public collateralForFacilitiesWarningModal: ModalComponent; @ViewChild("collateralForFacilitiesApprovalWarningModal") collateralForFacilitiesApprovalWarningModal: ModalComponent; public collateralFacilityIds: string; ruleEngineActionType = RuleEngineActionType; @ViewChildren(RaiseQueryHistoryComponent) public raiseQueryHistoryComp: RaiseQueryHistoryComponent; public raiseQueryInput: any; @ViewChildren(RaiseQueryComponent) public raiseQueryCompo: RaiseQueryComponent; public isRaiseQueryHistoryAvailable: boolean = true; @ViewChild(AttachmentParametersComponent) public attachmentComp: AttachmentParametersComponent; public previousReviewVersion: ReviewVersionModel; public reSubmissionUpdateDetails: any; public isPendingPostWorkflowAction: boolean = false; @Output() attestationsection = new EventEmitter<any>(); public approvalSectionVisible: boolean; approvalConfirmMessage: string; @ViewChild("approvalModal") public approvalModal: ModalComponent; public validationTriggered: boolean = false; public showMultiApprovalGrid: boolean = false; public collateralFacilityApprovalMessage: any; public collateralFacilityApprovalMSg: any = []; public passUseraData: any; @HostListener("document:click", ["$event"]) clickout(event) { if ( this.creditAnalysisComponent?.caSectionComponent?.caSection[ "_changesDetected" ] ) { this.creditAnalysisComponent?.caSectionComponent?.caSection[ "_results" ]?.forEach(ele => { if ( ele.nativeElement && ele.nativeElement.className == "ca-action-edition" && ele.nativeElement.offsetHeight !== 0 ) { this.creditAnalysisComponent?.caSectionComponent?.cASectionService.collapseAll(); } }); } } public IsDisplayReSubmissionSection: boolean = true; public approvalWorkflowStatus = ApprovalWorkflowStatusEnum; @ViewChild("messageModal") public messageModal: ModalComponent; public messageModalConfirmText: string = "Ok"; public messagemodalContent: string = ""; public messagemodalHeader: string = "Information"; public isFilApproveButtonDisabled: boolean = true; public minimumApprovalLevel: any; public roles: string[] = SecurityConfig.userRolesList; public isToggleCollapseClicked: boolean = false; public isExpandedState: boolean = false; public raiseQueryworkflowInstanceId: number; public stopAutoApproveFlow: boolean = false; public NAValue: string = "N/A"; public isFILBreachValid: boolean = false; constructor( private _crSanctioningService: SanctioningService, private timelineStatusService: ProgressTimelineService, private creditAnalysisService: CreditAnalysisService, private route: ActivatedRoute, private userService: UserService, private toastrService: ToastrService, private router: Router, private approvalRequestService: ApprovalRequestService, private templateSharedService: TemplateSharedService, private spinnerService: LoadingSpinnerService, private cspService: CspService, private interimReviewService: InterimReviewService, private changeDetectorRef: ChangeDetectorRef, private sanitizer: DomSanitizer, private lgdService: LGDService, private reviewContextService: ReviewContextService, private _rbarStateServiceService: RbarStateServiceService, private refreshService: RBARReviewRefreshService, private _helperService: HelpersService ) {} ngAfterViewChecked() { this.changeDetectorRef.detectChanges(); } ngOnInit(): void { window.dispatchEvent( new CustomEvent("hideShowScrollBarEvent", { detail: { overflow: true } }) ); const context = this.reviewContextService.currentContext; if (context) { this.reviewUId = context.reviewUId; this.status = context.status; this.workFlowId = context.workFlowId; this.isRBARAssesmentCompleted = !RBARConstants.RBARASSESSMENTSTATUS.includes(this.workFlowId); this.statusId = context?.workFlowId; } else { this.router.navigate(["/"]); } this.route.params.subscribe(params => { const institutionId = +params["id"]; this.groupId = institutionId; this.reviewId = +params["reviewId"]; this.templateId = +params["templateId"]; this.showCollapsed = this.templateId == TemplateEnum.Rbar || this.templateId == TemplateEnum.Standard ? false : true; this.autoApproveEligibleMessage = this.templateId == TemplateEnum.Rbar || this.templateId == TemplateEnum.Standard ? StandardReviewConstants.AUTO_APPROVE_ELIGIBLE_ANNUAL : InterimReviewConstants.AUTO_APPROVE_ELIGIBLE_INTERIM; }); //this.spinnerservice.show(); this.getWatchListComments(); this.getMasterreviewTemplate(); this.sectionIndexSub = this.timelineStatusService.activeSectionIndex$.subscribe(index => { this.activeSectionIndex = index; }); this.statusChangeSub = this.timelineStatusService.statusChanges$.subscribe( () => { this.timelineStatusService.updateTranformedTimelineData( this.removeApprovalSectionFromArray( this.sectionData?.reviewSection ?? [] ), this.templateId, this.activeSectionIndex, (data: any[]) => this.masterTimelineData$.next(data) ); } ); if (this.templateId == 4) { this.getInterimReviewTypes(this.reviewId); this._crSanctioningService .postGroupDetails(this.reviewUId, this.groupId) .subscribe({ next: res => {}, error: err => {}, }); } if (this.status !== this.reviewStatus.Approval) { this.disableOfflineAttachment = true; } else { this.disableOfflineAttachment = false; } // Approval Flow conditions; if ( this.status === this.reviewStatus.Approval || this.status === this.reviewStatus.PendingApprovalAssessment || this.status === this.reviewStatus.PendingForCompletion || this.status === this.reviewStatus.Completed ) { this.getApprovalDataFromDB(); this.setFiLApprovalButtonEntitlement(); } else if ( this.status === this.reviewStatus.Create || this.status === this.reviewStatus.Draft ) { if (this.status == this.reviewStatus.Draft) { if ( this.templateId === TemplateEnum.Rbar || this.templateId === TemplateEnum.Standard ) { this.getApprovalDataFromDBDraft(); } } this.detectFILBreach(); this.isReadOnlyModeRequired = false; } else { this.isReadOnlyModeRequired = true; } // if ( // this.templateId == TemplateEnum.Rbar && // this.status == this.reviewStatus.Draft // ) { // this.getApprovalDataFromDB(); // } this.keyMetricsRetainStatus = this.interimReviewService.interimKeyRiskMetrics$.subscribe( (data: any) => { if (data != null && data != undefined) this.isKeyRiskMetricsRetain = data; } ); if ( this.templateId === TemplateEnum.Rbar || this.templateId === TemplateEnum.Standard ) { this.setupSubscriptionToRbarState(context); this._rbarStateServiceService.sectionVisibility$ .pipe(takeUntil(this.destroy$)) .subscribe(workflowIds => { this.controlSectionVisibility(workflowIds); }); } this.cspStatus = this._rbarStateServiceService.isCspModified$.subscribe( (res: any) => { if (res && res.entityCsp != null) { this.cspLevel = res.entityCsp; this.updateCspLevelData(this.approvalWorkFlowData); this.cspOriginalTableData = res.cspData; } } ); this._rbarStateServiceService.entityCsp$.subscribe((data: any[]) => { if ( (this.status === this.reviewStatus.Create || this.status === this.reviewStatus.Draft) && data !== null ) { this.aggregatedEntityCsp = data; this.aggregatedEntityCsp?.forEach(t => { t.discretionId = this._rbarStateServiceService.getDiscretionIdByName( t.csp ); t.reviewUid = this.reviewUId; }); } }); } setFiLApprovalButtonEntitlement() { this.isFilApproveButtonDisabled = !( this.roles.includes("CreditRiskOps") || this.roles.includes("SuperUser") ); } removeApprovalSectionFromArray(timelineArray: any): any { const updatedTimelineArray = timelineArray.filter(item => { if ( (this.status === this.reviewStatus.Create || this.status === this.reviewStatus.Draft) && item.reviewSectionId == InterimReviewSections.APPROVAL ) { return false; } return true; }); return updatedTimelineArray; } private setupSubscriptionToRbarState(context: ReviewContext) { this._rbarStateServiceService.isClickOnContinue$ .pipe( filter(isClicked => isClicked), takeUntil(this.destroy$) ) .subscribe(() => { //After complete Yes -> continue -> save // isReadOnlyModeRequired it shoukd be false , otherwise it should be discbale inital time this.isReadOnlyModeRequired = false; this.approvalRequestData.isReadOnlyModeRequired = false; context.workFlowId = this.workFlowId = 1; context.status = this.status = StatusCodes.Draft; this.isRBARAssesmentCompleted = !RBARConstants.RBARASSESSMENTSTATUS.includes(context.workFlowId); setTimeout(() => { this.controlSectionVisibility([context.workFlowId]); }); }); } controlSectionVisibility(sectionsToOpen: number[] = []) { if (this.reviewSections && this.reviewSections.length > 0) { const sectionsArray = this.reviewSections.toArray(); if (sectionsToOpen.length > 0) { sectionsArray.forEach(section => { if (sectionsToOpen.includes(section.reviewSectionId)) { section.isInformationClosed = false; } else { section.isInformationClosed = true; } }); } } } public generateDoc() { this.spinnerService.show(WatchlistConstant.MSG_GENERATING_DOCUMENT); if (this.reviewStatus.Completed) { this._crSanctioningService .completeDownload( this.reviewData.reviewId, this.reviewData.templateId, this.reviewData.groupId, this.reviewData.reviewUId ) .subscribe({ next: response => { this.creditPaperUrl = window.URL.createObjectURL( new Blob([response], { type: "application/pdf" }) ); this.creditPaperUrl = this.sanitizer.bypassSecurityTrustResourceUrl( this.creditPaperUrl ); this.showCreditPaper = true; this.creditPaperModal.showModal(); this.spinnerService.hide(); }, error: (error: HttpErrorResponse) => { //console.log(error); //this.spinnerService.hide(); }, }); } else { //InterimReviewConstants.MSG_GENERATING_DOCUMENT // The key change is here: we pass `this.sectionData`, which contains the complete UI state. this.reviewData.groupId = this.groupId; this.reviewData.reviewId = this.reviewId; this.reviewData.reviewUId = this.reviewUId; this._crSanctioningService .generateDoc(this.reviewData, this.reviewUId) .subscribe({ next: response => { this.creditPaperUrl = window.URL.createObjectURL( new Blob([response], { type: "application/pdf" }) ); this.creditPaperUrl = this.sanitizer.bypassSecurityTrustResourceUrl( this.creditPaperUrl ); this.showCreditPaper = true; this.creditPaperModal.showModal(); this.spinnerService.hide(); }, error: (error: HttpErrorResponse) => { //console.log(error); this.toastrService.error( WatchlistConstant.MSG_GENERATING_DOCUMENT_FAIL ); this.spinnerService.hide(); }, }); } }
Output for 8.4.1 - 8.4.15
Parse error: syntax error, unexpected token "{" in /in/W2Hpt on line 3
Process exited with code 255.
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.28
Parse error: syntax error, unexpected token "," in /in/W2Hpt on line 4
Process exited with code 255.

preferences:
170.19 ms | 1004 KiB | 7 Q