diff --git a/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/incident-info-header/incident-header-panel.component.ts b/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/incident-info-header/incident-header-panel.component.ts
index 29a11da4f..04f4720df 100644
--- a/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/incident-info-header/incident-header-panel.component.ts
+++ b/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/incident-info-header/incident-header-panel.component.ts
@@ -692,10 +692,6 @@ export class IncidentHeaderPanelComponent implements AfterViewInit, OnInit {
}
}
- // printPage(){
- // this.requestPrint.emit();
- // }
-
public printPage() {
const twoColumnContent = document.getElementsByClassName('two-column-content-cards-container')[0];
twoColumnContent.classList.add('print');
diff --git a/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/public-incident-page.component.html b/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/public-incident-page.component.html
index 514cdaefb..411e2fc46 100644
--- a/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/public-incident-page.component.html
+++ b/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/public-incident-page.component.html
@@ -16,7 +16,7 @@
-
+
diff --git a/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/public-incident-page.component.ts b/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/public-incident-page.component.ts
index 05945edef..350f9255a 100644
--- a/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/public-incident-page.component.ts
+++ b/client/wfnews-war/src/main/angular/src/app/components/public-incident-page/public-incident-page.component.ts
@@ -16,6 +16,7 @@ import { findFireCentreByName, hideOnMobileView } from '../../utils';
templateUrl: './public-incident-page.component.html',
styleUrls: ['./public-incident-page.component.scss'],
})
+
export class PublicIncidentPageComponent implements OnInit {
public isLoading = true;
public loadingFailed = false;
@@ -35,7 +36,6 @@ export class PublicIncidentPageComponent implements OnInit {
findFireCentreByName = findFireCentreByName;
hideOnMobileView = hideOnMobileView;
-
constructor(
private router: ActivatedRoute,
protected cdr: ChangeDetectorRef,
@@ -294,19 +294,31 @@ export class PublicIncidentPageComponent implements OnInit {
window.location.href = mailtoUrl;
}
- onTabChange(event: MatTabChangeEvent) {
+ onTabChange(event: MatTabChangeEvent | number): void {
+ const TAB_ACTIONS = [
+ 'incident_details_details_click',
+ 'incident_details_response_click',
+ 'incident_details_gallery_click',
+ 'incident_details_maps_click',
+ ];
+
+ const tabLabels = ['Details', 'Response', 'Gallery', 'Maps'];
const url = this.appConfigService.getConfig().application.baseUrl.toString() + this.currentRouter.url.slice(1);
- let actionName;
- if (event?.tab?.textLabel === 'Response') {
- actionName = 'incident_details_response_click';
- } else if (event?.tab?.textLabel === 'Gallery') {
- actionName = 'incident_details_gallery_click';
- } else if (event?.tab?.textLabel === 'Maps') {
- actionName = 'incident_details_maps_click';
+
+ // Determine the index based on the type of event
+ const index = typeof event === 'number' ? event : event.index;
+
+ // Validate the index to avoid accessing undefined values
+ if (index < 0 || index >= TAB_ACTIONS.length) {
+ console.warn('Invalid tab index:', index);
+ return;
}
+
+ const actionName = TAB_ACTIONS[index];
this.snowPlowHelper(url, {
action: actionName,
- text: event?.tab?.textLabel
+ text: tabLabels[index],
});
}
+
}