annotate client/src/components/fairway/BottleneckDialogue.vue @ 5586:215e6ba9651b surveysperbottleneckid

Added property "displayName" to bottlenecks. Before displayed, bottlenecks ordered by country are now checked for doubles per country. In case a double is found the displayName is enriched with the bottleneck_id. Otherwise the displayName is equal to "name" or "objnam". Example: const testList = [ { properties: { responsible_country: "AT", name: "Bananas", bottleneck_id: "BN1" } }, { properties: { responsible_country: "DE", name: "Bananas", bottleneck_id: "BN2" } }, { properties: { responsible_country: "DE", name: "Bananas", bottleneck_id: "BN3" } } ]; is rendered to: AT Bananas DE Bananas / BN2 Bananas / BN3
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 04 Apr 2022 15:12:43 +0200
parents 2cadfdc9960c
children 7768f14f6535
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 <div
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 :class="[
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 'box ui-element rounded bg-white text-nowrap',
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5 { expanded: showProfiles }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 ]"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 >
4981
9f0830a1845d squashed the total layout to enable display of long fm importnames
Thomas Junk <thomas.junk@intevation.de>
parents: 4869
diff changeset
8 <div style="width: 17rem">
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 <UIBoxHeader
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 icon="chart-area"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 :title="profilesLable"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 :closeCallback="close"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13 />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 <div class="box-body">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
15 <UISpinnerOverlay v-if="surveysLoading || profileLoading" />
4479
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
16 <div class="d-flex flex-row">
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
17 <select
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
18 v-model="selectedBottleneck"
4982
b5028b98e7c4 fix layout of selecting BN, G, AFD for firefox
Thomas Junk <thomas.junk@intevation.de>
parents: 4981
diff changeset
19 class="w-90 form-control font-weight-bold"
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20 >
4479
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
21 <option :value="null">
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
22 <translate>Select Bottleneck</translate>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
23 </option>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
24 <optgroup
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
25 v-for="(bottlenecksForCountry, cc) in orderedBottlenecks"
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
26 :key="cc"
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
27 :label="cc"
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28 >
4479
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
29 <option
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
30 v-for="bn in bottlenecksForCountry"
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
31 :key="bn.properties.id"
5572
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
32 :value="bn.properties.bottleneck_id"
4479
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
33 >
5586
215e6ba9651b Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents: 5581
diff changeset
34 {{ bn.properties.displayName }}
5581
2cadfdc9960c Add comments for places where name is okay.
Thomas Junk <thomas.junk@intevation.de>
parents: 5579
diff changeset
35 <!-- name for display is okay-->
4479
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
36 </option>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
37 </optgroup>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
38 </select>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
39 <button @click="takeMeThere" class="btn btn-sm btn-info">
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
40 <font-awesome-icon icon="crosshairs" />
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
41 </button>
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
42 </div>
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
43 <div v-if="selectedBottleneck">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
44 <div class="d-flex flex-column mt-2">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
45 <div class="flex-fill">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
46 <small class="text-muted">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
47 <translate>Waterlevel</translate>:
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
48 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
49 <select
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
50 v-model="selectedWaterLevel"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
51 class="form-control form-control-sm small"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
52 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
53 <option value="ref">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 <translate>Depth Reference</translate>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 <template v-if="selectedSurvey">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56 ({{ selectedSurvey.depth_reference }}/{{
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
57 $options.filters.waterlevel(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 selectedSurvey.waterlevel_value
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
59 )
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
60 }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
61 m)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
62 </template>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
63 </option>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
64 <option value="current">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
65 <translate>Current Waterlevel</translate>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 <template v-if="bottleneck">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 ({{
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68 $options.filters.waterlevel(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
69 bottleneck.get("gm_waterlevel")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
70 )
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
72 m)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
73 </template>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
74 </option>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
75 </select>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
76 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
77 <div class="flex-fill">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
78 <small class="text-muted"> <translate>Survey</translate>: </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
79 <div class="d-flex">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
80 <select
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
81 v-model="selectedSurvey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
82 class="form-control form-control-sm small"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
83 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
84 <option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
85 v-for="survey in surveys"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
86 :key="survey.date_info"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
87 :value="survey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
88 >{{ survey.date_info | surveyDate }}</option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
90 </select>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
91 <button
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
92 v-if="isAllowedToDelete"
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
93 class="btn btn-dark btn-xs ml-2"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
94 @click="deleteSelectedSurvey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
95 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
96 <font-awesome-icon icon="trash" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
97 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
98 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
99 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
100 <div class="flex-fill" v-if="selectedSurvey && surveys.length > 1">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
101 <small class="text-muted mt-1">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
102 <translate>Compare with</translate>:
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
103 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
104 <select
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
105 v-model="additionalSurvey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
106 class="form-control form-control-sm small"
5408
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
107 :disabled="!areDifferecesAllowed"
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
108 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
109 <option :value="null">None</option>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
110 <option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
111 v-for="survey in additionalSurveys"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
112 :key="survey.date_info"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
113 :value="survey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
114 >{{ survey.date_info | surveyDate }}</option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
115 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
116 </select>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
117 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
118 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
119 <div class="mt-2 d-flex" v-if="additionalSurvey">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
120 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
121 v-if="differencesLoading"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
122 class="btn btn-info btn-xs flex-fill"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
123 disabled
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
124 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
125 <font-awesome-icon icon="spinner" spin class="mr-1" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
126 <translate>Calculating differences</translate>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
127 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
128 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
129 class="btn btn-info btn-xs flex-fill"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
130 @click="differencesVisible ? showSurvey() : showDifferences()"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
131 v-else
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
132 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
133 <translate v-if="differencesVisible" key="showsurvey"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
134 >Show survey</translate
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
135 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
136 <translate v-else key="showdifferences"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
137 >Show differences</translate
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
138 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
139 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
140 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
141 v-if="!paneSetup.includes('FAIRWAYPROFILE')"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
142 class="btn btn-info btn-xs ml-2"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
143 @click="$store.commit('application/paneRotate')"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
144 v-tooltip="rotatePanesTooltip"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
145 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
146 <font-awesome-icon icon="redo" fixed-width />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
147 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
148 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
149 class="btn btn-info btn-xs ml-2"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
150 @click="toggleSyncMaps()"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
151 v-tooltip="syncMapsTooltip"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
152 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
153 <font-awesome-icon
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
154 :icon="mapsAreSynced ? 'unlink' : 'link'"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
155 fixed-width
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
156 />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
157 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
158 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
159 <hr class="w-100 mb-0" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
160 <small class="text-muted d-block mt-2">
4502
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
161 <translate>Custom Depth</translate>:
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
162 </small>
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
163 <div class="d-flex">
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
164 <input
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
165 class="form-control form-control-sm w-100 mt-1"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
166 v-model.number="depth"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
167 type="number"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
168 step="0.1"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
169 min="0"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
170 />
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
171 <button
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
172 @click="useCustomDepth = !useCustomDepth"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
173 :class="[
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
174 'btn',
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
175 'btn-xs',
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
176 'ml-2',
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
177 {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
178 'btn-info': useCustomDepth,
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
179 'btn-secondary': !useCustomDepth
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
180 }
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
181 ]"
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
182 >
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
183 {{ useCustomDepth ? "disable" : "enable" }}
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
184 </button>
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
185 </div>
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
186 <small class="text-muted d-block mt-2">
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
187 <translate>Saved cross profiles</translate>:
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
188 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
189 <div class="d-flex">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
190 <select
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
191 :class="[
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
192 'form-control form-control-sm flex-fill',
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
193 { 'rounded-left-only': selectedCut }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
194 ]"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
195 v-model="selectedCut"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
196 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
197 <option></option>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
198 <option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
199 v-for="(cut, index) in previousCuts"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
200 :value="cut"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
201 :key="index"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
202 >{{ cut.label }}</option
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
203 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
204 </select>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
205 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
206 class="btn btn-xs btn-dark ml-2"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
207 @click="deleteSelectedCut(selectedCut)"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
208 v-if="selectedCut"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
209 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
210 <font-awesome-icon icon="trash" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
211 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
212 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
213 <small class="text-muted d-block mt-2">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
214 <translate>Enter coordinates manually</translate>:
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
215 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
216 <div class="position-relative">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
217 <input
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
218 class="form-control form-control-sm pr-5"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
219 placeholder="Lat,Lon,Lat,Lon"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
220 v-model="coordinatesInput"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
221 />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
222 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
223 class="btn btn-sm btn-info position-absolute input-button-right"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
224 @click="applyManualCoordinates"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
225 style="top: 0; right: 0;"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
226 v-if="coordinatesInputIsValid"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
227 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
228 <font-awesome-icon icon="check" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
229 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
230 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
231 <small class="d-flex text-left mt-2" v-if="startPoint && endPoint">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
232 <div class="text-nowrap mr-3">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
233 <b> <translate>Start</translate>: </b> <br />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
234 Lat: {{ startPoint[1] }} <br />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
235 Lon: {{ startPoint[0] }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
236 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
237 <div class="text-nowrap">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
238 <b>End:</b> <br />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
239 Lat: {{ endPoint[1] }} <br />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
240 Lon: {{ endPoint[0] }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
241 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
242 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
243 v-clipboard:copy="coordinatesForClipboard"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
244 v-clipboard:success="onCopyCoordinates"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
245 class="btn btn-info btn-sm ml-auto mt-auto"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
246 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
247 <font-awesome-icon icon="copy" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
248 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
249 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
250 <div class="d-flex mt-3">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
251 <div
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
252 class="pr-3 w-50"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
253 v-if="startPoint && endPoint && !selectedCut"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
254 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
255 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
256 class="btn btn-info btn-sm w-100"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
257 @click="showLabelInput = !showLabelInput"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
258 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
259 <font-awesome-icon :icon="showLabelInput ? 'times' : 'check'" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
260 {{ showLabelInput ? "Cancel" : "Save" }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
261 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
262 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
263 <div
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
264 :class="startPoint && endPoint && !selectedCut ? 'w-50' : 'w-100'"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
265 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
266 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
267 class="btn btn-info btn-sm w-100"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
268 @click="toggleCutTool"
5408
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
269 :disabled="!isCutAllowed"
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
270 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
271 <font-awesome-icon :icon="cutToolEnabled ? 'times' : 'plus'" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
272 {{ cutToolEnabled ? "Cancel" : "New" }}
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
273 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
274 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
275 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
276 <div v-if="showLabelInput" class="mt-2">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
277 <small class="text-muted">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
278 <translate>Enter label for cross profile</translate>:
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
279 </small>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
280 <div class="position-relative">
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
281 <input
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
282 class="form-control form-control-sm pr-5"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
283 v-model="cutLabel"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
284 />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
285 <button
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
286 class="btn btn-sm btn-info position-absolute input-button-right"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
287 @click="saveCut"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
288 v-if="cutLabel"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
289 style="top: 0; right: 0;"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
290 >
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
291 <font-awesome-icon icon="check" />
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
292 </button>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
293 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
294 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
295 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
296 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
297 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
298 </div>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
299 </template>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
300
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
301 <style lang="scss" scoped>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
302 .input-button-right {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
303 border-top-right-radius: $border-radius;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
304 border-bottom-right-radius: $border-radius;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
305 border-top-left-radius: 0 !important;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
306 border-bottom-left-radius: 0 !important;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
307 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
308
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
309 .rounded-left-only {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
310 border-top-right-radius: 0 !important;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
311 border-bottom-right-radius: 0 !important;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
312 border-top-left-radius: $border-radius;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
313 border-bottom-left-radius: $border-radius;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
314 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
315
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
316 input,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
317 select {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
318 font-size: 0.8em;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
319 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
320 </style>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
321
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
322 <script>
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
323 /* This is Free Software under GNU Affero General Public License v >= 3.0
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
324 * without warranty, see README.md and license for details.
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
325 *
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
326 * SPDX-License-Identifier: AGPL-3.0-or-later
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
327 * License-Filename: LICENSES/AGPL-3.0.txt
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
328 *
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
329 * Copyright (C) 2018 by via donau
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
330 * – Österreichische Wasserstraßen-Gesellschaft mbH
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
331 * Software engineering by Intevation GmbH
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
332 *
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
333 * Author(s):
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
334 * Markus Kottländer <markus.kottlaender@intevation.de>
5408
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
335 * Thomas Junk <thomas.junk@intevation.de>
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
336 */
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
337 import { mapState, mapGetters } from "vuex";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
338 import Feature from "ol/Feature";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
339 import LineString from "ol/geom/LineString";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
340 import { displayError, displayInfo } from "@/lib/errors";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
341 import { HTTP } from "@/lib/http";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
342 import { COMPARESURVEYS } from "@/components/paneSetups";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
343
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
344 export default {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
345 name: "profiles",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
346 data() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
347 return {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
348 coordinatesInput: "",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
349 cutLabel: "",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
350 showLabelInput: false
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
351 };
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
352 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
353 computed: {
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
354 ...mapState("user", ["user"]),
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
355 ...mapGetters("user", ["isWaterwayAdmin", "isSysAdmin"]),
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
356 ...mapGetters("usermanagement", ["userCountries"]),
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
357 ...mapState("application", ["showProfiles", "paneSetup"]),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
358 ...mapState("map", ["openLayersMaps", "syncedMaps", "cutToolEnabled"]),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
359 ...mapState("bottlenecks", [
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
360 "bottlenecksList",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
361 "surveys",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
362 "surveysLoading"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
363 ]),
5408
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
364 selectedSurveyIsMarking() {
5432
776e34886471 add missing guarding clause
Thomas Junk <thomas.junk@intevation.de>
parents: 5408
diff changeset
365 if (!this.selectedSurvey) return false;
5408
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
366 return this.selectedSurvey["survey_type"] === "marking";
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
367 },
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
368 areDifferecesAllowed() {
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
369 return !this.selectedSurveyIsMarking;
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
370 },
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
371 isCutAllowed() {
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
372 return !this.selectedSurveyIsMarking && !!this.selectedSurvey;
901b70f9c6bd disable cuts or differences if surveytype is 'marking'
Thomas Junk <thomas.junk@intevation.de>
parents: 4982
diff changeset
373 },
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
374 isAllowedToDelete() {
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
375 const userCountryCode = this.userCountries[this.user];
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
376 const bottleneck = this.bottlenecksList.find(
5572
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
377 bn => bn.properties.bottleneck_id === this.selectedBottleneck
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
378 );
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
379 if (!bottleneck) return;
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
380 if (this.isWaterwayAdmin || this.isSysAdmin) {
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
381 if (
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
382 userCountryCode === "global" ||
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
383 bottleneck.properties.responsible_country === userCountryCode
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
384 ) {
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
385 return true;
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
386 }
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
387 }
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
388 return false;
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
389 },
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
390 ...mapState("fairwayprofile", [
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
391 "previousCuts",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
392 "startPoint",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
393 "endPoint",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
394 "profileLoading",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
395 "differencesLoading",
4525
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
396 "currentDifference",
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
397 "waterLevels",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
398 "currentProfile"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
399 ]),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
400 ...mapGetters("map", ["openLayersMap"]),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
401 ...mapGetters("bottlenecks", ["orderedBottlenecks"]),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
402 profilesLable() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
403 return this.$gettext("Bottleneck Surveys");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
404 },
4502
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
405 useCustomDepth: {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
406 get() {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
407 return this.$store.state.fairwayprofile.useCustomDepth;
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
408 },
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
409 set(value) {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
410 this.$store.commit("fairwayprofile/setUseCustomDepth", value);
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
411 }
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
412 },
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
413 depth: {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
414 get() {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
415 return this.$store.state.fairwayprofile.depth;
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
416 },
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
417 set(value) {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
418 this.$store.commit("fairwayprofile/setDepth", value);
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
419 }
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
420 },
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
421 selectedBottleneck: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
422 get() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
423 return this.$store.state.bottlenecks.selectedBottleneck;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
424 },
5572
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
425 set(bottleneck_id) {
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
426 this.$store.dispatch(
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
427 "bottlenecks/setSelectedBottleneck",
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
428 bottleneck_id
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
429 );
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
430 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
431 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
432 selectedWaterLevel: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
433 get() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
434 return this.$store.state.fairwayprofile.selectedWaterLevel;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
435 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
436 set(value) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
437 this.$store.commit("fairwayprofile/setSelectedWaterLevel", value);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
438 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
439 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
440 selectedSurvey: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
441 get() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
442 return this.$store.state.bottlenecks.selectedSurvey;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
443 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
444 set(survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
445 this.$store.commit("fairwayprofile/additionalSurvey", null);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
446 this.$store.commit("bottlenecks/selectedSurvey", survey);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
447 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
448 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
449 additionalSurvey: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
450 get() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
451 return this.$store.state.fairwayprofile.additionalSurvey;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
452 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
453 set(survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
454 this.$store.commit("fairwayprofile/additionalSurvey", survey);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
455 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
456 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
457 selectedCut: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
458 get() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
459 return this.$store.state.fairwayprofile.selectedCut;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
460 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
461 set(cut) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
462 this.$store.commit("fairwayprofile/selectedCut", cut);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
463 if (!cut) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
464 this.$store.commit("fairwayprofile/clearCurrentProfile");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
465 this.openLayersMaps.forEach(m => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
466 m.getLayer("CUTTOOL")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
467 .getSource()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
468 .clear();
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
469 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
470 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
471 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
472 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
473 additionalSurveys() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
474 return this.surveys.filter(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
475 survey => survey.date_info !== this.selectedSurvey.date_info
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
476 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
477 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
478 coordinatesForClipboard() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
479 return (
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
480 this.startPoint[1] +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
481 "," +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
482 this.startPoint[0] +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
483 "," +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
484 this.endPoint[1] +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
485 "," +
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
486 this.endPoint[0]
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
487 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
488 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
489 coordinatesInputIsValid() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
490 const coordinates = this.coordinatesInput
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
491 .split(",")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
492 .map(coord => parseFloat(coord.trim()))
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
493 .filter(c => Number(c) === c);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
494 return coordinates.length === 4;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
495 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
496 differencesVisible() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
497 return (
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
498 this.openLayersMap(COMPARESURVEYS.compare.id) &&
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
499 !this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
500 .getLayer("BOTTLENECKISOLINE")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
501 .getVisible() &&
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
502 this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
503 .getLayer("DIFFERENCES")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
504 .getVisible()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
505 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
506 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
507 rotatePanesTooltip() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
508 return this.$gettext("Rotate Maps");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
509 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
510 syncMapsTooltip() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
511 return this.$gettext(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
512 this.mapsAreSynced ? "Unsynchronize Maps" : "Synchronize Maps"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
513 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
514 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
515 mapsAreSynced() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
516 return this.syncedMaps.includes(COMPARESURVEYS.compare.id);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
517 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
518 bottleneck() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
519 return this.openLayersMap()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
520 ? this.openLayersMap()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
521 .getLayer("BOTTLENECKS")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
522 .getSource()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
523 .getFeatures()
5572
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
524 .find(f => f.get("bottleneck_id") === this.selectedBottleneck)
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
525 : null;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
526 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
527 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
528 watch: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
529 selectedBottleneck() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
530 this.$store.dispatch("fairwayprofile/previousCuts");
5574
271888ef85bc Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents: 5572
diff changeset
531 if (this.bottleneck) {
271888ef85bc Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents: 5572
diff changeset
532 this.cutLabel =
5579
f54932eec5c0 Adding comments for usage of objnam
Thomas Junk <thomas.junk@intevation.de>
parents: 5574
diff changeset
533 this.bottleneck.get("objnam") + " (" + new Date().toISOString() + ")"; //objnam for Label is okay
5574
271888ef85bc Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents: 5572
diff changeset
534 }
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
535 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
536 selectedSurvey(survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
537 this.loadProfile(survey);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
538 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
539 additionalSurvey(survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
540 if (survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
541 this.loadDifferences();
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
542 this.$store.commit(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
543 "application/paneSetup",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
544 Object.keys(this.currentProfile).length
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
545 ? "COMPARESURVEYS_FAIRWAYPROFILE"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
546 : "COMPARESURVEYS"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
547 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
548 this.$store.commit("map/syncedMaps", [COMPARESURVEYS.compare.id]);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
549 } else {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
550 this.$store.commit(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
551 "application/paneSetup",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
552 Object.keys(this.currentProfile).length ? "FAIRWAYPROFILE" : "DEFAULT"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
553 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
554 this.$store.commit("map/syncedMaps", []);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
555 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
556 this.loadProfile(survey);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
557 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
558 selectedCut(cut) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
559 if (cut) {
4502
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
560 if (cut.depth) {
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
561 this.depth = cut.depth;
4528
0bad1dcdb044 client: Fairwayprofile: save the state of the enable/disable button for custom depth
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4526
diff changeset
562 this.useCustomDepth = cut.useCustomDepth;
4502
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
563 }
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
564 this.applyCoordinates(cut.coordinates);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
565 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
566 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
567 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
568 methods: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
569 toggleSyncMaps() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
570 if (this.mapsAreSynced) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
571 this.$store.commit(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
572 "map/syncedMaps",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
573 this.syncedMaps.filter(m => m !== COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
574 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
575 } else {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
576 this.$store.commit("map/syncedMaps", [COMPARESURVEYS.compare.id]);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
577 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
578 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
579 loadDifferences() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
580 this.$store.commit("fairwayprofile/setDifferencesLoading", true);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
581 HTTP.post(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
582 "/diff",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
583 {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
584 bottleneck: this.selectedSurvey.bottleneck_id,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
585 minuend: this.selectedSurvey.date_info,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
586 subtrahend: this.additionalSurvey.date_info
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
587 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
588 {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
589 headers: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
590 "X-Gemma-Auth": localStorage.getItem("token")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
591 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
592 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
593 )
4525
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
594 .then(response => {
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
595 this.$store.commit(
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
596 "fairwayprofile/setCurrentDifference",
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
597 response.data.id
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
598 );
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
599 if (this.openLayersMap(COMPARESURVEYS.compare.id)) {
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
600 this.openLayersMap(COMPARESURVEYS.compare.id)
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
601 .getLayer("DIFFERENCES")
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
602 .getSource()
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
603 .updateParams({
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
604 LAYERS: "sounding_differences",
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
605 VERSION: "1.1.1",
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
606 TILED: true,
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
607 CQL_FILTER: "id=" + response.data.id
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
608 });
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
609 this.openLayersMap(COMPARESURVEYS.compare.id)
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
610 .getLayer("DIFFERENCES")
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
611 .getSource()
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
612 .refresh();
4526
b3261790a9b2 Set differences layers visibility to false on survey change to avoid showing both layers.
Raimund Renkert <raimund@renkert.org>
parents: 4525
diff changeset
613 this.openLayersMap(COMPARESURVEYS.compare.id)
b3261790a9b2 Set differences layers visibility to false on survey change to avoid showing both layers.
Raimund Renkert <raimund@renkert.org>
parents: 4525
diff changeset
614 .getLayer("DIFFERENCES")
b3261790a9b2 Set differences layers visibility to false on survey change to avoid showing both layers.
Raimund Renkert <raimund@renkert.org>
parents: 4525
diff changeset
615 .setVisible(false);
4525
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
616 }
9887061df57b Use CQL filter to load the current survey difference.
Raimund Renkert <raimund@renkert.org>
parents: 4521
diff changeset
617 })
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
618 .catch(error => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
619 let status, data, message;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
620 if (error.response) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
621 status = error.response.status;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
622 data = error.response.data;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
623 message = `${status}: ${data.message || data}`;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
624 } else {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
625 message = error;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
626 }
4683
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
627 if (status === 429) {
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
628 displayInfo({
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
629 message: this.$gettext(
4684
00a2c761493e changed error message for too many ongoing difference calcs
Thomas Junk <thomas.junk@intevation.de>
parents: 4683
diff changeset
630 "Too many difference calculations already in progress. Please try again later."
4683
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
631 )
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
632 });
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
633 } else {
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
634 displayError({
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
635 title: this.$gettext("Backend Error"),
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
636 message: message
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
637 });
c15185297fff info about ongoing difference calculations
Thomas Junk <thomas.junk@intevation.de>
parents: 4528
diff changeset
638 }
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
639 })
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
640 .finally(() => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
641 this.$store.commit("fairwayprofile/setDifferencesLoading", false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
642 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
643 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
644 showDifferences() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
645 this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
646 .getLayer("BOTTLENECKISOLINE")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
647 .setVisible(false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
648 this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
649 .getLayer("DIFFERENCES")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
650 .setVisible(true);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
651 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
652 showSurvey() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
653 this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
654 .getLayer("BOTTLENECKISOLINE")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
655 .setVisible(true);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
656 this.openLayersMap(COMPARESURVEYS.compare.id)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
657 .getLayer("DIFFERENCES")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
658 .setVisible(false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
659 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
660 close() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
661 this.$store.commit("application/showProfiles", false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
662 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
663 loadProfile(survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
664 if (survey) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
665 this.$store.commit("fairwayprofile/profileLoading", true);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
666 this.$store
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
667 .dispatch("fairwayprofile/loadProfile", survey)
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
668 .finally(() => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
669 this.$store.commit("fairwayprofile/profileLoading", false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
670 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
671 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
672 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
673 toggleCutTool() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
674 this.$store.commit("map/cutToolEnabled", !this.cutToolEnabled);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
675 this.$store.commit("map/lineToolEnabled", false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
676 this.$store.commit("map/polygonToolEnabled", false);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
677 this.$store.commit("map/setCurrentMeasurement", null);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
678 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
679 onCopyCoordinates() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
680 displayInfo({
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
681 message: this.$gettext("Coordinates copied to clipboard!")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
682 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
683 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
684 applyManualCoordinates() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
685 const coordinates = this.coordinatesInput
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
686 .split(",")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
687 .map(coord => parseFloat(coord.trim()));
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
688 this.selectedCut = null;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
689 this.coordinatesInput = "";
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
690 this.applyCoordinates([
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
691 coordinates[1],
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
692 coordinates[0],
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
693 coordinates[3],
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
694 coordinates[2]
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
695 ]);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
696 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
697 applyCoordinates(coordinates) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
698 // allow only numbers
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
699 coordinates = coordinates.filter(c => Number(c) === c);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
700 if (coordinates.length === 4) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
701 // draw line on map
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
702 this.openLayersMaps.forEach(m => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
703 m.getLayer("CUTTOOL")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
704 .getSource()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
705 .clear();
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
706 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
707 const cut = new Feature({
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
708 geometry: new LineString([
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
709 [coordinates[0], coordinates[1]],
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
710 [coordinates[2], coordinates[3]]
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
711 ]).transform("EPSG:4326", "EPSG:3857")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
712 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
713 this.openLayersMaps.forEach(m => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
714 m.getLayer("CUTTOOL")
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
715 .getSource()
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
716 .addFeature(cut);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
717 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
718
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
719 // draw diagram
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
720 this.$store.dispatch("fairwayprofile/cut", cut);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
721 } else {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
722 displayError({
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
723 title: this.$gettext("Invalid input"),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
724 message: this.$gettext(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
725 "Please enter correct coordinates in the format: Lat,Lon,Lat,Lon"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
726 )
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
727 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
728 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
729 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
730 saveCut() {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
731 const previousCuts =
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
732 JSON.parse(localStorage.getItem("previousCuts")) || [];
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
733 const newEntry = {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
734 label: this.cutLabel,
5572
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
735 bottleneckName: this.bottleneck.get("objnam"),
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
736 bottleneckId: this.bottleneck.get("bottleneck_id"),
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
737 coordinates: [...this.startPoint, ...this.endPoint],
4502
4c3851391b6d client: fairwayprofile: implement custom depth for x-cuts
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4488
diff changeset
738 timestamp: new Date().getTime(),
4528
0bad1dcdb044 client: Fairwayprofile: save the state of the enable/disable button for custom depth
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4526
diff changeset
739 depth: this.depth,
0bad1dcdb044 client: Fairwayprofile: save the state of the enable/disable button for custom depth
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4526
diff changeset
740 useCustomDepth: this.useCustomDepth
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
741 };
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
742 const existingEntry = previousCuts.find(cut => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
743 return JSON.stringify(cut) === JSON.stringify(newEntry);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
744 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
745 if (!existingEntry) previousCuts.push(newEntry);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
746 if (previousCuts.length > 100) previousCuts.shift();
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
747 localStorage.setItem("previousCuts", JSON.stringify(previousCuts));
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
748 this.$store.dispatch("fairwayprofile/previousCuts");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
749 this.showLabelInput = false;
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
750 displayInfo({
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
751 title: this.$gettext("Profile saved!"),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
752 message: this.$gettext(
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
753 'You can now select these coordinates from the "Saved cross profiles" menu to restore this cross profile.'
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
754 )
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
755 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
756 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
757 deleteSelectedSurvey() {
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
758 HTTP.post(
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
759 "/imports/dsr",
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
760 {
4406
d336a78985ad bottleneck_dialogue: send correct bottleneck_id
Thomas Junk <thomas.junk@intevation.de>
parents: 4402
diff changeset
761 "bottleneck-id": this.selectedSurvey.bottleneck_id,
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
762 "date-info": this.selectedSurvey.date_info
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
763 },
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
764 {
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
765 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
766 }
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
767 )
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
768 .then(() => {
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
769 displayInfo({
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
770 title: this.$gettext("Survey"),
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
771 message:
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
772 this.$gettext("Deleting ") +
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
773 `${this.selectedBottleneck}: ${this.selectedSurvey.date_info}`
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
774 });
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
775 })
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
776 .catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
777 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
778 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
779 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
780 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
781 }
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
782 displayError({
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
783 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
784 message: message
4402
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
785 });
5e894e680e0d dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 4324
diff changeset
786 });
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
787 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
788 deleteSelectedCut(cut) {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
789 this.$store.commit("application/popup", {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
790 icon: "trash",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
791 title: this.$gettext("Delete cross profile"),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
792 content:
4324
36d384326407 BottleneckDialogue: Prototype for delete of surveys implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 4322
diff changeset
793 `<small><b>` +
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
794 this.$gettext("Do you really want to delete the cross profile:") +
4324
36d384326407 BottleneckDialogue: Prototype for delete of surveys implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 4322
diff changeset
795 `</b><br>
36d384326407 BottleneckDialogue: Prototype for delete of surveys implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 4322
diff changeset
796 ${cut.label}</small>`,
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
797 confirm: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
798 label: this.$gettext("Delete"),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
799 icon: "trash",
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
800 callback: () => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
801 let previousCuts =
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
802 JSON.parse(localStorage.getItem("previousCuts")) || [];
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
803 previousCuts = previousCuts.filter(cut => {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
804 return JSON.stringify(cut) !== JSON.stringify(this.selectedCut);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
805 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
806 localStorage.setItem("previousCuts", JSON.stringify(previousCuts));
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
807 this.$store.commit("fairwayprofile/selectedCut", null);
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
808 this.$store.dispatch("fairwayprofile/previousCuts");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
809 displayInfo({ title: this.$gettext("Profile deleted!") });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
810 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
811 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
812 cancel: {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
813 label: this.$gettext("Cancel"),
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
814 icon: "times"
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
815 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
816 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
817 },
4479
2d2c9f98360a Bottlenecks: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4406
diff changeset
818 takeMeThere() {
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
819 const bottleneck = this.bottlenecksList.find(
5572
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
820 bn => bn.properties.bottleneck_id === this.selectedBottleneck
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
821 );
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
822 if (!bottleneck) return;
4488
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4479
diff changeset
823 this.$store.commit(
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4479
diff changeset
824 "bottlenecks/setBottleneckForPrint",
5572
3b842e951317 change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents: 5432
diff changeset
825 bottleneck.properties.name
4488
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4479
diff changeset
826 );
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
827 this.$store.dispatch("map/moveToFeauture", {
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
828 feature: bottleneck,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
829 zoom: 17,
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
830 preventZoomOut: true
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
831 });
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
832 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
833 },
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
834 mounted() {
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
835 this.$store.dispatch("usermanagement/loadUsers").catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
836 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
837 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
838 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
839 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
840 }
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
841 displayError({
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
842 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4684
diff changeset
843 message: message
4521
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
844 });
245e6215361e Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4502
diff changeset
845 });
4322
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
846 this.$store.dispatch("bottlenecks/loadBottlenecksList");
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
847 }
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
848 };
fabe67e204e7 bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
849 </script>