{ "version": 3, "sources": ["src/app/core/auth/reports-auth.service.ts"], "sourcesContent": ["import { Injectable } from '@angular/core';\nimport { AuthService } from '@app-core/auth/auth.service';\nimport { UserSettingsService } from '@app-core/auth/user-settings.service';\nimport { LocationModulesEnum } from '@app-core/auth/location-modules-enum';\nimport { LocationSettingsService } from '@app-core/auth/location-settings.service';\nimport * as fromTheme from 'src/app/shared/state/theme-state';\nimport * as themeActions from '@app-shared/state/theme-state/theme.actions';\nimport { EzStoreService } from '@ezuiaws/ez.ui.packages/ez-store';\nimport { Observable } from 'rxjs';\nimport { map, filter } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ReportsAuthService {\n\n environment: string = this.authService.getEnvironment();\n\n constructor(\n private authService: AuthService,\n private userSettingsService: UserSettingsService,\n private locationSettingsService: LocationSettingsService,\n private themeStoreHelper: EzStoreService\n ) { }\n\n //#region Financial Reports\n public showFinancialReports() {\n let show: boolean = false;\n if (this.userSettingsService.userHasPermission('ReportsAllFinancial')\n || this.userSettingsService.userHasPermission('ReportManagement')\n || this.userSettingsService.userHasPermission('ReportDeposit')\n || this.userSettingsService.userHasPermission('ReportDepositOwn')\n || this.userSettingsService.userHasPermission('ReportsAllTrainer')\n || (this.userSettingsService.userHasPermission('ReportsMyTrainer') && this.authService.userSession.userResourceCalendarId)) {\n show = true;\n }\n return show;\n }\n\n public showAccountReceivableReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showAccruedRentalRevenueReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showAccruedSessionRevenueReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showAllSalesByCouponReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showCsiBatchSettlementReport(): Observable {\n this.themeStoreHelper.dispatchAction(themeActions.getAccessToCsiBatchSettlementReport());\n return this.themeStoreHelper.stateStreamSelector(fromTheme.getAccessToCsiBatchSettlementReport).pipe(\n filter(result => result != undefined),\n map((result: any) => {\n return result && this.userSettingsService.userHasPermission('ReportsAllFinancial');\n })\n );\n }\n\n public showPyxisDisbursementsReport(): Observable {\n this.themeStoreHelper.dispatchAction(themeActions.getAccessToPyxisDisbursementsReport());\n return this.themeStoreHelper.stateStreamSelector(fromTheme.getAccessToPyxisDisbursementsReport).pipe(\n filter(result => result != undefined),\n map((result: any) => {\n return result && this.userSettingsService.userHasPermission('ReportsAllFinancial');\n })\n );\n }\n\n public showCollectionsReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showMembershipDeferredRevenueReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial')\n && this.locationSettingsService.locationHasModule(LocationModulesEnum.HasAdvancedMemberships);\n }\n\n public showDepositsReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial')\n || this.userSettingsService.userHasPermission('ReportDeposit')\n || this.userSettingsService.userHasPermission('ReportDepositOwn');\n }\n\n public showDirectDebitFailuresReport() {\n this.themeStoreHelper.dispatchAction(themeActions.getAccessToDirectDebitFailuresReport());\n return this.themeStoreHelper.stateStreamSelector(fromTheme.getAccessToDirectDebitFailuresReport).pipe(\n filter(result => result != undefined),\n map((result: any) => {\n return result && this.userSettingsService.userHasPermission('ReportsAllFinancial');\n })\n );\n }\n\n public showClientCreditCardExpirationReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showIncomeBalancesByCustomerReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showInvoicesReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showMainDashboardReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showOpenInvoicesByCustomerReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showPackageSalesReport() {\n return this.userSettingsService.userHasPermission('ReportManagement');\n }\n\n public showRevenueReport() {\n return this.userSettingsService.userHasPermission('ReportManagement');\n }\n\n public showSalespersonCommissionReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showTrainerCommissionReport() {\n let show: boolean = false;\n if (this.userSettingsService.userHasPermission('ReportsAllFinancial')\n || this.userSettingsService.userHasPermission('ReportsAllTrainer')\n || (this.userSettingsService.userHasPermission('ReportsMyTrainer') && this.authService.userSession.userResourceCalendarId)) {\n show = true;\n }\n return show;\n }\n\n public showUnappliedPaymentsReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n\n public showUnderpaidItemsReport() {\n return this.userSettingsService.userHasPermission('ReportsAllFinancial');\n }\n //#endregion\n\n //#region Training Reports\n public showTrainingReports() {\n return this.userSettingsService.userHasPermission('ReportsAllTrainer')\n || this.userSettingsService.userHasPermission('ReportsMyTrainer');\n }\n\n public showSessionNotesReport() {\n return this.userSettingsService.userHasPermission('ReportsAllTrainer')\n || this.userSettingsService.userHasPermission('ReportsMyTrainer');\n }\n\n public showSessionsCompletedByClientReport() {\n return this.userSettingsService.userHasPermission('ReportsAllTrainer');\n }\n\n public showTrainerPerformanceReport() {\n return this.userSettingsService.userHasPermission('ReportsAllTrainer')\n || this.userSettingsService.userHasPermission('ReportsMyTrainer');\n }\n\n public showTrainerSessionsByWeekReport() {\n return this.userSettingsService.userHasPermission('ReportsAllTrainer');\n }\n\n public showTrainerVenueScheduleReport() {\n return this.userSettingsService.userHasPermission('ReportsAllTrainer')\n || this.userSettingsService.userHasPermission('ReportsMyTrainer');\n }\n\n public showTrainingPinupReport() {\n return this.userSettingsService.userHasPermission('ReportsAllTrainer');\n }\n //#endregion\n\n //#region Venue Booking Reports\n public showVenueBookingReports() {\n return this.userSettingsService.userHasPermission('ReportsAllVenueBooking')\n && this.locationSettingsService.locationHasModule(LocationModulesEnum.HasVenueScheduling);\n }\n //#endregion\n\n //#region Equipment Reports\n public showEquipmentReports() {\n return this.userSettingsService.userHasPermission('ReportsAllEquipment')\n && this.locationSettingsService.locationHasModule(LocationModulesEnum.HasEquipment);\n }\n //#endregion\n\n //#region Time Clock Reports\n public showTimeClockReports() {\n return this.userSettingsService.userHasPermission('ReportsAllTimeClock')\n && this.locationSettingsService.locationHasModule(LocationModulesEnum.HasTimeClock);\n }\n //#endregion\n\n //#region Membership Reports\n public showMembershipReports() {\n return this.userSettingsService.userHasPermission('ReportsAllMembership');\n }\n\n public showCheckInHistorySummaryReport() {\n return this.locationSettingsService.locationHasModule(LocationModulesEnum.HasCheckIn);\n }\n\n public showMembershipAttritionReport() {\n return this.locationSettingsService.locationHasModule(LocationModulesEnum.HasAdvancedMemberships);\n }\n\n public showMembershipsRevenueByMonthReport() {\n return this.authService.userSession.currentLocationCulture.toLocaleLowerCase() === 'en-us';\n }\n //#endregion\n\n //#region Point Of Sales Reports\n public showPointOfSalesReports() {\n return (this.locationSettingsService.locationHasModule(LocationModulesEnum.HasPOS) || this.locationSettingsService.locationHasModule(LocationModulesEnum.HasPOSv2))\n && this.userSettingsService.userHasPermission('ReportsAllPOS');\n }\n //#endregion\n\n //#region Marketing Reports\n public showMarketingReports() {\n return this.userSettingsService.userHasPermission('ReportsAllMarketing');\n }\n //#endregion\n\n //#region System Usage Reports\n public showSystemUsageReports() {\n return this.userSettingsService.userHasPermission('ReportAccountActivity');\n }\n //#endregion\n\n //#region Locker Reports\n public showLockerReports() {\n return this.locationSettingsService.locationHasModule(LocationModulesEnum.HasLockers)\n && this.userSettingsService.userHasPermission('ReportsAllLocker')\n && (this.environment === 'Development' || this.environment === 'QA');\n }\n //#endregion\n\n}\n"], "mappings": "kTAcA,IAAaA,GAAkB,IAAA,CAAzB,IAAOA,EAAP,MAAOA,CAAkB,CAI7BC,YACUC,EACAC,EACAC,EACAC,EAAiD,CAHjD,KAAAH,YAAAA,EACA,KAAAC,oBAAAA,EACA,KAAAC,wBAAAA,EACA,KAAAC,iBAAAA,EANV,KAAAC,YAAsB,KAAKJ,YAAYK,eAAc,CAOjD,CAGGC,sBAAoB,CACzB,IAAIC,EAAgB,GACpB,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3D,wBAAwB0B,kBAAkBC,EAAoBC,sBAAsB,CAClG,CAEOgC,qCAAmC,CACxC,OAAO,KAAK9D,YAAYS,YAAYsD,uBAAuBC,kBAAiB,IAAO,OACrF,CAIOC,yBAAuB,CAC5B,OAAQ,KAAK/D,wBAAwB0B,kBAAkBC,EAAoBqC,MAAM,GAAK,KAAKhE,wBAAwB0B,kBAAkBC,EAAoBsC,QAAQ,IAC5J,KAAKlE,oBAAoBO,kBAAkB,eAAe,CACjE,CAIO4D,sBAAoB,CACzB,OAAO,KAAKnE,oBAAoBO,kBAAkB,qBAAqB,CACzE,CAIO6D,wBAAsB,CAC3B,OAAO,KAAKpE,oBAAoBO,kBAAkB,uBAAuB,CAC3E,CAIO8D,mBAAiB,CACtB,OAAO,KAAKpE,wBAAwB0B,kBAAkBC,EAAoB0C,UAAU,GAC/E,KAAKtE,oBAAoBO,kBAAkB,kBAAkB,IAC5D,KAAKJ,cAAgB,eAAiB,KAAKA,cAAgB,KACnE,yCA1OWN,GAAkB0E,EAAAC,CAAA,EAAAD,EAAAE,CAAA,EAAAF,EAAAG,CAAA,EAAAH,EAAAI,CAAA,CAAA,CAAA,wBAAlB9E,EAAkB+E,QAAlB/E,EAAkBgF,UAAAC,WAFjB,MAAM,CAAA,EAEd,IAAOjF,EAAPkF,SAAOlF,CAAkB,GAAA", "names": ["ReportsAuthService", "constructor", "authService", "userSettingsService", "locationSettingsService", "themeStoreHelper", "environment", "getEnvironment", "showFinancialReports", "show", "userHasPermission", "userSession", "userResourceCalendarId", "showAccountReceivableReport", "showAccruedRentalRevenueReport", "showAccruedSessionRevenueReport", "showAllSalesByCouponReport", "showCsiBatchSettlementReport", "dispatchAction", "getAccessToCsiBatchSettlementReport", "stateStreamSelector", "pipe", "filter", "result", "undefined", "map", "showPyxisDisbursementsReport", "getAccessToPyxisDisbursementsReport", "showCollectionsReport", "showMembershipDeferredRevenueReport", "locationHasModule", "LocationModulesEnum", "HasAdvancedMemberships", "showDepositsReport", "showDirectDebitFailuresReport", "getAccessToDirectDebitFailuresReport", "showClientCreditCardExpirationReport", "showIncomeBalancesByCustomerReport", "showInvoicesReport", "showMainDashboardReport", "showOpenInvoicesByCustomerReport", "showPackageSalesReport", "showRevenueReport", "showSalespersonCommissionReport", "showTrainerCommissionReport", "showUnappliedPaymentsReport", "showUnderpaidItemsReport", "showTrainingReports", "showSessionNotesReport", "showSessionsCompletedByClientReport", "showTrainerPerformanceReport", "showTrainerSessionsByWeekReport", "showTrainerVenueScheduleReport", "showTrainingPinupReport", "showVenueBookingReports", "HasVenueScheduling", "showEquipmentReports", "HasEquipment", "showTimeClockReports", "HasTimeClock", "showMembershipReports", "showCheckInHistorySummaryReport", "HasCheckIn", "showMembershipAttritionReport", "showMembershipsRevenueByMonthReport", "currentLocationCulture", "toLocaleLowerCase", "showPointOfSalesReports", "HasPOS", "HasPOSv2", "showMarketingReports", "showSystemUsageReports", "showLockerReports", "HasLockers", "\u0275\u0275inject", "AuthService", "UserSettingsService", "LocationSettingsService", "EzStoreService", "factory", "\u0275fac", "providedIn", "_ReportsAuthService"] }