From 03d764292200ae010f1b34bc976bd4a22d6dbe2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Flavio=20Bont=C3=A0?= Date: Fri, 14 Nov 2025 10:31:47 +0100 Subject: [PATCH] =?UTF-8?q?fix=20css=20e=20accessibilit=C3=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .angulardoc.json | 2 +- ...ubbliche-controller-find-many-strutture.ts | 6 +- .../strutture-pubbliche-api-client.ts | 4 +- .../strutture-pubbliche.component.html | 323 ++++++++++-------- .../strutture-pubbliche.component.ts | 42 +-- 5 files changed, 211 insertions(+), 166 deletions(-) diff --git a/.angulardoc.json b/.angulardoc.json index 6a0ae59..943434f 100644 --- a/.angulardoc.json +++ b/.angulardoc.json @@ -1,4 +1,4 @@ { "repoId": "bc5fa7a7-7313-4845-954c-7227b0073b63", "lastSync": 0 -} \ No newline at end of file +} diff --git a/src/api/fn/strutture-pubbliche/strutture-pubbliche-controller-find-many-strutture.ts b/src/api/fn/strutture-pubbliche/strutture-pubbliche-controller-find-many-strutture.ts index 7239320..b83ae08 100644 --- a/src/api/fn/strutture-pubbliche/strutture-pubbliche-controller-find-many-strutture.ts +++ b/src/api/fn/strutture-pubbliche/strutture-pubbliche-controller-find-many-strutture.ts @@ -24,12 +24,12 @@ export interface StrutturePubblicheControllerFindManyStrutture$Params { /** * Luogo calcola distanza da */ - luogo?: string | null; + luogo: string; /** * Tipo luogo calcola distanza da */ - 'luogo.tipo'?: string | null; + 'luogo.tipo': string; /** * Tipo della struttura @@ -40,7 +40,7 @@ export interface StrutturePubblicheControllerFindManyStrutture$Params { export function strutturePubblicheControllerFindManyStrutture( http: HttpClient, rootUrl: string, - params?: StrutturePubblicheControllerFindManyStrutture$Params, + params: StrutturePubblicheControllerFindManyStrutture$Params, context?: HttpContext, ): Observable>> { const rb = new RequestBuilder( diff --git a/src/api/services/strutture-pubbliche-api-client.ts b/src/api/services/strutture-pubbliche-api-client.ts index 561bf12..bfb2696 100644 --- a/src/api/services/strutture-pubbliche-api-client.ts +++ b/src/api/services/strutture-pubbliche-api-client.ts @@ -39,7 +39,7 @@ export class StrutturePubblicheApiClient extends BaseService { * This method doesn't expect any request body. */ strutturePubblicheControllerFindManyStrutture$Response( - params?: StrutturePubblicheControllerFindManyStrutture$Params, + params: StrutturePubblicheControllerFindManyStrutture$Params, context?: HttpContext, ): Observable>> { return strutturePubblicheControllerFindManyStrutture( @@ -61,7 +61,7 @@ export class StrutturePubblicheApiClient extends BaseService { * This method doesn't expect any request body. */ strutturePubblicheControllerFindManyStrutture( - params?: StrutturePubblicheControllerFindManyStrutture$Params, + params: StrutturePubblicheControllerFindManyStrutture$Params, context?: HttpContext, ): Observable> { return this.strutturePubblicheControllerFindManyStrutture$Response( diff --git a/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.html b/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.html index 907c3ca..741e0dc 100644 --- a/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.html +++ b/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.html @@ -3,161 +3,202 @@
poseidon-layout
-
+

Consorzio Mu.Sa. -

-
+ +

Cerca strutture convenzionate -

+
-
- - - - - -
- @if (luogo.tipo === 'comune') { - -
- {{ luogo.comune - }}{{ - luogo.codiceStato === 'ITA' - ? ' (' + luogo.siglaProvincia + ')' - : '' - }} - - {{ - luogo.codiceStato === 'ITA' - ? 'Comune' - : ('Stato estero' | titlecase) - }}{{ - luogo.codiceStato === 'ITA' - ? ': Italia → ' + - luogo.regione + - ' → ' + - luogo.provincia + - ' → ' + - luogo.comune - : '' - }} +
+
+
+
+
+ Strutture Convenzionate
+
+
+
+ Tipologia struttura
+ +
- } @else if (luogo.tipo === 'stato') { - -
- {{ luogo.stato }} - - {{ - luogo.codiceStato === 'ITA' - ? ('Stato' | titlecase) - : ('Stato estero' | titlecase) - }} + +
+
+
+ Luogo* + @if ( + cercaStruttureForm.controls.luogo.errors?.['required'] && + vm.cercaStruttureFormSubmitted + ) { + Luogo obbligatorio + } +
+ + +
+ @if (luogo.tipo === 'comune') { + +
+ {{ luogo.comune + }}{{ + luogo.codiceStato === 'ITA' + ? ' (' + luogo.siglaProvincia + ')' + : '' + }} + + {{ + luogo.codiceStato === 'ITA' + ? 'Comune' + : ('Stato estero' | titlecase) + }}{{ + luogo.codiceStato === 'ITA' + ? ': Italia → ' + + luogo.regione + + ' → ' + + luogo.provincia + + ' → ' + + luogo.comune + : '' + }} +
+ } @else if (luogo.tipo === 'stato') { + +
+ {{ luogo.stato }} + + {{ + luogo.codiceStato === 'ITA' + ? ('Stato' | titlecase) + : ('Stato estero' | titlecase) + }} +
+ } @else if (luogo.tipo === 'regione') { + +
+ {{ luogo.regione }} + + Regione + {{ ': Italia → ' + luogo.regione }} +
+ } @else if (luogo.tipo === 'provincia') { + +
+ {{ luogo.provincia }} + + Provincia + {{ + ': Italia → ' + luogo.regione + ' → ' + luogo.provincia + }} +
+ } +
+
+
+
+
+
+ Indirizzo
+ +
- } @else if (luogo.tipo === 'regione') { - -
- {{ luogo.regione }} - - Regione - {{ ': Italia → ' + luogo.regione }} -
- } @else if (luogo.tipo === 'provincia') { - -
- {{ luogo.provincia }} - - Provincia - {{ - ': Italia → ' + luogo.regione + ' → ' + luogo.provincia - }} -
- }
- - - - - +
+ + +
+
+
+
+ + + + +
- @if ( - cercaStruttureForm.errors?.['atLeastOneRequired'] && - vm.cercaStruttureFormSubmitted - ) { - Seleziona almeno un filtro. - } -
- - - - -
- @@ -218,7 +260,7 @@ {{ row.struttura.nome }} @@ -235,26 +277,26 @@ @@ -266,6 +308,7 @@
diff --git a/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.ts b/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.ts index e191b0c..76a2d9a 100644 --- a/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.ts +++ b/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.ts @@ -5,6 +5,7 @@ import { FormGroup, FormsModule, ReactiveFormsModule, + Validators, } from '@angular/forms'; import { GoogleMap, @@ -46,19 +47,17 @@ import { tap, } from 'rxjs'; import { StrutturePubblicheControllerFindManyStrutture$Params } from '../../../../api/fn/strutture-pubbliche/strutture-pubbliche-controller-find-many-strutture'; -import { atLeastOneFilterRequired } from '../../main/strutture/strutture.component'; import { TableColumn } from '../../shared'; import { StrutturePubblicheService } from './strutture-pubbliche.service'; const cercaStruttureFormGroupFunc = () => { - return new FormGroup( - { - tipologiaStruttura: new FormControl(null), - luogo: new FormControl(null), - indirizzo: new FormControl(null), - }, - [atLeastOneFilterRequired], - ); + return new FormGroup({ + tipologiaStruttura: new FormControl(null), + luogo: new FormControl(null, { + validators: [Validators.required], + }), + indirizzo: new FormControl(null), + }); }; export type cercaStruttureForm = ReturnType; export type cercaStruttureFormValue = cercaStruttureForm['value']; @@ -151,7 +150,7 @@ export class StrutturePubblicheComponent { ) { this.model$ = this.state.select(); this.state.set({ - strutture: [], + strutture: undefined, tipologieStrutture: [], filteredLuoghiEsteso: [], @@ -222,28 +221,27 @@ export class StrutturePubblicheComponent { const params: StrutturePubblicheControllerFindManyStrutture$Params = { indirizzo: _form.indirizzo, tipoStruttura: _form.tipologiaStruttura, - luogo: _form.luogo?.luogo, - 'luogo.tipo': _form.luogo?.tipo, + luogo: _form.luogo!.luogo!, + 'luogo.tipo': _form.luogo!.tipo!, }; this.calcolaIndirizzoDa = _form.indirizzo; const strutture$ = this.strutturePubblicheService.getStrutture(params).pipe( - catchError(() => { + catchError((err) => { this.messageService.add({ severity: 'error', life: 5000, summary: 'Attenzione!', detail: - 'Impossibile recuperare la lista delle strutture in questo momento, riprova più tardi', + err.status === 400 + ? 'Il luogo è obbligatorio' + : 'Impossibile recuperare la lista delle strutture in questo momento, riprova più tardi', }); return of([] as StrutturePubblicheResDto[]); }), tap((res) => { this.cercaStruttureForm.enable(); if (!res) return; - this.state.set(() => ({ - cercaStruttureFormSubmitted: false, - })); this.gMapMarkers(res, false); }), map((res) => ({ strutture: res })), @@ -290,6 +288,9 @@ export class StrutturePubblicheComponent { }

+
`; this.infoWindow.infoWindow?.setContent(contentString); @@ -398,7 +399,7 @@ export class StrutturePubblicheComponent { ); } - calculateMapsLink(struttura: StrutturePubblicheResDto): void { + calculateMapsLink(struttura: StrutturePubblicheResDto, open = true): string { // https://www.google.com/maps/dir/?api=1&origin=45.476333943968626,9.17169124076061&destination=45.4692422,9.16562&travelmode=driving // https://www.google.com/maps/dir/?api=1&destination=45.4692422,9.16562&travelmode=driving @@ -436,13 +437,14 @@ export class StrutturePubblicheComponent { } url = `${url}&travelmode=${travelMode}`; - window.open(url, '_blank'); + + if (open) window.open(url, '_blank'); + return url; } checkLuogo() { //Hack: rimosso dall'autocomplete forceSelection perchè non funzionava come previsto, selezionando ad esempio "Milano" (comune), selezionava "Milano" (comune). const luogo = this.cercaStruttureForm.controls['luogo'].value; - console.log('luogo', luogo); if (typeof luogo === 'string') { this.cercaStruttureForm.controls['luogo'].setValue(null); }