feat : ajout de l'api de l'état pour chercher les villes via le CP
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"permissions": {
|
"permissions": {
|
||||||
"allow": [
|
"allow": [
|
||||||
"Bash(npm run:*)"
|
"Bash(npm run:*)",
|
||||||
|
"WebFetch(domain:geo.api.gouv.fr)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+12
-72
@@ -5,70 +5,10 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="fix : correction des retours de la V0">
|
<list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="fix : correction des retours de la V0">
|
||||||
<change afterPath="$PROJECT_DIR$/.claude/settings.local.json" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.claude/settings.local.json" beforeDir="false" afterPath="$PROJECT_DIR$/.claude/settings.local.json" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/components/workflow/workflow-liot-fields.vue" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/components/workflow/workflow-waiting-list.vue" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/components/workflow/workflow-weight.vue" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/composables/steps/useWeighingStep.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/composables/useAddressSync.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/composables/useFormDataLoading.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/composables/useLiotHandling.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/composables/useWorkflowSteps.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/config/reception.config.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/config/shipment.config.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/services/workflow-service.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/stores/workflow-store.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/frontend/types/workflow.ts" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/migrations/Version20260318103644.php" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/migrations/Version20260318104205.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/config/reference.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/reference.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/assets/css/main.css" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/assets/css/main.css" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/components/address.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/address.vue" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/frontend/components/address.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/address.vue" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/components/commun/update-weight.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/commun/update-weight.vue" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/frontend/nuxt.config.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/nuxt.config.ts" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/components/reception/reception-bovine-received.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/reception/reception-bovine-received.vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/components/reception/reception-form.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/reception/reception-form.vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/components/reception/reception-product-received.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/reception/reception-product-received.vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/components/reception/reception-weight.vue" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/components/reception/update-merchandise.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/reception/update-merchandise.vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/components/shipment/shipment-form.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/shipment/shipment-form.vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/components/shipment/shipment-weight.vue" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/components/ui/license-plate-input.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/ui/license-plate-input.vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/composables/useWeighing.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/composables/useWeighing.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/constants/steps.ts" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/i18n/locales/fr.json" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/i18n/locales/fr.json" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/admin/bovin/[[id]].vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/admin/bovin/[[id]].vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/admin/carrier/[[id]].vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/admin/carrier/[[id]].vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/admin/customer/[[id]].vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/admin/customer/[[id]].vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/admin/customer/customer-list.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/admin/customer/customer-list.vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/admin/supplier/[[id]].vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/admin/supplier/[[id]].vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/admin/supplier/supplier-list.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/admin/supplier/supplier-list.vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/admin/user/[[id]].vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/admin/user/[[id]].vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/reception/[[id]].vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/reception/[[id]].vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/reception/finish-reception.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/reception/finish-reception.vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/reception/update/[[id]].vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/reception/update/[[id]].vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/reception/waiting-reception.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/reception/waiting-reception.vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/shipment/[[id]].vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/shipment/[[id]].vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/shipment/update/[[id]].vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/shipment/update/[[id]].vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/pages/shipment/waiting-shipment.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/shipment/waiting-shipment.vue" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/services/address.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/services/address.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/services/dto/address-data.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/services/dto/address-data.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/services/dto/customer-data.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/services/dto/customer-data.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/services/dto/supplier-data.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/services/dto/supplier-data.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/services/reception.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/services/reception.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/services/shipment.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/services/shipment.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/services/weight.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/services/weight.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/stores/reception.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/stores/reception.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/frontend/stores/shipment.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/stores/shipment.ts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Command/SeedCommand.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Command/SeedCommand.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/DataFixtures/ReferenceFixtures.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/DataFixtures/ReferenceFixtures.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Entity/Address.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Entity/Address.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Entity/Carrier.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Entity/Carrier.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Entity/Customer.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Entity/Customer.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Entity/Reception.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Entity/Reception.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Entity/Shipment.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Entity/Shipment.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Entity/Supplier.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Entity/Supplier.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Entity/User.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Entity/User.php" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -383,15 +323,7 @@
|
|||||||
<workItem from="1773215356754" duration="5754000" />
|
<workItem from="1773215356754" duration="5754000" />
|
||||||
<workItem from="1773756072697" duration="5450000" />
|
<workItem from="1773756072697" duration="5450000" />
|
||||||
<workItem from="1773766075191" duration="6202000" />
|
<workItem from="1773766075191" duration="6202000" />
|
||||||
<workItem from="1773824491213" duration="14242000" />
|
<workItem from="1773824491213" duration="15167000" />
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00024" summary="fix : affiche plus détail dans les logs en recette/prod">
|
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1769077633390</created>
|
|
||||||
<option name="number" value="00024" />
|
|
||||||
<option name="presentableId" value="LOCAL-00024" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1769077633390</updated>
|
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00025" summary="fix : modification du script de déploiement pour corriger le problème d'écriture des logs de prod">
|
<task id="LOCAL-00025" summary="fix : modification du script de déploiement pour corriger le problème d'écriture des logs de prod">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -777,7 +709,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1773826699115</updated>
|
<updated>1773826699115</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="73" />
|
<task id="LOCAL-00073" summary="fix : correction des retours de la V0">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1773841634554</created>
|
||||||
|
<option name="number" value="00073" />
|
||||||
|
<option name="presentableId" value="LOCAL-00073" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1773841634554</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="74" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
|||||||
@@ -13,7 +13,15 @@
|
|||||||
<UiTextInput id="address-street" v-model="form.street" label="Rue" required />
|
<UiTextInput id="address-street" v-model="form.street" label="Rue" required />
|
||||||
<UiTextInput id="address-street2" v-model="form.street2" label="Complément" />
|
<UiTextInput id="address-street2" v-model="form.street2" label="Complément" />
|
||||||
<UiTextInput id="address-postalCode" v-model="form.postalCode" label="Code postal" required />
|
<UiTextInput id="address-postalCode" v-model="form.postalCode" label="Code postal" required />
|
||||||
<UiTextInput id="address-city" v-model="form.city" label="Ville" required />
|
<UiSelect
|
||||||
|
id="address-city"
|
||||||
|
v-model="form.city"
|
||||||
|
label="Ville"
|
||||||
|
:options="communeOptions"
|
||||||
|
:loading="isLoadingCities"
|
||||||
|
:disabled="communes.length === 0"
|
||||||
|
required
|
||||||
|
/>
|
||||||
<UiTextInput id="address-country" v-model="form.countryCode" label="Pays (code)" />
|
<UiTextInput id="address-country" v-model="form.countryCode" label="Pays (code)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center items-center">
|
<div class="flex justify-center items-center">
|
||||||
@@ -31,7 +39,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { AddressPayload } from "~/services/address"
|
import type { AddressPayload } from "~/services/address"
|
||||||
|
import { getCommunesByPostalCode, type CommuneData } from "~/services/geo"
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -43,6 +51,12 @@ const props = defineProps<{
|
|||||||
|
|
||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
const submitted = ref(false)
|
const submitted = ref(false)
|
||||||
|
const communes = ref<CommuneData[]>([])
|
||||||
|
const isLoadingCities = ref(false)
|
||||||
|
|
||||||
|
const communeOptions = computed(() =>
|
||||||
|
communes.value.map(c => ({ value: c.nom, label: c.nom }))
|
||||||
|
)
|
||||||
|
|
||||||
const emptyForm = (): AddressPayload => ({
|
const emptyForm = (): AddressPayload => ({
|
||||||
street: "",
|
street: "",
|
||||||
@@ -85,6 +99,41 @@ watch(
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
let debounceTimer: ReturnType<typeof setTimeout> | null = null
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => form.postalCode,
|
||||||
|
(cp) => {
|
||||||
|
if (debounceTimer) clearTimeout(debounceTimer)
|
||||||
|
|
||||||
|
if (!cp || cp.length < 5) {
|
||||||
|
communes.value = []
|
||||||
|
form.city = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cp.length === 5) {
|
||||||
|
debounceTimer = setTimeout(async () => {
|
||||||
|
isLoadingCities.value = true
|
||||||
|
const previousCity = form.city
|
||||||
|
try {
|
||||||
|
communes.value = await getCommunesByPostalCode(cp)
|
||||||
|
|
||||||
|
if (communes.value.length === 1) {
|
||||||
|
form.city = communes.value[0].nom
|
||||||
|
} else if (communes.value.some(c => c.nom === previousCity)) {
|
||||||
|
form.city = previousCity
|
||||||
|
} else {
|
||||||
|
form.city = ''
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
isLoadingCities.value = false
|
||||||
|
}
|
||||||
|
}, 300)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const validateForm = () => {
|
const validateForm = () => {
|
||||||
if (isLoading.value) return
|
if (isLoading.value) return
|
||||||
emit("validate", {...form})
|
emit("validate", {...form})
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ export default defineNuxtConfig({
|
|||||||
css: ['~/assets/css/main.css', '~/assets/css/toast.css'],
|
css: ['~/assets/css/main.css', '~/assets/css/toast.css'],
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
public: {
|
public: {
|
||||||
apiBase: process.env.NUXT_PUBLIC_API_BASE
|
apiBase: process.env.NUXT_PUBLIC_API_BASE,
|
||||||
|
geoApiBase: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toast: {
|
toast: {
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
export interface CommuneData {
|
||||||
|
nom: string
|
||||||
|
code: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getCommunesByPostalCode(postalCode: string): Promise<CommuneData[]> {
|
||||||
|
const config = useRuntimeConfig()
|
||||||
|
const base = config.public.geoApiBase
|
||||||
|
try {
|
||||||
|
return await $fetch<CommuneData[]>(`${base}/communes`, {
|
||||||
|
params: { codePostal: postalCode, fields: 'nom', format: 'json' }
|
||||||
|
})
|
||||||
|
} catch {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user