2022-11-23 12:00:49 -08:00
|
|
|
import { Controller } from '@hotwired/stimulus';
|
2023-01-13 09:37:03 -08:00
|
|
|
import { Alert } from 'bootstrap';
|
2022-11-23 12:00:49 -08:00
|
|
|
|
|
|
|
export default class extends Controller {
|
|
|
|
static values = {
|
|
|
|
id: Number
|
|
|
|
};
|
|
|
|
|
|
|
|
declare readonly idValue: number;
|
|
|
|
|
|
|
|
connect(): void {
|
|
|
|
if (!window.localStorage.getItem(`announcement${this.idValue}`)) {
|
|
|
|
this.element.classList.remove('d-none');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
close(): void {
|
|
|
|
window.localStorage.setItem(`announcement${this.idValue}`, 'true');
|
2023-01-13 09:37:03 -08:00
|
|
|
|
|
|
|
const alert = Alert.getOrCreateInstance(this.element);
|
|
|
|
alert.close();
|
2022-11-23 12:00:49 -08:00
|
|
|
}
|
|
|
|
}
|