annotate client/src/components/ImportStretches.vue @ 2136:3138d60dd1a6

moveToExtent substitutes moveMap where easy doable
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 06 Feb 2019 15:53:24 +0100
parents e9879eb7e965
children 55bedb39295a
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="">
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
21 <a
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
22 class="linkto text-info"
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
23 v-if="isInStaging(stretch.properties.name)"
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
24 @click="gotoStaging(getStagingLink(stretch.properties.name))"
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
25 >
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
26 {{ stretch.properties.name
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
27 }}<font-awesome-icon
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
28 class="ml-1 text-danger"
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
29 icon="exclamation-triangle"
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
30 fixed-width
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
31 ></font-awesome-icon
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
32 ><small class="ml-1">review</small>
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
33 </a>
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
34 <a v-else @click="moveMapToStretch(index)" href="#">{{
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
35 stretch.properties.name
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
36 }}</a>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
37 </td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
38 <td class="">
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
39 {{ formatSurveyDate(stretch.properties["date_info"]) }}
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
40 </td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
41 <td>{{ stretch.properties["source_organization"] }}</td>
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 <font-awesome-icon
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
44 @click="editStretch(index)"
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
45 icon="pencil-alt"
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
46 fixed-width
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
47 ></font-awesome-icon>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
48 </td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
49 <td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
50 <font-awesome-icon
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
51 @click="deleteStretch(index)"
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
52 icon="trash"
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
53 fixed-width
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
54 ></font-awesome-icon>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
55 </td>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
56 </tr>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
57 </tbody>
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
58 </table>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
59 <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
60 <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
61 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
62 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
63 <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
64 <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
65 <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
66 <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
67 <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
68 <input
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
69 id="id"
1870
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
70 type="text"
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
71 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
72 placeholder="AT_Section_12"
1870
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
73 aria-label="id"
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
74 v-model="id"
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
75 :disabled="!idEditable"
1870
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
76 />
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
77 <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
78 <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
79 <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
80 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
81 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
82 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
83 <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
84 <div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
85 <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
86 <translate>Countrycode</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
87 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
88 <input
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
89 id="countryCode"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
90 type="text"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
91 class="form-control"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
92 placeholder="AT"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
93 aria-label="id"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
94 v-model="countryCode"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
95 />
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
96 <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
97 <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
98 <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
99 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
100 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
101 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
102 <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
103 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
104 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
105 <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
106 <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
107 <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
108 <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
109 <input
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
110 id="startrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
111 type="text"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
112 class="form-control"
1987
ee274693b8ee Use something similar to a valid ISRS location code as placeholder
Tom Gottfried <tom@intevation.de>
parents: 1980
diff changeset
113 placeholder="e.g. ATXXX000010000019900"
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
114 aria-label="startrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
115 v-model="startrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
116 />
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
117 <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
118 <font-awesome-icon
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
119 @click="togglePipette('start')"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
120 :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
121 icon="bullseye"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
122 ></font-awesome-icon>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
123 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
124 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
125 <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
126 <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
127 <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
128 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
129 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
130 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
131 <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
132 <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
133 <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
134 <input
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
135 id="endrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
136 type="text"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
137 class="form-control"
1987
ee274693b8ee Use something similar to a valid ISRS location code as placeholder
Tom Gottfried <tom@intevation.de>
parents: 1980
diff changeset
138 placeholder="e.g. ATXXX000010000019900"
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
139 aria-label="endrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
140 v-model="endrhm"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
141 />
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
142 <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
143 <font-awesome-icon
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
144 @click="togglePipette('end')"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
145 :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
146 icon="bullseye"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
147 ></font-awesome-icon>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
148 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
149 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
150 <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
151 <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
152 <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
153 </small>
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
154 </span>
3050d702913a sections and stretches: only stretches. only sysadmin.
Thomas Junk <thomas.junk@intevation.de>
parents: 1827
diff changeset
155 </div>
1959
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
156 <span class="text-left text-danger">
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
157 <small v-if="!pointsValid">
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
158 <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
159 </small>
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
160 </span>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
161 </div>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
162 <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
163 <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
164 <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
165 <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
166 </small>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
167 <input
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
168 id="objbn"
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
169 type="text"
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
170 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
171 placeholder=""
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
172 aria-label="objbn"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
173 v-model="objbn"
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
174 />
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
175 <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
176 <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
177 <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
178 </small>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
179 </span>
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
180 </div>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
181 <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
182 <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
183 <translate>National Object name</translate>
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
184 </small>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
185 <input
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
186 id="nobjbn"
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
187 type="text"
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
188 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
189 placeholder=""
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
190 aria-label="nobjbn"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
191 v-model="nobjbn"
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
192 />
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
193 </div>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
194 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
195 <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
196 <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
197 <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
198 <input
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
199 id="date_info"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
200 type="date"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
201 class="form-control"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
202 placeholder="date_info"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
203 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
204 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
205 />
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
206 <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
207 <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
208 <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
209 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
210 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
211 </div>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
212 <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
213 <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
214 <input
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
215 id="source"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
216 type="text"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
217 class="form-control"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
218 placeholder="source"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
219 aria-label="source"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
220 v-model="source"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
221 />
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
222 <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
223 <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
224 <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
225 </small>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
226 </span>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
227 </div>
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
228 </div>
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
229 </div>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
230 <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
231 <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
232 <button
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
233 @click="save"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
234 type="submit"
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
235 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
236 >
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
237 <translate>Submit</translate>
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
238 </button>
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
239 </div>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
240 </div>
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
241 <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
242 <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
243 <translate>New stretch</translate>
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
244 </button>
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
245 </div>
1610
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
246 </div>
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
247 </template>
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
248
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
249 <script>
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
250 /* 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
251 * without warranty, see README.md and license for details.
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
252 *
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
253 * SPDX-License-Identifier: AGPL-3.0-or-later
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
254 * License-Filename: LICENSES/AGPL-3.0.txt
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
255 *
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
256 * Copyright (C) 2018 by via donau
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
257 * – Österreichische Wasserstraßen-Gesellschaft mbH
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
258 * Software engineering by Intevation GmbH
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
259 *
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
260 * Author(s):
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
261 * Thomas Junk <thomas.junk@intevation.de>
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
262 */
1827
27c4effba5b1 stretches only for sysadmin plus country code
Thomas Junk <thomas.junk@intevation.de>
parents: 1823
diff changeset
263 import { mapState, mapGetters } from "vuex";
1921
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
264 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
265 import { formatSurveyDate } from "@/lib/date.js";
1610
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
266
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
267 export default {
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
268 name: "importstretches",
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
269 data() {
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
270 return {
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
271 edit: false,
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
272 idEditable: true,
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
273 id: "",
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
274 funktion: "",
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
275 startrhm: "",
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
276 endrhm: "",
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
277 objbn: "",
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
278 nobjbn: "",
1827
27c4effba5b1 stretches only for sysadmin plus country code
Thomas Junk <thomas.junk@intevation.de>
parents: 1823
diff changeset
279 countryCode: "",
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
280 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
281 source: "",
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
282 pipetteStart: false,
1816
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
283 pipetteEnd: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
284 idError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
285 funktionError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
286 startrhmError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
287 endrhmError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
288 objbnError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
289 nobjbnError: false,
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
290 date_infoError: false,
1827
27c4effba5b1 stretches only for sysadmin plus country code
Thomas Junk <thomas.junk@intevation.de>
parents: 1823
diff changeset
291 sourceError: false,
27c4effba5b1 stretches only for sysadmin plus country code
Thomas Junk <thomas.junk@intevation.de>
parents: 1823
diff changeset
292 countryCodeError: false
1803
975a7de89f05 define stretches WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 1797
diff changeset
293 };
1610
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
294 },
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
295 mounted() {
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
296 this.edit = false;
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
297 this.loadStretches().catch(error => {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
298 const { status, data } = error.response;
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
299 displayError({
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
300 title: this.$gettext("Backend Error"),
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
301 message: `${status}: ${data.message || data}`
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
302 });
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
303 });
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
304 this.loadStagingData().catch(error => {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
305 const { status, data } = error.response;
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
306 displayError({
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
307 title: this.$gettext("Backend Error"),
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
308 message: `${status}: ${data.message || data}`
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
309 });
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
310 });
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
311 },
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
312 methods: {
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
313 gotoStaging(id) {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
314 this.$router.push("/?review=" + id);
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
315 },
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
316 isInStaging(stretchname) {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
317 for (let s of this.stretchesInStaging) {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
318 if (s.name == stretchname) return true;
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
319 }
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
320 return false;
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
321 },
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
322 getStagingLink(stretchname) {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
323 for (let s of this.stretchesInStaging) {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
324 if (s.name == stretchname) return s.id;
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
325 }
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
326 },
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
327 loadStagingData() {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
328 return new Promise((resolve, reject) => {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
329 this.$store
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
330 .dispatch("imports/getStaging")
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
331 .then(response => {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
332 resolve(response);
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
333 })
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
334 .catch(error => {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
335 reject(error);
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
336 });
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
337 });
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
338 },
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
339 editStretch(index) {
1977
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
340 const properties = this.stretches[index].properties;
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
341 this.date_info = properties.date_info.split("T")[0];
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
342 this.id = properties.name;
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
343 this.nobjbn = properties.nobjnam;
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
344 this.objbn = properties.objnam;
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
345 this.countryCode = properties.countries;
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
346 this.source = properties["source_organization"];
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
347 this.edit = true;
1977
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
348 this.startrhm = this.sanitizeRHM(properties.lower);
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
349 this.endrhm = this.sanitizeRHM(properties.upper);
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
350 this.idEditable = false;
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
351 },
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
352 deleteStretch(index) {
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
353 displayInfo({
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
354 title: this.$gettext("Not implemented"),
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
355 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
356 });
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
357 },
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
358 moveMapToStretch(index) {
2136
3138d60dd1a6 moveToExtent substitutes moveMap where easy doable
Thomas Junk <thomas.junk@intevation.de>
parents: 2102
diff changeset
359 this.$store.commit("map/moveToExtent", {
3138d60dd1a6 moveToExtent substitutes moveMap where easy doable
Thomas Junk <thomas.junk@intevation.de>
parents: 2102
diff changeset
360 feature: this.stretches[index],
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
361 zoom: 17,
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
362 preventZoomOut: true
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
363 });
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
364 },
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
365 formatSurveyDate(d) {
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
366 return formatSurveyDate(d);
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
367 },
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
368 loadStretches() {
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
369 return new Promise((resolve, reject) => {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
370 this.$store
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
371 .dispatch("imports/loadStretches")
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
372 .then(response => {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
373 resolve(response);
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
374 })
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
375 .catch(error => {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
376 reject(error);
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
377 });
1942
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
378 });
d1b7b1c70410 import stretch: listview with edit-function
Thomas Junk <thomas.junk@intevation.de>
parents: 1930
diff changeset
379 },
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
380 clean() {
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
381 this.id = "";
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
382 this.edit = false;
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
383 this.idEditable = true;
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
384 this.funktion = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
385 this.startrhm = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
386 this.endrhm = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
387 this.objbn = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
388 this.nobjbn = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
389 this.countryCode = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
390 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
391 this.source = "";
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
392 this.pipetteStart = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
393 this.pipetteEnd = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
394 this.idError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
395 this.funktionError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
396 this.startrhmError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
397 this.endrhmError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
398 this.objbnError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
399 this.nobjbnError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
400 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
401 this.sourceError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
402 this.countryCodeError = false;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
403 },
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
404 startEdit() {
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
405 this.clean();
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
406 this.edit = true;
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
407 },
1823
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
408 togglePipette(t) {
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
409 if (t === "start") {
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
410 this.pipetteStart = !this.pipetteStart;
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
411 this.pipetteEnd = false;
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
412 } else {
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
413 this.pipetteEnd = !this.pipetteEnd;
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
414 this.pipetteStart = false;
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
415 }
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
416 },
1816
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
417 validate() {
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
418 const fields = [
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
419 "id",
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
420 "funktion",
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
421 "startrhm",
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
422 "endrhm",
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
423 "objbn",
1960
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
424 "nobjbn",
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
425 "countryCode",
1816
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
426 "date_info",
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
427 "source"
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
428 ];
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
429 fields.forEach(field => {
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
430 if (!this[field]) {
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
431 this[field + "Error"] = true;
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
432 } else {
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
433 this[field + "Error"] = false;
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
434 }
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
435 });
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
436 },
1871
8ae7a1fba4cd prototypical listview for stretches. new and back buttons. have fun
Thomas Junk <thomas.junk@intevation.de>
parents: 1870
diff changeset
437 save() {
1816
199fa7e759aa define stretches: more userfriendly errormessage behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1809
diff changeset
438 this.validate();
1960
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
439 if (!this.pointsValid) return;
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
440 if (
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
441 !this.id ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
442 !this.startrhm ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
443 !this.endrhm ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
444 !this.source ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
445 !this.date_info ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
446 !this.objbn ||
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
447 !this.countryCode
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
448 )
e5c5954fbd84 define stretches: validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1959
diff changeset
449 return;
1930
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
450 const data = {
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
451 name: this.id,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
452 from: this.startrhm,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
453 to: this.endrhm,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
454 "source-organization": this.source,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
455 "date-info": this.date_info,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
456 objnam: this.objbn,
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
457 nobjnam: this.nobjbn,
1977
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
458 countries: this.countryCode.split(",").map(x => {
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
459 return x.trim();
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
460 })
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1888
diff changeset
461 };
1930
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
462 this.$store
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
463 .dispatch("imports/saveStretch", data)
1921
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
464 .then(() => {
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
465 displayInfo({
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
466 title: this.$gettext("Import"),
1930
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
467 message: this.$gettext("Starting import of stretch")
1921
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
468 });
1930
1aa864cccddc define stretches: converted to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 1921
diff changeset
469 this.clean();
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
470 this.loadStretches().then(() => {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
471 this.edit = false;
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
472 });
1921
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
473 })
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
474 .catch(error => {
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
475 const { status, data } = error.response;
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
476 displayError({
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
477 title: this.$gettext("Backend Error"),
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
478 message: `${status}: ${data.message || data}`
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
479 });
0059aa870a39 Hotfixed stretch import.
Sascha Wilde <wilde@intevation.de>
parents: 1896
diff changeset
480 });
1977
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
481 },
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
482 sanitizeRHM(rhm) {
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
483 return rhm.replace(/,|\(|\)/g, "");
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
484 }
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
485 },
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
486 watch: {
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
487 identifiedFeatures() {
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
488 const filterDistanceMarks = x => {
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
489 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
490 };
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
491 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
492 if (distanceMark.length > 0) {
1977
53c1383dfee3 define stretch: edit function prefills fields
Thomas Junk <thomas.junk@intevation.de>
parents: 1961
diff changeset
493 const value = this.sanitizeRHM(distanceMark[0]["id_"].split(".")[1]);
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
494 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
495 this.endrhm = this.pipetteEnd ? value : this.endrhm;
1823
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
496 this.pipetteStart = false;
7d37d9f5f272 define stretches: better targetting behaviour
Thomas Junk <thomas.junk@intevation.de>
parents: 1816
diff changeset
497 this.pipetteEnd = false;
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
498 }
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
499 }
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
500 },
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
501 computed: {
1827
27c4effba5b1 stretches only for sysadmin plus country code
Thomas Junk <thomas.junk@intevation.de>
parents: 1823
diff changeset
502 ...mapState("map", ["identifiedFeatures", "currentMeasurement"]),
1889
b6d0460b069d define stretches: Now with store-backend
Thomas Junk <thomas.junk@intevation.de>
parents: 1888
diff changeset
503 ...mapGetters("user", ["isSysAdmin"]),
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
504 ...mapState("imports", ["stretches", "staging"]),
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
505 stretchesInStaging() {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
506 const result = [];
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
507 for (let stretch of this.stretches) {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
508 for (let s of this.staging) {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
509 if (s.kind == "st" && s.summary.stretch == stretch.properties.name) {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
510 result.push({ name: s.summary.stretch, id: s.id });
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
511 }
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
512 }
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
513 }
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
514 return result;
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
515 },
1959
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
516 pointsValid() {
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
517 if (!this.startrhm || !this.endrhm) return true;
1961
9b9f1d164f26 validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1960
diff changeset
518 const start = this.startrhm.replace(/\D+/, "") * 1;
9b9f1d164f26 validation
Thomas Junk <thomas.junk@intevation.de>
parents: 1960
diff changeset
519 const end = this.endrhm.replace(/\D+/, "") * 1;
1959
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
520 const result = start < end;
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
521 return result;
84e475938b75 define stretches: validation of start vs endpoint
Thomas Junk <thomas.junk@intevation.de>
parents: 1942
diff changeset
522 }
1809
b16a6db0008f feat: define sections and stretches with targetting option
Thomas Junk <thomas.junk@intevation.de>
parents: 1803
diff changeset
523 }
1610
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
524 };
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
525 </script>
2ee243f9a7ee import stretches boilerplate added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
526
1980
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
527 <style lang="scss" scoped>
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
528 .linkto {
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
529 cursor: pointer;
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
530 }
c8e2f6838eaf define stretches: mark stretches in review
Thomas Junk <thomas.junk@intevation.de>
parents: 1977
diff changeset
531 </style>