annotate client/src/components/fairway/AvailableFairwayDepthDialogue.vue @ 3272:a9d047ccf408

client: fairway availability: set stretch in dialog when selecting stretch from map/list
author Markus Kottlaender <markus@intevation.de>
date Wed, 15 May 2019 14:54:53 +0200
parents 94e966ebef35
children 5f0c6e931e7f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 <div
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 :class="[
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 'box ui-element rounded bg-white text-nowrap',
3231
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
5 { expanded: showFairwayDepth }
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 ]"
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 >
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 <div style="width: 18rem">
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 <UIBoxHeader icon="chart-line" :title="label" :closeCallback="close" />
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 <div class="box-body">
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 <UISpinnerOverlay v-if="loading" />
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
12 <div
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
13 class="mb-3 d-flex flex-row justify-content-between align-items-center"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
14 >
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
15 <div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
16 <input :value="$options.BOTTLENECKS" type="radio" v-model="type" />
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
17 <small class="ml-1 text-muted">
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
18 <translate>Bottlenecks</translate>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
19 </small>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
20 </div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
21 <div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
22 <input :value="$options.STRETCHES" type="radio" v-model="type" />
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
23 <small class="ml-1 text-muted">
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
24 <translate>Stretches</translate>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
25 </small>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
26 </div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
27 <div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
28 <input :value="$options.SECTIONS" type="radio" v-model="type" />
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
29 <small class="ml-1 text-muted">
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
30 <translate>Sections</translate>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
31 </small>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
32 </div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
33 </div>
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
34 <div class="d-flex flex-column">
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
35 <select
3236
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
36 :key="1"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
37 v-if="type === $options.BOTTLENECKS"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
38 @change="entrySelected"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
39 class="form-control form-control-sm font-weight-bold"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
40 v-model="selectedEntry"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
41 >
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
42 <option :value="null">{{ empty }}</option>
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
43 <optgroup
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
44 v-for="(bottlenecksForCountry, cc) in orderedBottlenecks"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
45 :key="cc"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
46 :label="cc"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
47 >
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
48 <option
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
49 v-for="bn in bottlenecksForCountry"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
50 :key="bn.properties.name"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
51 :value="bn"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
52 >
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
53 {{ bn.properties.name }}
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
54 </option>
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
55 </optgroup>
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
56 </select>
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
57 <select
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
58 :key="2"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
59 v-else
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
60 @change="entrySelected"
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
61 class="form-control form-control-sm font-weight-bold"
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
62 v-model="selectedEntry"
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
63 >
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
64 <option :value="null">{{ empty }}</option>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
65 <option
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
66 v-for="(entry, index) in entries"
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
67 :value="entry"
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
68 :key="index"
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
69 >{{ entry.properties.name }}</option
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
70 >
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 </select>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
72 </div>
3185
505414dfe3e7 available_fairway_depth: move statistic dialog to store
Thomas Junk <thomas.junk@intevation.de>
parents: 3184
diff changeset
73 <div class="d-flex flex-column mt-3">
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
74 <div class="d-flex flex-row w-100">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
75 <div class="d-flex flex-column mb-3 w-50 mr-1">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
76 <small class="my-auto text-muted"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
77 ><translate>Type</translate></small
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
78 >
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
79 <select
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
80 v-model="selectedFrequency"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
81 class="form-control form-control-sm"
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
82 >
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
83 <option
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
84 v-for="(option, index) in $options.FREQUENCIES"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
85 :value="option"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
86 :key="index"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
87 ><translate>{{ option }}</translate></option
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
88 >
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
89 </select>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
90 </div>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
91 <div class="d-flex flex-column mb-3 w-50 ml-1">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
92 <small class="my-auto text-muted"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
93 ><translate>LOS</translate></small
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
94 >
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
95 <select v-model="los" class="form-control form-control-sm">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
96 <option value="1">1</option>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
97 <option value="2">2</option>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
98 <option value="3">3</option>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
99 </select>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
100 </div>
3185
505414dfe3e7 available_fairway_depth: move statistic dialog to store
Thomas Junk <thomas.junk@intevation.de>
parents: 3184
diff changeset
101 </div>
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
102 <div class="d-flex flex-row w-100">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
103 <div class="d-flex flex-column w-50 mr-1">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
104 <small for="from" class="my-auto text-muted"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
105 ><translate>Date from</translate></small
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
106 ><input
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
107 id="from"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
108 v-model="fromDate"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
109 class="form-control form-control-sm"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
110 type="date"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
111 />
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
112 </div>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
113 <div class="d-flex flex-column w-50 ml-1">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
114 <small for="to" class="my-auto text-muted"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
115 ><translate>Date to</translate></small
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
116 ><input
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
117 id="to"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
118 v-model="toDate"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
119 class="form-control form-control-sm"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
120 type="date"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
121 />
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
122 </div>
3185
505414dfe3e7 available_fairway_depth: move statistic dialog to store
Thomas Junk <thomas.junk@intevation.de>
parents: 3184
diff changeset
123 </div>
505414dfe3e7 available_fairway_depth: move statistic dialog to store
Thomas Junk <thomas.junk@intevation.de>
parents: 3184
diff changeset
124 </div>
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
125 <div class="mt-3">
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
126 <button
3178
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
127 @click="openFairwaydepth"
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
128 :disabled="isComplete"
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
129 class="btn btn-info btn-sm w-100"
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
130 >
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
131 <translate>Available Fairway Depth</translate>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
132 </button>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
133 </div>
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
134 </div>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
135 </div>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
136 </div>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
137 </template>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
138
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
139 <style lang="scss" scoped>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
140 input,
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
141 select {
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
142 font-size: 0.8em;
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
143 }
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
144 </style>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
145
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
146 <script>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
147 /* This is Free Software under GNU Affero General Public License v >= 3.0
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
148 * without warranty, see README.md and license for details.
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
149 *
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
150 * SPDX-License-Identifier: AGPL-3.0-or-later
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
151 * License-Filename: LICENSES/AGPL-3.0.txt
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
152 *
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
153 * Copyright (C) 2018 by via donau
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
154 * – Österreichische Wasserstraßen-Gesellschaft mbH
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
155 * Software engineering by Intevation GmbH
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
156 *
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
157 * Author(s):
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
158 * Markus Kottländer <markus.kottlaender@intevation.de>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
159 * Thomas Junk <thomas.junk@intevation.de>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
160 */
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
161
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
162 import app from "@/main";
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
163 import { displayError } from "@/lib/errors";
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
164 import { mapState, mapGetters } from "vuex";
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
165
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
166 export default {
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
167 data() {
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
168 return {
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
169 loading: false
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
170 };
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
171 },
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
172 methods: {
3178
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
173 openFairwaydepth() {
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
174 this.loading = true;
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
175 this.$store
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
176 .dispatch("fairwayavailability/loadAvailableFairwayDepth", {
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
177 feature: this.selectedFairwayAvailabilityFeature,
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
178 from: this.from,
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
179 to: this.to,
3198
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
180 frequency: this.frequency,
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
181 LOS: this.los
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
182 })
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
183 .then(() => {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
184 this.$store.commit("application/paneSetup", "AVAILABLEFAIRWAYDEPTH");
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
185 })
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
186 .catch(error => {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
187 console.log(error);
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
188 const { status, data } = error.response;
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
189 displayError({
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
190 title: this.$gettext("Backend Error"),
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
191 message: `${status}: ${data.message || data}`
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
192 });
3272
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
193 })
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
194 .finally(() => {
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
195 this.loading = false;
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
196 });
3178
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
197 },
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
198 close() {
3231
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
199 this.$store.commit("application/showFairwayDepth", false);
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
200 },
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
201 entrySelected() {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
202 if (this.type === this.$options.BOTTLENECKS) {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
203 this.openLayersMap()
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
204 .getLayer("BOTTLENECKS")
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
205 .setVisible(true);
3178
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
206 if (this.showProfiles) {
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
207 this.$store.dispatch(
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
208 "bottlenecks/setSelectedBottleneck",
3183
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
209 this.selectedFairwayAvailabilityFeature.properties.name
3178
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
210 );
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
211 }
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
212 }
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
213 if (this.type === this.$options.STRETCHES) {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
214 this.openLayersMap()
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
215 .getLayer("STRETCHES")
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
216 .setVisible(true);
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
217 }
3183
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
218 if (this.selectedFairwayAvailabilityFeature) {
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
219 this.$store.dispatch("map/moveToFeauture", {
3183
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
220 feature: this.selectedFairwayAvailabilityFeature,
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
221 zoom: 17,
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
222 preventZoomOut: true
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
223 });
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
224 }
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
225 },
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
226 setSelectedBottleneck() {
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
227 const bn = this.bottlenecksList.filter(
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
228 x => x.properties.name === this.selectedBottleneck
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
229 )[0];
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
230 this.$store.commit(
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
231 "fairwayavailability/setSelectedFairwayAvailability",
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
232 bn
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
233 );
3272
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
234 },
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
235 setSelectedStretch() {
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
236 const stretch = this.stretches.find(x => x.id === this.selectedStretchId);
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
237 this.$store.commit(
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
238 "fairwayavailability/setSelectedFairwayAvailability",
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
239 stretch
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
240 );
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
241 }
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
242 },
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
243 computed: {
3231
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
244 ...mapState("application", [
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
245 "showFairwayDepth",
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
246 "paneSetup",
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
247 "showProfiles"
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
248 ]),
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
249 ...mapState("fairwayavailability", [
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
250 "selectedFairwayAvailabilityFeature",
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
251 "from",
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
252 "to",
3198
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
253 "frequency",
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
254 "LOS"
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
255 ]),
3272
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
256 ...mapState("imports", ["stretches", "selectedStretchId"]),
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
257 ...mapState("bottlenecks", ["bottlenecksList", "selectedBottleneck"]),
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
258 ...mapGetters("map", ["openLayersMap"]),
3236
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
259 ...mapGetters("bottlenecks", ["orderedBottlenecks"]),
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
260 isComplete() {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
261 return (
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
262 this.from == null ||
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
263 this.to == null ||
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
264 this.frequency == null ||
3214
861329d535b2 statistics: guarg for los
Thomas Junk <thomas.junk@intevation.de>
parents: 3207
diff changeset
265 this.los == null ||
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
266 this.selectedFairwayAvailabilityFeature == null
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
267 );
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
268 },
3205
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
269 type: {
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
270 get() {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
271 return this.$store.state.fairwayavailability.type;
3205
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
272 },
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
273 set(type) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
274 this.$store.commit("fairwayavailability/type", type);
3205
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
275 }
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
276 },
3198
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
277 los: {
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
278 get() {
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
279 return this.LOS;
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
280 },
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
281 set(value) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
282 this.$store.commit("fairwayavailability/setLOS", value);
3198
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
283 }
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
284 },
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
285 fromDate: {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
286 get() {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
287 return this.from;
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
288 },
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
289 set(value) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
290 this.$store.commit("fairwayavailability/setFrom", value);
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
291 }
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
292 },
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
293 toDate: {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
294 get() {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
295 return this.to;
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
296 },
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
297 set(value) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
298 this.$store.commit("fairwayavailability/setTo", value);
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
299 }
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
300 },
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
301 selectedFrequency: {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
302 get() {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
303 return this.frequency;
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
304 },
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
305 set(value) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
306 this.$store.commit("fairwayavailability/setFrequency", value);
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
307 }
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
308 },
3183
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
309 selectedEntry: {
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
310 get() {
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
311 return this.selectedFairwayAvailabilityFeature;
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
312 },
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
313 set(feature) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
314 this.$store.commit(
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
315 "fairwayavailability/setSelectedFairwayAvailability",
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
316 feature
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
317 );
3183
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
318 }
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
319 },
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
320 entries() {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
321 if (this.type === this.$options.BOTTLENECKS) return this.bottlenecksList;
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
322 if (this.type === this.$options.STRETCHES) return this.stretches;
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
323 return [];
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
324 },
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
325 label() {
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
326 return this.$gettext("Statistics");
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
327 },
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
328 empty() {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
329 if (this.type === this.$options.BOTTLENECKS)
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
330 return this.$gettext("Select bottleneck");
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
331 if (this.type === this.$options.STRETCHES)
3238
94e966ebef35 available_fairway_depth: fix typo
Thomas Junk <thomas.junk@intevation.de>
parents: 3237
diff changeset
332 return this.$gettext("Select stretch");
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
333 return this.$gettext("Select section");
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
334 }
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
335 },
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
336 watch: {
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
337 selectedBottleneck() {
3174
aeb9d6fc640a statistics: sprinkled more fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3173
diff changeset
338 this.type = this.$options.BOTTLENECKS;
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
339 this.setSelectedBottleneck();
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
340 },
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
341 type() {
3175
296392d4539c client: statistics dialog: fix resetting selectedEntry
Markus Kottlaender <markus@intevation.de>
parents: 3174
diff changeset
342 if (this.type === this.$options.BOTTLENECKS && this.selectedBottleneck) {
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
343 this.setSelectedBottleneck();
3272
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
344 } else if (
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
345 this.type === this.$options.STRETCHES &&
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
346 this.selectedStretchId
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
347 ) {
a9d047ccf408 client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents: 3238
diff changeset
348 this.setSelectedStretch();
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
349 } else {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
350 this.$store.commit(
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
351 "fairwayavailability/setSelectedFairwayAvailability",
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
352 null
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
353 );
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
354 }
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
355 this.openLayersMap()
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
356 .getLayer("STRETCHES")
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
357 .setVisible(true);
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
358 },
3237
86e108358216 available_fairway_depth: bug fix for loading bottlenecks and stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
359 showFairwayDepth() {
86e108358216 available_fairway_depth: bug fix for loading bottlenecks and stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
360 if (this.showFairwayDepth) {
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
361 this.loading = true;
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
362 this.$store.dispatch("bottlenecks/loadBottlenecksList").then(() => {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
363 this.$store.dispatch("imports/loadStretches").then(() => {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
364 this.loading = false;
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
365 if (this.selectedBottleneck) this.setSelectedBottleneck();
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
366 });
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
367 });
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
368 }
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
369 }
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
370 },
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
371 BOTTLENECKS: "bottlenecks",
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
372 SECTIONS: "sections",
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
373 STRETCHES: "stretches",
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
374 AVAILABLEFAIRWAYDEPTH: app.$gettext("Available Fairway Depth"),
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
375 FREQUENCIES: {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
376 MONTHLY: "monthly",
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
377 QUARTERLY: "quarterly",
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
378 YEARLY: "yearly"
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
379 }
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
380 };
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
381 </script>