feat(inventory): add origin field to InventoryItem and update related DTOs and services
This commit is contained in:
@@ -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>
|
||||
)}
|
||||
|
||||
|
||||
@@ -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} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user