{"version":3,"sources":["webpack:///src/C:/BuildAgent/work/709799f7b218f10/src/pages/billing/billing-dashboard/claims-ready-billing.ts","webpack:///./src/pages/billing/billing-dashboard/claims-ready-billing.html"],"names":["ClaimsReadyBilling","claimsService","router","permissionManager","bindingEngine","selectedBranches","itemColumnSize","dashboardGridHeight","isPalliativeCareView","isLoading","isError","isAuthorized","hasPermission","billingAndFinancialRoutes","gridItems","typesOfBill","this","_claimsService","_router","_permissionManager","_bindingEngine","selectedRoute","find","route","name","isProdReady","settings","checkRoutePermission","initSubscriptions","getClaimsReadyBillingData","_locationSubscription","collectionObserver","subscribe","getClaimBillTypesByLocation","locationIds","isOnlyClaims","getClaimsReadyForBilling","claimsReadyBillingData","Object","entries","forEach","claim","claimTitle","getClaimTitle","push","title","count","metaData","status","value","length","selectedClaimTypes","filter","type","endsWith","params","types","queryString","navigate","claimLower","toLowerCase","includes","url","window","open","dispose","defaultBinding","toView","defaultBindingMode","module","exports"],"mappings":"4iDAwBaA,EAAb,WAuBI,WACIC,EACAC,EACAC,EACAC,I,4FAA4B,SAzBzB,KAAAC,iBAA6B,GAE7B,KAAAC,eAAyB,EAEzB,KAAAC,oBAA8B,GAE9B,KAAAC,sBAAgC,EAMhC,KAAAC,WAAqB,EACrB,KAAAC,SAAmB,EAEnB,KAAAC,cAAwB,EACxB,KAAAC,eAAyB,EACzB,KAAAC,0BAA2C,4BAC3C,KAAAC,UAAwC,GACxC,KAAAC,YAAwB,GAQ3BC,KAAKC,eAAiBhB,EACtBe,KAAKE,QAAUhB,EACfc,KAAKG,mBAAqBhB,EAC1Ba,KAAKI,eAAiBhB,CACzB,C,UAjCL,O,EAAA,E,EAAA,8B,MAoCYiB,EAAgBL,KAAKH,0BAA0BS,MAAK,SAACC,GAAD,MAA0B,yBAAfA,EAAMC,IAAjB,IACpDC,EAAc,0BAA6B,QAAd,EAACJ,SAAa,eAAEK,UACjDV,KAAKJ,cAAgBa,GAAeT,KAAKG,mBAAmBQ,qBAAqBN,GACjFL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405a4b9c7.js","sourcesContent":["import {\r\n BindingEngine,\r\n Disposable,\r\n autoinject,\r\n bindable,\r\n bindingMode,\r\n buildQueryString,\r\n containerless,\r\n customElement\r\n} from \"aurelia-framework\";\r\nimport { RouteConfig, Router } from \"aurelia-router\";\r\n\r\nimport { EnumMap } from \"../../../common/utilities/enum-map\";\r\nimport { isPageProdReady } from \"../../../common/utilities/is-route-allowed\";\r\nimport { PermissionManager } from \"../../../common/utilities/permission-manager\";\r\nimport { IGetClaimsReadyForBilling } from \"../../../interfaces/billing/i-claim\";\r\nimport { IDashboardGridItems } from \"../../../interfaces/custom-elements/i-dashboard-grid\";\r\nimport { IGetClaimReadyBillingQuery } from \"../../../interfaces/i-claim-ready-billing\";\r\nimport { ClaimsService } from \"../../../services/claims-service\";\r\nimport { billingAndFinancialRoutes } from \"../../reports/billing-and-financial/billing-and-financial-routes\";\r\n\r\n@autoinject\r\n@containerless\r\n@customElement(\"claims-ready-billing\")\r\nexport class ClaimsReadyBilling {\r\n @bindable({ defaultBinding: bindingMode.toView })\r\n public selectedBranches: string[] = [];\r\n @bindable({ defaultBindingMode: bindingMode.toView })\r\n public itemColumnSize: number = 6;\r\n @bindable({ defaultBindingMode: bindingMode.toView })\r\n public dashboardGridHeight: number = 50;\r\n @bindable({ defaultBindingMode: bindingMode.toView })\r\n public isPalliativeCareView: boolean = false;\r\n private readonly _claimsService: ClaimsService;\r\n private _router: Router;\r\n private _permissionManager: PermissionManager;\r\n private _locationSubscription: Disposable;\r\n private _bindingEngine: BindingEngine;\r\n public isLoading: boolean = false;\r\n public isError: boolean = false;\r\n public claimsReadyBillingData: IGetClaimsReadyForBilling;\r\n public isAuthorized: boolean = true;\r\n public hasPermission: boolean = false;\r\n public billingAndFinancialRoutes: RouteConfig[] = billingAndFinancialRoutes;\r\n public gridItems: IDashboardGridItems[] = [];\r\n public typesOfBill: string[] = [];\r\n\r\n public constructor(\r\n claimsService: ClaimsService,\r\n router: Router,\r\n permissionManager: PermissionManager,\r\n bindingEngine: BindingEngine\r\n ) {\r\n this._claimsService = claimsService;\r\n this._router = router;\r\n this._permissionManager = permissionManager;\r\n this._bindingEngine = bindingEngine;\r\n }\r\n\r\n public bind() {\r\n let selectedRoute = this.billingAndFinancialRoutes.find((route) => route.name === \"claims-ready-billing\");\r\n let isProdReady = isPageProdReady(selectedRoute?.settings);\r\n this.hasPermission = isProdReady && this._permissionManager.checkRoutePermission(selectedRoute);\r\n this.itemColumnSize = this.isPalliativeCareView ? 12 : this.itemColumnSize;\r\n }\r\n\r\n public async attached() {\r\n this.initSubscriptions();\r\n await this.getClaimsReadyBillingData();\r\n if (this.isPalliativeCareView) {\r\n this.dashboardGridHeight = 100;\r\n }\r\n }\r\n\r\n public initSubscriptions() {\r\n this._locationSubscription = this._bindingEngine.collectionObserver(this.selectedBranches).subscribe(() => {\r\n this.getClaimsReadyBillingData();\r\n });\r\n }\r\n\r\n public async getClaimsReadyBillingData() {\r\n try {\r\n this.isError = false;\r\n this.isLoading = true;\r\n this.typesOfBill = await this._claimsService.getClaimBillTypesByLocation({\r\n locationIds: this.selectedBranches,\r\n isOnlyClaims: false\r\n });\r\n this.claimsReadyBillingData = await this._claimsService.getClaimsReadyForBilling(this.selectedBranches);\r\n let claimsReadyBillingData = Object.entries(this.claimsReadyBillingData);\r\n this.gridItems = [];\r\n if (!this.isPalliativeCareView) {\r\n claimsReadyBillingData.forEach((claim) => {\r\n let claimTitle = this.getClaimTitle(claim[0]);\r\n this.gridItems.push({\r\n title: claimTitle,\r\n count: claim[1],\r\n metaData: [{ title: claimTitle, count: claim[1] }]\r\n });\r\n });\r\n } else {\r\n claimsReadyBillingData.forEach((claim) => {\r\n let claimTitle = this.getClaimTitle(claim[0]);\r\n if (claimTitle === \"Claim\") {\r\n this.gridItems.push({\r\n title: claimTitle,\r\n count: claim[1],\r\n metaData: [{ title: claimTitle, count: claim[1] }]\r\n });\r\n }\r\n });\r\n }\r\n } catch (e) {\r\n this.isError = true;\r\n if (e.status === 403) {\r\n this.isAuthorized = false;\r\n }\r\n throw e;\r\n } finally {\r\n this.isLoading = false;\r\n }\r\n }\r\n\r\n public getClaimTitle(title: string) {\r\n switch (title) {\r\n case \"noeCount\":\r\n return \"NOE\";\r\n case \"noeTransferCount\":\r\n return \"NOE - Transfer\";\r\n case \"notrCount\":\r\n return \"NOTR\";\r\n case \"otherClaimCount\":\r\n return \"Claim\";\r\n case \"noeCancelCount\":\r\n return \"NOE - Cancel\";\r\n default:\r\n return \"\";\r\n }\r\n }\r\n\r\n public navigateToReport(value: any) {\r\n if (value?.length > 0) {\r\n let selectedClaimTypes = this.typesOfBill.filter((type) => type.endsWith(value[0].title));\r\n if (selectedClaimTypes?.length > 0) {\r\n let params = {\r\n types: selectedClaimTypes,\r\n locationIds: this.selectedBranches\r\n };\r\n let queryString = buildQueryString(params);\r\n this._router.navigate(`/reports/billing-and-financial-reports/claims-ready-billing?${queryString}`);\r\n } else {\r\n let claimTypesOfBill = this.typesOfBill.filter((claim) => {\r\n let claimLower = claim.toLowerCase();\r\n return !claimLower.includes(\"noe\") && !claimLower.includes(\"notr\");\r\n });\r\n let params: IGetClaimReadyBillingQuery = {\r\n types: claimTypesOfBill,\r\n locationIds: this.selectedBranches\r\n };\r\n let queryString = buildQueryString(params);\r\n this._router.navigate(`/reports/billing-and-financial-reports/claims-ready-billing?${queryString}`);\r\n }\r\n }\r\n }\r\n\r\n public navigateToViewReportLink() {\r\n let params = {\r\n locationIds: this.selectedBranches\r\n };\r\n let queryString = buildQueryString(params);\r\n let url = `/reports/billing-and-financial-reports/claims-ready-billing?${queryString}`;\r\n window.open(url);\r\n }\r\n\r\n public detached() {\r\n this._locationSubscription?.dispose();\r\n }\r\n}\r\n","module.exports = \"\\r\\n\";"],"sourceRoot":""}