Commit Graph

39 Commits

Author SHA1 Message Date
HotSwapp
dc1c10f44b feat: Add delete button for uploaded CSV files in admin panel
- Added delete button (trash icon) next to each uploaded file in the import section
- Implemented DELETE endpoint at /admin/delete-file/{filename} with authentication and validation
- Added JavaScript function to handle file deletion with confirmation dialog
- Includes security checks for directory traversal and file existence
- Logs file deletion actions with username for audit trail
- UI automatically refreshes after successful deletion
2025-10-08 13:07:04 -05:00
HotSwapp
fa4e0b9f62 Add Database Status section to admin panel
- Added table_counts query in /admin route to get record counts for all tables
  * Reference tables (TrnsType, TrnsLkup, Footers, FileStat, Employee, etc.)
  * Core data tables (Rolodex, LegacyPhone, LegacyFile, Ledger, etc.)
  * Specialized tables (PlanInfo, Qdros, Pensions, etc.)
  * Modern models (Client, Phone, Case, Transaction, Payment, Document)

- Created Database Status UI section in admin.html
  * Four-column layout showing all table categories
  * Color-coded badges (green=has data, gray=empty)
  * Check mark icons for populated tables
  * Table row highlighting based on data presence
  * Legend explaining the visual indicators

- Helps users track import progress at a glance
- Shows which tables have been successfully imported
- Distinguishes between legacy and modern model data
2025-10-08 12:59:35 -05:00
HotSwapp
2e7e9693c5 Add next section prompt and task summary 2025-10-08 09:55:12 -05:00
HotSwapp
e11e9aaf16 Add comprehensive CSV import system documentation
- Created IMPORT_GUIDE.md: Complete user guide with step-by-step instructions
  * Detailed import order for all 27+ tables
  * Troubleshooting guide
  * Data validation procedures
  * Best practices and performance notes

- Created IMPORT_SYSTEM_SUMMARY.md: Technical implementation summary
  * Complete list of all implemented functions (28 import + 7 sync)
  * Architecture and data flow diagrams
  * Module organization
  * Testing status and next steps
  * ~3,000 lines of code documented
2025-10-08 09:54:30 -05:00
HotSwapp
4030dbd88e Implement comprehensive CSV import system for legacy database migration
- Added 5 new legacy models to app/models.py (FileType, FileNots, RolexV, FVarLkup, RVarLkup)
- Created app/import_legacy.py with import functions for all legacy tables:
  * Reference tables: TRNSTYPE, TRNSLKUP, FOOTERS, FILESTAT, EMPLOYEE, GRUPLKUP, FILETYPE, FVARLKUP, RVARLKUP
  * Core tables: ROLODEX, PHONE, ROLEX_V, FILES, FILES_R, FILES_V, FILENOTS, LEDGER, DEPOSITS, PAYMENTS
  * Specialized: PLANINFO, QDROS, PENSIONS and all pension-related tables
- Created app/sync_legacy_to_modern.py with sync functions to populate modern models from legacy data
- Updated admin routes in app/main.py:
  * Extended process_csv_import to support all new import types
  * Added /admin/sync endpoint for syncing legacy to modern models
  * Updated get_import_type_from_filename to recognize all CSV file patterns
- Enhanced app/templates/admin.html with:
  * Import Order Guide showing recommended import sequence
  * Sync to Modern Models section with confirmation dialog
  * Sync results display with detailed per-table statistics
  * Updated supported file formats list
- All import functions use batch processing (500 rows), proper error handling, and structured logging
- Sync functions maintain foreign key integrity and skip orphaned records with warnings
2025-10-08 09:41:38 -05:00
HotSwapp
2efbf14940 fixed rolodex page 2025-10-07 23:09:15 -05:00
HotSwapp
fdcff9fbb2 Expand encoding fallback to handle more legacy CSV encodings
- Added windows-1252, cp1250, iso-8859-1 to encoding fallback list
- Enhanced error logging in open_text_with_fallbacks function
- Improved error messages to show all attempted encodings
- Added warning logs for each encoding attempt that fails

