annotate client/src/components/ImportStretches.vue @ 1960:e5c5954fbd84

define stretches: validation
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 22 Jan 2019 17:22:46 +0100
parents 84e475938b75
children 9b9f1d164f26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1610
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
2 <div class="d-flex flex-column mb-3">
1797
67340ceecc5f feat: define sections and stretches etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
3 <h6 class="mb-0 py-2 px-3 border-bottom d-flex align-items-center">
67340ceecc5f feat: define sections and stretches etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
4 <font-awesome-icon icon="road" class="mr-2"></font-awesome-icon>
1870
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
5 <translate>Define stretches</translate>
1797
67340ceecc5f feat: define sections and stretches etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1669
diff changeset
6 </h6>
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
7 <div v-if="!edit" class="mb-3 mr-3 ml-3 text-left">
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
8 <table v-if="stretches.length > 0" class="table">
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
9 <thead>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
10 <tr>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
11 <th class="header"><translate>Name</translate></th>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
12 <th class="header"><translate>Datum</translate></th>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
13 <th class="header"><translate>Source organization</translate></th>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
14 <th class="tools">&nbsp;</th>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
15 <th class="tools">&nbsp;</th>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
16 </tr>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
17 </thead>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
18 <tbody>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
19 <tr class="small" v-for="(stretch, index) in stretches" :key="index">
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
20 <td class="">
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
21 <a @click="moveMapToStretch(index)" href="#">{{
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
22 stretch.properties.name
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
23 }}</a>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
24 </td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
25 <td class="">
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
26 {{ formatSurveyDate(stretch.properties["date_info"]) }}
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
27 </td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
28 <td>{{ stretch.properties["source_organization"] }}</td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
29 <td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
30 <font-awesome-icon
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
31 @click="editStretch(index)"
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
32 icon="pencil-alt"
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
33 fixed-width
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
34 ></font-awesome-icon>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
35 </td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
36 <td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
37 <font-awesome-icon
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
38 @click="deleteStretch(index)"
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
39 icon="trash"
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
40 fixed-width
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
41 ></font-awesome-icon>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
42 </td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
43 </tr>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
44 </tbody>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
45 </table>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
46 <div class="mt-3" v-if="stretches.length == 0">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
47 <translate>No results.</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
48 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
49 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
50 <div v-if="edit">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
51 <div class="ml-3 mr-3">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
52 <div class="d-flex flex-row justify-content-between">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
53 <div class="mt-2 w-50 mr-2 text-left">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
54 <small class="text-muted"> <translate>ID</translate> </small>
1870
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
55 <input
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
56 id="id"
1870
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
57 type="text"
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
58 class="form-control"
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
59 placeholder="AT_Section_12"
1870
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
60 aria-label="id"
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
61 v-model="id"
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
62 />
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
63 <span class="text-left text-danger">
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
64 <small v-if="idError && !id">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
65 <translate>Please enter an id</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
66 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
67 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
68 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
69 <div class="mt-2 w-50 ml-2 text-left">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
70 <div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
71 <small class="text-muted">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
72 <translate>Countrycode</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
73 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
74 <input
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
75 id="countryCode"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
76 type="text"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
77 class="form-control"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
78 placeholder="AT"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
79 aria-label="id"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
80 v-model="countryCode"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
81 />
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
82 <span class="text-left text-danger">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
83 <small v-if="countryCodeError && !countryCode">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
84 <translate>Please enter a countrycode </translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
85 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
86 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
87 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
88 <div class="w-50 ml-2"></div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
89 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
90 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
91 <div class="d-flex flex-column justify-content-between">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
92 <div class="mt-2 text-left">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
93 <small class="text-muted"> <translate>Start rhm</translate> </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
94 <div class="d-flex flex-row">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
95 <input
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
96 id="startrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
97 type="text"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
98 class="form-control"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
99 placeholder="e.g. ATXXX00001000000019900"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
100 aria-label="startrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
101 v-model="startrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
102 />
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
103 <span class="input-group-text">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
104 <font-awesome-icon
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
105 @click="togglePipette('start')"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
106 :class="{ 'text-info': pipetteStart }"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
107 icon="bullseye"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
108 ></font-awesome-icon>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
109 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
110 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
111 <span class="text-left text-danger">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
112 <small v-if="startrhmError && !startrhm">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
113 <translate>Please enter a start point</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
114 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
115 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
116 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
117 <div class="mt-2 text-left">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
118 <small class="text-muted"> <translate>End rhm</translate> </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
119 <div class="d-flex flex-row">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
120 <input
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
121 id="endrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
122 type="text"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
123 class="form-control"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
124 placeholder="e.g. ATXXX00001000000019900"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
125 aria-label="endrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
126 v-model="endrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
127 />
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
128 <span class="input-group-text">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
129 <font-awesome-icon
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
130 @click="togglePipette('end')"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
131 :class="{ 'text-info': pipetteEnd }"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
132 icon="bullseye"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
133 ></font-awesome-icon>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
134 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
135 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
136 <span class="text-left text-danger">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
137 <small v-if="endrhmError && !endrhm">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
138 <translate>Please enter an end point</translate>
1870
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
139 </small>
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
140 </span>
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
141 </div>
1959
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
142 <span class="text-left text-danger">
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
143 <small v-if="!pointsValid">
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
144 <translate>Startpoint is not before endpoint.</translate>
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
145 </small>
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
146 </span>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
147 </div>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
148 <div class="d-flex flex-row justify-content-between">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
149 <div class="mt-2 mr-2 w-50 text-left">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
150 <small class="text-muted">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
151 <translate>Object name</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
152 </small>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
153 <input
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
154 id="objbn"
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
155 type="text"
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
156 class="form-control"
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
157 placeholder=""
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
158 aria-label="objbn"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
159 v-model="objbn"
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
160 />
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
161 <span class="text-left text-danger">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
162 <small v-if="objbnError && !objbn">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
163 <translate>Please enter an objectname</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
164 </small>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
165 </span>
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
166 </div>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
167 <div class="mt-2 ml-2 w-50 text-left">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
168 <small class="text-muted">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
169 <translate>National Object name</translate>
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
170 </small>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
171 <input
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
172 id="nobjbn"
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
173 type="text"
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
174 class="form-control"
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
175 placeholder=""
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
176 aria-label="nobjbn"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
177 v-model="nobjbn"
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
178 />
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
179 <span class="text-left text-danger">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
180 <small v-if="nobjbnError && !nobjbn">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
181 <translate>Please enter an objectname</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
182 </small>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
183 </span>
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
184 </div>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
185 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
186 <div class="d-flex flex-row justify-content-between">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
187 <div class="mt-2 mr-2 w-50 text-left">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
188 <small class="text-muted"> <translate>Date info</translate> </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
189 <input
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
190 id="date_info"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
191 type="date"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
192 class="form-control"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
193 placeholder="date_info"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
194 aria-label="date_info"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
195 v-model="date_info"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
196 />
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
197 <span class="text-left text-danger">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
198 <small v-if="date_infoError && !date_info">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
199 <translate>Please enter a date</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
200 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
201 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
202 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
203 <div class="mt-2 ml-2 w-50 text-left">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
204 <small class="text-muted"> <translate>Source</translate> </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
205 <input
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
206 id="source"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
207 type="text"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
208 class="form-control"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
209 placeholder="source"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
210 aria-label="source"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
211 v-model="source"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
212 />
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
213 <span class="text-left text-danger">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
214 <small v-if="sourceError && !source">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
215 <translate>Please enter a source</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
216 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
217 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
218 </div>
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
219 </div>
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
220 </div>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
221 <div class="text-right mt-2 mr-3 mb-3">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
222 <button @click="edit = false" class="btn btn-warning mr-2">Back</button>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
223 <button
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
224 @click="save"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
225 type="submit"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
226 class="shadow-sm btn btn-info submit-button"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
227 >
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
228 <translate>Submit</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
229 </button>
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
230 </div>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
231 </div>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
232 <div class="text-right mr-3">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
233 <button v-if="!edit" @click="startEdit()" class="btn btn-info">
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
234 <translate>New stretch</translate>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
235 </button>
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
236 </div>
1610
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
237 </div>
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
238 </template>
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
239
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
240 <script>
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
241 /* This is Free Software under GNU Affero General Public License v >= 3.0
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
242 * without warranty, see README.md and license for details.
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
243 *
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
244 * SPDX-License-Identifier: AGPL-3.0-or-later
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
245 * License-Filename: LICENSES/AGPL-3.0.txt
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
246 *
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
247 * Copyright (C) 2018 by via donau
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
248 * – Österreichische Wasserstraßen-Gesellschaft mbH
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
249 * Software engineering by Intevation GmbH
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
250 *
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
251 * Author(s):
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
252 * Thomas Junk <thomas.junk@intevation.de>
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
253 */
1827
27c4effba5b1 stretches only for sysadmin plus country code
Thomas Junk <thomas.junk@intevation.de>
parents: 1823
diff changeset
254 import { mapState, mapGetters } from "vuex";
1921
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
255 import { displayError, displayInfo } from "@/lib/errors.js";
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
256 import { formatSurveyDate } from "@/lib/date.js";
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
257 import center from "@turf/center";
1610
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
258
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
259 export default {
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
260 name: "importstretches",
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
261 data() {
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
262 return {
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
263 edit: false,
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
264 id: "",
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
265 funktion: "",
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
266 startrhm: "",
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
267 endrhm: "",
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
268 objbn: "",
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
269 nobjbn: "",
1827
27c4effba5b1 stretches only for sysadmin plus country code
Thomas Junk <thomas.junk@intevation.de>
parents: 1823
diff changeset
270 countryCode: "",
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
271 date_info: new Date().toISOString().split("T")[0],
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
272 source: "",
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
273 pipetteStart: false,
1816
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
274 pipetteEnd: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
275 idError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
276 funktionError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
277 startrhmError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
278 endrhmError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
279 objbnError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
280 nobjbnError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
281 date_infoError: false,
1827
27c4effba5b1 stretches only for sysadmin plus country code
Thomas Junk <thomas.junk@intevation.de>
parents: 1823
diff changeset
282 sourceError: false,
27c4effba5b1 stretches only for sysadmin plus country code
Thomas Junk <thomas.junk@intevation.de>
parents: 1823
diff changeset
283 countryCodeError: false
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
284 };
1610
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
285 },
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
286 mounted() {
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
287 this.edit = false;
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
288 this.loadStretches();
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
289 },
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
290 methods: {
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
291 editStretch(index) {
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
292 const { date_info, name, objnam, nobjnam } = this.stretches[
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
293 index
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
294 ].properties;
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
295 this.date_info = date_info;
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
296 this.id = name;
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
297 this.nobjbn = nobjnam;
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
298 this.objbn = objnam;
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
299 this.source = this.stretches[index];
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
300 this.edit = true;
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
301 },
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
302 deleteStretch(index) {
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
303 displayInfo({
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
304 title: this.$gettext("Not implemented"),
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
305 message: this.$gettext("Deleting " + this.stretches[index].id)
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
306 });
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
307 },
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
308 moveMapToStretch(index) {
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
309 const { coordinates } = center(this.stretches[index]).geometry;
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
310 this.$store.commit("map/moveMap", {
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
311 coordinates: coordinates,
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
312 zoom: 17,
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
313 preventZoomOut: true
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
314 });
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
315 },
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
316 formatSurveyDate(d) {
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
317 return formatSurveyDate(d);
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
318 },
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
319 loadStretches() {
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
320 this.$store.dispatch("imports/loadStretches").catch(error => {
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
321 const { status, data } = error.response;
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
322 displayError({
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
323 title: this.$gettext("Backend Error"),
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
324 message: `${status}: ${data.message || data}`
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
325 });
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
326 });
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
327 },
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
328 clean() {
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
329 this.id = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
330 this.funktion = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
331 this.startrhm = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
332 this.endrhm = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
333 this.objbn = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
334 this.nobjbn = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
335 this.countryCode = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
336 this.date_info = new Date().toISOString().split("T")[0];
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
337 this.source = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
338 this.pipetteStart = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
339 this.pipetteEnd = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
340 this.idError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
341 this.funktionError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
342 this.startrhmError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
343 this.endrhmError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
344 this.objbnError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
345 this.nobjbnError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
346 this.date_infoError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
347 this.sourceError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
348 this.countryCodeError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
349 },
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
350 startEdit() {
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
351 this.clean();
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
352 this.edit = true;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
353 },
1823
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
354 togglePipette(t) {
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
355 if (t === "start") {
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
356 this.pipetteStart = !this.pipetteStart;
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
357 this.pipetteEnd = false;
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
358 } else {
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
359 this.pipetteEnd = !this.pipetteEnd;
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
360 this.pipetteStart = false;
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
361 }
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
362 },
1816
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
363 validate() {
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
364 const fields = [
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
365 "id",
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
366 "funktion",
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
367 "startrhm",
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
368 "endrhm",
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
369 "objbn",
1960
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
370 "nobjbn",
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
371 "countryCode",
1816
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
372 "date_info",
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
373 "source"
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
374 ];
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
375 fields.forEach(field => {
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
376 if (!this[field]) {
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
377 this[field + "Error"] = true;
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
378 } else {
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
379 this[field + "Error"] = false;
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
380 }
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
381 });
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
382 },
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
383 save() {
1816
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
384 this.validate();
1960
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
385 if (!this.pointsValid) return;
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
386 if (
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
387 !this.id ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
388 !this.startrhm ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
389 !this.endrhm ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
390 !this.source ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
391 !this.date_info ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
392 !this.objbn ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
393 !this.nobjbn ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
394 !this.countryCode
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
395 )
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
396 return;
1930
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
397 const data = {
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
398 name: this.id,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
399 from: this.startrhm,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
400 to: this.endrhm,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
401 "source-organization": this.source,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
402 "date-info": this.date_info,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
403 objnam: this.objbn,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
404 nobjnam: this.nobjbn,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
405 countries: this.countryCode.split(",")
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1888
diff changeset
406 };
1930
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
407 this.$store
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
408 .dispatch("imports/saveStretch", data)
1921
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
409 .then(() => {
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
410 displayInfo({
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
411 title: this.$gettext("Import"),
1930
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
412 message: this.$gettext("Starting import of stretch")
1921
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
413 });
1930
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
414 this.clean();
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
415 this.edit = false;
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
416 this.loadStretches();
1921
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
417 })
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
418 .catch(error => {
1930
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
419 console.log(error);
1921
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
420 const { status, data } = error.response;
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
421 displayError({
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
422 title: this.$gettext("Backend Error"),
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
423 message: `${status}: ${data.message || data}`
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
424 });
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
425 });
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
426 }
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
427 },
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
428 watch: {
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
429 identifiedFeatures() {
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
430 const filterDistanceMarks = x => {
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
431 return /^distance_marks/.test(x["id_"]);
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
432 };
1959
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
433 console.log(this.identifiedFeatures);
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
434 const distanceMark = this.identifiedFeatures.filter(filterDistanceMarks);
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
435 if (distanceMark.length > 0) {
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
436 const value = distanceMark[0]["id_"]
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
437 .split(".")[1]
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
438 .replace(/,|\(|\)/g, "");
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
439 this.startrhm = this.pipetteStart ? value : this.startrhm;
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
440 this.endrhm = this.pipetteEnd ? value : this.endrhm;
1823
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
441 this.pipetteStart = false;
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
442 this.pipetteEnd = false;
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
443 }
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
444 }
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
445 },
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
446 computed: {
1827
27c4effba5b1 stretches only for sysadmin plus country code
Thomas Junk <thomas.junk@intevation.de>
parents: 1823
diff changeset
447 ...mapState("map", ["identifiedFeatures", "currentMeasurement"]),
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1888
diff changeset
448 ...mapGetters("user", ["isSysAdmin"]),
1959
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
449 ...mapState("imports", ["stretches"]),
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
450 pointsValid() {
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
451 if (!this.startrhm || !this.endrhm) return true;
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
452 const start = this.startrhm.replace(/\D+/, "");
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
453 const end = this.endrhm.replace(/\D+/, "");
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
454 const result = start < end;
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
455 return result;
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
456 }
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
457 }
1610
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
458 };
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
459 </script>
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
460
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
461 <style lang="scss" scoped></style>