feat(vat): Momsdeklaration as Stegen - stepper, flat steps, house toolbar (#1154)
* feat(vat): Momsdeklaration as Stegen (horizontal stepper, one step at a time) The founder-picked concept variant for Moms: the four pipeline sections (kontrollera, granska, bokfor, lamna in) become a clickable horizontal stepper with honest per-step status subs (fel/varningar from the pre-flight checks, att betala/aterfa from ruta 49, bokford/utkast lifted from the settlement proposal via a new optional onStatus callback on VatBookingCard) and one step's content rendered at a time with quiet Nasta-links. Errors land on step 1, otherwise Granska. SkatteverketPanel moves inside steg 4 next to the manual filing card when a declaration exists; the no-data states keep it standalone. A period switch resets the step choice. All checks, booking, drilldowns, exports and the SKV submit flow are untouched. Co-Authored-By: Claude Fable 5 <[email protected]> * polish(vat): de-box the Stegen step contents to the concept language Founder review: the stepper was new but the step contents kept the old card chrome. Now flat on the panel throughout: the period picker is a quiet toolbar row (no card, no labels), Granska renders as a centered document column with sans eyebrow group heads and ruta 49 as an emphasized document foot, the pre-flight checks are hairline rows with quiet Korrigera links instead of boxed alerts and outline buttons, VatBookingCard and VatManualFilingCard lose their cards (notes become flat muted/attn lines), and SkatteverketPanel's card shells become flat sections with sans uppercase eyebrows. All logic, flows and dialogs untouched. Co-Authored-By: Claude Fable 5 <[email protected]> * polish(vat): black Exportera, no page-level Fraga Anna, clear Nasta buttons Founder feedback on Stegen: the toolbar keeps only Exportera and it wears the primary pill (ReportExportMenu gains an optional variant prop, outline stays the default everywhere else); the AgentSparkleButton leaves the page (the global assistant bubble remains); the Nasta step links become white outline pill buttons so the forward path reads as clearly as the export action. All other buttons on the page already follow the house variants (primary/outline/ghost/quiet links). Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5
parent
5c42852d7e
commit
cb7b31819b
@@ -30,10 +30,13 @@ export function ReportExportMenu({
|
||||
items,
|
||||
children,
|
||||
size = 'sm',
|
||||
variant = 'outline',
|
||||
}: {
|
||||
items?: ReportExportItem[]
|
||||
children?: React.ReactNode
|
||||
size?: 'default' | 'sm'
|
||||
/** Trigger style; the VAT Stegen page uses the primary pill. */
|
||||
variant?: 'outline' | 'default'
|
||||
}) {
|
||||
const t = useTranslations('reports')
|
||||
const hasItems = !!items && items.length > 0
|
||||
@@ -44,7 +47,7 @@ export function ReportExportMenu({
|
||||
{hasItems && (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="outline" size={size}>
|
||||
<Button variant={variant} size={size}>
|
||||
<Download className="h-4 w-4 mr-2" />
|
||||
{t('export')}
|
||||
</Button>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { ENABLED_EXTENSION_IDS } from '@/lib/extensions/_generated/enabled-extensions'
|
||||
import React, { useState, useEffect, useCallback } from 'react'
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
@@ -678,12 +677,12 @@ function SkatteverketPanelInner({
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<Card>
|
||||
<CardContent className="p-6 space-y-4">
|
||||
<section>
|
||||
<div className="space-y-4">
|
||||
<Skeleton className="h-5 w-48" />
|
||||
<Skeleton className="h-24" />
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -693,14 +692,14 @@ function SkatteverketPanelInner({
|
||||
// trial sees the upsell instead of action buttons that would 403.
|
||||
if (!hasSkvCapability) {
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base flex items-center gap-2">
|
||||
<section>
|
||||
<div className="mb-3">
|
||||
<h3 className="flex items-center gap-2 font-sans text-xs font-medium uppercase tracking-wider text-muted-foreground">
|
||||
<FileCheck className="h-4 w-4" />
|
||||
Skicka direkt till Skatteverket (valfritt)
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
</h3>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Med ett abonnemang kan du ansluta med BankID och skicka deklarationen
|
||||
direkt härifrån, samt validera, spara utkast och signera.
|
||||
@@ -708,8 +707,8 @@ function SkatteverketPanelInner({
|
||||
<UpgradeNote>
|
||||
Direktinlämning till Skatteverket kräver ett abonnemang.
|
||||
</UpgradeNote>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -719,14 +718,14 @@ function SkatteverketPanelInner({
|
||||
// directly from Accounted, so frame it that way.
|
||||
if (!status?.connected) {
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base flex items-center gap-2">
|
||||
<section>
|
||||
<div className="mb-3">
|
||||
<h3 className="flex items-center gap-2 font-sans text-xs font-medium uppercase tracking-wider text-muted-foreground">
|
||||
<FileCheck className="h-4 w-4" />
|
||||
Skicka direkt till Skatteverket (valfritt)
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
</h3>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
{notice?.kind === 'error' && (
|
||||
<div
|
||||
role="alert"
|
||||
@@ -745,8 +744,8 @@ function SkatteverketPanelInner({
|
||||
<Link2 className="h-4 w-4" />
|
||||
Anslut med BankID
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -754,13 +753,13 @@ function SkatteverketPanelInner({
|
||||
const hasErrors = kontroller.some(k => k.status === 'ERROR')
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<section>
|
||||
<div className="mb-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<CardTitle className="text-base flex items-center gap-2">
|
||||
<h3 className="flex items-center gap-2 font-sans text-xs font-medium uppercase tracking-wider text-muted-foreground">
|
||||
<FileCheck className="h-4 w-4" />
|
||||
Skicka direkt till Skatteverket
|
||||
</CardTitle>
|
||||
</h3>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Badge variant="success" className="gap-1">
|
||||
<CheckCircle2 className="h-3 w-3" />
|
||||
@@ -902,8 +901,8 @@ function SkatteverketPanelInner({
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
{/* In-flight status for overflow-menu actions: their menu closes on
|
||||
select, so this row is the only visible sign of work. */}
|
||||
{actionLoading && ACTION_IN_FLIGHT_LABELS[actionLoading] && (
|
||||
@@ -1067,8 +1066,8 @@ function SkatteverketPanelInner({
|
||||
Valideringsfelen ovan måste åtgärdas innan deklarationen kan lämnas in.
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</div>
|
||||
<DestructiveConfirmDialog {...dialogProps} />
|
||||
</Card>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import {
|
||||
@@ -39,6 +37,8 @@ import type { RcBasisGap } from '@/lib/reports/rc-basis-gaps'
|
||||
import type { VatPeriodType } from '@/types'
|
||||
import { formatDate } from '@/lib/utils'
|
||||
import { useCanWrite } from '@/lib/hooks/use-can-write'
|
||||
import { QUIET_LINK_CLASS } from '@/components/ui/dry-table'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
function formatAmount(amount: number): string {
|
||||
return amount.toLocaleString('sv-SE', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
||||
@@ -102,8 +102,6 @@ export function VatChecksCard({
|
||||
const { canWrite } = useCanWrite()
|
||||
const { dialogProps, confirm } = useDestructiveConfirm()
|
||||
|
||||
const errorCount = checks.filter((c) => c.status === 'ERROR').length
|
||||
const warningCount = checks.length - errorCount
|
||||
const hasRcBasisGaps = checks.some((c) => c.code === 'RC_BASIS_MISSING')
|
||||
|
||||
// Gap fetch tagged with the key it was requested under: loading is derived
|
||||
@@ -298,24 +296,7 @@ export function VatChecksCard({
|
||||
const visibleGaps = showAll ? gaps : gaps.slice(0, GAP_PREVIEW_COUNT)
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<CardTitle className="text-base">Kontroll av underlaget</CardTitle>
|
||||
{errorCount > 0 ? (
|
||||
<Badge variant="destructive">
|
||||
{errorCount} {errorCount === 1 ? 'fel' : 'fel'}
|
||||
</Badge>
|
||||
) : warningCount > 0 ? (
|
||||
<Badge variant="warning">
|
||||
{warningCount} {warningCount === 1 ? 'varning' : 'varningar'}
|
||||
</Badge>
|
||||
) : (
|
||||
<Badge variant="success">Inga anmärkningar</Badge>
|
||||
)}
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="space-y-4">
|
||||
{checks.length === 0 && (
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<CheckCircle2 className="h-4 w-4 text-success" />
|
||||
@@ -324,23 +305,19 @@ export function VatChecksCard({
|
||||
)}
|
||||
|
||||
{checks.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<div>
|
||||
{checks.map((c, i) => (
|
||||
<div
|
||||
key={`${c.code}-${i}`}
|
||||
className={`flex items-start gap-2 rounded-lg p-3 text-sm ${
|
||||
c.status === 'ERROR'
|
||||
? 'bg-destructive/5 text-destructive'
|
||||
: 'border border-border bg-muted/30'
|
||||
}`}
|
||||
className="flex items-start gap-2 border-b border-border/60 py-3 text-[13px] leading-5 last:border-b-0"
|
||||
>
|
||||
{c.status === 'ERROR' ? (
|
||||
<ShieldAlert className="h-4 w-4 mt-1 shrink-0" />
|
||||
<ShieldAlert className="mt-0.5 h-4 w-4 shrink-0 text-destructive" aria-hidden="true" />
|
||||
) : (
|
||||
<AlertTriangle className="h-4 w-4 mt-1 shrink-0 text-warning" />
|
||||
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-attn" aria-hidden="true" />
|
||||
)}
|
||||
<div>
|
||||
<span className="font-mono text-xs mr-2">{c.code}</span>
|
||||
<span className="mr-2 font-mono text-xs text-muted-foreground">{c.code}</span>
|
||||
{c.message}
|
||||
</div>
|
||||
</div>
|
||||
@@ -461,21 +438,20 @@ export function VatChecksCard({
|
||||
<span className="text-sm tabular-nums text-muted-foreground">
|
||||
{formatAmount(gap.expectedBasisAmount)} kr
|
||||
</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
handleFixOne(gap)
|
||||
}}
|
||||
disabled={!canWrite || busy}
|
||||
className={cn(QUIET_LINK_CLASS, 'inline-flex items-center disabled:cursor-not-allowed disabled:opacity-50')}
|
||||
>
|
||||
{fixingId === gap.entryId ? (
|
||||
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
||||
) : (
|
||||
<CheckCircle2 className="h-4 w-4 mr-2" />
|
||||
{fixingId === gap.entryId && (
|
||||
<Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" aria-hidden="true" />
|
||||
)}
|
||||
Korrigera
|
||||
</Button>
|
||||
</button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
@@ -598,16 +574,15 @@ export function VatChecksCard({
|
||||
</DataList>
|
||||
|
||||
{gaps.length > GAP_PREVIEW_COUNT && (
|
||||
<Button variant="ghost" onClick={() => setShowAll((v) => !v)}>
|
||||
<button type="button" onClick={() => setShowAll((v) => !v)} className={QUIET_LINK_CLASS}>
|
||||
{showAll ? 'Visa färre' : `Visa alla ${gaps.length} verifikationer`}
|
||||
</Button>
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
<DestructiveConfirmDialog {...dialogProps} />
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
+266
-148
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user