diff --git a/assets/scripts/app-back-bo.ts b/assets/scripts/app-back-bo.ts index 6db50b845..be60bafd8 100644 --- a/assets/scripts/app-back-bo.ts +++ b/assets/scripts/app-back-bo.ts @@ -30,6 +30,7 @@ import './vanilla/controllers/back_signalement_view/form_upload_documents.js'; import './vanilla/controllers/back_signalement_view/input_autocomplete_bailleur.js'; import './vanilla/controllers/back_signalement_view/form_cloture_modal.js'; import './vanilla/controllers/back_signalement_view/form_acceptation_refus.js'; +import './vanilla/controllers/back_signalement_view/pick-localisation.js'; import './vanilla/controllers/back_signalement_edit_file/back_signalement_edit_file.js'; import './vanilla/controllers/back_signalement_delete_file/back_signalement_delete_file.js'; import './vanilla/controllers/back_signalement_list_export/back_signalement_list_export.js'; diff --git a/assets/scripts/vanilla/controllers/back_signalement_view/pick-localisation.js b/assets/scripts/vanilla/controllers/back_signalement_view/pick-localisation.js new file mode 100644 index 000000000..3e966ceac --- /dev/null +++ b/assets/scripts/vanilla/controllers/back_signalement_view/pick-localisation.js @@ -0,0 +1,115 @@ +import L from 'leaflet'; +import 'leaflet.vectorgrid'; + +const modalLocalisation = document.getElementById('fr-modal-localisation'); +const modalPickLocalisation = document.getElementById('fr-modal-pick-localisation'); +const modalPickLocalisationMessage = document.getElementById('fr-modal-pick-localisation-message'); + +if (modalLocalisation) { + modalLocalisation.addEventListener('dsfr.disclose', (e) => { + if(modalLocalisation.dataset.loaded == 'false'){ + modalLocalisation.dataset.loaded = 'true' + const map = L.map('fr-modal-localisation-map') + L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { + maxZoom: 19, + attribution: '© OpenStreetMap' + }).addTo(map) + let lat = modalLocalisation.dataset.lat + let lng = modalLocalisation.dataset.lng + map.setView([lat, lng], 18) + L.marker([lat, lng]).addTo(map) + } + }) + +}else if (modalPickLocalisation) { + const map = L.map('fr-modal-pick-localisation-map') + L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { + maxZoom: 19, + attribution: '© OpenStreetMap' + }).addTo(map) + + modalPickLocalisation.addEventListener('dsfr.disclose', (e) => { + if(modalPickLocalisation.dataset.loaded == 'false'){ + modalPickLocalisation.dataset.loaded = 'true' + const apiAdresse = 'https://api-adresse.data.gouv.fr/search/?q=' + let address = modalPickLocalisation.dataset.address + let postCode = modalPickLocalisation.dataset.postcode + fetch(apiAdresse + address + '&postcode=' + postCode).then(response => response.json()).then(json => { + map.setView([json.features[0].geometry.coordinates[1], json.features[0].geometry.coordinates[0]], 18) + modalPickLocalisationMessage.classList.add('fr-hidden') + }) + } + }) + + // Patch pour rendre les couches vectorielles interactives : https://github.com/Leaflet/Leaflet.VectorGrid/issues/274#issuecomment-1371640331 + L.Canvas.Tile.include({ + _onClick: function (e) { + var point = this._map.mouseEventToLayerPoint(e).subtract(this.getOffset()); + var layer = L.Layer; + var clickedLayer = L.Layer; + + for (var id in this._layers) { + layer = this._layers[id]; + if ( + layer.options.interactive && + layer._containsPoint(point) && + !this._map._draggableMoved(layer) + ) { + clickedLayer = layer; + } + } + if (clickedLayer) { + if (typeof clickedLayer === 'object' && clickedLayer !== null) { + clickedLayer.fireEvent(e.type, undefined, true); + } + } + }, + }) + // Fin du patch + var clickedStyle = { + radius: 5, + fillColor: '#31e060', + color: '#ffffff', + weight: 3, + fill: true, + fillOpacity: 1, + opacity: 1 + } + + var initialStyle = { + radius: 5, + fillColor: '#1452e3', + color: '#ffffff', + weight: 3, + fill: true, + fillOpacity: 1, + opacity: 1 + } + + var vectorTileOptions = { + rendererFactory: L.canvas.tile, + vectorTileLayerStyles: { + 'default': initialStyle + }, + interactive: true, + getFeatureId: function(f) { + return f.properties.rnb_id; + } + } + + var vectorTileLayer = L.vectorGrid.protobuf('https://rnb-api.beta.gouv.fr/api/alpha/tiles/{x}/{y}/{z}.pbf', vectorTileOptions); + vectorTileLayer.addTo(map); + var previousId; + vectorTileLayer.on('click', async function(e) { + var properties = e.layer.properties; + var rnb_id = properties.rnb_id; + if (previousId !== undefined) { + vectorTileLayer.setFeatureStyle(previousId, initialStyle); + } + vectorTileLayer.setFeatureStyle(rnb_id, clickedStyle); + previousId = rnb_id; + document.getElementById('fr-modal-pick-localisation-rnb-id').value = rnb_id + document.getElementById('fr-modal-pick-localisation-submit').disabled = false + }) +} + diff --git a/assets/styles/histologe.scss b/assets/styles/histologe.scss index 1473aa7c8..576a36bb7 100644 --- a/assets/styles/histologe.scss +++ b/assets/styles/histologe.scss @@ -930,6 +930,9 @@ a.photo-preview { background: white; } } +#fr-modal-localisation-map, #fr-modal-pick-localisation-map { + height: 50vh; +} #zone_map, #info_zone_map { height: 70vh; } diff --git a/config/app/csp.yaml b/config/app/csp.yaml index aaf85a10a..f4cc9cfb4 100644 --- a/config/app/csp.yaml +++ b/config/app/csp.yaml @@ -15,6 +15,7 @@ parameters: - "https://cdn.jsdelivr.net/npm/tinymce@7.1.2/" - "https://cdn.jsdelivr.net/gh/nelmio/NelmioApiDocBundle/public/swagger-ui/" - "https://cdn.jsdelivr.net/gh/nelmio/NelmioApiDocBundle/public/" + - "https://cdn.jsdelivr.net/npm/leaflet.vectorgrid/dist/Leaflet.VectorGrid.bundled.min.js" style-src: - "'self'" - "'unsafe-inline'" @@ -34,6 +35,7 @@ parameters: - "blob:" - "https://voxusagers.numerique.gouv.fr" - "https://*.tile.openstreetmap.org" + - "https://tile.openstreetmap.org" - "https://cdn.jsdelivr.net" - "https://jedonnemonavis.numerique.gouv.fr" - "https://cdn.redoc.ly" @@ -44,6 +46,7 @@ parameters: - "https://histologe.matomo.cloud" - "https://koumoul.com" - "https://sentry.incubateur.net" + - "https://rnb-api.beta.gouv.fr" font-src: - "'self'" - "https://fonts.gstatic.com" diff --git a/package-lock.json b/package-lock.json index a54092ebe..c6a6a84f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "datatables.net-vue3": "^1.0.0", "leaflet": "^1.9.4", "leaflet.markercluster": "^1.5.3", + "leaflet.vectorgrid": "^1.3.0", "libphonenumber-js": "^1.10.44", "vue": "^3.5.13", "vue-chartjs": "^4.1.1", @@ -7236,6 +7237,26 @@ "postcss": "^8.1.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -8168,6 +8189,21 @@ "leaflet": "^1.3.1" } }, + "node_modules/leaflet.vectorgrid": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/leaflet.vectorgrid/-/leaflet.vectorgrid-1.3.0.tgz", + "integrity": "sha512-kWmj1pKM+MVdo/7Mg5zsB3YrGZvo/uIuiANV9MvWUFOG+Y2xAJzrteDhoIcCgTjHSSRJ36xdeGdIQVhuWjnCZw==", + "license": "Beerware", + "dependencies": { + "pbf": "^3.0.2", + "topojson-client": "^2.1.0", + "vector-tile": "^1.3.0", + "whatwg-fetch": "^2.0.3" + }, + "peerDependencies": { + "leaflet": "^1.0.2" + } + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -8967,6 +9003,19 @@ "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", "dev": true }, + "node_modules/pbf": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.3.0.tgz", + "integrity": "sha512-XDF38WCH3z5OV/OVa8GKUNtLAyneuzbCisx7QUCF8Q6Nutx0WnJrQe5O+kOtBlLfRNUws98Y58Lblp+NJG5T4Q==", + "license": "BSD-3-Clause", + "dependencies": { + "ieee754": "^1.1.12", + "resolve-protobuf-schema": "^2.1.0" + }, + "bin": { + "pbf": "bin/pbf" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -9081,6 +9130,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/point-geometry": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/point-geometry/-/point-geometry-0.0.0.tgz", + "integrity": "sha512-tXK8bY2l3/CPkyO7+UbOWbVjCpKoYY4t6uY3AYYy4Bagd4Z942gLeQOgtHICwBwgPf8dI6fw4VqKwzSNgvlw4A==", + "deprecated": "This module has moved: please install @mapbox/point-geometry instead", + "license": "ISC" + }, "node_modules/possible-typed-array-names": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", @@ -9670,6 +9726,12 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "node_modules/protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==", + "license": "MIT" + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -10036,6 +10098,15 @@ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, + "node_modules/resolve-protobuf-schema": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", + "license": "MIT", + "dependencies": { + "protocol-buffers-schema": "^3.3.1" + } + }, "node_modules/resolve-url-loader": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-url-loader/-/resolve-url-loader-5.0.0.tgz", @@ -11165,6 +11236,26 @@ "node": ">=0.6" } }, + "node_modules/topojson-client": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/topojson-client/-/topojson-client-2.1.0.tgz", + "integrity": "sha512-mxXNa6imbsrWXqUKF7iwGl2TkrshZ7dwQF+KuAB4hX9wTmfecNzqSjMmQZNhP2Ztvfwx8rKt0BfQfHF+ki6hQw==", + "license": "BSD-3-Clause", + "dependencies": { + "commander": "2" + }, + "bin": { + "topo2geo": "bin/topo2geo", + "topomerge": "bin/topomerge", + "topoquantize": "bin/topoquantize" + } + }, + "node_modules/topojson-client/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, "node_modules/tree-dump": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/tree-dump/-/tree-dump-1.0.2.tgz", @@ -11632,6 +11723,16 @@ "node": ">= 0.8" } }, + "node_modules/vector-tile": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/vector-tile/-/vector-tile-1.3.0.tgz", + "integrity": "sha512-ECpYpDhbgTSGIRwaf4bLbiDHcUHDM+LGrBOmV1tdG+Lde8vajJtywP5vGFmMj0Z3cApTV0+9sLWgBCVsRuoAKQ==", + "deprecated": "This module has moved: please install @mapbox/vector-tile instead", + "license": "BSD", + "dependencies": { + "point-geometry": "0.0.0" + } + }, "node_modules/vue": { "version": "3.5.13", "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.13.tgz", @@ -12276,6 +12377,12 @@ "node": ">=0.8.0" } }, + "node_modules/whatwg-fetch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz", + "integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==", + "license": "MIT" + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index c4cf9a35f..079bd974d 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "datatables.net-vue3": "^1.0.0", "leaflet": "^1.9.4", "leaflet.markercluster": "^1.5.3", + "leaflet.vectorgrid": "^1.3.0", "libphonenumber-js": "^1.10.44", "vue": "^3.5.13", "vue-chartjs": "^4.1.1", diff --git a/src/Controller/Back/SignalementActionController.php b/src/Controller/Back/SignalementActionController.php index a222f6f22..dfda5fb6c 100755 --- a/src/Controller/Back/SignalementActionController.php +++ b/src/Controller/Back/SignalementActionController.php @@ -8,9 +8,11 @@ use App\Entity\Suivi; use App\Entity\Tag; use App\Entity\User; +use App\Manager\SignalementManager; use App\Manager\SuiviManager; use App\Repository\AffectationRepository; use App\Repository\SuiviRepository; +use App\Service\BetaGouv\RnbService; use App\Service\Mailer\NotificationMail; use App\Service\Mailer\NotificationMailerRegistry; use App\Service\Mailer\NotificationMailerType; @@ -238,4 +240,37 @@ public function switchValue(Signalement $signalement, Request $request, EntityMa return $this->json(['response' => 'error'], 400); } + + #[Route('/{uuid:signalement}/set-rnb', name: 'back_signalement_set_rnb', methods: 'POST')] + public function setRnbId( + Signalement $signalement, + Request $request, + RnbService $rnbService, + SignalementManager $signalementManager, + ): RedirectResponse { + $this->denyAccessUnlessGranted('SIGN_EDIT', $signalement); + $rnbId = $request->get('rnbId'); + $token = $request->get('_token'); + if (!$this->isCsrfTokenValid('signalement_set_rnb_'.$signalement->getUuid(), $token)) { + $this->addFlash('error', 'Le jeton CSRF est invalide. Veuillez réessayer.'); + + return $this->redirectToRoute('back_signalement_view', ['uuid' => $signalement->getUuid()]); + } + if (!empty($signalement->getGeoloc())) { + $this->addFlash('error', 'Le signalement a déjà une géolocalisation.'); + + return $this->redirectToRoute('back_signalement_view', ['uuid' => $signalement->getUuid()]); + } + $building = $rnbService->getBuilding($rnbId); + if (!$building) { + $this->addFlash('error', 'Le bâtiment n\'a pas été trouvé.'); + } else { + $signalement->setRnbIdOccupant($building->getRnbId()); + $signalement->setGeoloc(['lat' => $building->getLat(), 'lng' => $building->getLng()]); + $signalementManager->flush(); + $this->addFlash('success', 'Le bâtiment a été mis à jour avec succès.'); + } + + return $this->redirectToRoute('back_signalement_view', ['uuid' => $signalement->getUuid()]); + } } diff --git a/src/DataFixtures/Files/NewSignalement.yml b/src/DataFixtures/Files/NewSignalement.yml index 8bcc226b4..3429f863c 100644 --- a/src/DataFixtures/Files/NewSignalement.yml +++ b/src/DataFixtures/Files/NewSignalement.yml @@ -863,3 +863,40 @@ signalements: - "desordres_batiment_securite_murs_fissures_details_mur_porteur_oui" - "desordres_batiment_securite_balcons" - "desordres_batiment_incendie_odeur_gaz" + - + territory: "Gard" + uuid: "00000000-0000-0000-2025-000000000004" + reference: "2025-03" + details: "Il fait trés froid dans mon logement même avec le chauffage à fond." + is_proprio_averti: 1 + is_allocataire: "0" + nature_logement: "maison" + superficie: 80 + loyer: 750 + date_entree: "2018-07-01" + nom_proprio: "LaBouze" + type_proprio: "PARTICULIER" + is_logement_social: 0 + civilite_occupant: "mr" + nom_occupant: "Ervit" + prenom_occupant: "Jean-Philippe" + tel_occupant: "+330644556677" + phone_number: "+330644556677" + mail_occupant: "jp.ervit@yopmail.com" + adresse_occupant: "15 chemin de la route" + cp_occupant: "30360" + ville_occupant: "Vézénobres" + statut: 2 + geoloc: "[]" + insee_occupant: "" + nb_pieces_logement: 4 + nb_occupants_logement: 4 + score: 35 + score_logement: 20 + score_batiment: 15 + created_from_uuid: '00000000-0000-0000-2025-000000000004' + profile_declarant: "LOCATAIRE" + type_composition_logement: "[]" + situation_foyer: "[]" + information_procedure: "[]" + information_complementaire: "[]" diff --git a/src/Service/BetaGouv/Response/RnbBuilding.php b/src/Service/BetaGouv/Response/RnbBuilding.php index 3f982dc3d..adf2b5cdb 100644 --- a/src/Service/BetaGouv/Response/RnbBuilding.php +++ b/src/Service/BetaGouv/Response/RnbBuilding.php @@ -5,14 +5,28 @@ class RnbBuilding { private ?string $rnbId = null; + private ?float $lat = null; + private ?float $lng = null; public function __construct(?array $building = null) { $this->rnbId = $building['rnb_id']; + $this->lng = $building['point']['coordinates'][0]; + $this->lat = $building['point']['coordinates'][1]; } public function getRnbId(): ?string { return $this->rnbId; } + + public function getLat(): ?float + { + return $this->lat; + } + + public function getLng(): ?float + { + return $this->lng; + } } diff --git a/src/Service/BetaGouv/RnbService.php b/src/Service/BetaGouv/RnbService.php index 24beaa98a..f31714b78 100755 --- a/src/Service/BetaGouv/RnbService.php +++ b/src/Service/BetaGouv/RnbService.php @@ -17,10 +17,16 @@ public function __construct( ) { } - private function searchBuildings(array $queryParams): ?array + private function searchBuildings(?string $rnbId = null, array $queryParams = []): ?array { try { - $url = self::API_URL.'?'.http_build_query($queryParams); + $url = self::API_URL; + if (null !== $rnbId) { + $url .= $rnbId.'/'; + } + if (!empty($queryParams)) { + $url .= '?'.http_build_query($queryParams); + } $response = $this->httpClient->request('GET', $url); if (Response::HTTP_OK === $response->getStatusCode()) { @@ -36,7 +42,7 @@ private function searchBuildings(array $queryParams): ?array public function getBuildings(string $cleInteropBan): array { $buildings = []; - $results = $this->searchBuildings(['cle_interop_ban' => $cleInteropBan]); + $results = $this->searchBuildings(queryParams: ['cle_interop_ban' => $cleInteropBan]); if (null !== $results && !empty($results['results'])) { foreach ($results['results'] as $item) { $buildings[] = new RnbBuilding($item); @@ -45,4 +51,14 @@ public function getBuildings(string $cleInteropBan): array return $buildings; } + + public function getBuilding(string $rnbId): ?RnbBuilding + { + $result = $this->searchBuildings(rnbId: $rnbId); + if (!empty($result)) { + return new RnbBuilding($result); + } + + return null; + } } diff --git a/templates/_partials/_modal_localisation.html.twig b/templates/_partials/_modal_localisation.html.twig new file mode 100755 index 000000000..03382aa29 --- /dev/null +++ b/templates/_partials/_modal_localisation.html.twig @@ -0,0 +1,33 @@ + +
+
+
+
+
+ +
+
+

