birzha-legalizasia-frontend/src/components/top-bar/Main.vue

307 lines
10 KiB
Vue

<template>
<!-- BEGIN: Top Bar -->
<div
class="top-bar-boxed h-[70px] z-[51] relative border-b border-white/[0.08] mt-12 md:-mt-5 -mx-3 sm:-mx-8 px-3 sm:px-8 md:pt-0 mb-12"
>
<div class="h-full flex items-center">
<!-- BEGIN: Logo -->
<a href="" class="-intro-x hidden md:flex items-center">
<Logo />
<span class="text-white text-lg ml-3">
Türkmenistanyň Döwlet haryt-çig mal biržasy
</span>
</a>
<!-- END: Logo -->
<!-- BEGIN: Spacer -->
<div class="mr-auto"></div>
<!-- END: Spacer -->
<!-- BEGIN: Search -->
<div class="intro-x relative mr-3 sm:mr-6">
<div class="search hidden sm:block">
<input
type="text"
class="search__input form-control border-transparent"
placeholder="Search..."
@focus="showSearchDropdown"
@blur="hideSearchDropdown"
/>
<SearchIcon class="search__icon dark:text-slate-500" />
</div>
<a class="notification notification--light sm:hidden" href="">
<SearchIcon class="notification__icon dark:text-slate-500" />
</a>
<div class="search-result" :class="{ show: searchDropdown }">
<div class="search-result__content">
<div class="search-result__content__title">Pages</div>
<div class="mb-5">
<a href="" class="flex items-center">
<div
class="w-8 h-8 bg-success/20 dark:bg-success/10 text-success flex items-center justify-center rounded-full"
>
<InboxIcon class="w-4 h-4" />
</div>
<div class="ml-3">Mail Settings</div>
</a>
<a href="" class="flex items-center mt-2">
<div
class="w-8 h-8 bg-pending/10 text-pending flex items-center justify-center rounded-full"
>
<UsersIcon class="w-4 h-4" />
</div>
<div class="ml-3">Users & Permissions</div>
</a>
<a href="" class="flex items-center mt-2">
<div
class="w-8 h-8 bg-primary/10 dark:bg-primary/20 text-primary/80 flex items-center justify-center rounded-full"
>
<CreditCardIcon class="w-4 h-4" />
</div>
<div class="ml-3">Transactions Report</div>
</a>
</div>
<div class="search-result__content__title">Users</div>
<div class="mb-5">
<a
v-for="(faker, fakerKey) in $_.take($f(), 4)"
:key="fakerKey"
href
class="flex items-center mt-2"
>
<div class="w-8 h-8 image-fit">
<img
alt="Icewall Tailwind HTML Admin Template"
class="rounded-full"
:src="faker.photos[0]"
/>
</div>
<div class="ml-3">{{ faker.users[0].name }}</div>
<div
class="ml-auto w-48 truncate text-slate-500 text-xs text-right"
>
{{ faker.users[0].email }}
</div>
</a>
</div>
<div class="search-result__content__title">Products</div>
<a
v-for="(faker, fakerKey) in $_.take($f(), 4)"
:key="fakerKey"
href
class="flex items-center mt-2"
>
<div class="w-8 h-8 image-fit">
<img
alt="Icewall Tailwind HTML Admin Template"
class="rounded-full"
:src="faker.images[0]"
/>
</div>
<div class="ml-3">{{ faker.products[0].name }}</div>
<div
class="ml-auto w-48 truncate text-slate-500 text-xs text-right"
>
{{ faker.products[0].category }}
</div>
</a>
</div>
</div>
</div>
<!-- END: Search -->
<!-- BEGIN: Notifications -->
<Dropdown class="intro-x mr-4 sm:mr-6">
<DropdownToggle
tag="div"
role="button"
class="notification notification--bullet cursor-pointer"
>
<BellIcon class="notification__icon dark:text-slate-500" />
</DropdownToggle>
<DropdownMenu class="notification-content pt-2">
<DropdownContent tag="div" class="notification-content__box">
<div class="notification-content__title">Notifications</div>
<div
v-for="(faker, fakerKey) in $_.take($f(), 5)"
:key="fakerKey"
class="cursor-pointer relative flex items-center"
:class="{ 'mt-5': fakerKey }"
>
<div class="w-12 h-12 flex-none image-fit mr-1">
<img
alt="Icewall Tailwind HTML Admin Template"
class="rounded-full"
:src="faker.photos[0]"
/>
<div
class="w-3 h-3 bg-success absolute right-0 bottom-0 rounded-full border-2 border-white"
></div>
</div>
<div class="ml-2 overflow-hidden">
<div class="flex items-center">
<a href="javascript:;" class="font-medium truncate mr-5">{{
faker.users[0].name
}}</a>
<div class="text-xs text-slate-400 ml-auto whitespace-nowrap">
{{ faker.times[0] }}
</div>
</div>
<div class="w-full truncate text-slate-500 mt-0.5">
{{ faker.news[0].shortContent }}
</div>
</div>
</div>
</DropdownContent>
</DropdownMenu>
</Dropdown>
<!-- END: Notifications -->
<!-- BEGIN: Languages -->
<Dropdown class="intro-x w-8 mr-4 sm:mr-6">
<DropdownToggle
tag="div"
role="button"
class="w-6 h-6 rounded-full overflow-hidden shadow-lg image-fit zoom-in scale-110"
>
<img
alt="flag"
:src="`/src/assets/images/flags/${selectedLang}.png`"
/>
</DropdownToggle>
<DropdownMenu class="pt-2">
<DropdownContent tag="div">
<div
v-for="(lang, key) in languages"
:key="key"
class="cursor-pointer relative flex items-center"
:class="{ 'mt-5': key }"
@click="onLanguageChanged(lang.code)"
>
<div class="w-5 h-5 flex-none image-fit mr-1">
<img
alt="Icewall Tailwind HTML Admin Template"
class="rounded-full"
:src="`/src/assets/images/flags/${lang.code}.png`"
/>
</div>
<div class="ml-2 overflow-hidden">
<div class="flex items-center">
<a href="javascript:;" class="font-medium truncate mr-5">{{
lang.label
}}</a>
<!-- <a class="font-medium truncate mr-5">Rus Dili</a> -->
</div>
</div>
</div>
</DropdownContent>
</DropdownMenu>
</Dropdown>
<!-- END: Languages -->
<!-- BEGIN: Account Menu -->
<Dropdown class="intro-x w-8 h-8">
<DropdownToggle
tag="div"
role="button"
class="w-8 h-8 rounded-full overflow-hidden shadow-lg image-fit zoom-in scale-110"
>
<img
alt="Icewall Tailwind HTML Admin Template"
:src="$f()[9].photos[0]"
/>
</DropdownToggle>
<DropdownMenu class="w-56">
<DropdownContent
class="bg-primary/80 before:block before:absolute before:bg-black before:inset-0 before:rounded-md before:z-[-1] text-white"
>
<DropdownHeader tag="div" class="!font-normal">
<div class="font-medium">
{{ $f()[0].users[0].name }}
</div>
<div class="text-xs text-white/60 mt-0.5 dark:text-slate-500">
{{ $f()[0].jobs[0] }}
</div>
</DropdownHeader>
<DropdownDivider class="border-white/[0.08]" />
<DropdownItem class="dropdown-item hover:bg-white/5">
<UserIcon class="w-4 h-4 mr-2" /> Profile</DropdownItem
>
<DropdownItem class="dropdown-item hover:bg-white/5">
<EditIcon class="w-4 h-4 mr-2" /> Add Account</DropdownItem
>
<DropdownItem class="dropdown-item hover:bg-white/5">
<LockIcon class="w-4 h-4 mr-2" /> Reset Password</DropdownItem
>
<DropdownItem class="dropdown-item hover:bg-white/5">
<HelpCircleIcon class="w-4 h-4 mr-2" /> Help</DropdownItem
>
<DropdownDivider class="border-white/[0.08]" />
<DropdownItem
class="dropdown-item hover:bg-white/5"
@click="onLogout"
>
<ToggleRightIcon class="w-4 h-4 mr-2" />
Logout</DropdownItem
>
</DropdownContent>
</DropdownMenu>
</Dropdown>
<!-- END: Account Menu -->
</div>
</div>
<!-- END: Top Bar -->
</template>
<script setup>
import { ref, onBeforeMount } from "vue";
import { useAuthStore } from "@/stores";
import { SELECTED_LANG } from "@/helpers";
import i18n from "@/i18n";
import Logo from "@/components/logo/Main.vue";
const searchDropdown = ref(false);
const showSearchDropdown = () => {
searchDropdown.value = true;
};
const hideSearchDropdown = () => {
searchDropdown.value = false;
};
const selectedLang = ref("");
const languages = [
{
code: "tm",
label: "Türkmen dili",
},
{
code: "ru",
label: "Русский",
},
{
code: "en",
label: "English",
},
];
const onLanguageChanged = (val) => {
selectedLang.value = val;
i18n.global.locale = val;
localStorage.setItem(SELECTED_LANG, val);
};
const onLogout = () => {
console.log("Logout");
const authStore = useAuthStore();
return authStore.logout();
};
onBeforeMount(() => {
const lang = localStorage.getItem(SELECTED_LANG);
if (lang) selectedLang.value = lang;
else selectedLang.value = "tm";
});
</script>