sidebarItem belum fix

This commit is contained in:
2025-05-28 07:23:47 +07:00
parent 692ffdf2f1
commit 453fccf550
14 changed files with 990 additions and 48 deletions

View File

@@ -1,6 +1,18 @@
<script setup lang="ts">
import { ref } from 'vue';
const { $encodeBase64 } = useNuxtApp();
const checkbox = ref(true);
const cookies = useCookie('user_token_profile');
// const keycloak = async () => {
// const response = await $fetch(`/api/auth/login`, { method: 'POST', mode: 'no-cors' }).then((response) => {
// console.log(response)
// cookies.value = $encodeBase64('ini_token')
// window.location.href = response.callbackURL
// })
// }
const { signIn, getProviders } = useAuth()
const providers = await getProviders()
</script>
<template>
@@ -11,22 +23,26 @@ const checkbox = ref(true);
</v-col>
<v-col cols="12">
<v-label class="font-weight-bold mb-1">Password</v-label>
<v-text-field variant="outlined" density="compact" type="password" hide-details color="primary"></v-text-field>
<v-text-field variant="outlined" density="compact" type="password" hide-details
color="primary"></v-text-field>
</v-col>
<v-col cols="12" class="pt-0">
<div class="d-flex flex-wrap align-center">
<v-checkbox v-model="checkbox" color="primary" hide-details>
<v-checkbox v-model="checkbox" color="primary" hide-details>
<template v-slot:label class="text-body-1">Remeber this Device</template>
</v-checkbox>
<div class="ml-sm-auto">
<NuxtLink to="/"
class="text-primary text-decoration-none text-body-1 opacity-1 font-weight-medium">Forgot
<NuxtLink to="/" class="text-primary text-decoration-none text-body-1 opacity-1 font-weight-medium">
Forgot
Password ?</NuxtLink>
</div>
</div>
</v-col>
<v-col cols="12" class="pt-0">
<v-btn to="/" color="primary" size="large" block flat>Sign in</v-btn>
<button v-for="provider in providers" :key="provider.id" class="login-button" @click="signIn('keycloak')">
Sign in with {{ provider.name }}
</button>
<!-- <v-btn @click="keycloak()" color="primary" size="large" block flat>Sign in</v-btn> -->
</v-col>
</v-row>
</template>

View File

@@ -1,5 +1,15 @@
<script setup lang="ts">
import { UserIcon, MailIcon, ListCheckIcon } from 'vue-tabler-icons';
const runtimeConfig = useRuntimeConfig();
const user_profile = useCookie('user_token_profile');
// const user_token = useCookie('user_token');
const logout = async () => {
console.log('Logging out...');
window.location.href = `${runtimeConfig.public.keycloakUrl}/realms/${runtimeConfig.public.keycloakRealm}/protocol/openid-connect/logout?client_id=${runtimeConfig.public.keycloakClient}&post_logout_redirect_uri=http://localhost:3000`;
// user_token.value = null;
user_profile.value = null;
navigateTo('/auth/login')
}
</script>
<template>
@@ -16,27 +26,27 @@ import { UserIcon, MailIcon, ListCheckIcon } from 'vue-tabler-icons';
</template>
<v-sheet rounded="md" width="200" elevation="10" class="mt-2">
<v-list class="py-0" lines="one" density="compact">
<v-list-item value="item1" active-color="primary" >
<v-list-item value="item1" active-color="primary">
<template v-slot:prepend>
<UserIcon stroke-width="1.5" size="20"/>
<UserIcon stroke-width="1.5" size="20" />
</template>
<v-list-item-title class="pl-4 text-body-1">My Profile</v-list-item-title>
</v-list-item>
<v-list-item value="item2" active-color="primary">
<template v-slot:prepend>
<MailIcon stroke-width="1.5" size="20"/>
<MailIcon stroke-width="1.5" size="20" />
</template>
<v-list-item-title class="pl-4 text-body-1">My Account</v-list-item-title>
<v-list-item-title class="pl-4 text-body-1">My Account</v-list-item-title>
</v-list-item>
<v-list-item value="item3" active-color="primary">
<v-list-item value="item3" active-color="primary">
<template v-slot:prepend>
<ListCheckIcon stroke-width="1.5" size="20"/>
<ListCheckIcon stroke-width="1.5" size="20" />
</template>
<v-list-item-title class="pl-4 text-body-1">My Task</v-list-item-title>
</v-list-item>
</v-list>
<div class="pt-4 pb-4 px-5 text-center">
<v-btn to="/auth/login" color="primary" variant="outlined" block>Logout</v-btn>
<v-btn @click="logout" color="primary" variant="outlined" block>Logout</v-btn>
</div>
</v-sheet>
</v-menu>

View File

@@ -1,3 +1,5 @@
const { $decodeBase64 } = useNuxtApp();
export interface menu {
header?: string;
title?: string;
@@ -14,6 +16,7 @@ export interface menu {
type?: string;
subCaption?: string;
external?: boolean;
requiredGroups?: string[];
}
const sidebarItem: menu[] = [
@@ -27,16 +30,19 @@ const sidebarItem: menu[] = [
title: "Front Pages",
icon: "home-angle-linear",
to: "/front",
requiredGroups: ["/Bidang Pelayanan Medik"],
children: [
{
title: "Coba VueForm",
to: "/coba",
external: false,
requiredGroups: ["/Bidang Pelayanan Medik"]
},
{
title: "Coba VueForm2",
to: "/coba2",
external: false,
requiredGroups: ["/Bidang Diklit/Staff"]
},
{
title: "Homepage",
@@ -51,6 +57,8 @@ const sidebarItem: menu[] = [
title: "Typography",
icon: "text-circle-outline",
to: "/ui/typography",
requiredGroups: ['/Instalasi Bedah Sentral', '/Instalasi Rawat Jalan'],
},
{
title: "Shadow",
@@ -107,4 +115,7 @@ const sidebarItem: menu[] = [
},
];
export default sidebarItem;