comparison client/src/components/Bottlenecks.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 add2d47c2567
comparison
equal deleted inserted replaced
2540:3c17d401fbd4 2541:468c8dc796cf
27 <a href="#" @click="selectBottleneck(bottleneck)">{{ 27 <a href="#" @click="selectBottleneck(bottleneck)">{{
28 bottleneck.properties.name 28 bottleneck.properties.name
29 }}</a> 29 }}</a>
30 </div> 30 </div>
31 <div class="col-3 py-2"> 31 <div class="col-3 py-2">
32 {{ formatSurveyDate(bottleneck.properties.current) }} 32 {{ bottleneck.properties.current | surveyDate }}
33 </div> 33 </div>
34 <div class="col-3 py-2"> 34 <div class="col-3 py-2">
35 {{ 35 {{
36 displayCurrentChainage( 36 displayCurrentChainage(
37 bottleneck.properties.from, 37 bottleneck.properties.from,
78 class="d-inline-block px-3 py-2" 78 class="d-inline-block px-3 py-2"
79 v-for="(survey, index) in openBottleneckSurveys" 79 v-for="(survey, index) in openBottleneckSurveys"
80 :key="index" 80 :key="index"
81 @click="selectSurvey(survey, bottleneck)" 81 @click="selectSurvey(survey, bottleneck)"
82 > 82 >
83 {{ formatSurveyDate(survey.date_info) }} 83 {{ survey.date_info | surveyDate }}
84 </a> 84 </a>
85 </div> 85 </div>
86 </UITableBody> 86 </UITableBody>
87 </div> 87 </div>
88 </template> 88 </template>
123 * Markus Kottländer <markus.kottlaender@intevation.de> 123 * Markus Kottländer <markus.kottlaender@intevation.de>
124 */ 124 */
125 import { mapState } from "vuex"; 125 import { mapState } from "vuex";
126 import { HTTP } from "@/lib/http"; 126 import { HTTP } from "@/lib/http";
127 import { displayError } from "@/lib/errors.js"; 127 import { displayError } from "@/lib/errors.js";
128 import { formatSurveyDate } from "@/lib/date.js";
129 128
130 export default { 129 export default {
131 name: "bottlenecks", 130 name: "bottlenecks",
132 data() { 131 data() {
133 return { 132 return {
150 ? "sort-amount-down" 149 ? "sort-amount-down"
151 : "sort-amount-up"; 150 : "sort-amount-up";
152 } 151 }
153 }, 152 },
154 methods: { 153 methods: {
155 formatSurveyDate(date) {
156 return formatSurveyDate(date);
157 },
158 filteredAndSortedBottlenecks() { 154 filteredAndSortedBottlenecks() {
159 return this.bottlenecksList 155 return this.bottlenecksList
160 .filter(bn => { 156 .filter(bn => {
161 return bn.properties.name 157 return bn.properties.name
162 .toLowerCase() 158 .toLowerCase()