04dbb31d7e
* feat: implement salary module with personnummer encryption, salary entries, tax tables, and AGI tracking - Added personnummer encryption and decryption functions for secure storage. - Created salary entries handling for journal entries including gross salary, tax withholding, and employer contributions. - Implemented tax table lookup functionality for calculating tax amounts based on monthly income. - Developed SQL migration for salary module including tables for payroll configuration, tax rates, employees, salary runs, salary run employees, salary line items, and AGI declarations. - Established row-level security policies for all new tables to ensure company-scoped access. * feat: add salary calculation modules for 2026 - Implemented engångsskatt calculation for one-time payments with tax brackets. - Added löneväxling functionality for salary sacrifice to pension, including employer savings and warnings. - Created pain.001 generator for salary batch payments in compliance with Swedish banking standards. - Developed PDF template for payslips, including detailed breakdowns and employer costs. - Generated seed data for Swedish tax tables for 2026, including SQL insert statements. - Implemented traktamente calculations for per diem and mileage allowances, adhering to Skatteverket regulations. - Added seed script for populating tax tables in the database. * feat: Update meal reduction percentages in traktamente calculation fix: Remove obsolete seed script for 2026 tax tables feat: Extend SalaryRunStatus type to include 'corrected' status feat: Implement KU10 XML generation endpoint for annual employee income statements feat: Add endpoint for creating corrections to booked salary runs feat: Implement endpoint for sending payslip PDFs to employees feat: Create KU10 XML generator for annual reporting feat: Add salary transaction matcher for auto-linking bank transactions to salary entries chore: Add database migration for salary correction support * feat: replace select elements with custom Select component for employment and salary types * feat: enhance salary calculations with pension entry and avgifter category support
89 lines
3.2 KiB
TypeScript
89 lines
3.2 KiB
TypeScript
'use client'
|
|
|
|
import Link from 'next/link'
|
|
import { usePathname } from 'next/navigation'
|
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
|
import { useRouter } from 'next/navigation'
|
|
import { useCompany } from '@/contexts/CompanyContext'
|
|
import { ENABLED_EXTENSION_IDS } from '@/lib/extensions/_generated/enabled-extensions'
|
|
|
|
interface NavItem {
|
|
href: string
|
|
label: string
|
|
show: boolean
|
|
}
|
|
|
|
export function SettingsNav({ isSandbox }: { isSandbox?: boolean }) {
|
|
const pathname = usePathname()
|
|
const router = useRouter()
|
|
const { company } = useCompany()
|
|
|
|
const hasCompany = !!company
|
|
const hasBankingExtension = ENABLED_EXTENSION_IDS.has('enable-banking')
|
|
const hasMcpExtension = ENABLED_EXTENSION_IDS.has('mcp-server')
|
|
|
|
const items: NavItem[] = [
|
|
{ href: '/settings/company', label: 'Företag', show: hasCompany },
|
|
{ href: '/settings/invoicing', label: 'Fakturering', show: hasCompany },
|
|
{ href: '/settings/bookkeeping', label: 'Bokföring', show: hasCompany },
|
|
{ href: '/settings/tax', label: 'Skatt', show: hasCompany },
|
|
{ href: '/settings/team', label: 'Lag', show: false },
|
|
{ href: '/settings/banking', label: 'Bank (PSD2)', show: hasCompany && !isSandbox && hasBankingExtension },
|
|
{ href: '/settings/salary', label: 'Löner', show: hasCompany && company?.entity_type === 'aktiebolag' },
|
|
{ href: '/settings/templates', label: 'Mallar', show: hasCompany },
|
|
{ href: '/settings/account', label: 'Konto', show: true },
|
|
{ href: '/settings/api', label: 'API', show: hasCompany && hasMcpExtension },
|
|
].filter(item => item.show)
|
|
|
|
const activeHref = items.find(item => pathname.startsWith(item.href))?.href || items[0]?.href
|
|
|
|
return (
|
|
<>
|
|
{/* Mobile: select dropdown */}
|
|
<div className="sm:hidden">
|
|
<Select value={activeHref} onValueChange={(v) => router.push(v)}>
|
|
<SelectTrigger className="w-full">
|
|
<SelectValue />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
{items.map(item => (
|
|
<SelectItem key={item.href} value={item.href}>
|
|
{item.label}
|
|
</SelectItem>
|
|
))}
|
|
</SelectContent>
|
|
</Select>
|
|
</div>
|
|
|
|
{/* Desktop: horizontal tabs with bottom border */}
|
|
<nav
|
|
className="hidden sm:block overflow-x-auto scrollbar-none border-b border-border"
|
|
aria-label="Inställningar"
|
|
>
|
|
<ul className="flex gap-0 -mb-px">
|
|
{items.map(item => {
|
|
const isActive = pathname.startsWith(item.href)
|
|
return (
|
|
<li key={item.href}>
|
|
<Link
|
|
href={item.href}
|
|
className={`block whitespace-nowrap px-3 py-2 text-sm transition-colors border-b-2 ${
|
|
isActive
|
|
? 'font-medium text-foreground border-foreground'
|
|
: 'text-muted-foreground border-transparent hover:text-foreground hover:border-border'
|
|
}`}
|
|
>
|
|
{item.label}
|
|
</Link>
|
|
</li>
|
|
)
|
|
})}
|
|
</ul>
|
|
</nav>
|
|
</>
|
|
)
|
|
}
|
|
|
|
// Keep old name as alias for backward compat during transition
|
|
export const SettingsSidebar = SettingsNav
|