view client/src/components/importconfiguration/ImportDetails.vue @ 2979:8f266dc8b4e3 unified_import

unified_imports: moved imports partially to new UI
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 09 Apr 2019 14:52:55 +0200
parents d6dd158b8071
children 1b8bb4f89227
line wrap: on
line source

<template>
  <div class="mt-3 mb-3 mr-3 ml-3 text-left">
    <small class="text-muted">
      <translate>Import type</translate>
    </small>
    <select v-model="Import" class="custom-select" id="importtype">
      <optgroup :label="regularLabel">
        <option :value="$options.IMPORTTYPES.BOTTLENECK">
          <translate>Bottlenecks</translate>
        </option>
        <option :value="$options.IMPORTTYPES.WATERWAYAXIS">
          <translate>Waterway axis</translate>
        </option>
        <option :value="$options.IMPORTTYPES.GAUGEMEASUREMENT">
          <translate>Gauge measurement</translate>
        </option>
        <option :value="$options.IMPORTTYPES.FAIRWAYAVAILABILITY">
          <translate>Available fairway depths</translate>
        </option>
        <option :value="$options.IMPORTTYPES.WATERWAYAREA">
          <translate>Waterway area</translate>
        </option>
        <option :value="$options.IMPORTTYPES.FAIRWAYDIMENSION">
          <translate>Fairway dimension</translate>
        </option>
        <option :value="$options.IMPORTTYPES.WATERWAYGAUGES">
          <translate>Waterway gauges</translate>
        </option>
        <option :value="$options.IMPORTTYPES.DISTANCEMARKSVIRTUAL">
          <translate>Distance marks virtual</translate>
        </option>
        <option :value="$options.IMPORTTYPES.DISTANCEMARKSASHORE">
          <translate>Distance marks ashore</translate>
        </option>
      </optgroup>
      <optgroup :label="onetimeLabel">
        <option :value="$options.IMPORTTYPES.SOUNDINGRESULTS">
          <translate>Soundingresults</translate>
        </option>
        <option :value="$options.IMPORTTYPES.APPROVEDGAUGEMEASUREMENTS">
          <translate>Approved Gaugemeasurements</translate>
        </option>
        <option :value="$options.IMPORTTYPES.WATERWAYPROFILES">
          <translate>Waterway Profiles</translate>
        </option>
      </optgroup>
    </select>
    <ApprovedGaugeMeasurement
      v-if="Import === $options.IMPORTTYPES.APPROVEDGAUGEMEASUREMENTS"
      class="mt-3"
    />
    <WaterwayProfiles
      class="mt-3"
      v-if="Import === $options.IMPORTTYPES.WATERWAYPROFILES"
    />
    <SoundingResults
      class="mt-3"
      v-if="Import === $options.IMPORTTYPES.SOUNDINGRESULTS"
    />
    <ScheduledImports
      class="mt-3"
      v-if="Import && !isOnetime"
    ></ScheduledImports>
    <div v-if="!Import" class="d-flex flex-row w-100 mt-3">
      <button :key="1" @click="back()" class="ml-auto btn btn-warning">
        Back
      </button>
    </div>
  </div>
</template>

<style lang="scss" scoped></style>

<script>
/* This is Free Software under GNU Affero General Public License v >= 3.0
 * without warranty, see README.md and license for details.
 *
 * SPDX-License-Identifier: AGPL-3.0-or-later
 * License-Filename: LICENSES/AGPL-3.0.txt
 *
 * Copyright (C) 2018, 2019 by via donau
 *   – Österreichische Wasserstraßen-Gesellschaft mbH
 * Software engineering by Intevation GmbH
 *
 * Author(s):
 * Thomas Junk <thomas.junk@intevation.de>
 * Tom Gottfried <tom.gottfried@intevation.de>
 */
import { IMPORTTYPES } from "@/store/importschedule";
import { mapState } from "vuex";
export default {
  components: {
    ApprovedGaugeMeasurement: () =>
      import("./types/ApprovedGaugeMeasurement.vue"),
    WaterwayProfiles: () => import("./types/WaterwayProfiles"),
    SoundingResults: () => import("./types/Soundingresults.vue"),
    ScheduledImports: () => import("./types/ScheduledImports.vue")
  },
  data() {
    return {};
  },
  computed: {
    ...mapState("importschedule", ["currentSchedule"]),
    isOnetime() {
      for (let kind of [
        this.$options.IMPORTTYPES.SOUNDINGRESULTS,
        this.$options.IMPORTTYPES.APPROVEDGAUGEMEASUREMENTS,
        this.$options.IMPORTTYPES.WATERWAYPROFILES
      ]) {
        if (kind === this.currentSchedule.importType) return true;
      }
      return false;
    },
    Import: {
      get() {
        return this.currentSchedule.importType;
      },
      set(value) {
        this.$store.commit("importschedule/setImportType", value);
      }
    },
    onetimeLabel() {
      return this.$gettext("Onetime Imports");
    },
    regularLabel() {
      return this.$gettext("Regular Imports");
    }
  },
  methods: {
    back() {
      this.$store.commit("importschedule/setListMode");
    }
  },
  IMPORTTYPES: IMPORTTYPES
};
</script>