annotate client/src/components/ImportStretches.vue @ 2541:468c8dc796cf

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