- {formatCurrency(Number(invoice.total), invoice.currency)}
+
+
+
{invoice.invoice_number}
+
+ {formatCurrency(Number(invoice.total), invoice.currency)}
+
+
+
+ {(invoice.customer as { name: string })?.name} · {formatDate(invoice.invoice_date)}
+
+ {isCreditNote && (
+
+ Kredit
+
+ )}
+ {isProforma && (
+
+ Proforma
+
+ )}
+ {isDeliveryNote && (
+
+ Följesedel
+
+ )}
+
+ {status.label}
+
+ {relativeTime && (
+
+ {relativeTime.text}
+
+ )}
+
{invoice.currency !== 'SEK' && invoice.total_sek && (
-
+
{formatCurrency(Number(invoice.total_sek))}
)}
diff --git a/app/(dashboard)/layout.tsx b/app/(dashboard)/layout.tsx
index 19500d94..b1f30cc5 100644
--- a/app/(dashboard)/layout.tsx
+++ b/app/(dashboard)/layout.tsx
@@ -18,11 +18,18 @@ export default async function DashboardLayout({
redirect('/login')
}
- const { data: settings } = await supabase
- .from('company_settings')
- .select('company_name, onboarding_complete, entity_type, is_sandbox')
- .eq('user_id', user.id)
- .single()
+ const [{ data: settings }, { count: uncategorizedCount }] = await Promise.all([
+ supabase
+ .from('company_settings')
+ .select('company_name, onboarding_complete, entity_type, is_sandbox')
+ .eq('user_id', user.id)
+ .single(),
+ supabase
+ .from('transactions')
+ .select('*', { count: 'exact', head: true })
+ .eq('user_id', user.id)
+ .is('is_business', null),
+ ])
if (!settings?.onboarding_complete) {
redirect('/onboarding')
@@ -30,12 +37,6 @@ export default async function DashboardLayout({
const entityType = (settings.entity_type as EntityType) || 'enskild_firma'
- const { count: uncategorizedCount } = await supabase
- .from('transactions')
- .select('*', { count: 'exact', head: true })
- .eq('user_id', user.id)
- .is('is_business', null)
-
const isSandbox = settings.is_sandbox === true
return (
@@ -54,7 +55,7 @@ export default async function DashboardLayout({
uncategorizedTransactionCount={uncategorizedCount ?? 0}
isSandbox={isSandbox}
/>
-
+
{children}
diff --git a/app/(dashboard)/reports/page.tsx b/app/(dashboard)/reports/page.tsx
index 646c464d..1e07517c 100644
--- a/app/(dashboard)/reports/page.tsx
+++ b/app/(dashboard)/reports/page.tsx
@@ -33,6 +33,7 @@ export default function ReportsPage() {
const [selectedPeriod, setSelectedPeriod] = useState('')
const [activeTab, setActiveTab] = useState('trial-balance')
const [entityType, setEntityType] = useState(null)
+ const [isLoadingInit, setIsLoadingInit] = useState(true)
async function fetchPeriods() {
const res = await fetch('/api/bookkeeping/fiscal-periods')
@@ -56,8 +57,9 @@ export default function ReportsPage() {
}
useEffect(() => {
- fetchPeriods()
- fetchEntityType()
+ Promise.all([fetchPeriods(), fetchEntityType()]).finally(() => {
+ setIsLoadingInit(false)
+ })
}, [])
const isEnskildFirma = entityType === 'enskild_firma'
@@ -65,16 +67,45 @@ export default function ReportsPage() {
return (
-
+
-
Rapporter
+
Rapporter
Huvudbok, grundbok, kundreskontra, saldobalans, resultaträkning, balansräkning, momsdeklaration och mer
-
+ {isLoadingInit ? (
+
+
+
+ {[1, 2, 3, 4].map((i) => (
+
+ ))}
+
+
+
+
+
+
+
+
+ ) : (
+ <>
+
@@ -635,7 +698,7 @@ function ReportSectionTable({
{sections.map((section) => (
{section.title}
-
+
{section.rows.map((row) => (
@@ -647,7 +710,7 @@ function ReportSectionTable({
))}
-
+
{section.title}
@@ -838,7 +901,7 @@ function VatDeclarationView() {
{/* Utgående moms */}
Utgående moms (försäljning)
-
+
{data.rutor.ruta05 > 0 && (
@@ -890,13 +953,13 @@ function VatDeclarationView() {
-
+
{/* Ingående moms */}
Ingående moms (avdragsgill)
-
+
|
@@ -928,7 +991,7 @@ function VatDeclarationView() {
| {formatAmount(data.rutor.ruta48)} kr |
-
+
@@ -1126,7 +1189,7 @@ function SupplierLedgerView({ periodId }: { periodId: string }) {
Ålderfördelning per leverantör
-
+
| Leverantör |
@@ -1162,7 +1225,7 @@ function SupplierLedgerView({ periodId }: { periodId: string }) {
{formatAmount(ledger.total_outstanding)} |
-
+
)}
@@ -1343,7 +1406,7 @@ function GeneralLedgerView({ periodId }: { periodId: string }) {
-
+
| Ver.nr |
@@ -1380,7 +1443,7 @@ function GeneralLedgerView({ periodId }: { periodId: string }) {
{formatAmount(account.closing_balance)} |
-
+
))}
@@ -1498,7 +1561,7 @@ function JournalRegisterView({ periodId }: { periodId: string }) {