Localisation du signalement

+
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/templates/_partials/_modal_pick_localisation.html.twig b/templates/_partials/_modal_pick_localisation.html.twig new file mode 100755 index 000000000..140e12927 --- /dev/null +++ b/templates/_partials/_modal_pick_localisation.html.twig @@ -0,0 +1,47 @@ + +
+
+
+
+
+ +
+
+

Sélectionner le bâtiment correspondant au logement

+
Chargement en cours
+
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/templates/back/signalement/view.html.twig b/templates/back/signalement/view.html.twig index ef3df4f37..76fd85979 100755 --- a/templates/back/signalement/view.html.twig +++ b/templates/back/signalement/view.html.twig @@ -20,6 +20,11 @@ {% if is_granted('SIGN_EDIT', signalement) %} {% include '_partials/_modal_upload_files.html.twig' %} {% endif %} + {% if signalement.geoloc.lat is defined and signalement.geoloc.lng is defined %} + {% include '_partials/_modal_localisation.html.twig' %} + {% elseif is_granted('SIGN_EDIT', signalement) %} + {% include '_partials/_modal_pick_localisation.html.twig' %} + {% endif %} {% if is_granted('ROLE_ADMIN') %} {% include '_partials/_modal_send_lien_suivi.html.twig' %} {% endif %} @@ -51,4 +56,4 @@ {% include 'back/signalement/view/tabs.html.twig' %} -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/templates/back/signalement/view/header.html.twig b/templates/back/signalement/view/header.html.twig index ba2b93476..090015225 100755 --- a/templates/back/signalement/view/header.html.twig +++ b/templates/back/signalement/view/header.html.twig @@ -101,21 +101,25 @@ {% endif %} -
- {% if signalement.geoloc.lat is defined and signalement.geoloc.lng is defined %} - - Voir sur la carte - - {% else %} - - Voir sur la carte - - {% endif %} -
+
+ {% if signalement.geoloc.lat is defined and signalement.geoloc.lng is defined %} + + {% elseif is_granted('SIGN_EDIT', signalement) %} + + {% endif %} +
{% if signalement.statut is not same as constant('App\\Entity\\Signalement::STATUS_NEED_VALIDATION') %} diff --git a/tests/Functional/Controller/Back/SignalementListControllerTest.php b/tests/Functional/Controller/Back/SignalementListControllerTest.php index d746bf2a3..6f6dfbe78 100644 --- a/tests/Functional/Controller/Back/SignalementListControllerTest.php +++ b/tests/Functional/Controller/Back/SignalementListControllerTest.php @@ -188,20 +188,20 @@ public function provideNewFilterSearch(): \Generator yield 'Search by Procédure estimée' => [['procedure' => 'rsd', 'isImported' => 'oui'], 7]; yield 'Search by Partenaires affectés' => [['partenaires' => ['5'], 'isImported' => 'oui'], 2]; yield 'Search by Statut de la visite' => [['visiteStatus' => 'Planifiée', 'isImported' => 'oui'], 5]; - yield 'Search by Type de dernier suivi' => [['typeDernierSuivi' => 'automatique', 'isImported' => 'oui'], 34]; + yield 'Search by Type de dernier suivi' => [['typeDernierSuivi' => 'automatique', 'isImported' => 'oui'], 35]; yield 'Search by Date de dernier suivi' => [['dateDernierSuiviDebut' => '2023-04-01', 'dateDernierSuiviFin' => '2023-04-18', 'isImported' => 'oui'], 3]; yield 'Search by Statut de l\'affectation' => [['statusAffectation' => 'refuse', 'isImported' => 'oui'], 1]; yield 'Search by Score criticite' => [['criticiteScoreMin' => 5, 'criticiteScoreMax' => 6, 'isImported' => 'oui'], 9]; - yield 'Search by Declarant' => [['typeDeclarant' => 'locataire', 'isImported' => 'oui'], 47]; + yield 'Search by Declarant' => [['typeDeclarant' => 'locataire', 'isImported' => 'oui'], 48]; yield 'Search by Nature du parc' => [['natureParc' => 'public', 'isImported' => 'oui'], 7]; yield 'Search by Allocataire CAF' => [['allocataire' => 'caf', 'isImported' => 'oui'], 16]; yield 'Search by Allocataire MSA' => [['allocataire' => 'msa', 'isImported' => 'oui'], 1]; yield 'Search by Allocataire Oui (CAF+MSA+1)' => [['allocataire' => 'oui', 'isImported' => 'oui'], 17]; - yield 'Search by Allocataire Non (null+empty)' => [['allocataire' => 'non', 'isImported' => 'oui'], 8]; - yield 'Search by Situation Bail en cours' => [['situation' => 'bail_en_cours', 'isImported' => 'oui'], 11]; + yield 'Search by Allocataire Non (null+empty)' => [['allocataire' => 'non', 'isImported' => 'oui'], 9]; + yield 'Search by Situation Bail en cours' => [['situation' => 'bail_en_cours', 'isImported' => 'oui'], 12]; yield 'Search by Situation Prévis de départ' => [['situation' => 'preavis_de_depart', 'isImported' => 'oui'], 1]; yield 'Search by Situation Attente de relogement' => [['situation' => 'attente_relogement', 'isImported' => 'oui'], 2]; - yield 'Search by Signalement Imported' => [['isImported' => 'oui'], 52]; + yield 'Search by Signalement Imported' => [['isImported' => 'oui'], 53]; yield 'Search by Zones' => [['isImported' => 'oui', 'zones' => [1, 2, 3]], 4]; yield 'Search by Zones on Territory 34' => [['isImported' => 'oui', 'zones' => [1, 2, 3], 'territoire' => '35'], 1]; yield 'Search by Sans suivi in territory 13' => [['isImported' => 'oui', 'sansSuiviPeriode' => 30, 'territoire' => '13'], 7]; diff --git a/tests/Functional/Controller/BackStatistiquesControllerTest.php b/tests/Functional/Controller/BackStatistiquesControllerTest.php index c3d020dd7..035179d29 100644 --- a/tests/Functional/Controller/BackStatistiquesControllerTest.php +++ b/tests/Functional/Controller/BackStatistiquesControllerTest.php @@ -50,8 +50,8 @@ public function testStatistiquesHomepage(string $route, string $email): void public function provideRoutesStatistiquesDatas(): \Generator { yield 'Super Admin' => ['back_statistiques_filter', [], self::USER_SUPER_ADMIN, [ - ['result' => 49, 'label' => 'count_signalement'], - ['result' => 57.5, 'label' => 'average_criticite'], + ['result' => 50, 'label' => 'count_signalement'], + ['result' => 57, 'label' => 'average_criticite'], ]]; yield 'Responsable Territoire' => ['back_statistiques_filter', [], self::USER_ADMIN_TERRITOIRE, [ ['result' => 26, 'label' => 'count_signalement'], diff --git a/tests/Functional/Controller/StatistiquesControllerTest.php b/tests/Functional/Controller/StatistiquesControllerTest.php index b93cde82c..0cc47fe67 100644 --- a/tests/Functional/Controller/StatistiquesControllerTest.php +++ b/tests/Functional/Controller/StatistiquesControllerTest.php @@ -25,7 +25,7 @@ public function testFrontStatistiques(): void $expectedResponses = [ ['result' => 1, 'label' => 'count_signalement_resolus'], - ['result' => 46, 'label' => 'count_signalement'], + ['result' => 47, 'label' => 'count_signalement'], ]; foreach ($expectedResponses as $expectedResponse) {