{"version":3,"sources":["webpack:///./src/components/plans-and-reports/ReportGridItem.ts","webpack:///./src/components/plan-create/plan-create.ts","webpack:///./src/components/plan-create/plan-create.html","webpack:///./src/components/plans-and-reports/plans-and-reports.ts","webpack:///./src/components/plans-and-reports/plans-and-reports.html","webpack:///./src/components/sidebar/sidebar.ts","webpack:///./src/components/sidebar/sidebar.html"],"names":["id","description","organization","reportingPeriod","reportStatus","reportStatusDescription","reOpenedReportStatus","reOpenedReportStatusDescription","timestamp","canDeleteItem","canUnSubmitItem","isDeleting","isSysAdmin","isUnSubmitting","this","Submitted","Draft","organizationService","unitPlanReportService","statePlanReportService","zonePlanReportService","centralPlanReportService","reportingPeriodService","signalr","router","reportingPeriods","isCreatingPlan","signalreventhandlers","isSearching","items","nodatafound","filterText","search","myorganizations","organizations","length","splice","forEach","org","push","afterSearching","createPlan","getOrganizationServiceForSelectedOrganization","createPlan2","getOrganizationReference","selectedOrganization","selectedReportingPeriod","year","reportingTerm","reportingFrequency","selectOrganization","item","loadOrganizationReportingPeriods","getReportingPeriodsToCreatePlan","onUnitPlanCreated","planid","navigate","onUnitPlanCreateFailed","e","$values","join","onZonePlanCreated","onZonePlanCreateFailed","onStatePlanCreated","onStatePlanCreateFailed","onCentralPlanCreated","onCentralPlanCreateFailed","trim","toLowerCase","filter","desc","includes","orgType","organizationTypeDescription","parents","parentDescriptions","attached","key","hasOwnProperty","on","undefined","itemindex","findIndex","organizationType","Central","State","Zone","detached","off","Unit","Error","details","PlanCreate","module","exports","allReportService","authService","storage","dialogService","searchStorageKey","isDownloading","isReset","canDeleteManagedOrgReport","canUnSubmitManagedOrgReport","mapDtoToGridItem","dto","canDelete","canUnSubmit","isSystemAdmin","setFromDate","reportSearchTerms","timestampFrom","toDate","timestampFromElement","val","format","timestampFromInputChanged","value","timestampToInputChanged","timestampTo","setToDate","timestampToElement","setReportingPeriodStartDateFrom","reportingPeriodStartDateFrom","Date","utcOffset","reportingPeriodStartDateFromElement","reportingPeriodStartDateFromInputChanged","reportingPeriodEndDateToInputChanged","reportingPeriodEndDateTo","setReportingPeriodEndDateTo","reportingPeriodEndDateToElement","onReportDeleted","reportId","deletedItemIndex","grid","onReportUnSubmitted","unSubmittedItemIndex","onReportDeleteFailed","onReportUnSubmitFailed","get","options","locale","minYear","autoUpdateInput","showDropdowns","timePicker","timePickerSeconds","singleDatePicker","daterangepicker","downloadReports","download","blob","set","reset","resetToDefault","PlanPromoted","deleteConfirmed","organizationTypeUnit","delete","organizationTypeZone","organizationTypeState","organizationTypeCentral","deleteConfirmationDialog","open","viewModel","model","whenClosed","response","wasCancelled","unSubmitConfirmed","unsubmitReport","unSubmitConfirmationDialog","unSubmit","PlansAndReports","of","authservice","toggleClass","one","setTimeout","window","dispatchEvent","Event","isUserVisible","roles","userRoles","role","Sidebar"],"mappings":"4FAEA,gDAGA,aACI,WAAmBA,EACRC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,QAAA,IAAAA,OAAA,GAbQ,KAAAb,KACR,KAAAC,cACA,KAAAC,eACA,KAAAC,kBACA,KAAAC,eACA,KAAAC,0BACA,KAAAC,uBACA,KAAAC,kCACA,KAAAC,YACA,KAAAC,gBACA,KAAAC,kBACA,KAAAC,aACA,KAAAC,aACA,KAAAC,iBASf,OAPI,sBAAI,sBAAO,C,IAAX,WACI,OAAOC,KAAKF,YAAcE,KAAKV,eAAiB,IAAaW,W,gCAGjE,sBAAI,0BAAW,C,IAAf,WACI,OAAQD,KAAKF,YAAcE,KAAKV,eAAiB,IAAaY,OAAUF,KAAKJ,iB,gCAErF,EAvBA,I,0/DCWA,aAaI,WAAmBO,EACRC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GAPX,WAAmB,KAAAP,sBACR,KAAAC,wBACA,KAAAC,yBACA,KAAAC,wBACA,KAAAC,2BACA,KAAAC,yBACA,KAAAC,UACA,KAAAC,SAlBX,KAAAC,iBAA+C,GAG/C,KAAAC,gBAAiB,EAC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KAAKyH,KAAK3G,cAAgBd,KAAKsF,e,gCAG3C,sBAAI,0BAAW,C,IAAf,WACI,OAAQtF,KAAKyH,KAAK3G,cAAgBd,KAAKsF,gBAAkBtF,KAAKyH,KAAKzG,a,gCAGvE,sBAAI,uBAAQ,C,IAAZ,WACI,OAAQhB,KAAKyH,KAAK3G,cAAgBd,KAAKsF,e,gCA7VlC0E,EAAe,GAV3B,YACG,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IAAYC,GAAG,IAAgB,CAAC,oBAChC,iB,uBAiBqC,IACH,IACA,IACC,IACE,IACjB,IACI,IACX,IACa,mBAxBjBD,GAAb,I,kGClCAjF,EAAOC,QAAU,g2oB,smBCOjB,aACI,WAAmBtE,EAAuBwJ,GAAvB,KAAAxJ,SAAuB,KAAAwJ,cAwB9C,OAtBI,YAAApG,SAAA,WAGO,KACD,IAAE,mBAAmBG,GAAG,QAAS,WAC7B,IAAE,YACCkG,YAAY,WAEZC,IAAI,gBAAiB,WACpBC,WAAW,WACTC,OAAOC,cAAc,IAAIC,MAAM,YAC9B,UAMjB,YAAAC,cAAA,SAAcC,GACZ,IAAIA,GAAyB,GAAhBA,EAAMrJ,OAAa,OAAO,EACvC,IAAMsJ,EAAY3K,KAAKkK,YAAYQ,MACnC,OAAgE,GAAzDA,EAAMnH,OAAO,SAAAqH,GAAQ,OAAAD,EAAUlH,SAASmH,KAAOvJ,QAvB/CwJ,EAAO,GAFnB,IACA,I,uBAE8B,IAA4B,OAD9CA,GAAb,I,gDCPA9F,EAAOC,QAAU","file":"app~58f4c78a.39daa5a3497384b834b7.chunk.js","sourcesContent":["import { OrganizationReference } from \"models/OrganizationReference\";\r\nimport { ReportingPeriod } from \"models/ReportingPeriod\";\r\nimport { ReportStatus } from \"models/ReportStatus\";\r\nimport { ReopenedReportStatus } from \"models/ReopenedReportStatus\";\r\n\r\nexport class ReportGridItem {\r\n constructor(public id: number, \r\n public description: string, \r\n public organization: OrganizationReference, \r\n public reportingPeriod: ReportingPeriod,\r\n public reportStatus: ReportStatus,\r\n public reportStatusDescription: string,\r\n public reOpenedReportStatus: ReopenedReportStatus,\r\n public reOpenedReportStatusDescription: string,\r\n public timestamp: Date,\r\n public canDeleteItem: boolean,\r\n public canUnSubmitItem: boolean,\r\n public isDeleting: boolean,\r\n public isSysAdmin: boolean,\r\n public isUnSubmitting: boolean = false) { }\r\n\r\n get canCopy() {\r\n return this.isSysAdmin || this.reportStatus === ReportStatus.Submitted;\r\n }\r\n\r\n get canUnSubmit() {\r\n return (this.isSysAdmin && this.reportStatus !== ReportStatus.Draft) || this.canUnSubmitItem;\r\n }\r\n}\r\n","import {autoinject} from \"aurelia-framework\";\r\nimport {AppRouter} from \"aurelia-router\";\r\nimport * as toastr from \"toastr\";\r\nimport {OrganizationType} from \"models/OrganizationType\";\r\nimport {OrganizationService} from \"services/OrganizationService\";\r\nimport {OrganizationViewModelDto} from \"models/OrganizationViewModelDto\";\r\nimport {StatePlanReportService} from \"services/StatePlanReportService\";\r\nimport {UnitPlanReportService} from \"services/UnitPlanReportService\";\r\nimport {SignalrWrapper} from \"signalrwrapper\";\r\nimport {OrganizationReference} from \"models/OrganizationReference\";\r\nimport { ZonePlanReportService } from \"services/ZonePlanReportService\";\r\nimport { CentralPlanReportService } from \"services/CentralPlanReportService\";\r\nimport { ReportingPeriodViewModel } from \"models/ReportingPeriodViewModel\";\r\nimport { ReportingPeriodService } from \"services/ReportingPeriodService\";\r\n\r\n@autoinject\r\nexport class PlanCreate { \r\n selectedOrganization: OrganizationViewModelDto;\r\n reportingPeriods: ReportingPeriodViewModel[] = [];\r\n selectedReportingPeriod: ReportingPeriodViewModel;\r\n\r\n isCreatingPlan = false;\r\n signalreventhandlers: any = {};\r\n \r\n isSearching = false;\r\n items: OrganizationViewModelDto[] = [];\r\n nodatafound = false;\r\n filterText: string = '';\r\n\r\n constructor(public organizationService: OrganizationService,\r\n public unitPlanReportService: UnitPlanReportService,\r\n public statePlanReportService: StatePlanReportService,\r\n public zonePlanReportService: ZonePlanReportService,\r\n public centralPlanReportService: CentralPlanReportService,\r\n public reportingPeriodService: ReportingPeriodService,\r\n public signalr: SignalrWrapper,\r\n public router: AppRouter) {\r\n this.signalreventhandlers = {\r\n \"UnitPlanCreated\": this.onUnitPlanCreated,\r\n \"UnitPlanCreateFailed\": this.onUnitPlanCreateFailed,\r\n \"ZonePlanCreated\": this.onZonePlanCreated,\r\n \"ZonePlanCreateFailed\": this.onZonePlanCreateFailed,\r\n \"StatePlanCreated\": this.onStatePlanCreated,\r\n \"StatePlanCreateFailed\": this.onStatePlanCreateFailed,\r\n \"CentralPlanCreated\": this.onCentralPlanCreated,\r\n \"CentralPlanCreateFailed\": this.onCentralPlanCreateFailed\r\n };\r\n }\r\n\r\n get filteredItems(): OrganizationViewModelDto[] {\r\n if (!this.filterText || this.filterText.trim() === '') {\r\n return this.items;\r\n }\r\n const search = this.filterText.toLowerCase().trim();\r\n return this.items.filter(item => {\r\n const desc = item.description && item.description.toLowerCase().includes(search);\r\n const orgType = item.organizationTypeDescription && item.organizationTypeDescription.toLowerCase().includes(search);\r\n const parents = item.parentDescriptions && item.parentDescriptions.toLowerCase().includes(search);\r\n return desc || orgType || parents;\r\n });\r\n }\r\n\r\n async attached() {\r\n for (const key in this.signalreventhandlers) {\r\n if (this.signalreventhandlers.hasOwnProperty(key)) {\r\n this.signalr.on(key, this.signalreventhandlers[key]);\r\n }\r\n }\r\n await this.search();\r\n }\r\n\r\n search = async () => {\r\n this.isSearching = true;\r\n const organizations = await this.organizationService.myorganizations();\r\n this.isSearching = false;\r\n this.nodatafound = organizations.length == 0;\r\n this.items.splice(0, this.items.length);\r\n organizations.forEach(org => this.items.push(org));\r\n await this.afterSearching();\r\n }\r\n\r\n async afterSearching() {\r\n this.selectOrganization(undefined);\r\n let itemindex=-1;\r\n if(this.items.length === 1) {\r\n await this.selectOrganization(this.items[0]);\r\n return;\r\n }\r\n\r\n if((itemindex = this.items.findIndex(item => item.organizationType === OrganizationType.Central)) !== -1){\r\n await this.selectOrganization(this.items[itemindex]);\r\n return;\r\n }\r\n else if((itemindex = this.items.findIndex(item => item.organizationType === OrganizationType.State)) !== -1){\r\n await this.selectOrganization(this.items[itemindex]);\r\n return;\r\n }\r\n else if((itemindex = this.items.findIndex(item => item.organizationType === OrganizationType.Zone)) !== -1){\r\n await this.selectOrganization(this.items[itemindex]);\r\n return;\r\n }\r\n else if(this.items.length === 1) {\r\n await this.selectOrganization(this.items[0]);\r\n return;\r\n }\r\n }\r\n\r\n detached() {\r\n for(const key in this.signalreventhandlers) {\r\n if (this.signalreventhandlers.hasOwnProperty(key)) {\r\n this.signalr.off(key, this.signalreventhandlers[key]);\r\n }\r\n }\r\n }\r\n \r\n getOrganizationServiceForSelectedOrganization() : UnitPlanReportService | StatePlanReportService | ZonePlanReportService | CentralPlanReportService {\r\n if(this.selectedOrganization.organizationType === OrganizationType.State) {\r\n return this.statePlanReportService;\r\n }\r\n else if(this.selectedOrganization.organizationType == OrganizationType.Unit)\r\n {\r\n return this.unitPlanReportService;\r\n }\r\n else if(this.selectedOrganization.organizationType == OrganizationType.Zone)\r\n {\r\n return this.zonePlanReportService;\r\n }\r\n else if(this.selectedOrganization.organizationType == OrganizationType.Central)\r\n {\r\n return this.centralPlanReportService;\r\n }\r\n else throw new Error(\"Not Implemented\");\r\n }\r\n\r\n createPlan = async () => {\r\n try {\r\n const orgService = this.getOrganizationServiceForSelectedOrganization();\r\n await orgService.createPlan2(this.getOrganizationReference(this.selectedOrganization, this.selectedReportingPeriod), \r\n this.selectedReportingPeriod.year, this.selectedReportingPeriod.reportingTerm, this.selectedReportingPeriod.reportingFrequency);\r\n } catch(error) {\r\n toastr.error(error);\r\n return;\r\n }\r\n this.isCreatingPlan = true;\r\n }\r\n\r\n selectOrganization = async (item: OrganizationViewModelDto) => {\r\n this.reportingPeriods = [];\r\n this.selectedOrganization = item;\r\n await this.loadOrganizationReportingPeriods();\r\n }\r\n\r\n loadOrganizationReportingPeriods = async () => {\r\n if(!this.selectedOrganization) return;\r\n this.reportingPeriods = await this.reportingPeriodService.getReportingPeriodsToCreatePlan(this.selectedOrganization.id);\r\n }\r\n\r\n getOrganizationReference(org: OrganizationViewModelDto, selectedReportingPeriod: ReportingPeriodViewModel) {\r\n return new OrganizationReference(org.id, org.organizationType, org.description, selectedReportingPeriod.reportingFrequency, org.details);\r\n }\r\n\r\n onUnitPlanCreated = (planid: number) => {\r\n toastr.success(\"Plan Created\");\r\n this.router.navigate(`unit-plan-edit/${planid}`);\r\n }\r\n\r\n onUnitPlanCreateFailed = (e: {$values: string[]}) => {\r\n this.isCreatingPlan = false;\r\n toastr.error(e.$values.join(\", \"));\r\n }\r\n\r\n onZonePlanCreated = (planid: number) => {\r\n toastr.success(\"Plan Created\");\r\n this.router.navigate(`zone-plan-edit/${planid}`);\r\n }\r\n\r\n onZonePlanCreateFailed = (e: {$values: string[]}) => {\r\n this.isCreatingPlan = false;\r\n toastr.error(e.$values.join(\", \"));\r\n }\r\n\r\n onStatePlanCreated = (planid: number) => {\r\n toastr.success(\"Plan created\");\r\n this.router.navigate(`state-plan-edit/${planid}`);\r\n }\r\n\r\n onStatePlanCreateFailed = (e: {$values: string[]}) => {\r\n this.isCreatingPlan = false;\r\n toastr.error(e.$values.join(\", \"));\r\n }\r\n\r\n onCentralPlanCreated = (planid: number) => {\r\n toastr.success(\"Plan created\");\r\n this.router.navigate(`central-plan-edit/${planid}`);\r\n }\r\n\r\n onCentralPlanCreateFailed = (e: {$values: string[]}) => {\r\n this.isCreatingPlan = false;\r\n toastr.error(e.$values.join(\", \"));\r\n }\r\n}\r\n","module.exports = \">\";","import { DialogService, DialogSettings } from \"aurelia-dialog\";\r\nimport { inject, autoinject, NewInstance } from \"aurelia-framework\";\r\nimport $ from \"jquery\";\r\nimport * as moment from \"moment\";\r\nimport * as toastr from \"toastr\";\r\nimport { saveAs } from \"file-saver\";\r\nimport { AllReportService } from \"../../services/AllReportsService\";\r\nimport { ReportSearchTerms } from \"models/ReportSearchTerms\";\r\nimport { ReportViewModelDto } from \"models/ReportViewModelDto\";\r\nimport { Grid } from \"resources/grid/grid\";\r\nimport { UnitPlanReportService } from \"services/UnitPlanReportService\";\r\nimport { ZonePlanReportService } from \"services/ZonePlanReportService\";\r\nimport { StatePlanReportService } from \"services/StatePlanReportService\";\r\nimport { CentralPlanReportService } from \"services/CentralPlanReportService\";\r\nimport { OrganizationType } from \"models/OrganizationType\";\r\nimport { SignalrWrapper } from \"signalrwrapper\";\r\nimport { ReportGridItem } from \"./ReportGridItem\";\r\nimport { AuthService } from \"auth-service\";\r\nimport { BrowserStorage } from \"../../utils/browserStorage\";\r\nimport { ReportStatus } from \"models/ReportStatus\";\r\nimport { YesNoDialog } from \"../../resources/yes-no-dialog/yes-no-dialog\"\r\nimport { YesNo } from \"../../resources/yes-no-dialog/YesNo\";\r\n\r\n\r\n@inject(\r\n AllReportService,\r\n UnitPlanReportService,\r\n ZonePlanReportService,\r\n StatePlanReportService,\r\n CentralPlanReportService,\r\n SignalrWrapper,\r\n AuthService,\r\n NewInstance.of(BrowserStorage, [\"PlansAndReports\"]),\r\n DialogService)\r\nexport class PlansAndReports {\r\n private storage: BrowserStorage;\r\n private searchStorageKey: string = \"searchTerms\";\r\n private reportSearchTerms: ReportSearchTerms;\r\n grid: Grid;\r\n\r\n timestampFromElement: HTMLElement;\r\n timestampToElement: HTMLElement;\r\n reportingPeriodStartDateFromElement: HTMLElement;\r\n reportingPeriodEndDateToElement: HTMLElement;\r\n\r\n isDownloading = false;\r\n isReset = false;\r\n signalreventhandlers: any = {};\r\n canDeleteManagedOrgReport = false;\r\n canUnSubmitManagedOrgReport = false;\r\n constructor(public allReportService: AllReportService,\r\n public unitPlanReportService: UnitPlanReportService,\r\n public zonePlanReportService: ZonePlanReportService,\r\n public statePlanReportService: StatePlanReportService,\r\n public centralPlanReportService: CentralPlanReportService,\r\n public signalr: SignalrWrapper,\r\n public authService: AuthService,\r\n storage: BrowserStorage,\r\n public dialogService: DialogService) {\r\n this.signalreventhandlers = {\r\n \"ReportDeleted\": this.onReportDeleted,\r\n \"ReportDeleteFailed\": this.onReportDeleteFailed,\r\n \"ReportUnSubmitted\": this.onReportUnSubmitted,\r\n \"ReportUnSubmitFailed\": this.onReportUnSubmitFailed\r\n };\r\n\r\n this.storage = storage;\r\n this.reportSearchTerms = new ReportSearchTerms(this.storage.get(this.searchStorageKey))\r\n\r\n this.grid = new Grid(this.reportSearchTerms,\r\n this.allReportService.search, this.mapDtoToGridItem);\r\n }\r\n\r\n mapDtoToGridItem = (dto: ReportViewModelDto) => {\r\n if (dto.canDelete){\r\n this.canDeleteManagedOrgReport = true;\r\n }\r\n \r\n if (dto.canUnSubmit){\r\n this.canUnSubmitManagedOrgReport = true;\r\n }\r\n\r\n return new ReportGridItem(\r\n dto.id,\r\n dto.description,\r\n dto.organization,\r\n dto.reportingPeriod,\r\n dto.reportStatus,\r\n dto.reportStatusDescription,\r\n dto.reOpenedReportStatus,\r\n dto.reOpenedReportStatusDescription,\r\n dto.timestamp,\r\n dto.canDelete,\r\n dto.canUnSubmit,\r\n false,\r\n this.authService ? this.authService.isSystemAdmin : false\r\n );\r\n }\r\n\r\n async attached() {\r\n const options: any = {\r\n locale: {\r\n format: 'DD/M/YYYY hh:mm:ss A'\r\n },\r\n minYear: 2019,\r\n autoUpdateInput: false,\r\n showDropdowns: true,\r\n timePicker: true,\r\n timePickerSeconds: true,\r\n singleDatePicker: true\r\n };\r\n $(this.timestampFromElement).daterangepicker(options, this.setFromDate);\r\n $(this.timestampToElement).daterangepicker(options, this.setToDate);\r\n\r\n $(this.reportingPeriodStartDateFromElement).daterangepicker(options, this.setReportingPeriodStartDateFrom);\r\n $(this.reportingPeriodEndDateToElement).daterangepicker(options, this.setReportingPeriodEndDateTo);\r\n\r\n if (this.reportSearchTerms.timestampFrom) {\r\n $(this.timestampFromElement).val(moment(this.reportSearchTerms.timestampFrom).format('DD/M/YYYY hh:mm:ss A'));\r\n }\r\n if (this.reportSearchTerms.timestampTo) {\r\n $(this.timestampToElement).val(moment(this.reportSearchTerms.timestampTo).format('DD/M/YYYY hh:mm:ss A'));\r\n }\r\n if (this.reportSearchTerms.reportingPeriodStartDateFrom) {\r\n $(this.reportingPeriodStartDateFromElement).val(moment(this.reportSearchTerms.reportingPeriodStartDateFrom).format('YYYY MMMM'));\r\n }\r\n if (this.reportSearchTerms.reportingPeriodEndDateTo) {\r\n $(this.reportingPeriodEndDateToElement).val(moment(this.reportSearchTerms.reportingPeriodEndDateTo).format('YYYY MMMM'));\r\n }\r\n\r\n for (const key in this.signalreventhandlers) {\r\n if (this.signalreventhandlers.hasOwnProperty(key)) {\r\n this.signalr.on(key, this.signalreventhandlers[key]);\r\n }\r\n }\r\n await this.grid.search();\r\n }\r\n\r\n detached() {\r\n for (const key in this.signalreventhandlers) {\r\n if (this.signalreventhandlers.hasOwnProperty(key)) {\r\n this.signalr.off(key, this.signalreventhandlers[key]);\r\n }\r\n }\r\n }\r\n\r\n setFromDate = (timestamp: moment.Moment) => {\r\n this.reportSearchTerms.timestampFrom = timestamp.toDate();\r\n $(this.timestampFromElement).val(timestamp.format('DD/M/YYYY hh:mm:ss A'));\r\n }\r\n\r\n timestampFromInputChanged = (value: string) => {\r\n if (!value) {\r\n this.reportSearchTerms.timestampFrom = undefined;\r\n }\r\n }\r\n\r\n timestampToInputChanged = (value: string) => {\r\n if (!value) {\r\n this.reportSearchTerms.timestampTo = undefined;\r\n }\r\n }\r\n\r\n setToDate = (timestamp: moment.Moment) => {\r\n this.reportSearchTerms.timestampTo = timestamp.toDate();\r\n $(this.timestampToElement).val(timestamp.format('DD/M/YYYY hh:mm:ss A'));\r\n }\r\n\r\n setReportingPeriodStartDateFrom = (timestamp: moment.Moment) => {\r\n // Remove timezone-offset from the timestamp (https://stackoverflow.com/questions/31154023/set-the-timezone-of-a-date-object)\r\n this.reportSearchTerms.reportingPeriodStartDateFrom = new Date(moment.parseZone(timestamp).utcOffset(0, true).format());\r\n $(this.reportingPeriodStartDateFromElement).val(timestamp.format('YYYY MMMM'));\r\n }\r\n\r\n reportingPeriodStartDateFromInputChanged = (value: string) => {\r\n if (!value) {\r\n this.reportSearchTerms.reportingPeriodStartDateFrom = undefined;\r\n }\r\n }\r\n\r\n reportingPeriodEndDateToInputChanged = (value: string) => {\r\n if (!value) {\r\n this.reportSearchTerms.reportingPeriodEndDateTo = undefined;\r\n }\r\n }\r\n\r\n setReportingPeriodEndDateTo = (timestamp: moment.Moment) => {\r\n // Remove timezone-offset from the timestamp (https://stackoverflow.com/questions/31154023/set-the-timezone-of-a-date-object)\r\n this.reportSearchTerms.reportingPeriodEndDateTo = new Date(moment.parseZone(timestamp).utcOffset(0, true).format());\r\n $(this.reportingPeriodEndDateToElement).val(timestamp.format('YYYY MMMM'));\r\n }\r\n\r\n async downloadReports() {\r\n this.isDownloading = true;\r\n const blob = await this.allReportService.download(this.reportSearchTerms);\r\n this.isDownloading = false;\r\n if (!blob) {\r\n toastr.error(\"Error downloading report\");\r\n return;\r\n }\r\n saveAs(blob, \"AllReports.xlsx\");\r\n }\r\n\r\n async search(){\r\n await this.grid.search();\r\n this.storage.set(\"searchTerms\", this.reportSearchTerms);\r\n }\r\n\r\n async reset() {\r\n this.isReset = true;\r\n $(this.timestampFromElement).val(undefined);\r\n $(this.timestampToElement).val(undefined);\r\n $(this.reportingPeriodStartDateFromElement).val(undefined);\r\n $(this.reportingPeriodEndDateToElement).val(undefined);\r\n this.reportSearchTerms.resetToDefault();\r\n this.storage.set(\"searchTerms\", this.reportSearchTerms);\r\n this.isReset = false;\r\n }\r\n\r\n get reportStatusDraft() {\r\n return ReportStatus.Draft;\r\n }\r\n\r\n get reportStatusPlanPromoted() {\r\n return ReportStatus.PlanPromoted;\r\n }\r\n\r\n get reportStatusSubmitted() {\r\n return ReportStatus.Submitted;\r\n }\r\n\r\n get organizationTypeUnit() {\r\n return OrganizationType.Unit;\r\n }\r\n\r\n get organizationTypeZone() {\r\n return OrganizationType.Zone;\r\n }\r\n\r\n get organizationTypeState() {\r\n return OrganizationType.State;\r\n }\r\n\r\n get organizationTypeCentral() {\r\n return OrganizationType.Central;\r\n }\r\n\r\n async deleteConfirmed(item: ReportGridItem) {\r\n if (item.organization.organizationType === this.organizationTypeUnit) {\r\n await this.unitPlanReportService.delete(item.organization.id, item.id);\r\n item.isDeleting = true;\r\n return;\r\n }\r\n if (item.organization.organizationType === this.organizationTypeZone) {\r\n await this.zonePlanReportService.delete(item.organization.id, item.id);\r\n item.isDeleting = true;\r\n return;\r\n }\r\n if (item.organization.organizationType === this.organizationTypeState) {\r\n await this.statePlanReportService.delete(item.organization.id, item.id);\r\n item.isDeleting = true;\r\n return;\r\n }\r\n if (item.organization.organizationType === this.organizationTypeCentral) {\r\n await this.centralPlanReportService.delete(item.organization.id, item.id);\r\n item.isDeleting = true;\r\n return;\r\n }\r\n throw new Error(\"Not Implemented\");\r\n }\r\n\r\n async deleteConfirmationDialog(item: ReportGridItem) {\r\n await this.dialogService.open({\r\n viewModel: YesNoDialog,\r\n model: new YesNo(\"Are you sure you want to delete?\", \"This operation cannot be undone.\")\r\n }).whenClosed((response) => {\r\n if (response.wasCancelled) {\r\n return;\r\n } else {\r\n return this.deleteConfirmed(item);\r\n }\r\n });\r\n }\r\n\r\n async delete(item: ReportGridItem) {\r\n return this.deleteConfirmationDialog(item);\r\n }\r\n\r\n async unSubmitConfirmed(item: ReportGridItem) {\r\n if (item.organization.organizationType === this.organizationTypeUnit) {\r\n await this.unitPlanReportService.unsubmitReport(item.organization.id, item.id);\r\n item.isUnSubmitting = true;\r\n return;\r\n }\r\n if (item.organization.organizationType === this.organizationTypeZone) {\r\n await this.zonePlanReportService.unsubmitReport(item.organization.id, item.id);\r\n item.isUnSubmitting = true;\r\n return;\r\n }\r\n if (item.organization.organizationType === this.organizationTypeState) {\r\n await this.statePlanReportService.unsubmitReport(item.organization.id, item.id);\r\n item.isUnSubmitting = true;\r\n return;\r\n }\r\n if (item.organization.organizationType === this.organizationTypeCentral) {\r\n await this.centralPlanReportService.unsubmitReport(item.organization.id, item.id);\r\n item.isUnSubmitting = true;\r\n return;\r\n }\r\n throw new Error(\"Not Implemented\");\r\n }\r\n\r\n async unSubmitConfirmationDialog(item: ReportGridItem) {\r\n await this.dialogService.open({\r\n viewModel: YesNoDialog,\r\n model: new YesNo(\r\n \"Are you sure you want to unsubmit?\",\r\n \"If you unsubmit the report, the `Last Period` values will be automatically recalculated and overwritten with the `This Period` values from the report submitted for the previous reporting period.\"\r\n )\r\n }).whenClosed((response) => {\r\n if (response.wasCancelled) {\r\n return;\r\n } else {\r\n return this.unSubmitConfirmed(item);\r\n }\r\n });\r\n }\r\n\r\n async unSubmit(item: ReportGridItem) {\r\n return this.unSubmitConfirmationDialog(item);\r\n }\r\n\r\n onReportDeleted = (reportId: number) => {\r\n const deletedItemIndex = this.grid.items.findIndex(item => item.id === reportId);\r\n if (deletedItemIndex !== -1) {\r\n this.grid.items[deletedItemIndex].isDeleting = false;\r\n this.grid.items.splice(deletedItemIndex, 1);\r\n }\r\n toastr.success(\"Deleted successfully\");\r\n }\r\n\r\n onReportUnSubmitted = (reportId: number) => {\r\n const unSubmittedItemIndex = this.grid.items.findIndex(item => item.id === reportId);\r\n if (unSubmittedItemIndex !== -1) {\r\n const item = this.grid.items[unSubmittedItemIndex];\r\n item.isUnSubmitting = false;\r\n item.reportStatus = item.reportStatus - 1;\r\n if (item.reportStatus == ReportStatus.Draft){\r\n item.canUnSubmitItem = false;\r\n }\r\n }\r\n toastr.success(\"Unsubmitted successfully\");\r\n }\r\n\r\n get canDelete() {\r\n return this.authService.isSystemAdmin == true;\r\n }\r\n\r\n get canUnSubmit() {\r\n return this.authService.isSystemAdmin == true;\r\n }\r\n\r\n onReportDeleteFailed = (e: { $values: string[] }) => {\r\n toastr.error(e.$values.join(\", \"));\r\n }\r\n\r\n onReportUnSubmitFailed = (e: { $values: string[] }) => {\r\n toastr.error(e.$values.join(\", \"));\r\n }\r\n\r\n get canSearch() {\r\n return !this.grid.isSearching && !this.isDownloading;\r\n }\r\n\r\n get canCreatePlan() {\r\n return !this.grid.isSearching && !this.isDownloading;\r\n }\r\n\r\n get canDownload() {\r\n return !this.grid.isSearching && !this.isDownloading && !this.grid.nodatafound;\r\n }\r\n\r\n get canReset() {\r\n return !this.grid.isSearching && !this.isDownloading;\r\n }\r\n}\r\n","module.exports = \"\\r\\n\";","import { containerless, autoinject } from \"aurelia-framework\";\r\nimport { Router } from \"aurelia-router\";\r\nimport $ from \"jquery\";\r\nimport { AuthService } from \"auth-service\";\r\n\r\n@containerless\r\n@autoinject\r\nexport class Sidebar {\r\n constructor(public router: Router, public authservice: AuthService){}\r\n\r\n attached() {\r\n // TODO: sidebar.js code in appstack didn't run \r\n // when loaded via aurelia\r\n if($) {\r\n $(\".sidebar-toggle\").on(\"click\", function() {\r\n $(\".sidebar\")\r\n .toggleClass(\"toggled\")\r\n // Triger resize after animation\r\n .one(\"transitionend\", function() {\r\n setTimeout(function() {\r\n window.dispatchEvent(new Event(\"resize\"));\r\n }, 100);\r\n });\r\n });\r\n }\r\n }\r\n\r\n isUserVisible(roles: string[]): boolean {\r\n if(!roles || roles.length == 0) return true;\r\n const userRoles = this.authservice.roles;\r\n return roles.filter(role => userRoles.includes(role)).length != 0;\r\n }\r\n}","module.exports = \"\";"],"sourceRoot":""}