feat: versão 1.5 - CRM Beta com leads, funis, campanhas e portal do cliente
This commit is contained in:
@@ -4,6 +4,7 @@ import { useState, useEffect, useRef } from 'react';
|
||||
import { Combobox, Dialog, DialogBackdrop, DialogPanel } from '@headlessui/react';
|
||||
import { MagnifyingGlassIcon } from '@heroicons/react/24/outline';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { getUser } from '@/lib/auth';
|
||||
import {
|
||||
HomeIcon,
|
||||
RocketLaunchIcon,
|
||||
@@ -16,7 +17,8 @@ import {
|
||||
ShareIcon,
|
||||
Cog6ToothIcon,
|
||||
PlusIcon,
|
||||
ArrowRightIcon
|
||||
ArrowRightIcon,
|
||||
UserCircleIcon
|
||||
} from '@heroicons/react/24/outline';
|
||||
|
||||
interface CommandPaletteProps {
|
||||
@@ -76,25 +78,37 @@ export default function CommandPalette({ isOpen, setIsOpen }: CommandPaletteProp
|
||||
}, [setIsOpen]);
|
||||
|
||||
const navigation = [
|
||||
{ name: 'Visão Geral', href: '/dashboard', icon: HomeIcon, category: 'Navegação', solution: 'dashboard' },
|
||||
{ name: 'CRM', href: '/crm', icon: RocketLaunchIcon, category: 'Navegação', solution: 'crm' },
|
||||
{ name: 'ERP', href: '/erp', icon: ChartBarIcon, category: 'Navegação', solution: 'erp' },
|
||||
{ name: 'Projetos', href: '/projetos', icon: BriefcaseIcon, category: 'Navegação', solution: 'projetos' },
|
||||
{ name: 'Helpdesk', href: '/helpdesk', icon: LifebuoyIcon, category: 'Navegação', solution: 'helpdesk' },
|
||||
{ name: 'Pagamentos', href: '/pagamentos', icon: CreditCardIcon, category: 'Navegação', solution: 'pagamentos' },
|
||||
{ name: 'Contratos', href: '/contratos', icon: DocumentTextIcon, category: 'Navegação', solution: 'contratos' },
|
||||
{ name: 'Documentos', href: '/documentos', icon: FolderIcon, category: 'Navegação', solution: 'documentos' },
|
||||
{ name: 'Redes Sociais', href: '/social', icon: ShareIcon, category: 'Navegação', solution: 'social' },
|
||||
{ name: 'Configurações', href: '/configuracoes', icon: Cog6ToothIcon, category: 'Navegação', solution: 'dashboard' },
|
||||
// Ações
|
||||
{ name: 'Novo Projeto', href: '/projetos/novo', icon: PlusIcon, category: 'Ações', solution: 'projetos' },
|
||||
{ name: 'Novo Chamado', href: '/helpdesk/novo', icon: PlusIcon, category: 'Ações', solution: 'helpdesk' },
|
||||
{ name: 'Novo Contrato', href: '/contratos/novo', icon: PlusIcon, category: 'Ações', solution: 'contratos' },
|
||||
// Agência
|
||||
{ name: 'Visão Geral', href: '/dashboard', icon: HomeIcon, category: 'Navegação', solution: 'dashboard', allowedTypes: ['agency_user'] },
|
||||
{ name: 'CRM', href: '/crm', icon: RocketLaunchIcon, category: 'Navegação', solution: 'crm', allowedTypes: ['agency_user'] },
|
||||
{ name: 'ERP', href: '/erp', icon: ChartBarIcon, category: 'Navegação', solution: 'erp', allowedTypes: ['agency_user'] },
|
||||
{ name: 'Projetos', href: '/projetos', icon: BriefcaseIcon, category: 'Navegação', solution: 'projetos', allowedTypes: ['agency_user'] },
|
||||
{ name: 'Helpdesk', href: '/helpdesk', icon: LifebuoyIcon, category: 'Navegação', solution: 'helpdesk', allowedTypes: ['agency_user'] },
|
||||
{ name: 'Pagamentos', href: '/pagamentos', icon: CreditCardIcon, category: 'Navegação', solution: 'pagamentos', allowedTypes: ['agency_user'] },
|
||||
{ name: 'Contratos', href: '/contratos', icon: DocumentTextIcon, category: 'Navegação', solution: 'contratos', allowedTypes: ['agency_user'] },
|
||||
{ name: 'Documentos', href: '/documentos', icon: FolderIcon, category: 'Navegação', solution: 'documentos', allowedTypes: ['agency_user'] },
|
||||
{ name: 'Redes Sociais', href: '/social', icon: ShareIcon, category: 'Navegação', solution: 'social', allowedTypes: ['agency_user'] },
|
||||
{ name: 'Configurações', href: '/configuracoes', icon: Cog6ToothIcon, category: 'Navegação', solution: 'dashboard', allowedTypes: ['agency_user'] },
|
||||
|
||||
// Cliente
|
||||
{ name: 'Dashboard', href: '/cliente/dashboard', icon: HomeIcon, category: 'Navegação', solution: 'dashboard', allowedTypes: ['customer'] },
|
||||
{ name: 'Meus Leads', href: '/cliente/leads', icon: RocketLaunchIcon, category: 'Navegação', solution: 'crm', allowedTypes: ['customer'] },
|
||||
{ name: 'Minhas Listas', href: '/cliente/listas', icon: FolderIcon, category: 'Navegação', solution: 'crm', allowedTypes: ['customer'] },
|
||||
{ name: 'Meu Perfil', href: '/cliente/perfil', icon: UserCircleIcon, category: 'Navegação', solution: 'dashboard', allowedTypes: ['customer'] },
|
||||
|
||||
// Ações Agência
|
||||
{ name: 'Novo Projeto', href: '/projetos/novo', icon: PlusIcon, category: 'Ações', solution: 'projetos', allowedTypes: ['agency_user'] },
|
||||
{ name: 'Novo Chamado', href: '/helpdesk/novo', icon: PlusIcon, category: 'Ações', solution: 'helpdesk', allowedTypes: ['agency_user'] },
|
||||
{ name: 'Novo Contrato', href: '/contratos/novo', icon: PlusIcon, category: 'Ações', solution: 'contratos', allowedTypes: ['agency_user'] },
|
||||
];
|
||||
|
||||
// Filtrar por soluções disponíveis
|
||||
// Filtrar por soluções disponíveis e tipo de usuário
|
||||
const user = getUser();
|
||||
const userType = user?.user_type || 'agency_user';
|
||||
|
||||
const allowedNavigation = navigation.filter(item =>
|
||||
availableSolutions.includes(item.solution)
|
||||
availableSolutions.includes(item.solution) &&
|
||||
(!item.allowedTypes || item.allowedTypes.includes(userType))
|
||||
);
|
||||
|
||||
const filteredItems =
|
||||
|
||||
Reference in New Issue
Block a user