<template>
  <div v-loading="loading">
    <div class="assets-container" v-for="type in types" :key="type.id">
      <assets-summary data-id="assets-sumary" :asset="type" :isExtended="mapIsVisible"/>
    </div>
  </div>
</template>

<script>
import {mapGetters, mapActions} from 'vuex';

import AssetsSummary from '@/components/assets/AssetsSummary.vue';

export default {
  name: 'assets-container',
  components: {AssetsSummary},
  data() {
    return {
      loading: true,
      types: null,
    };
  },
  computed: {
    ...mapGetters({
      mapIsVisible: 'mapIsVisible',
      allAssets: 'getAssets',
    }),
  },
  methods: {
    ...mapActions([
      'fetchAssetsByType',
    ]),
    translate(data) {
      return this.$t(`map.${data}`);
    },
  },
  mounted() {
    this.fetchAssetsByType('type').then((allAssets) => {
      if (allAssets) {
        this.types = allAssets.data;
        this.loading = false;
      }
    });
  },
};
</script>

<style lang="scss" scoped>
  .assets-container {
    padding: 0 4%;
    padding-bottom: 5%;
    padding-top: 3%;
    margin-bottom: 2%;
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.1);
    background-color: #FFF;
  }

  .padFilter{
    padding-bottom: 5%;
  }

</style>
