view client/src/components/Contextbox.vue @ 4488:bff6c5c1db4f

client: pdf-gen: improve adding bottleneck info to pdf * Check if the bottleneck is in the current view to add its info to the exported pdf and the pdf filename, this avoid wrong filename and wrong info in pdf in case view has been changed to another location. * Set the bottleneck to print after moving to it in map.
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 27 Sep 2019 11:15:02 +0200
parents ad2bf9580696
children 1fd771b08ced
line wrap: on
line source

<template>
  <div :class="style">
    <Bottlenecks v-if="contextBoxContent === 'bottlenecks'" />
    <keep-alive>
      <Staging v-if="contextBoxContent === 'staging'" />
      <Stretches v-if="contextBoxContent === 'stretches'" />
      <Sections v-if="contextBoxContent === 'sections'" />
      <ImportConfiguration v-if="contextBoxContent === 'importconfiguration'" />
    </keep-alive>
    <ImportOverview v-if="contextBoxContent === 'importoverview'" />
  </div>
</template>

<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 by via donau
 *   – Österreichische Wasserstraßen-Gesellschaft mbH
 * Software engineering by Intevation GmbH
 *
 * Author(s):
 * Markus Kottländer <markus.kottlaender@intevation.de>
 */
import { mapState } from "vuex";

export default {
  name: "contextbox",
  components: {
    Bottlenecks: () => import("@/components/Bottlenecks"),
    Stretches: () => import("@/components/stretches/Stretches"),
    Sections: () => import("@/components/sections/Sections"),
    ImportOverview: () => import("@/components/importoverview/ImportOverview"),
    ImportConfiguration: () => import("@/components/importconfiguration/Import")
  },
  computed: {
    ...mapState("application", [
      "showSearchbarLastState",
      "contextBoxContent",
      "showContextBox"
    ]),
    style() {
      return [
        "ui-element shadow-xs contextbox",
        {
          contextboxcollapsed: !this.showContextBox,
          contextboxextended: this.showContextBox,
          "rounded-bottom": this.contextBoxContent !== "imports",
          rounded: this.contextBoxContent === "imports"
        }
      ];
    }
  },
  methods: {
    close() {
      this.$store.commit("map/mapPopupEnabled", true);
      this.$store.commit("application/searchQuery", "");
      this.$store.commit("application/showContextBox", false);
      this.$store.commit("map/reviewActive", false);
      this.$store.commit(
        "application/showSearchbar",
        this.showSearchbarLastState
      );
      this.$router.push("/");
    }
  }
};
</script>

<style lang="scss" scoped>
.contextbox {
  position: relative;
  background-color: #ffffff;
  opacity: $slight-transparent;
  transition: max-width 0.3s, max-height 0.3s;
  overflow: hidden;
  background: #fff;
}
.contextbox > div:last-child {
  width: 668px;
}

.contextboxcollapsed {
  max-width: 0;
  max-height: 0;
}

.contextboxextended {
  max-width: 668px;
}

.close-contextbox {
  position: absolute;
  z-index: 2;
  right: 0;
  top: 7px;
  height: $icon-width;
  width: $icon-height;
}
</style>