Add automatic invoice parsing to extract purchase items

- Install pdf-parse and tesseract.js for PDF/image processing
- Create /api/admin/parse-invoice endpoint to extract line items from invoices
- Parser extracts quantity and description from invoice text
- Attempts to match extracted items to products in database
- Update PurchaseForm with "Extract items" button
- Pre-fill purchase form with parsed items (user can edit/add more)
- Supports PDF files and image scans (JPG, PNG, etc)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Andymick
2026-07-16 21:14:49 +01:00
co-authored by Claude Haiku 4.5
parent 48017facf0
commit d596cbe836
4 changed files with 547 additions and 9 deletions
+2
View File
@@ -19,10 +19,12 @@
"konva": "9.3.14",
"next": "14.2.5",
"nodemailer": "6.9.14",
"pdf-parse": "^2.4.5",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-konva": "18.2.10",
"stripe": "16.2.0",
"tesseract.js": "^7.0.0",
"uuid": "9.0.1",
"zustand": "4.5.4"
},