feat(inventory): add origin field to InventoryItem and update related DTOs and services

This commit is contained in:
Nils-Johan Gynther
2026-04-19 15:11:35 +02:00
parent 3b0208b5b4
commit 976a72612e
14 changed files with 210 additions and 23 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ type Tab = 'kvitto' | 'recept';
type Product = { id: number; name: string; canonicalName: string | null };
export default function ImportTabsClient({ activeTab }: { activeTab: Tab }) {
export default function ImportTabsClient({ activeTab, isAdmin }: { activeTab: Tab; isAdmin: boolean }) {
return (
<main style={{ padding: '1rem', maxWidth: '900px', margin: '0 auto' }}>
<h1 style={{ marginBottom: '1rem' }}>Importera</h1>
@@ -55,7 +55,7 @@ export default function ImportTabsClient({ activeTab }: { activeTab: Tab }) {
<p style={{ color: '#666', marginBottom: '1.5rem' }}>
Fotografera eller ladda upp ett kvitto varorna läggs till i ditt inventarie.
</p>
<ReceiptImportClient />
<ReceiptImportClient isAdmin={isAdmin} />
</div>
)}
+4 -1
View File
@@ -1,6 +1,7 @@
import { Metadata } from 'next';
import Navigation from '../Navigation';
import ImportTabsClient from './ImportTabsClient';
import { auth } from '../../auth';
type Props = {
searchParams: Promise<{ tab?: string }>;
@@ -15,10 +16,12 @@ export async function generateMetadata({ searchParams }: Props): Promise<Metadat
export default async function ImportPage({ searchParams }: Props) {
const { tab } = await searchParams;
const activeTab = tab === 'recept' ? 'recept' : 'kvitto';
const session = await auth();
const isAdmin = (session?.user as any)?.role === 'admin';
return (
<>
<Navigation />
<ImportTabsClient activeTab={activeTab} />
<ImportTabsClient activeTab={activeTab} isAdmin={isAdmin} />
</>
);
}