Add USB checkout system and SSO profile page

New Features:
- USB Device checkout/check-in system with barcode scanning
  - displayusb.asp: List all USB devices with status
  - addusb.asp: Add new USB devices via barcode scan
  - checkout_usb.asp/savecheckout_usb.asp: Check out USB to SSO
  - checkin_usb.asp/savecheckin_usb.asp: Check in with wipe confirmation
  - usb_history.asp: Full checkout history with filters
  - api_usb.asp: JSON API for AJAX lookups
- displayprofile.asp: SSO profile page showing user info and USB history
- Date/time format changed to 12-hour (MM/DD/YYYY h:mm AM/PM)
- SSO links in USB history now link to profile page via search

Database:
- New machinetypeid 44 for USB devices
- New usb_checkouts table for tracking checkouts

Cleanup:
- Removed v2 folder (duplicate/old files)
- Removed old debug/test files
- Removed completed migration documentation

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-07 11:16:14 -05:00
parent c7834d4b99
commit 65b622c361
1061 changed files with 19034 additions and 213120 deletions

View File

@@ -1,346 +1,211 @@
# ShopDB Documentation
Welcome to the ShopDB documentation! This folder contains everything you need to understand, develop, and maintain the ShopDB application.
**Last Updated:** 2025-11-25
**Current Status:** Phase 2 Complete, Phase 3 Planned
---
## Project Status Overview
### Migration Progress
| Phase | Status | Description | Completed |
|-------|--------|-------------|-----------|
| **Phase 1** | COMPLETE | Schema changes - new tables, columns, indexes | Nov 6, 2025 |
| **Phase 2** | COMPLETE | PC migration to unified machines table | Nov 10, 2025 |
| **Phase 3** | PLANNED | Network devices migration (servers, switches, cameras) | TBD |
### Current Architecture
```
machines table (unified)
├── Equipment (machinetypeid 1-24, pctypeid IS NULL)
└── PCs (machinetypeid 25-29, pctypeid IS NOT NULL)
printers table (separate - by design)
Network devices (Phase 3 will migrate):
- servers, switches, cameras, accesspoints, idfs
- Will become machinetypeid 30-36 in machines table
```
### Key Accomplishments (Oct-Nov 2025)
- Consolidated PCs into unified `machines` table (277 PCs migrated)
- Created `communications` table for all network interfaces (705+ records)
- Created `machinerelationships` table for PC/equipment relationships
- Modernized all PC pages (displaypcs, displaypc, editpc)
- Fixed 36+ API bugs for PowerShell data collection
- Added compliance and warranty tracking infrastructure
- Implemented network map for all device types
---
## Documentation Overview
### 📘 For New Team Members
### For New Team Members
**Start here in this order:**
1. **[QUICK_REFERENCE.md](QUICK_REFERENCE.md)** ⭐ START HERE
- Quick facts, common tasks, cheat sheets
- Perfect for daily reference
- **Time to read:** 15 minutes
1. **[QUICK_REFERENCE.md](QUICK_REFERENCE.md)** - Quick facts, common tasks, cheat sheets (15 min)
2. **[GIT_WORKFLOW.md](GIT_WORKFLOW.md)** 🔧 MANDATORY
- Git workflow and commit standards
- How to commit and push changes
- **MUST READ before making any code changes**
- **Time to read:** 20 minutes
2. **[ASP_DEVELOPMENT_GUIDE.md](ASP_DEVELOPMENT_GUIDE.md)** - Dev environment setup, VBScript patterns (30 min)
3. **[ASP_DEVELOPMENT_GUIDE.md](ASP_DEVELOPMENT_GUIDE.md)**
- Development environment setup
- How to start/stop the dev environment
- VBScript/ASP basics and patterns
- **Time to read:** 30 minutes
3. **[STANDARDS.md](STANDARDS.md)** - Coding standards, security requirements (45 min)
4. **[DEEP_DIVE_REPORT.md](DEEP_DIVE_REPORT.md)** 📚 COMPREHENSIVE
- Complete database schema documentation
- Application architecture deep dive
- Data flows and workflows
- Technical debt analysis
- Recommendations and roadmap
- **Time to read:** 2-3 hours (reference material)
4. **[DEEP_DIVE_REPORT.md](DEEP_DIVE_REPORT.md)** - Complete database/architecture docs (reference)
5. **[STANDARDS.md](STANDARDS.md)** ⚠️ MANDATORY
- Coding standards (MUST follow)
- Security requirements
- Database access patterns
- Input validation rules
- Error handling standards
- **Time to read:** 45 minutes
6. **[NESTED_ENTITY_CREATION.md](NESTED_ENTITY_CREATION.md)**
- How to create complex forms
- Nested entity management (e.g., add printer + create new model inline)
- **Time to read:** 20 minutes
7. **[GIT_SETUP_GUIDE.md](GIT_SETUP_GUIDE.md)**
- Setting up Gitea (Git server with web UI)
- SSH key configuration
- First-time Git setup
- **Time to read:** 30 minutes (one-time setup)
8. **[GITEA_FEATURES_GUIDE.md](GITEA_FEATURES_GUIDE.md)**
- Using Gitea Projects (Kanban boards)
- Issue tracking and bug management
- Wiki for collaborative documentation
- Pull requests and code review
- Milestones and releases
- **Time to read:** 45 minutes
5. **[NESTED_ENTITY_CREATION.md](NESTED_ENTITY_CREATION.md)** - Complex forms, inline entity creation (20 min)
---
## Quick Navigation
## Migration Documentation
### By Role
### Phase 1 & 2 (Complete)
**Developers:**
1. Read: QUICK_REFERENCE.md
2. **MANDATORY: GIT_WORKFLOW.md** ⚠️
3. Setup: ASP_DEVELOPMENT_GUIDE.md, GIT_SETUP_GUIDE.md
4. Standards: STANDARDS.md
5. Deep dive: DEEP_DIVE_REPORT.md (sections 2, 3, 6)
6. Advanced: NESTED_ENTITY_CREATION.md
7. Project Management: GITEA_FEATURES_GUIDE.md
| Document | Description |
|----------|-------------|
| [DATABASE_MIGRATION_FINAL_DESIGN.md](DATABASE_MIGRATION_FINAL_DESIGN.md) | Complete Phase 1 specification |
| [MIGRATION_QUICK_REFERENCE.md](MIGRATION_QUICK_REFERENCE.md) | Quick lookup for migration |
| [PC_MACHINES_CONSOLIDATION_PLAN.md](PC_MACHINES_CONSOLIDATION_PLAN.md) | Phase 2 PC migration plan |
| [MACHINE_RELATIONSHIPS_EXAMPLES.md](MACHINE_RELATIONSHIPS_EXAMPLES.md) | Relationship query patterns |
**Database Administrators:**
1. Read: QUICK_REFERENCE.md (Database section)
2. Read: DEEP_DIVE_REPORT.md (Section 1: Database Architecture)
3. Review: STANDARDS.md (Database Access Standards)
4. Reference: SQL queries in QUICK_REFERENCE.md
### Phase 3 (Planned)
**System Administrators:**
1. Read: ASP_DEVELOPMENT_GUIDE.md (Prerequisites, Troubleshooting)
2. Read: DEEP_DIVE_REPORT.md (Section 7.3: For System Administrators)
3. Reference: QUICK_REFERENCE.md (Common Tasks)
**Business Analysts:**
1. Read: DEEP_DIVE_REPORT.md (Executive Summary, Section 1, Section 7.4)
2. Reference: QUICK_REFERENCE.md (Key Views, SQL Queries)
**Project Managers:**
1. Read: DEEP_DIVE_REPORT.md (Executive Summary, Section 4: Technical Debt, Section 6: Recommendations)
2. Read: GITEA_FEATURES_GUIDE.md (Projects, Issues, Milestones, Releases)
| Document | Description |
|----------|-------------|
| [PHASE3_NETWORK_DEVICES_MIGRATION_PLAN.md](PHASE3_NETWORK_DEVICES_MIGRATION_PLAN.md) | Network devices migration plan |
---
## By Topic
## Core Documentation
### Standards & Development
| Document | Purpose | Status |
|----------|---------|--------|
| [STANDARDS.md](STANDARDS.md) | Coding standards, security | Current |
| [ASP_DEVELOPMENT_GUIDE.md](ASP_DEVELOPMENT_GUIDE.md) | Dev setup, patterns | Current |
| [QUICK_REFERENCE.md](QUICK_REFERENCE.md) | Cheat sheets | Current |
| [NESTED_ENTITY_CREATION.md](NESTED_ENTITY_CREATION.md) | Complex forms | Current |
### Architecture & Design
| Document | Purpose | Status |
|----------|---------|--------|
| [DEEP_DIVE_REPORT.md](DEEP_DIVE_REPORT.md) | Complete system documentation | Current |
| [INFRASTRUCTURE_FINAL_ARCHITECTURE.md](INFRASTRUCTURE_FINAL_ARCHITECTURE.md) | Infrastructure design | Current |
| [NETWORK_DEVICES_UNIFIED_DESIGN.md](NETWORK_DEVICES_UNIFIED_DESIGN.md) | Network unification design | Current |
---
## SQL Migration Scripts
All migration scripts are in `/sql/migration_phase*/` folders:
```
sql/
├── migration_phase1/ # Schema changes (8 scripts + rollbacks)
├── migration_phase2/ # PC data migration (8 scripts)
├── migration_phase3/ # Network devices (planned)
└── *.sql # Utility scripts
```
---
## Quick Start
### Dev Environment
```bash
# Start dev environment
~/start-dev-env.sh
# Check status
~/status-dev-env.sh
# Access application
http://192.168.122.151:8080
```
### Git (Gitea)
```bash
# Gitea web UI
http://localhost:3000
# Clone repo
git clone ssh://git@localhost:2222/cproudlock/shopdb.git
```
### Database
- **Schema Overview:** DEEP_DIVE_REPORT.md → Section 1
- **Quick Reference:** QUICK_REFERENCE.md → Core Tables Cheat Sheet
- **Access Patterns:** STANDARDS.md → Database Access Standards
- **Views:** DEEP_DIVE_REPORT.md → Section 1.3
- **Sample Queries:** QUICK_REFERENCE.md → Useful SQL Queries
### Development
- **Git Workflow:** GIT_WORKFLOW.md → Complete workflow guide ⚠️ MANDATORY
- **Git Setup:** GIT_SETUP_GUIDE.md → Gitea installation and SSH keys
- **Project Management:** GITEA_FEATURES_GUIDE.md → Issues, Projects, Wiki, PRs
- **Setup Environment:** ASP_DEVELOPMENT_GUIDE.md → Project Setup
- **Coding Patterns:** ASP_DEVELOPMENT_GUIDE.md → Common VBScript/ASP Patterns
- **Standards:** STANDARDS.md → All sections
- **Quick Reference:** QUICK_REFERENCE.md → Key VBScript Patterns
```bash
# Connect to MySQL
docker exec -it dev-mysql mysql -u root -prootpassword shopdb
### Architecture
- **Overview:** DEEP_DIVE_REPORT.md → Section 2
- **File Structure:** DEEP_DIVE_REPORT.md → Section 2.2
- **Data Flows:** DEEP_DIVE_REPORT.md → Section 3
- **Diagrams:** DEEP_DIVE_REPORT.md → Sections 9, 10
### Security
- **Standards:** STANDARDS.md → Security Standards
- **Issues:** DEEP_DIVE_REPORT.md → Section 4.1
- **Checklist:** QUICK_REFERENCE.md → Security Checklist
### Troubleshooting
- **Dev Environment:** ASP_DEVELOPMENT_GUIDE.md → Troubleshooting
- **Quick Fixes:** QUICK_REFERENCE.md → Troubleshooting
- **Common Issues:** DEEP_DIVE_REPORT.md → Section 4
# Quick queries
SELECT COUNT(*) FROM machines WHERE pctypeid IS NOT NULL; -- PCs
SELECT COUNT(*) FROM machines WHERE pctypeid IS NULL; -- Equipment
SELECT COUNT(*) FROM printers WHERE isactive = 1; -- Printers
```
---
## Document Maintenance
## Key Database Tables
### When to Update
### Core Tables (Phase 2 Schema)
**QUICK_REFERENCE.md:**
- New common task identified
- New frequently-used query
- New troubleshooting tip
| Table | Purpose | Records |
|-------|---------|---------|
| `machines` | All equipment + PCs | 500+ |
| `communications` | Network interfaces | 700+ |
| `machinerelationships` | PC/equipment links | 50+ |
| `printers` | Printers (separate) | 200+ |
| `warranties` | Warranty tracking | var |
| `compliance` | Compliance data | var |
**ASP_DEVELOPMENT_GUIDE.md:**
- Development environment changes
- New tools or dependencies
- Setup process changes
### Key Views
**DEEP_DIVE_REPORT.md:**
- Major schema changes
- New features added
- Architecture changes
- Quarterly review updates
**STANDARDS.md:**
- New coding standards adopted
- Security policy changes
- New validation patterns
- New error codes
**NESTED_ENTITY_CREATION.md:**
- New nested entity patterns
- Complex form examples
### How to Update
1. **Small Updates:** Edit the file directly, commit to Git (once setup)
2. **Major Updates:** Create a copy, edit, have peer review, then replace
3. **Always Update:** "Last Updated" date at bottom of each file
4. **Document Changes:** Note what changed in Git commit message
| View | Purpose |
|------|---------|
| `vw_network_devices` | All network devices unified |
| `vw_active_pcs` | Active PCs with details |
| `vw_machine_relationships` | Relationship summary |
---
## Document Status
## Recent Session Summaries
| Document | Last Updated | Status | Review Cycle |
|----------|--------------|--------|--------------|
| QUICK_REFERENCE.md | 2025-10-20 | ✅ Current | As needed |
| GIT_WORKFLOW.md | 2025-10-20 | ✅ Current | Quarterly |
| GIT_SETUP_GUIDE.md | 2025-10-20 | ✅ Current | Annually |
| GITEA_FEATURES_GUIDE.md | 2025-10-20 | ✅ Current | Quarterly |
| ASP_DEVELOPMENT_GUIDE.md | 2025-10-10 | ✅ Current | Quarterly |
| DEEP_DIVE_REPORT.md | 2025-10-20 | ✅ Current | Quarterly |
| STANDARDS.md | 2025-10-10 | ✅ Current | Semi-annually |
| NESTED_ENTITY_CREATION.md | 2025-10-10 | ✅ Current | Annually |
| README.md (this file) | 2025-10-20 | ✅ Current | As needed |
Located in project root:
---
## Quick Start for New Developers
### Day 1 Checklist
- [ ] Read QUICK_REFERENCE.md (15 min)
- [ ] **Read GIT_WORKFLOW.md (20 min) - MANDATORY** ⚠️
- [ ] Follow ASP_DEVELOPMENT_GUIDE.md to setup environment (1-2 hours)
- [ ] Verify Git repository is initialized
- [ ] Browse application at http://192.168.122.151:8080
- [ ] Read STANDARDS.md (45 min)
- [ ] Make a test edit, commit, and push to Git
### Week 1 Checklist
- [ ] Read DEEP_DIVE_REPORT.md Executive Summary
- [ ] Read DEEP_DIVE_REPORT.md Section 1 (Database)
- [ ] Read DEEP_DIVE_REPORT.md Section 2 (Architecture)
- [ ] Read GITEA_FEATURES_GUIDE.md (Issues, Projects, Wiki)
- [ ] Create your first issue in Gitea
- [ ] Explore all display*.asp pages
- [ ] Run sample SQL queries from QUICK_REFERENCE.md
- [ ] Understand PC-to-machine assignment logic
### Month 1 Checklist
- [ ] Complete DEEP_DIVE_REPORT.md
- [ ] Implement a small feature end-to-end
- [ ] Review NESTED_ENTITY_CREATION.md
- [ ] Contribute a documentation improvement
- [ ] Pair program with experienced team member
---
## External Resources
### Classic ASP / VBScript
- [Microsoft ASP Reference](https://learn.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms525334(v=vs.90))
- [VBScript Language Reference](https://learn.microsoft.com/en-us/previous-versions//d1wf56tt(v=vs.85))
- [W3Schools ASP Tutorial](https://www.w3schools.com/asp/)
### MySQL
- [MySQL 5.6 Reference Manual](https://dev.mysql.com/doc/refman/5.6/en/)
- [MySQL FULLTEXT Search](https://dev.mysql.com/doc/refman/5.6/en/fulltext-search.html)
- [MySQL Performance Tuning](https://dev.mysql.com/doc/refman/5.6/en/optimization.html)
### Frontend
- [Bootstrap 4.6 Documentation](https://getbootstrap.com/docs/4.6/)
- [jQuery Documentation](https://api.jquery.com/)
- [Material Design Iconic Font](https://zavoloklom.github.io/material-design-iconic-font/)
- [FullCalendar v3](https://fullcalendar.io/docs/v3)
- [DataTables](https://datatables.net/)
| File | Date | Focus |
|------|------|-------|
| SESSION_SUMMARY_2025-11-13.md | Nov 13 | Phase 2 testing, network_map fixes |
| SESSION_SUMMARY_2025-11-10.md | Nov 10 | Relationship fixes, Phase 3 planning |
---
## Getting Help
### Documentation Issues
- Document unclear? Create an issue or update it yourself!
- Found an error? Fix it and commit
- Missing information? Add it!
### Technical Questions
- Check QUICK_REFERENCE.md first
- Search DEEP_DIVE_REPORT.md
- Ask team lead
- Create documentation if answer isn't documented
### Code Questions
- Review STANDARDS.md
- Check ASP_DEVELOPMENT_GUIDE.md for patterns
- Look at similar existing code
- Ask for code review
---
## Contributing to Documentation
We encourage all team members to improve documentation!
### Guidelines
1. **Be Clear** - Write for someone who doesn't know the system
2. **Be Concise** - Respect the reader's time
3. **Be Accurate** - Test commands/code before documenting
4. **Be Current** - Update dates when you edit
5. **Be Helpful** - Include examples and context
### What to Document
- Solutions to problems you encountered
- Common tasks you perform
- Tricky patterns or gotchas
- New features or changes
- Helpful queries or scripts
### How to Contribute
1. Edit the relevant .md file
2. Update "Last Updated" date
3. Commit with descriptive message
4. (Optional) Have peer review for major changes
1. Check [QUICK_REFERENCE.md](QUICK_REFERENCE.md) first
2. Search [DEEP_DIVE_REPORT.md](DEEP_DIVE_REPORT.md)
3. Review [STANDARDS.md](STANDARDS.md) for coding questions
4. Check session summaries for recent changes
---
## Version History
**v1.3** - 2025-10-20
- Added GIT_WORKFLOW.md (mandatory Git workflow documentation)
- Added GIT_SETUP_GUIDE.md (Gitea setup guide)
- Updated README.md with Git workflow references
- Established mandatory commit-after-every-change policy
**v1.2** - 2025-10-20
- Added DEEP_DIVE_REPORT.md (comprehensive technical report)
- Added QUICK_REFERENCE.md (cheat sheets)
- Added this README.md
- Updated ASP_DEVELOPMENT_GUIDE.md with documentation references
**v1.1** - 2025-10-10
- Added STANDARDS.md (coding standards)
- Added NESTED_ENTITY_CREATION.md
- Updated ASP_DEVELOPMENT_GUIDE.md
**v1.0** - 2025-10-09
- Initial ASP_DEVELOPMENT_GUIDE.md created
---
## Future Documentation Plans
- [ ] API Documentation (when APIs expand)
- [ ] Deployment Guide (CI/CD pipeline)
- [ ] Security Audit Report
- [ ] Performance Optimization Guide
- [ ] Testing Guide (when tests implemented)
- [ ] Video tutorials (screen recordings)
- [ ] FAQ document
- [ ] Glossary of GE-specific terms
| Version | Date | Changes |
|---------|------|---------|
| v2.0 | 2025-11-25 | Updated for Phase 2 completion, cleanup |
| v1.3 | 2025-10-20 | Added Git workflow documentation |
| v1.2 | 2025-10-20 | Added DEEP_DIVE_REPORT, QUICK_REFERENCE |
| v1.1 | 2025-10-10 | Added STANDARDS, NESTED_ENTITY_CREATION |
| v1.0 | 2025-10-09 | Initial ASP_DEVELOPMENT_GUIDE |
---
**Maintained By:** Development Team
**Questions?** Ask team lead or update docs directly
**Feedback?** Create issue or improve the docs yourself!
---
## Summary
You now have comprehensive documentation covering:
**Quick Reference** - Daily cheat sheet
**Git Workflow** - Mandatory version control workflow ⚠️
**Development Guide** - Environment setup
**Deep Dive Report** - Complete technical documentation
**Standards** - Mandatory coding rules
**Advanced Patterns** - Complex forms
**Start with QUICK_REFERENCE.md, then read GIT_WORKFLOW.md before making any code changes!**
Happy coding! 🚀
**Last Updated:** 2025-11-25