diff --git a/src/components/stock/AddItemForm.tsx b/src/components/stock/AddItemForm.tsx index 4b2f50d..dc85599 100644 --- a/src/components/stock/AddItemForm.tsx +++ b/src/components/stock/AddItemForm.tsx @@ -42,9 +42,9 @@ export function AddItemForm({ setOpen, refreshData }: AddItemFormProps) { const records = await pb.collection('stock_items').getList(1, 50, { fields: 'category', }); - // Explicitly type item.category as string and cat as string - const uniqueCategories = Array.from(new Set(records.items.map((item: { category: string }) => item.category))); - const options = uniqueCategories.map((cat: string) => ({ // Explicitly type 'cat' as string + // Get unique categories from stock_items + const uniqueCategories = Array.from(new Set(records.items.map(item => item.category))); + const options = uniqueCategories.map((cat: string) => ({ value: cat.toLowerCase(), label: cat, })); diff --git a/src/lib/logger.ts b/src/lib/logger.ts index b2ca9b5..abc4f42 100644 --- a/src/lib/logger.ts +++ b/src/lib/logger.ts @@ -197,7 +197,24 @@ class Logger { } ); - return result; + // Map RecordModel[] to LogRecord[] + const items: LogRecord[] = result.items.map((item: any) => ({ + id: item.id, + created: item.created, + updated: item.updated, + action: item.action, + level: item.level, + details: item.details, + user: item.user, + module: item.module, + metadata: item.metadata ? JSON.parse(item.metadata) : undefined, + })); + + return { + items, + totalItems: result.totalItems, + totalPages: result.totalPages, + }; } catch (error) { console.error('Failed to retrieve logs:', error); throw error; diff --git a/src/pages/BookOut.tsx b/src/pages/BookOut.tsx index 445c1c9..ff17a11 100644 --- a/src/pages/BookOut.tsx +++ b/src/pages/BookOut.tsx @@ -1,12 +1,5 @@ import { useState, useEffect, useCallback } from "react"; -import { BookOutForm } - - -