Commit Graph

3 Commits

Author SHA1 Message Date
0fb4170549 fix: Convert relative image URLs to full InvenTree URLs in web app
Fixes 404 errors when loading part images in the web interface.

Problem:
- InvenTree API returns relative image paths like /media/part_images/...
- Browser tries to load from Flask app instead of InvenTree server
- Results in 404 errors

Solution:
- Detect relative image URLs (starting with /)
- Prepend InvenTree host URL to make them absolute
- Apply to both image and thumbnail properties

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 11:33:58 +07:00
8dadd66f45 fix: Add support for ANSI MH10.8.2 barcode format
Fixes barcode parsing for ANSI MH10.8.2 format barcodes that don't use GS/RS separators.

Problem:
- Barcodes like [)>06PSAM9019-ND1PJL-100-25-T... were not being parsed
- Only separator-based and JSON formats were supported
- User's real-world barcodes were being added to queue as raw strings

Solution:
- Added ANSI MH10.8.2 format detection ([)>06 prefix)
- Extract part code between P and first field marker (1P, 30P)
- Extract quantity from Q<digits> pattern
- Updated both desktop and web app parsing logic

Tested with real barcode:
- Input: [)>06PSAM9019-ND1PJL-100-25-T30PSAM9019-NDK1...Q1811...
- Parsed: Part=SAM9019-ND, Qty=1811 

Files Changed:
- src/stocktool/stock_tool_gui_v2.py - Enhanced parse_scan()
- src/stocktool/web/static/js/app.js - Enhanced parseBarcode()
- test_barcode_parsing.py - Test script for validation
- test_barcode_analyze.py - Barcode structure analysis tool
- QUICKSTART_WEB.md - Quick start guide for web app

Supported Formats Now:
1. JSON-like: {PM:PART-CODE,QTY:10}
2. Separator-based: GS/RS (\x1D, \x1E) separated fields
3. ANSI MH10.8.2: [)>06P<part>...Q<qty>... (NEW!)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 11:29:20 +07:00
03b7a4b0c8 feat: Add web application interface
Implements a modern web-based interface alongside the existing desktop app.

Features:
- Flask backend with REST API and WebSocket support
- Responsive web UI with TailwindCSS and Alpine.js
- Real-time updates via Socket.IO
- All desktop features available in browser
- Multi-user support
- Mobile-friendly responsive design
- Same async import queue functionality

Technology Stack:
- Backend: Flask + Flask-SocketIO + Flask-CORS
- Frontend: HTML5 + TailwindCSS + Alpine.js
- Real-time: WebSocket (Socket.IO)
- Icons: Font Awesome 6

New Files:
- src/stocktool/web/app.py - Flask application server
- src/stocktool/web/templates/index.html - Main web interface
- src/stocktool/web/static/js/app.js - Alpine.js application logic
- WEB_APP.md - Complete web app documentation

API Endpoints:
- GET /api/config - Application configuration
- GET /api/locations - List locations
- POST /api/part/search - Search for part
- POST /api/part/import - Queue part import
- POST /api/stock/add - Add stock
- POST /api/stock/update - Update stock
- POST /api/stock/check - Check stock level
- POST /api/part/locate - Locate part
- GET /api/pending - Get pending imports

WebSocket Events:
- import_complete - Part import finished
- import_retry - Import failed, retrying
- import_failed - Import failed completely
- barcode_parsed - Barcode successfully parsed

Benefits:
- Access from any device with a browser
- No desktop installation required
- Better mobile experience
- Multiple users can work simultaneously
- Easier deployment and updates
- Network-accessible within local network

Usage:
  uv run stock-tool-web
  # Open browser to http://localhost:5000

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 11:20:22 +07:00