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(); }, }); } }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.150.0160.00719.85
8.4.140.0170.01018.66
8.4.130.0330.00717.50
8.4.120.0380.01017.74
8.4.110.0340.01017.85
8.4.100.0360.00917.68
8.4.90.0340.01317.59
8.4.80.0360.01017.95
8.4.70.0370.00817.69
8.4.60.0380.00917.71
8.4.50.0360.00917.73
8.4.40.0370.01217.46
8.4.30.0380.00917.55
8.4.20.0360.01217.53
8.4.10.0410.01017.62
8.3.280.0270.00918.35
8.3.270.0360.00716.53
8.3.260.0370.00716.42
8.3.250.0360.00816.37
8.3.240.0350.00816.68
8.3.230.0350.01116.91
8.3.220.0350.00916.45
8.3.210.0330.01216.48
8.3.200.0370.00916.74
8.3.190.0390.00916.60
8.3.180.0330.01116.55
8.3.170.0400.00916.45
8.3.160.0380.00916.69
8.3.150.0390.00716.62
8.3.140.0360.01016.61
8.3.130.0330.00816.56
8.3.120.0350.00616.52
8.3.110.0370.00516.74
8.3.100.0360.00916.58
8.3.90.0370.00816.59
8.3.80.0370.00716.60
8.3.70.0390.00716.51
8.3.60.0370.00916.68
8.3.50.0350.01016.61
8.3.40.0340.00917.40
8.3.30.0270.01017.57
8.3.20.0280.00817.66
8.3.10.0280.00917.71
8.3.00.0170.00918.64
8.2.290.0310.00616.47
8.2.280.0290.01016.57
8.2.270.0310.00816.53
8.2.260.0310.00716.56
8.2.250.0310.00916.69
8.2.240.0290.01116.43
8.2.230.0290.00516.41
8.2.220.0300.00516.63
8.2.210.0280.00916.30
8.2.200.0300.00916.37
8.2.190.0290.01016.46
8.2.180.0310.00916.45
8.2.170.0280.00917.85
8.2.160.0300.00617.56
8.2.150.0320.01117.59
8.2.140.0310.00817.38
8.2.130.0270.01317.43
8.2.120.0280.00917.46
8.2.110.0310.00617.55
8.2.100.0280.00917.57
8.2.90.0290.00817.51
8.2.80.0300.00817.62
8.2.70.0290.01017.58
8.2.60.0310.00817.54
8.2.50.0270.00917.58
8.2.40.0300.00917.51
8.2.30.0290.00917.30
8.2.20.0300.01017.39
8.2.10.0260.01117.38
8.2.00.0210.00917.46

preferences:
162.57 ms | 1000 KiB | 7 Q