|
@@ -7,15 +7,17 @@
|
|
|
import logout_icon from '$lib/assets/logout_icon.svg';
|
|
import logout_icon from '$lib/assets/logout_icon.svg';
|
|
|
import close_icon from '$lib/assets/close_icon.svg';
|
|
import close_icon from '$lib/assets/close_icon.svg';
|
|
|
import menu_icon from '$lib/assets/menu_icon.svg';
|
|
import menu_icon from '$lib/assets/menu_icon.svg';
|
|
|
|
|
+ import { userFlag } from '$lib/utils/store';
|
|
|
//import { logout } from '../lib/auth'; // Você precisa criar esse arquivo
|
|
//import { logout } from '../lib/auth'; // Você precisa criar esse arquivo
|
|
|
|
|
+ $: flag = $userFlag;
|
|
|
|
|
+ $: navItems = [];
|
|
|
|
|
|
|
|
- let flagUser = 'admin';
|
|
|
|
|
let isMobileMenuOpen = false;
|
|
let isMobileMenuOpen = false;
|
|
|
- $: navItems = [];
|
|
|
|
|
onMount(() => {
|
|
onMount(() => {
|
|
|
- if (flagUser == 'waiter') {
|
|
|
|
|
- navItems = [{ name: 'Mesas', path: '/dashboard/tables' }];
|
|
|
|
|
- } else if (flagUser == 'admin') {
|
|
|
|
|
|
|
+ console.log(flag);
|
|
|
|
|
+ if (flag == 'waiter') {
|
|
|
|
|
+ navItems = [{ name: 'Mesas', path: '/dashboard/tables', icon: 'table_bar' }];
|
|
|
|
|
+ } else if (flag == 'admin') {
|
|
|
navItems = [
|
|
navItems = [
|
|
|
{ name: 'Mesas', path: '/dashboard/tables', icon: 'table_bar' },
|
|
{ name: 'Mesas', path: '/dashboard/tables', icon: 'table_bar' },
|
|
|
{ name: 'Produtos', path: '/dashboard/products', icon: 'product_sell' },
|
|
{ name: 'Produtos', path: '/dashboard/products', icon: 'product_sell' },
|
|
@@ -23,8 +25,8 @@
|
|
|
{ name: 'Cozinha', path: '/dashboard/cozinha', icon: 'kitchen_icon' },
|
|
{ name: 'Cozinha', path: '/dashboard/cozinha', icon: 'kitchen_icon' },
|
|
|
{ name: 'Gerenciar Usuários', path: '/dashboard/control', icon: 'mananger' }
|
|
{ name: 'Gerenciar Usuários', path: '/dashboard/control', icon: 'mananger' }
|
|
|
];
|
|
];
|
|
|
- } else if (flagUser == 'kitchen') {
|
|
|
|
|
- navItems = [{ name: 'Cozinha', path: '/dashboard/cozinha' }];
|
|
|
|
|
|
|
+ } else if (flag == 'kitchen') {
|
|
|
|
|
+ navItems = [{ name: 'Cozinha', path: '/dashboard/cozinha', icon: 'kitchen_icon' }];
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -51,7 +53,7 @@
|
|
|
<nav class="flex-1 space-y-2 px-2 py-4">
|
|
<nav class="flex-1 space-y-2 px-2 py-4">
|
|
|
{#each navItems as item}
|
|
{#each navItems as item}
|
|
|
<button
|
|
<button
|
|
|
- class={`flex items-center rounded-lg px-4 py-3 text-sm transition-colors ${
|
|
|
|
|
|
|
+ class={`flex cursor-pointer items-center rounded-lg px-4 py-3 text-sm transition-colors ${
|
|
|
currentPath === item.path
|
|
currentPath === item.path
|
|
|
? 'bg-gray-700 text-white'
|
|
? 'bg-gray-700 text-white'
|
|
|
: 'text-gray-300 hover:bg-gray-700'
|
|
: 'text-gray-300 hover:bg-gray-700'
|