Skip to content

Commit 153a347

Browse files
Merge pull request #511 from AgenceBio/fix/modification-parcelles-troue
fix: Modification d'une parcelle non gérée 'trouée'
2 parents 0d5220a + 117f7c0 commit 153a347

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

src/components/map/CustomControlsParcelles.vue

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ const props = defineProps({
2525
type: Boolean,
2626
required: true,
2727
},
28+
disable: {
29+
type: Boolean,
30+
required: true,
31+
},
2832
});
29-
const currentMode = ref(props.mode);
33+
const currentMode = ref(!props.disable ? props.mode : "");
3034
const windowWidth = useWindowWidth();
3135
3236
const selectModif = () => {
@@ -72,6 +76,7 @@ const redo = () => {
7276
title="Modifier"
7377
aria-label="Modifier"
7478
@click="selectModif()"
79+
:disabled="disable"
7580
>
7681
<span class="ri-shape-line" aria-hidden="true" style="font-size: 1.2em"></span>
7782
<span v-if="windowWidth > 780" class="button-text">Modifier</span>
@@ -83,6 +88,7 @@ const redo = () => {
8388
title="Diviser"
8489
aria-label="Diviser"
8590
@click="selectDivid()"
91+
:disabled="disable"
8692
>
8793
<span class="ri-scissors-cut-line" aria-hidden="true" style="font-size: 1.2em"></span>
8894
<span v-if="windowWidth > 780" class="button-text">Diviser</span>
@@ -95,6 +101,7 @@ const redo = () => {
95101
title="Découper les bordures"
96102
aria-label="Découper les bordures"
97103
@click="selectCutBorders()"
104+
:disabled="disable"
98105
>
99106
<span class="fr-icon-crop-line" aria-hidden="true"></span>
100107
<span v-if="windowWidth > 780" class="button-text">{{
@@ -111,25 +118,32 @@ const redo = () => {
111118
:class="mesureActive ? 'selected-button' : ''"
112119
@click="selectMesure()"
113120
aria-label="Mesurer"
121+
:disabled="disable"
114122
>
115123
<span class="ri-ruler-line" aria-hidden="true" style="font-size: 1.5em"></span>
116124
</button>
117125
<div class="separator"></div>
118-
<button type="button" title="Supprimer" aria-label="Supprimer" :disabled="!canDelete" @click="supprimer()">
126+
<button
127+
type="button"
128+
title="Supprimer"
129+
aria-label="Supprimer"
130+
:disabled="!canDelete || disable"
131+
@click="supprimer()"
132+
>
119133
<span class="fr-icon-delete-line" aria-hidden="true" style="font-size: 1.2em"></span>
120134
</button>
121-
<button type="button" title="Annuler" aria-label="Annuler" :disabled="!canUndo" @click="undo()">
135+
<button type="button" title="Annuler" aria-label="Annuler" :disabled="!canUndo || disable" @click="undo()">
122136
<span class="fr-icon-arrow-go-back-line" aria-hidden="true" style="font-size: 1.2em"></span>
123137
</button>
124-
<button type="button" title="Rétablir" aria-label="Rétablir" :disabled="!canRedo" @click="redo()">
138+
<button type="button" title="Rétablir" aria-label="Rétablir" :disabled="!canRedo || disable" @click="redo()">
125139
<span class="fr-icon-arrow-go-forward-line" aria-hidden="true" style="font-size: 1.2em"></span>
126140
</button>
127141
</div>
128142
</div>
129143
</Teleport>
130144
</template>
131145

132-
<style>
146+
<style scoped>
133147
.command-modif-parcellaire {
134148
display: inline-flex;
135149
justify-content: space-between;
@@ -177,6 +191,10 @@ button:hover {
177191
background-color: #f5f5f5;
178192
}
179193
194+
button:disabled .button-text {
195+
color: gray;
196+
}
197+
180198
.button-text {
181199
margin-left: 4px;
182200
color: #000091;

src/pages/exploitations/[numeroBio]/[recordId]/modifier/[featureId].vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ meta:
126126
:canRedo="historyIndex < history.length - 1"
127127
:canDelete="currentMode == 'modif' && selectedParcelles !== null && modifiedFeature.length > 1"
128128
:mesureActive="measureOn"
129+
:disable="disableBar"
129130
@divide="openDivide"
130131
@cutBorders="openCutBorders"
131132
@editContour="openEdit"
@@ -390,6 +391,8 @@ const selectedParcelles = ref(null);
390391
const history = ref([]);
391392
const historyIndex = ref(-1);
392393
394+
const disableBar = ref(false);
395+
393396
const helper = {
394397
modif: {
395398
title: "Modifier le tracé",
@@ -2087,6 +2090,8 @@ function loadFeatureModif() {
20872090
if (e.message.startsWith("Feature is not")) {
20882091
loadingError.value =
20892092
"La modification de contour n’est pas encore disponible pour les parcelles évidées. Veuillez nous en excuser.";
2093+
draw.setMode("select");
2094+
disableBar.value = true;
20902095
} else {
20912096
throw e;
20922097
}

0 commit comments

Comments
 (0)