AppBar.vue 4.75 KB
Newer Older
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
1 2 3 4 5 6 7 8 9 10
<template>
  <div>
    <v-app-bar
      id="home-app-bar"
      app
      color="white"
      elevation="1"
      height="80"
    >
      <v-spacer />
krlsnvz93's avatar
krlsnvz93 committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

      <!-- <div>
        <v-tabs
          class="hidden-sm-and-down"
          optional
        >
          <v-tab
            v-for="(name, i) in items"
            :key="i"
            :to="{ name }"
            :exact="name === 'Home'"
            :ripple="false"
            active-class="text--primary"
            class="font-weight-bold"
            min-width="96"
            text
          >
            {{ name }}
          </v-tab>
        </v-tabs>
      </div> -->

Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
33
      <v-app-bar-nav-icon
Yoelvis Gonzalez's avatar
fixes  
Yoelvis Gonzalez committed
34
        @click="showHideDrawer"
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
35
      />
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
36 37
      <v-menu
        offset-y
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
38 39
        max-width="200"
        min-width="200"
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
      >
        <template v-slot:activator="{ on, attrs }">
          <v-btn
            v-bind="attrs"
            icon
            fab
            class=""
            v-on="on"
          >
            <v-tooltip
              bottom
              max-width="125"
              min-width="125"
              color="rgba(0,0,0, 0.8)"
            >
              <template v-slot:activator="{ on, attrs }">
                <v-icon
                  v-bind="attrs"
                  color="#2D89C5"
                  v-on="on"
                >
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
61
                  mdi-account
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
                </v-icon>
                <svg
                  viewBox="0 0 36 36"
                  height="12px"
                  width="12px"
                  role="img"
                  aria-hidden="true"
                  class="v-icon__svg langbtn"
                >
                  <path
                    fill="#2D89C5"
                    d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"
                  />
                </svg>
              </template>
              <span class="tooltip">Usuario</span>
            </v-tooltip>
          </v-btn>
        </template>
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
        <v-lazy>
          <v-card>
            <v-list
              dense
              style="margin-left: 16px"
            >
              <v-list-item-title class="h3">
                <b>
                  {{ user.name }}
                </b>
              </v-list-item-title>
              <v-list-item-subtitle>{{ user.role }}</v-list-item-subtitle>
            </v-list>
            <v-list
              dense
            >
              <v-list-item
                v-for="item in globalActions"
                :key="item.title"
                @click="navigateProcesses(item.link)"
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
101
              >
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
                <v-list-item-avatar>
                  <v-avatar
                    fab
                  >
                    <v-icon color="#2D89C5">
                      {{ item.icon }}
                    </v-icon>
                  </v-avatar>
                </v-list-item-avatar>
                <v-list-item-content>
                  <v-list-item-title>{{ item.title }}</v-list-item-title>
                </v-list-item-content>
              </v-list-item>
            </v-list>
            <v-list
              dense
            >
              <v-list-item
                v-for="item in globalActions"
                :key="item.title"
                @click="getMeOut"
              >
                <v-list-item-avatar>
                  <v-avatar
                    fab
                  >
                    <v-icon color="#2D89C5">
                      mdi-logout
                    </v-icon>
                  </v-avatar>
                </v-list-item-avatar>
                <v-list-item-content>
                  <v-list-item-title>Cerrar Sesión</v-list-item-title>
                </v-list-item-content>
              </v-list-item>
            </v-list>
          </v-card>
        </v-lazy>
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
140
      </v-menu>
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
141
    </v-app-bar>
krlsnvz93's avatar
krlsnvz93 committed
142 143 144 145 146

    <!-- <home-drawer
      v-model="drawer"
      :items="items"
    /> -->
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
147 148 149 150
  </div>
</template>

<script>
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
151
  import { mapGetters } from 'vuex'
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
152 153 154
  export default {
    name: 'HomeAppBar',

krlsnvz93's avatar
krlsnvz93 committed
155 156 157 158
    /* components: {
      HomeDrawer: () => import('./Drawer'),
    }, */

Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
159
    data: () => ({
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
160
      globalActions: [
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
161
        { link: 'lol', title: 'Registrar Usuario', icon: 'mdi-account-plus' },
Yoelvis Gonzalez's avatar
ok  
Yoelvis Gonzalez committed
162
      ],
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
163 164 165 166 167 168 169
      items: [
        'Home',
        'About',
        'Contact',
        'Pro',
      ],
    }),
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
170 171 172
    computed: {
      ...mapGetters(['user']),
    },
Yoelvis Gonzalez's avatar
fixes  
Yoelvis Gonzalez committed
173
    methods: {
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
174 175 176 177 178 179 180
      getMeOut () {
        console.log(this.user.name)
        /* this.clearUser()
        localStorage.commit('tkn', null)
        localStorage.commit('usr', null) */
        // Todo: SEND LOGOUT REQUEST
      },
Yoelvis Gonzalez's avatar
fixes  
Yoelvis Gonzalez committed
181 182 183 184
      showHideDrawer () {
        this.$store.commit('setDrawer')
      },
    },
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
185 186 187 188 189 190 191 192 193 194 195 196 197
  }
</script>

<style lang="sass">
  #home-app-bar
    .v-tabs-slider
      max-width: 24px
      margin: 0 auto

    .v-tab
      &::before
        display: none
</style>