diff --git a/frontend/src/app/pages/home/home.html b/frontend/src/app/pages/home/home.html index b23f5ee..d77e270 100644 --- a/frontend/src/app/pages/home/home.html +++ b/frontend/src/app/pages/home/home.html @@ -9,6 +9,7 @@
+
diff --git a/frontend/src/app/pages/home/home.ts b/frontend/src/app/pages/home/home.ts index 755ab61..82437d8 100644 --- a/frontend/src/app/pages/home/home.ts +++ b/frontend/src/app/pages/home/home.ts @@ -3,12 +3,13 @@ import {Menu} from './menu/menu'; import { AllEvents } from '../../maps/all-events/all-events'; import { EditForm } from '../../forms/edit-form/edit-form'; import { OedbApi } from '../../services/oedb-api'; - +import { UnlocatedEvents } from '../../shared/unlocated-events/unlocated-events'; @Component({ selector: 'app-home', imports: [ Menu, AllEvents, + UnlocatedEvents, EditForm ], templateUrl: './home.html', diff --git a/frontend/src/app/pages/home/menu/menu.html b/frontend/src/app/pages/home/menu/menu.html index bd97729..17aca62 100644 --- a/frontend/src/app/pages/home/menu/menu.html +++ b/frontend/src/app/pages/home/menu/menu.html @@ -8,7 +8,7 @@
-
+
(bouton de template pour ne pas remplir le formulaire)
(reste optionnel du formulaire) - +
diff --git a/frontend/src/app/shared/unlocated-events/unlocated-events.html b/frontend/src/app/shared/unlocated-events/unlocated-events.html new file mode 100644 index 0000000..f27bd9b --- /dev/null +++ b/frontend/src/app/shared/unlocated-events/unlocated-events.html @@ -0,0 +1,10 @@ +

{{unlocated.length}} Évènements non localisés

+ +@if (display_list) { + +} diff --git a/frontend/src/app/shared/unlocated-events/unlocated-events.scss b/frontend/src/app/shared/unlocated-events/unlocated-events.scss new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/app/shared/unlocated-events/unlocated-events.spec.ts b/frontend/src/app/shared/unlocated-events/unlocated-events.spec.ts new file mode 100644 index 0000000..ea13b85 --- /dev/null +++ b/frontend/src/app/shared/unlocated-events/unlocated-events.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UnlocatedEvents } from './unlocated-events'; + +describe('UnlocatedEvents', () => { + let component: UnlocatedEvents; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [UnlocatedEvents] + }) + .compileComponents(); + + fixture = TestBed.createComponent(UnlocatedEvents); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/shared/unlocated-events/unlocated-events.ts b/frontend/src/app/shared/unlocated-events/unlocated-events.ts new file mode 100644 index 0000000..34e9f6d --- /dev/null +++ b/frontend/src/app/shared/unlocated-events/unlocated-events.ts @@ -0,0 +1,32 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +@Component({ + selector: 'app-unlocated-events', + standalone: true, + imports: [CommonModule], + templateUrl: './unlocated-events.html', + styleUrl: './unlocated-events.scss' +}) +export class UnlocatedEvents implements OnInit{ + + @Input() events: Array = []; + unlocated: Array = []; + display_list = false + + ngOnInit() { + this.unlocated = (this.events || []).filter(ev => { + // Vérifie si la géométrie est un point + if (!ev.geometry || ev.geometry.type !== 'Point') return false; + const coords = ev.geometry.coordinates; + // Vérifie si les coordonnées sont valides + if (!Array.isArray(coords) || coords.length !== 2) return true; + // Si les coordonnées sont [0,0], on considère comme non localisé + if (coords[0] === 0 && coords[1] === 0) return true; + // Si l'une des coordonnées est manquante ou nulle + if (coords[0] == null || coords[1] == null) return true; + return false; + }); + console.log('unlocated events', this.unlocated); + } +}