{"version":3,"sources":["webpack:///./src/components/Bottlenecks.vue","webpack:///src/components/Bottlenecks.vue","webpack:///./src/components/Bottlenecks.vue?0b3c","webpack:///./src/components/Bottlenecks.vue?3ccc"],"names":["render","_this","_vm","this","_c","_self","attrs","bottlenecksLabel","$parent","close","id","title","concat","nameLabel","width","countryLabel","chainageLabel","latestmeasurementLabel","_f","filteredBottlenecks","sortColumn","sortDirection","item","openBottleneck","scopedSlots","_u","key","fn","_ref","bottleneck","staticClass","staticStyle","on","$event","selectBottleneck","_v","_s","properties","displayName","responsible_country","displayCurrentChainage","from","to","current","loading","loadSurveys","_e","_ref2","_l","openBottleneckSurveys","survey","index","selectSurvey","date_info","staticRenderFns","name","mixins","sortTable","data","computed","_objectSpread","mapState","mapGetters","$gettext","sortIcon","methods","bottlenecksForDisplay","filter","bn","toLowerCase","includes","searchQuery","_this2","$store","dispatch","bottleneck_id","then","commit","feature","zoom","preventZoomOut","_this3","_this4","HTTP","get","encodeURIComponent","headers","localStorage","getItem","response","surveys","sort","a","b","catch","error","message","_error$response","status","displayError","finally","mounted","component"],"mappings":"uHAAA,IAAIA,EAAS,WAAiB,IAAAC,EAAA,KAAKC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACA,EAAG,cAAc,CAACE,MAAM,CAAC,KAAO,OAAO,MAAQJ,EAAIK,iBAAiB,cAAgBL,EAAIM,QAAQC,SAASL,EAAG,gBAAgB,CAACE,MAAM,CAAC,QAAU,CACrN,CAAEI,GAAI,yBAA0BC,MAAO,GAAFC,OAAKV,EAAIW,WAAaC,MAAO,SAClE,CACEJ,GAAI,iCACJC,MAAO,GAAFC,OAAKV,EAAIa,cACdD,MAAO,SAET,CAAEJ,GAAI,kBAAmBC,MAAO,GAAFC,OAAKV,EAAIc,eAAiBF,MAAO,SAC/D,CACEJ,GAAI,qBACJC,MAAO,GAAFC,OAAKV,EAAIe,wBACdH,MAAO,aAENV,EAAG,cAAc,CAACE,MAAM,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iBAAA,SAAAL,GAAA,IAAAoD,EAAA,KACA,KAAAR,OACAC,SACA,oCACA7C,EAAAQ,WAAAsC,eAEAC,MAAA,WACAK,EAAAR,OAAAC,SAAA,sBACAI,QAAAjD,EACAkD,KAAA,GACAC,gBAAA,OAGA,KAAAP,OAAAI,OACA,oCACAhD,EAAAQ,WAAAkB,OAGAV,YAAA,SAAAhB,GAAA,IAAAqD,EAAA,KACArD,IAAA,KAAAN,gBACA,KAAAA,eAAA,KACA,KAAA0B,sBAAA,OAEA,KAAAL,QAAAf,EACAsD,OAAAC,IACA,eACAC,mBAAAxD,EAAAQ,WAAAsC,eACA,CACAW,QAAA,CACA,eAAAC,aAAAC,QAAA,SACA,4CAIAZ,MAAA,SAAAa,GACAP,EAAAjC,sBAAAwC,EAAA/B,KAAAgC,QAAAC,MAAA,SAAAC,EAAAC,GACA,OAAAD,EAAAvC,UAAAwC,EAAAxC,UAAA,QAEA6B,EAAA3D,eAAAM,KAEAiE,OAAA,SAAAC,GACA,IAAAC,EAAA,wBACA,GAAAD,EAAAN,SAAA,CACA,IAAAQ,EAAAF,EAAAN,SAAAS,EAAAD,EAAAC,OAAAxC,EAAAuC,EAAAvC,KACAsC,EAAA,GAAApF,OAAAsF,EAAA,MAAAtF,OAAA8C,EAAAsC,SAAAtC,GAEAyC,eAAA,CACAxF,MAAAuE,EAAAnB,SAAA,iBACAiC,eAGAI,SAAA,kBAAAlB,EAAAtC,QAAA,UAGAJ,uBAAA,SAAAC,EAAAC,GACA,OAAAD,EAAA,SAAAC,EAAA,KAGA2D,QAAA,WACA,KAAA5B,OAAAC,SAAA,qCCpNoV,I,YCOhV4B,EAAY,eACd,EACAtG,EACAsD,GACA,EACA,KACA,KACA,MAIa,aAAAgD,E","file":"js/chunk-2d2261b2.ba170e28.js","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',[_c('UIBoxHeader',{attrs:{\"icon\":\"ship\",\"title\":_vm.bottlenecksLabel,\"closeCallback\":_vm.$parent.close}}),_c('UITableHeader',{attrs:{\"columns\":[\n      { id: 'properties.displayName', title: `${_vm.nameLabel}`, width: '230px' },\n      {\n        id: 'properties.responsible_country',\n        title: `${_vm.countryLabel}`,\n        width: '100px'\n      },\n      { id: 'properties.from', title: `${_vm.chainageLabel}`, width: '155px' },\n      {\n        id: 'properties.current',\n        title: `${_vm.latestmeasurementLabel}`,\n        width: '150px'\n      }\n    ]}}),_c('UITableBody',{attrs:{\"data\":_vm._f(\"sortTable\")(_vm.filteredBottlenecks(),_vm.sortColumn, _vm.sortDirection),\"maxHeight\":\"35rem\",\"isActive\":item => item === this.openBottleneck},scopedSlots:_vm._u([{key:\"row\",fn:function({ item: bottleneck }){return [_c('div',{staticClass:\"table-cell truncate text-left\",staticStyle:{\"width\":\"230px\"}},[_c('a',{attrs:{\"href\":\"#\"},on:{\"click\":function($event){return _vm.selectBottleneck(bottleneck)}}},[_vm._v(_vm._s(bottleneck.properties.displayName))])]),_c('div',{staticClass:\"table-cell text-center\",staticStyle:{\"width\":\"100px\"}},[_c('span',{staticClass:\"mx-auto\"},[_vm._v(_vm._s(bottleneck.properties.responsible_country))])]),_c('div',{staticClass:\"table-cell\",staticStyle:{\"flex-grow\":\"1\"}},[_c('span',{staticClass:\"mx-auto\"},[_vm._v(_vm._s(_vm.displayCurrentChainage(\n            bottleneck.properties.from,\n            bottleneck.properties.to\n          )))])]),_c('div',{staticClass:\"table-cell\",staticStyle:{\"width\":\"150px\"}},[_c('span',{staticClass:\"ml-auto\"},[_vm._v(_vm._s(_vm._f(\"surveyDate\")(bottleneck.properties.current)))]),(bottleneck.properties.current)?_c('UISpinnerButton',{attrs:{\"loading\":_vm.loading === bottleneck,\"state\":bottleneck === _vm.openBottleneck},on:{\"click\":function($event){return _vm.loadSurveys(bottleneck)}}}):_vm._e()],1)]}},{key:\"expand\",fn:function({ item: bottleneck }){return _vm._l((_vm.openBottleneckSurveys),function(survey,index){return _c('a',{key:index,staticClass:\"d-inline-block px-3 py-2\",attrs:{\"href\":\"#\"},on:{\"click\":function($event){return _vm.selectSurvey(survey, bottleneck)}}},[_vm._v(\"\\n        \"+_vm._s(_vm._f(\"surveyDate\")(survey.date_info))+\"\\n      \")])})}}])})],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <div>\n    <UIBoxHeader\n      icon=\"ship\"\n      :title=\"bottlenecksLabel\"\n      :closeCallback=\"$parent.close\"\n    />\n    <UITableHeader\n      :columns=\"[\n        { id: 'properties.displayName', title: `${nameLabel}`, width: '230px' },\n        {\n          id: 'properties.responsible_country',\n          title: `${countryLabel}`,\n          width: '100px'\n        },\n        { id: 'properties.from', title: `${chainageLabel}`, width: '155px' },\n        {\n          id: 'properties.current',\n          title: `${latestmeasurementLabel}`,\n          width: '150px'\n        }\n      ]\"\n    />\n    <UITableBody\n      :data=\"filteredBottlenecks() | sortTable(sortColumn, sortDirection)\"\n      maxHeight=\"35rem\"\n      :isActive=\"item => item === this.openBottleneck\"\n    >\n      <template v-slot:row=\"{ item: bottleneck }\">\n        <div class=\"table-cell truncate text-left\" style=\"width: 230px\">\n          <a href=\"#\" @click=\"selectBottleneck(bottleneck)\">{{\n            bottleneck.properties.displayName\n          }}</a>\n        </div>\n        <div class=\"table-cell text-center\" style=\"width: 100px\">\n          <span class=\"mx-auto\">{{\n            bottleneck.properties.responsible_country\n          }}</span>\n        </div>\n        <div class=\"table-cell\" style=\"flex-grow:1;\">\n          <span class=\"mx-auto\">{{\n            displayCurrentChainage(\n              bottleneck.properties.from,\n              bottleneck.properties.to\n            )\n          }}</span>\n        </div>\n        <div class=\"table-cell\" style=\"width: 150px\">\n          <span class=\"ml-auto\">{{\n            bottleneck.properties.current | surveyDate\n          }}</span>\n          <UISpinnerButton\n            @click=\"loadSurveys(bottleneck)\"\n            :loading=\"loading === bottleneck\"\n            :state=\"bottleneck === openBottleneck\"\n            v-if=\"bottleneck.properties.current\"\n          />\n        </div>\n      </template>\n      <template v-slot:expand=\"{ item: bottleneck }\">\n        <a\n          href=\"#\"\n          class=\"d-inline-block px-3 py-2\"\n          v-for=\"(survey, index) in openBottleneckSurveys\"\n          :key=\"index\"\n          @click=\"selectSurvey(survey, bottleneck)\"\n        >\n          {{ survey.date_info | surveyDate }}\n        </a>\n      </template>\n    </UITableBody>\n  </div>\n</template>\n\n<script>\n/* This is Free Software under GNU Affero General Public License v >= 3.0\n * without warranty, see README.md and license for details.\n *\n * SPDX-License-Identifier: AGPL-3.0-or-later\n * License-Filename: LICENSES/AGPL-3.0.txt\n *\n * Copyright (C) 2018 by via donau\n *   – Österreichische Wasserstraßen-Gesellschaft mbH\n * Software engineering by Intevation GmbH\n *\n * Author(s):\n * Markus Kottländer <markus.kottlaender@intevation.de>\n */\nimport { mapState, mapGetters } from \"vuex\";\nimport { HTTP } from \"@/lib/http\";\nimport { displayError } from \"@/lib/errors\";\nimport { sortTable } from \"@/lib/mixins\";\n\nexport default {\n  name: \"bottlenecks\",\n  mixins: [sortTable],\n  data() {\n    return {\n      sortColumn: \"properties.name\",\n      openBottleneck: null,\n      openBottleneckSurveys: null,\n      loading: null\n    };\n  },\n  computed: {\n    ...mapState(\"application\", [\"searchQuery\", \"showSearchbarLastState\"]),\n    ...mapGetters(\"bottlenecks\", [\"bottlenecksForDisplay\"]),\n    bottlenecksLabel() {\n      return this.$gettext(\"Bottlenecks\");\n    },\n    countryLabel() {\n      return this.$gettext(\"Country\");\n    },\n    nameLabel() {\n      return this.$gettext(\"Name\");\n    },\n    latestmeasurementLabel() {\n      return this.$gettext(\"Latest Measurement\");\n    },\n    chainageLabel() {\n      return this.$gettext(\"Chainage\");\n    },\n    sortIcon() {\n      return this.sortDirection === \"ASC\"\n        ? \"sort-amount-down\"\n        : \"sort-amount-up\";\n    }\n  },\n  methods: {\n    filteredBottlenecks() {\n      return this.bottlenecksForDisplay.filter(bn => {\n        return bn.properties.name\n          .toLowerCase()\n          .includes(this.searchQuery.toLowerCase());\n      });\n    },\n    selectSurvey(survey, bottleneck) {\n      this.$store\n        .dispatch(\n          \"bottlenecks/setSelectedBottleneck\",\n          bottleneck.properties.bottleneck_id\n        )\n        .then(() => {\n          this.$store.commit(\"bottlenecks/selectedSurvey\", survey);\n        })\n        .then(() => {\n          this.$store.dispatch(\"map/moveToFeauture\", {\n            feature: bottleneck,\n            zoom: 16,\n            preventZoomOut: true\n          });\n        });\n    },\n    selectBottleneck(bottleneck) {\n      this.$store\n        .dispatch(\n          \"bottlenecks/setSelectedBottleneck\",\n          bottleneck.properties.bottleneck_id\n        )\n        .then(() => {\n          this.$store.dispatch(\"map/moveToFeauture\", {\n            feature: bottleneck,\n            zoom: 16,\n            preventZoomOut: true\n          });\n        });\n      this.$store.commit(\n        \"bottlenecks/setBottleneckForPrint\",\n        bottleneck.properties.name\n      );\n    },\n    loadSurveys(bottleneck) {\n      if (bottleneck === this.openBottleneck) {\n        this.openBottleneck = null;\n        this.openBottleneckSurveys = null;\n      } else {\n        this.loading = bottleneck;\n        HTTP.get(\n          \"/surveys?id=\" +\n            encodeURIComponent(bottleneck.properties.bottleneck_id),\n          {\n            headers: {\n              \"X-Gemma-Auth\": localStorage.getItem(\"token\"),\n              \"Content-type\": \"text/xml; charset=UTF-8\"\n            }\n          }\n        )\n          .then(response => {\n            this.openBottleneckSurveys = response.data.surveys.sort((a, b) => {\n              return a.date_info < b.date_info ? 1 : -1;\n            });\n            this.openBottleneck = bottleneck;\n          })\n          .catch(error => {\n            let message = \"Backend not reachable\";\n            if (error.response) {\n              const { status, data } = error.response;\n              message = `${status}: ${data.message || data}`;\n            }\n            displayError({\n              title: this.$gettext(\"Backend Error\"),\n              message: message\n            });\n          })\n          .finally(() => (this.loading = null));\n      }\n    },\n    displayCurrentChainage(from, to) {\n      return from / 10 + \" - \" + to / 10;\n    }\n  },\n  mounted() {\n    this.$store.dispatch(\"bottlenecks/loadBottlenecksList\");\n  }\n};\n</script>\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Bottlenecks.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Bottlenecks.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./Bottlenecks.vue?vue&type=template&id=65219c7f\"\nimport script from \"./Bottlenecks.vue?vue&type=script&lang=js\"\nexport * from \"./Bottlenecks.vue?vue&type=script&lang=js\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}