project-booster-vue 9.27.0 → 9.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "9.27.0",
3
+ "version": "9.28.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -15,6 +15,9 @@
15
15
  <div class="pb-city-search__title">
16
16
  {{ computedPayload.viewModel.label }}
17
17
  </div>
18
+ <div v-if="computedPayload.viewModel.subtitle" class="pb-city-search__subtitle">
19
+ {{ computedPayload.viewModel.subtitle }}
20
+ </div>
18
21
  <div class="pb-city-search__form">
19
22
  <m-flex class="pb-city-search__header" ref="pbCitySearchHeader" direction="column">
20
23
  <m-flex
@@ -178,6 +181,7 @@ export default defineComponent({
178
181
  name: string;
179
182
  region: string;
180
183
  inseeCode: string;
184
+ postalCode: string;
181
185
  } | null,
182
186
  searchKeywordBackup: undefined as string | undefined,
183
187
  displaySuggestions: false,
@@ -218,6 +222,12 @@ export default defineComponent({
218
222
  this?.computedPayload?.value?.city?.inseeCode,
219
223
  this?.computedPayload?.defaultDecoratorValue,
220
224
  ),
225
+ postalCode: decorate(
226
+ this.answers,
227
+ this.runtimeOptions,
228
+ this?.computedPayload?.value?.city?.postalCode,
229
+ this?.computedPayload?.defaultDecoratorValue,
230
+ ),
221
231
  };
222
232
  this.searchKeyword = this?.selectedCity?.name;
223
233
  this.forceHideSuggestions = true;
@@ -301,7 +311,6 @@ export default defineComponent({
301
311
  this.focused = false;
302
312
  this.forceHideSuggestions = true;
303
313
  this.searchKeywordBackup = this.searchKeyword;
304
- this.searchKeyword = suggestion.terms[0].value;
305
314
  this.getPlaceDetails(suggestion.place_id);
306
315
  setTimeout(() => {
307
316
  this.autoFocused = true;
@@ -320,22 +329,23 @@ export default defineComponent({
320
329
  const selectedCity = results[0];
321
330
  this.suggestions = null;
322
331
 
323
- const placeData = await axios.get('https://geo.api.gouv.fr/communes', {
324
- params: {
325
- lat: selectedCity.geometry.location.lat(),
326
- lon: selectedCity.geometry.location.lng(),
327
- fields: 'nom,code',
328
- format: 'json',
329
- geometry: 'centre',
330
- },
331
- });
332
- const selectedCityCode = placeData.data[0].code;
332
+ const placeData = await this.getPlaceFromGeoGouvAPI(
333
+ selectedCity.geometry.location.lat(),
334
+ selectedCity.geometry.location.lng(),
335
+ );
336
+ const postalCode =
337
+ results[0].address_components.filter((field) => field.types.includes('postal_code'))[0]?.short_name ||
338
+ placeData.postalCode;
333
339
 
334
340
  this.selectedCity = {
335
- inseeCode: selectedCityCode,
336
- name: selectedCity.address_components[0].short_name,
341
+ inseeCode: placeData.inseeCode,
342
+ postalCode: postalCode,
343
+ name: placeData.name,
337
344
  region: selectedCity.address_components[2].short_name,
338
345
  };
346
+
347
+ this.searchKeyword =
348
+ this.selectedCity.postalCode + ' ' + this.selectedCity.name + ', ' + this.selectedCity.region;
339
349
  this.$forceUpdate();
340
350
  }
341
351
  });
@@ -356,6 +366,23 @@ export default defineComponent({
356
366
  ],
357
367
  });
358
368
  },
369
+ async getPlaceFromGeoGouvAPI(lat: number, lng: number) {
370
+ const placeData = await axios.get('https://geo.api.gouv.fr/communes', {
371
+ params: {
372
+ lat: lat,
373
+ lon: lng,
374
+ fields: 'nom,code,codesPostaux',
375
+ format: 'json',
376
+ geometry: 'centre',
377
+ },
378
+ });
379
+
380
+ return {
381
+ inseeCode: placeData.data[0].code,
382
+ postalCode: placeData.data[0].codesPostaux[0],
383
+ name: placeData.data[0].nom,
384
+ };
385
+ },
359
386
  },
360
387
  });
361
388
  </script>
@@ -422,12 +449,27 @@ $responsive-breakpoint: 'm';
422
449
  @include set-from-screen($responsive-breakpoint) {
423
450
  @include set-font-scale('08', 'm');
424
451
 
425
- padding: $mu250 $mu100 $mu250 $mu100;
452
+ padding: $mu100 $mu100 $mu100 $mu100;
426
453
  text-align: center;
427
454
  width: auto;
428
455
  }
429
456
  }
430
457
 
458
+ &__subtitle {
459
+ @include set-font-scale('06', 's');
460
+
461
+ color: $color-grey-600;
462
+ padding-bottom: $mu100;
463
+
464
+ @include set-from-screen($responsive-breakpoint) {
465
+ @include set-font-scale('06', 'm');
466
+
467
+ padding-bottom: $mu100;
468
+ text-align: center;
469
+ width: 100%;
470
+ }
471
+ }
472
+
431
473
  &__image {
432
474
  margin: 0 auto;
433
475
  padding-bottom: $mu200;
@@ -2,6 +2,7 @@
2
2
  "viewModel": {
3
3
  "backLabel": "Question précédente",
4
4
  "label": "Dans quelle commune se situe votre projet ?",
5
+ "subtitle": "Cette information nous aide à identifier les aides dont vous pourriez profiter",
5
6
  "placeholder": "Commune",
6
7
  "actionLabel": "Continuer",
7
8
  "image": "https://storage.googleapis.com/project-booster-media/new-house/Estimation%20Construction%20Neuve%20-%20Localisation.png"