view client/src/views/Users.vue @ 293:85b653d4380c usermanagement

style: Table is now rendered as a card.
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 31 Jul 2018 13:36:40 +0200
parents dfd5a549ae95
children c57b0b230452
line wrap: on
line source

<template>
  <div class="main d-flex">
    <Sidebar v-bind:isOverlay="false"></Sidebar>
    <div class="d-flex flex-row content">
      <div class="d-flex flex-column">
        <div>
          <h1>User Management</h1>
        </div>
        <div class="userlist">
          <div class="card shadow" style="width: 85rem;">
              <div class="card-header text-white bg-info mb-3">
                users
              </div>
              <div class="card-body">
                <table class="table">
                  <thead>
                    <tr>
                      <th scope="col">Username</th>
                      <th scope="col">Country</th>
                      <th scope="col">Email</th>
                      <th scope="col">Role</th>
                    </tr>
                  </thead>
                  <tbody>
                  <tr v-for="user in users" :key="user.user">
                    <td>{{ user.user }}</td>
                    <td>{{ user.country }}</td>
                    <td>{{ user.email}}</td>
                    <td>{{ user.role }}</td>
                    </tr>
                  </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss">
@import "../assets/application.scss";
.main {
  height: 100vh;
}

.content {
  margin-top: $large-offset;
  margin-left: auto;
  margin-right: auto;
}

.userlist {
  margin-top: $large-offset;
}
.shadow {
  box-shadow: $basic-shadow-light !important;
}
</style>

<script>
import Sidebar from "../components/Sidebar";
import store from "../store";
import { mapGetters } from "vuex";

export default {
  name: "userview",
  components: {
    Sidebar
  },
  computed: {
    ...mapGetters("usermanagement", ["users"])
  },
  beforeRouteEnter(to, from, next) {
    store.dispatch("usermanagement/loadUsers").then(next);
  }
};
</script>