19
19
20
20
<div class =" fr-grid-row fr-grid-row--gutters" >
21
21
<div class =" fr-col-9" >
22
+ <div v-if =" loadingError" class =" fr-alert fr-alert--error fr-my-3v" >
23
+ <p >{{ loadingError }}</p >
24
+ </div >
22
25
<MapContainer v-if =" recordStore.isSetup" :options =" { interactive: true }" class =" map" :bounds =" mapBounds" ref =" map" >
23
26
<GeojsonLayer :style =" baseStyle" name =" base" />
24
27
<GeojsonLayer :data =" otherCollection" name =" parcellaire-operateur" />
@@ -34,15 +37,15 @@ meta:
34
37
<button
35
38
class =" fr-btn fr-btn--tertiary-no-outline fr-btn--icon-left fr-icon-arrow-go-back-fill fr-mb-4w"
36
39
@click =" reset"
37
- :disabled =" feature === null"
40
+ :disabled =" loadingError || feature === null"
38
41
>
39
42
Réinitialiser le tracé</button >
40
- <div v-if =" error" class =" fr-alert fr-alert--error" >
43
+ <div v-if =" !loadingError && error" class =" fr-alert fr-alert--error" >
41
44
<p >{{ error }}</p >
42
45
</div >
43
46
<button
44
47
class =" fr-btn fr-btn--primary fr-btn--icon-left fr-icon-save-fill"
45
- :disabled =" error !== ''"
48
+ :disabled =" error !== '' || loadingError !== '' "
46
49
@click =" showConfirmModal = true"
47
50
>
48
51
Enregistrer le tracé
@@ -107,7 +110,7 @@ const permissions = usePermissions()
107
110
const messages = useMessages ()
108
111
const router = useRouter ()
109
112
110
- const otherCollection = computed (() => featureCollection (
113
+ const otherCollection = computed (() => loadingError . value ? featureStore . collection : featureCollection (
111
114
featureStore .collection .features .filter (f => f .id !== Number (props .featureId )))
112
115
)
113
116
const modifiedFeature = ref (null )
@@ -122,6 +125,7 @@ const mapBounds = computed(() => {
122
125
123
126
const map = ref (null ) // MapContainer instance
124
127
let draw // TerraDraw instance
128
+ const loadingError = ref (' ' )
125
129
const error = ref (' ' )
126
130
const showConfirmModal = ref (false )
127
131
@@ -183,7 +187,15 @@ function loadFeature () {
183
187
coord => coord .map (c => c .map (n => Number (n .toFixed (COORDINATE_PRECISION - 1 ))))
184
188
)
185
189
terraDrawFeature .properties .mode = ' polygon'
186
- draw .addFeatures ([terraDrawFeature])
190
+ try {
191
+ draw .addFeatures ([terraDrawFeature])
192
+ } catch (e) {
193
+ if (e .message .startsWith (' Feature is not' )) {
194
+ loadingError .value = ' La modification de contour n’est pas encore disponible pour les parcelles évidées. Veuillez nous en excuser.'
195
+ } else {
196
+ throw e
197
+ }
198
+ }
187
199
188
200
// Clone feature to avoid modifying the featureStore
189
201
modifiedFeature .value = JSON .parse (JSON .stringify (featureStore .getFeatureById (Number (props .featureId ))))
0 commit comments