This should resolve 'charmap' codec errors and other encoding issues with legacy CSV files that use different Windows codepages or ISO encodings.
2025-10-07 22:25:34 -05:00
HotSwapp
09ef56fc1d Apply encoding fallback to all CSV importers (phone, files, ledger, payments, qdros)
- Updated import_phone_data to use open_text_with_fallbacks for encoding support
- Updated import_files_data to use open_text_with_fallbacks for encoding support
- Updated import_ledger_data to use open_text_with_fallbacks for encoding support
- Updated import_qdros_data to use open_text_with_fallbacks for encoding support
- Updated import_payments_data to use open_text_with_fallbacks for encoding support

All CSV import functions now use the same encoding fallback pattern that tries utf-8, utf-8-sig, cp1252, and latin-1 encodings to handle legacy CSV files with different encodings.
2025-10-07 22:21:07 -05:00
HotSwapp
58b2bb9a6c Add stored filename visibility and auto-select functionality to admin upload results
- Added 'Stored Filename' column to Upload Results table showing the actual filename used for storage
- Added 'Select All' button for each import type section to quickly select/deselect all files
- Improved JavaScript to handle select all/deselect all functionality with proper button state management
- Enhanced UI to clearly distinguish between original and stored filenames
2025-10-07 22:15:08 -05:00
HotSwapp
9497d69c76 Navbar: remove brand logo image; keep text brand only 2025-10-07 22:03:20 -05:00
HotSwapp
2a7d91da54 Auth UI: reliably hide navbar on login via body_class; add .auth-logo sized ~button width; restart 2025-10-07 21:59:40 -05:00
HotSwapp
bb68c489ee Auth UI: hide navbar on login via base navbar block; keep footer; remove circular logo styling; widen auth wrapper; restart container 2025-10-07 21:50:18 -05:00
HotSwapp
180314d43d UI: Simplify login page styling, remove purple gradient background, stop global .container overrides; add scoped .auth-wrapper; neutralize buttons/cards; rebuild verified via smoke test 2025-10-07 21:37:10 -05:00
HotSwapp
7fe57ccb6d Improve login screen design and functionality
- Increased logo size from 60x60 to 120x120px with proper styling
- Enhanced card layout with better padding and rounded corners
- Added modern gradient background and improved visual hierarchy
- Improved form styling with larger inputs and better spacing
- Enhanced password visibility toggle with better UX
- Improved error message styling with icons and rounded corners
- Added responsive design improvements for better mobile experience
- Updated color scheme with modern gradients and improved contrast
2025-10-07 21:33:12 -05:00
HotSwapp
aeb0be6982 feat(reports): add Envelope, Phone Book (address+phone) and Rolodex Info reports
- PDF builders in app/reporting.py (envelope, phone+address, rolodex info)
- Endpoints in app/main.py with auth, filtering, logging, Content-Disposition
- New HTML template report_phone_book_address.html
- Rolodex bulk actions updated with buttons/links
- JS helper to submit selections to alternate endpoints

