view client/src/components/ui/UITableBody.vue @ 5348:45b03e8ca47e extented-report

Toggles in user overview and in details section as well established This commit introduces toggles to change the state for administrative users to be able to receive the DQL Report. For quick access there is the possibility to change via overview. If you want to edit this in the details or if you change the role of the user to a non administrative, there is the possibility to change the flag in a fast way. When the user looses administrative privilege the option is not available and the according flag is set to "false". Aside: Changed user.go to resolve inconsitencies in frontend where the key "reports" was missing due to "omitempty" in marshalling the go objects.
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 21 Jun 2021 16:41:39 +0200
parents d2dba0638ef1
children 7768f14f6535
line wrap: on
line source

<template>
  <div
    class="table-body text-left small"
    :style="'overflow-y: auto; max-height: ' + maxHeight"
    v-if="data.length"
  >
    <div
      v-for="(item, index) in data"
      :key="key(index)"
      :class="['row-container border-top', { active: isActive(item) }]"
    >
      <div class="row mx-0">
        <slot :item="item" :index="index" name="row"></slot>
      </div>
      <div class="expand" v-if="isActive(item)">
        <slot :item="item" :index="index" name="expand"></slot>
      </div>
    </div>
  </div>
  <div v-else class="small text-center py-3 border-top">
    <translate>No results.</translate>
  </div>
</template>

<style lang="sass">
.table-body
  .row-container
    > .row
      &:hover
        background-color: #fcfcfc
      .table-cell
        display: flex
        align-items: center
        padding: 1.5px 3px
        border-right: solid 1px #dee2e6
        &:last-child
          border-right: none
        &.center
          justify-content: center
    .expand
      border-bottom: solid 2px $color-info

    &.active
      > .row
        color: #fff
        .table-cell
          border-right-color: rgba(255, 255, 255, 0.3)
          background-color: $color-info
          color: #fff
          a
            color: #fff !important
</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 by via donau
 *   – Österreichische Wasserstraßen-Gesellschaft mbH
 * Software engineering by Intevation GmbH
 *
 * Author(s):
 * Markus Kottländer <markus.kottlaender@intevation.de>
 */

export default {
  props: {
    data: {
      type: Array
    },
    maxHeight: {
      type: String,
      default: "18rem"
    },
    isActive: {
      type: Function,
      default: () => false
    }
  },
  methods: {
    key(index) {
      return index;
    }
  }
};
</script>