# AlertsService

**Kind:** Class

**Source:** `Frontend/src/app/components/shared/alerts/alerts.service.ts` (line 36)

**Part of:** [Frontend](subsystem-frontend-src-app)

`AlertsService` centralizes alert actions for shared frontend components. It exposes methods for standard alerts, translated alerts, and error alerts so callers do not duplicate alert-handling logic.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `goAlert` | `goAlert(type: string | 'W' | 'warning' | 'E' | 'error' | 'S' | 'success' | 'I' | 'info', msg: string, icon: string, timeOut: number)` | `void` |
| `goTranslatedAlert` | `goTranslatedAlert(type: string | 'W' | 'warning' | 'E' | 'error' | 'S' | 'success' | 'I' | 'info', msg: AlertMsg, icon: string, timeOut: number)` | `void` |
| `goAlertError` | `goAlertError(type: string | 'W' | 'warning' | 'E' | 'error' | 'S' | 'success' | 'I' | 'info', msg: string, msgList: string[], icon: string, timeOut: number)` | `void` |

## Properties

| Property | Type |
|---|---|
| `_alert` | `Alerts` |
| `alert` | `any` |
| `_alertTranslated` | `AlertsTranslated` |
| `alertTranslated` | `any` |
| `type` | `string | 'W' | 'warning' | 'E' | 'error' | 'S' | 'success' | 'I' | 'info'` |
| `msg` | `AlertMsg` |

## Diagram

```mermaid
graph LR
  Component[Frontend Component] --> Service[AlertsService]
  Service --> Standard[goAlert()]
  Service --> Translated[goTranslatedAlert()]
  Service --> Error[goAlertError()]
  Standard --> AlertUI[Alert Display]
  Translated --> AlertUI
  Error --> AlertUI
```

## Usage

```ts
import { Component, inject } from '@angular/core';
import { AlertsService } from './components/shared/alerts/alerts.service';

@Component({
  selector: 'app-example',
  template: `
    <button (click)="showAlert()">Show alert</button>
    <button (click)="showTranslatedAlert()">Show translated alert</button>
    <button (click)="showError()">Show error</button>
  `,
})
export class ExampleComponent {
  private readonly alertsService = inject(AlertsService);

  showAlert(): void {
    this.alertsService.goAlert();
  }

  showTranslatedAlert(): void {
    this.alertsService.goTranslatedAlert();
  }

  showError(): void {
    this.alertsService.goAlertError();
  }
}
```

## AI Coding Instructions

- Inject `AlertsService` into components or services that need to trigger alert behavior.
- Use `goAlert()` for standard alert flows and `goAlertError()` for error-related flows.
- Use `goTranslatedAlert()` when the alert content must follow the application's translation flow.
- Keep alert decisions in calling code and route display behavior through `AlertsService`.

## Used by

171 references from 171 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (171)

- `AppComponent` — `Frontend/src/app/app.component.ts`:1
- `MrqDetailsComponent` — `Frontend/src/app/components/MRQ/mrq-details/mrq-details.component.ts`:1
- `MrqInquiryComponent` — `Frontend/src/app/components/MRQ/mrq-details/mrq-inquiry/mrq-inquiry.component.ts`:1
- `MrqListComponent` — `Frontend/src/app/components/MRQ/mrq-list/mrq-list.component.ts`:1
- `BillOfMaterialsDetailsComponent` — `Frontend/src/app/components/bill-of-materials/bill-of-materials-details/bill-of-materials-details.component.ts`:1
- `BillOfMaterialsListComponent` — `Frontend/src/app/components/bill-of-materials/bill-of-materials-list/bill-of-materials-list.component.ts`:1
- `BlogPopupComponent` — `Frontend/src/app/components/blogs/blog-popup/blog-popup.component.ts`:1
- `BlogsDetailsComponent` — `Frontend/src/app/components/blogs/blogs-details/blogs-details.component.ts`:1

…and 163 more.