Tested via docker compose build/up and health check.
2025-10-07 17:50:03 -05:00
HotSwapp
684b947651 docs: add next-section prompt for Reports (Envelope, Phone Book variants, Rolodex Info); confirm TODO next step pending run/test 2025-10-07 17:40:02 -05:00
HotSwapp
f649b3c4f1 reports: add PDF generation infra (fpdf2); Phone Book CSV/PDF export; Payments - Detailed report with preview and PDF grouped by deposit date; update Dockerfile for deps; smoke-tested in Docker 2025-10-07 17:30:50 -05:00
HotSwapp
a4f47fce4f docs(todo): check off structured logging/audit trail; audit logs on ledger CUD with pre/post totals; payments search and dashboard present 2025-10-07 17:19:44 -05:00
HotSwapp
d3d89c7a5f feat(logging): structured audit logs for ledger CRUD with user, keys, pre/post balances\n\n- Add compute_case_totals_for_case_id and helpers to extract ledger keys\n- Instrument ledger_create/update/delete to emit ledger_audit with deltas\n- Preserve existing event logs (ledger_create/update/delete)\n- Verified in Docker; smoke tests pass 2025-10-07 17:10:36 -05:00
HotSwapp
e07a4fda1c Answer-table pattern: add reusable macros, integrate with Rolodex; bulk actions retained. Field prompts/help: generic focus-based help in forms (case, rolodex); add JS support. Rebuild Docker. 2025-10-07 17:00:54 -05:00
HotSwapp
748fe92565 chore(todo): check off completed legacy MVP items (models, imports, rolodex CRUD & search, dashboard/case/ledger basics, payments search, amount auto-compute, item_no uniqueness) 2025-10-07 16:32:28 -05:00
HotSwapp
1eb8ba8edd API: Standardized JSON list responses with Pydantic schemas and Pagination; add sort_by/sort_dir validation with whitelists; consistent JSON 401 for /api/*; structured logging for sorting/pagination; add pydantic dep; add Docker smoke script and README docs. 2025-10-07 16:05:09 -05:00
HotSwapp
c68ba45ceb Add legacy SQLAlchemy models mapped from docs/legacy-schema.md: ROLODEX, PHONE, FILES (+R/V), LEDGER, FILESTAT, FOOTERS, EMPLOYEE, STATES, GRUPLKUP, PRINTERS, SETUP, DEPOSITS, PAYMENTS (legacy), TRNSTYPE, TRNSLKUP, PLANINFO, QDROS, PENSIONS (+RESULTS/MARRIAGE/DEATH/SCHEDULE/SEPARATE). Add appropriate FKs and indexes; keep modern models intact. 2025-10-07 10:12:00 -05:00
HotSwapp
432f303a33 docs: add inferred legacy schema from CSV headers and .SC usage to guide migration 2025-10-07 09:51:30 -05:00
HotSwapp
950d261eb4 File Cabinet MVP: case detail with inline Ledger CRUD
- Extend Transaction with ledger fields (item_no, employee_number, t_code, t_type_l, quantity, rate, billed)
- Startup SQLite migration to add missing columns on transactions
- Ledger create/update/delete endpoints with validations and auto-compute Amount = Quantity × Rate
- Uniqueness: ensure (transaction_date, item_no) per case by auto-incrementing
- Compute case totals (billed/unbilled/overall) and display in case view
- Update case.html for master-detail ledger UI; add client-side auto-compute JS
- Enhance import_ledger_data to populate extended fields
- Close/Reopen actions retained; case detail sorting by date/item
- Auth: switch to pbkdf2_sha256 default (bcrypt fallback) and seed admin robustness

Tested in Docker: health OK, login OK, import ROLODEX/FILES OK, ledger create persisted and totals displayed.
2025-10-07 09:26:58 -05:00
HotSwapp
f9c3b3cc9c MVP legacy features: payments search page, phone book report (HTML+CSV), Rolodex bulk selection + actions; audit logging for Rolodex/Phone CRUD; nav updates 2025-10-06 23:31:02 -05:00
HotSwapp
d456ae4f39 docs: add TODO-Legacy with legacy feature checklist and examples 2025-10-06 23:14:27 -05:00
HotSwapp
978a866813 chore: route uvicorn logs to structlog; disable default access logs 2025-10-06 23:00:25 -05:00
HotSwapp
0637fc2a63 chore: add structured logging with structlog; add request_id middleware; replace std logging 2025-10-06 22:22:04 -05:00
HotSwapp
b2d751f555 feat: Complete case edit functionality and Docker setup
- Fix case edit form data handling (POST requests now work correctly)
- Add comprehensive Docker setup with Dockerfile and docker-compose.yml
- Fix CSV import validation for client and case data
- Improve import error handling and column mapping
- Add .dockerignore for efficient Docker builds
- Complete end-to-end testing of full application workflow

All core functionality from del.plan.md now implemented and tested:
 Case view, edit, close, and reopen operations
 Data import from CSV files with validation
 Authentication and session management
 Dashboard with search and pagination
 Production-ready Docker containerization
2025-10-06 20:32:51 -05:00
HotSwapp
4dbc452b65 items 2025-10-06 20:28:00 -05:00
HotSwapp
216adcc1f6 feat: Implement comprehensive admin panel with CSV import system
- Add ImportLog model for tracking import history and results
- Create admin.html template with file upload form and progress display
- Implement POST /admin/upload route for CSV file handling with validation
- Build CSV import engine with dispatcher routing by filename patterns:
  * ROLODEX*.csv → Client model import
  * PHONE*.csv → Phone model import with client linking
  * FILES*.csv → Case model import
  * LEDGER*.csv → Transaction model import
  * QDROS*.csv → Document model import
  * PAYMENTS*.csv → Payment model import
- Add POST /admin/import/{data_type} route for triggering imports
- Implement comprehensive validation, error handling, and progress tracking
- Support for CSV header validation, data type conversions, and duplicate handling
- Real-time progress tracking with ImportLog database model
- Responsive UI with Bootstrap components for upload and results display
- Enhanced navigation with admin panel link already in place
- Tested import functionality with validation and error handling

The admin panel enables bulk importing of legacy CSV data from the old-csv/ directory, making the system fully functional with real data.
2025-10-06 19:52:31 -05:00
HotSwapp
728d26ad17 feat(case): enable editing and close/reopen actions on case detail
- Add POST /case/{id}/update route for editing case fields (status, case_type, description, open_date, close_date)
- Add POST /case/{id}/close route to set status='closed' and close_date=current date
- Add POST /case/{id}/reopen route to set status='active' and clear close_date
- Update case.html template with edit form, success/error messaging, and action buttons
- Include comprehensive validation for dates and status values
- Add proper error handling with session-based error storage
- Preserve existing view content and styling consistency
2025-10-06 19:43:21 -05:00
HotSwapp
2e49340663 feat(case): add GET /case/{id} detail view and Jinja template; link from dashboard table; eager-load related data; 404 handling and logging 2025-10-06 19:21:58 -05:00
HotSwapp
6174df42b4 feat(dashboard): list recent cases with search and pagination\n\n- Add q, page, page_size to /dashboard route\n- Join clients and filter by file_no/name/company\n- Bootstrap table UI with search form and pagination\n- Log query params; preserve auth/session\n\nCo-authored-by: AI Assistant <ai@example.com> 2025-10-06 19:11:40 -05:00
HotSwapp
6aa4d59a25 feat(auth): add session-based login/logout with bcrypt hashing, seed default admin, templates and navbar updates; add auth middleware; pin SQLAlchemy 1.4.x for Py3.13; update TODOs 2025-10-06 19:04:36 -05:00
HotSwapp
227c74294f feat: Set up SessionMiddleware and Jinja2 Template Configuration
- Add SECRET_KEY environment variable and .env file for session management
- Configure SessionMiddleware with FastAPI for user session handling
- Set up Jinja2 template engine with template directory configuration
- Mount static files directory for CSS, JS, and image assets
- Create comprehensive base.html template with Bootstrap 5 CDN
- Add Bootstrap Icons and custom styling support
- Include responsive navigation with user authentication state
- Create placeholder CSS and JavaScript files for customization
- Add aiofiles dependency for static file serving

This establishes the web framework foundation with session management
and templating system ready for frontend development.
2025-10-06 18:27:44 -05:00
HotSwapp
de983a73d2 Set up database configuration and connection management
- Created app/database.py with SQLAlchemy engine, session management, and connection utilities
- Added comprehensive database models in app/models.py for User, Client, Phone, Case, Transaction, Document, and Payment
- Implemented FastAPI application with database lifecycle management in app/main.py
- Added health check endpoint to verify database connectivity
- Created README.md with database configuration documentation
- Verified database connection works correctly with SQLite backend
2025-10-06 18:22:18 -05:00
HotSwapp
36dffd5372 Initial project structure: directories, empty files, requirements.txt, and logo 2025-10-06 18:18:47 -05:00