hrms-edm/Services/client/src/components/Profile.vue

51 lines
1.3 KiB
Vue
Raw Normal View History

2023-11-23 08:47:44 +07:00
<script setup lang="ts">
import { getUsername, logout } from '@/services/KeyCloakService'
2023-11-23 08:47:44 +07:00
import { ref } from 'vue'
const dropdownOpen = ref<boolean>(false)
const accountName = ref<string>(getUsername())
2023-11-23 08:47:44 +07:00
</script>
<template>
<div
@click="() => (dropdownOpen = !dropdownOpen)"
2023-12-07 17:03:49 +07:00
class="row q-px-xs cursor"
2023-11-23 08:47:44 +07:00
id="app-toolbar-title"
>
<div class="col">
2023-12-08 16:14:37 +07:00
<q-avatar class="q-mt-xs">
<img src="../assets/profile.png" />
2023-11-23 08:47:44 +07:00
</q-avatar>
</div>
2023-12-07 17:03:49 +07:00
<div>
2023-11-23 08:47:44 +07:00
<div class="row q-pl-sm">
<span class="text-body1" style="font-size:13px">
2023-11-23 08:47:44 +07:00
{{ accountName }}
</span>
</div>
<div class="row q-pl-sm">
2023-12-06 15:41:51 +07:00
<span class="text-caption text-grey" style="font-size:10px"> เจาหนาท </span>
2023-11-23 08:47:44 +07:00
</div>
</div>
</div>
<q-btn-dropdown stretch flat v-model="dropdownOpen">
<q-list>
<q-item clickable v-close-popup tabindex="0" @click="() => logout()">
2023-11-23 08:47:44 +07:00
<q-item-section avatar>
<q-avatar icon="logout" color="primary" text-color="white" caption>
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label>Logout</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</template>
<style lang="scss" scoped>
.cursor {
cursor: pointer;
}
</style>