Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch: (2270) Activation du déplacement du marquer de localisation de site #1058

Merged
merged 9 commits into from
Nov 29, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ export default mode => ([
submitedValue: getStringOrNull(req.body.name),
storedValue: getStringOrNull(req.town.name),
},
// Mis en commentaire le temps de résoudre l'incohérence des coordonnées géographiques du site toujours initialisée à celle de la commune
// { key: 'coordinates', submitedValue: req.body['coordinates'], storedValue: `${req.town.city.latitude},${req.town.city.longitude}` },
{
key: 'coordinates',
submitedValue: req.body.coordinates,
storedValue: `${req.town.latitude},${req.town.longitude}`,
},
{
key: 'built_at',
submitedValue: getStringOrNull(req.body.built_at),
Expand Down
6 changes: 6 additions & 0 deletions packages/api/server/models/shantytownModel/_common/getDiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ export default (oldVersion, newVersion): Diff[] => {
insalubrityParcels: {
label: "Parcelles concernées par l'arrêté d'insalubrité (numéros de parcelles)",
},
latitude: {
label: 'Coordonnées GPS : Latitude',
},
longitude: {
label: 'Coordonnées GPS : Longitude',
},
};

const finalDiff = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<template>
<div class="flex flex-col sm:flex-row space-x-8">
<div class="flex flex-col md:flex-row space-x-8">
<ArrangementLeftMenuColumn
:tabs="tabs"
:activeTab="computedActiveTab"
class="print:hidden mb-12 shrink-0"
:class="{
columnWidthClass: true,
'hidden sm:flex': autohide === true,
'hidden md:flex': autohide === true,
}"
>
<template v-slot:title v-if="$slots.menuTitle"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<p>Lat {{ town.latitude }}, Long {{ town.longitude }}</p>
<p>Latitude : {{ town.latitude }}</p>
<p>Longitude : {{ town.longitude }}</p>
<ButtonCopy
:value="`${town.latitude},${town.longitude}`"
@copied="notifyCopy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
showMandatoryStar
id="addressParagraph"
>
<InputAddress v-model="values.address" />
<InputAddress
v-model="values.address"
:disabled="isSubmitting"
/>
</FormParagraph>

<div class="text-sm mb-4" v-if="nearbyShantytowns.length">
Expand Down Expand Up @@ -44,6 +47,26 @@
<FormParagraph title="Appellation du site" id="name">
<InputName />
</FormParagraph>

<FormParagraph title="Coordonnées GPS" id="coordinates">
<div class="flex flex-col gap-2">
<ButtonGPS
:town="{
latitude: coordinates[0],
longitude: coordinates[1],
}"
/>
<div
v-if="initialCoordinates !== coordinates"
class="text-redA11Y text-sm"
>
<Icon class="text-sm" icon="triangle-exclamation" />
Vous avez déplacé le marqueur de l'emplacement du
site. N'oubliez pas de cliquer sur "Mettre à jour"
pour valider ce changement de localisation.
</div>
</div>
</FormParagraph>
</section>

<section class="h-96 bg-G500 lg:w-96 ml-4 my-3" v-if="address">
Expand All @@ -55,11 +78,12 @@

<script setup>
import { findNearby } from "@/api/towns.api";
import { useFieldValue, useFormValues } from "vee-validate";
import { useFieldValue, useFormValues, useIsSubmitting } from "vee-validate";
import { defineProps, ref, toRefs, watch } from "vue";

import FormSection from "@/components/FormSection/FormSection.vue";
import { FormParagraph, Link } from "@resorptionbidonvilles/ui";
import ButtonGPS from "@/components/ButtonGPS/ButtonGPS.vue";
import { FormParagraph, Link, Icon } from "@resorptionbidonvilles/ui";
import InputAddress from "@/components/InputAddress/InputAddress.vue";
import InputCoordinates from "../inputs/FormDeclarationDeSiteInputCoordinates.vue";
import InputName from "../inputs/FormDeclarationDeSiteInputName.vue";
Expand All @@ -76,6 +100,8 @@ const values = useFormValues();
const address = useFieldValue("address");
const coordinates = useFieldValue("coordinates");
const nearbyShantytowns = ref([]);
const initialCoordinates = ref(coordinates.value);
const isSubmitting = useIsSubmitting();

watch(address, () => {
nearbyShantytowns.value = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="mx-auto mt-8 w-8/12 text-sm bg-white p-3">
<p>
Si besoin, préciser la localisation en déplaçant le pointeur
bleu sur la carte.
sur la carte.
</p>
<p
class="font-bold text-right cursor-pointer text-primary"
Expand Down
Loading