fix: Sidebar toggle positioning and documentation updates

- Fix collapsible sidebar toggle button positioning (moved outside sidebar)
- Toggle button now stays visible when sidebar is collapsed
- Update cache busting version
- Update Claude.md with new features documentation
- Update README.md with new features documentation
- Remove migrations folder (no longer needed)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-23 10:39:55 -05:00
parent b8a987e4c6
commit 380b0e1adf
6 changed files with 129 additions and 218 deletions

192
Claude.md
View File

@@ -2,30 +2,18 @@
## Project Status (January 2026)
**Current Phase**: All core features implemented. ANSI Art terminal redesign complete. System is production-ready.
**Current Phase**: All core features implemented. System is production-ready.
**Completed Features**:
- Activity Timeline (Feature 1)
- Ticket Assignment (Feature 2)
- ✅ Status Transitions with Workflows (Feature 3)
- ✅ Ticket Templates (Feature 4)
- ✅ Bulk Actions - Admin Only (Feature 5)
- ✅ ANSI Art Terminal Redesign
- ✅ File Attachments
- ✅ Ticket Dependencies
- @Mentions in Comments
- ✅ Recurring Tickets
- ✅ Custom Fields
- ✅ Advanced Search with Saved Filters
- ✅ Export to CSV/JSON
- ✅ Admin Pages (Templates, Workflow, Recurring, Custom Fields, User Activity, Audit Log)
**Recent Updates** (January 2026):
- Added admin dropdown navigation in dashboard header
- Fixed template/recurring ticket modals (larger size, type/assignee fields)
- Made dashboard stat cards clickable for quick filtering
- Fixed table overflow on dashboard
- Improved error handling for ticket dependencies API
- Activity Timeline, Ticket Assignment, Status Transitions with Workflows
- Ticket Templates, Bulk Actions (Admin Only)
- File Attachments, Ticket Dependencies, @Mentions in Comments
- Recurring Tickets, Custom Fields, Advanced Search with Saved Filters
- Export to CSV/JSON, API Key Management
- Ticket Visibility Levels (public/internal/confidential)
- Collapsible Sidebar, Kanban Card View, Inline Ticket Preview
- Mobile Responsive Design, Ticket Linking in Comments
- Admin Pages (Templates, Workflow, Recurring, Custom Fields, User Activity, Audit Log, API Keys)
## Project Overview
@@ -37,7 +25,6 @@ Tinker Tickets is a feature-rich, self-hosted ticket management system built for
- Database: MariaDB on separate LXC (10.10.10.50)
- Web Server: Apache on production (10.10.10.45)
- Authentication: Authelia SSO with LLDAP backend
- External Libraries: marked.js (Markdown rendering)
**Production Environment:**
- **Primary URL**: http://t.lotusguild.org
@@ -64,11 +51,13 @@ Controllers → Models → Database
│ ├── check_duplicates.php # GET: Check for duplicate tickets
│ ├── delete_attachment.php # POST/DELETE: Delete attachment
│ ├── export_tickets.php # GET: Export tickets to CSV/JSON
│ ├── generate_api_key.php # POST: Generate API key (admin)
│ ├── get_template.php # GET: Fetch ticket template
│ ├── get_users.php # GET: Get user list
│ ├── manage_recurring.php # CRUD: Recurring tickets (admin)
│ ├── manage_templates.php # CRUD: Templates (admin)
│ ├── manage_workflows.php # CRUD: Workflow rules (admin)
│ ├── revoke_api_key.php # POST: Revoke API key (admin)
│ ├── ticket_dependencies.php # GET/POST/DELETE: Ticket dependencies
│ ├── update_ticket.php # POST: Update ticket (workflow validation)
│ └── upload_attachment.php # GET/POST: List or upload attachments
@@ -79,11 +68,11 @@ Controllers → Models → Database
│ ├── js/
│ │ ├── advanced-search.js # Advanced search modal
│ │ ├── ascii-banner.js # ASCII art banner
│ │ ├── dashboard.js # Dashboard + bulk actions + templates
│ │ ├── dashboard.js # Dashboard + bulk actions + kanban + sidebar
│ │ ├── keyboard-shortcuts.js # Keyboard shortcuts
│ │ ├── markdown.js # Markdown rendering
│ │ ├── markdown.js # Markdown rendering + ticket linking
│ │ ├── settings.js # User preferences
│ │ ├── ticket.js # Ticket + comments + assignment
│ │ ├── ticket.js # Ticket + comments + visibility
│ │ └── toast.js # Toast notifications
│ └── images/
│ └── favicon.png
@@ -91,7 +80,7 @@ Controllers → Models → Database
│ └── config.php # Config + .env loading
├── controllers/
│ ├── DashboardController.php # Dashboard with stats + filters
│ └── TicketController.php # Ticket CRUD + timeline + templates
│ └── TicketController.php # Ticket CRUD + timeline + visibility
├── cron/
│ └── create_recurring_tickets.php # Process recurring ticket schedules
├── helpers/
@@ -102,6 +91,7 @@ Controllers → Models → Database
│ ├── RateLimitMiddleware.php # API rate limiting
│ └── SecurityHeadersMiddleware.php # Security headers
├── models/
│ ├── ApiKeyModel.php # API key generation/validation
│ ├── AuditLogModel.php # Audit logging + timeline
│ ├── BulkOperationsModel.php # Bulk operations tracking
│ ├── CommentModel.php # Comment data access
@@ -110,8 +100,8 @@ Controllers → Models → Database
│ ├── RecurringTicketModel.php # Recurring ticket schedules
│ ├── StatsModel.php # Dashboard statistics
│ ├── TemplateModel.php # Ticket templates
│ ├── TicketModel.php # Ticket CRUD + assignment
│ ├── UserModel.php # User management
│ ├── TicketModel.php # Ticket CRUD + assignment + visibility
│ ├── UserModel.php # User management + groups
│ ├── UserPreferencesModel.php # User preferences
│ └── WorkflowModel.php # Status transition workflows
├── scripts/
@@ -119,15 +109,16 @@ Controllers → Models → Database
├── uploads/ # File attachment storage
├── views/
│ ├── admin/
│ │ ├── ApiKeysView.php # API key management
│ │ ├── AuditLogView.php # Audit log browser
│ │ ├── CustomFieldsView.php # Custom field management
│ │ ├── RecurringTicketsView.php # Recurring ticket management
│ │ ├── TemplatesView.php # Template management
│ │ ├── UserActivityView.php # User activity report
│ │ └── WorkflowDesignerView.php # Workflow transition designer
│ ├── CreateTicketView.php # Ticket creation with templates
│ ├── DashboardView.php # Dashboard with stats + bulk actions
│ └── TicketView.php # Ticket view with timeline + assignment
│ ├── CreateTicketView.php # Ticket creation with visibility
│ ├── DashboardView.php # Dashboard with kanban + sidebar
│ └── TicketView.php # Ticket view with visibility editing
├── .env # Environment variables (GITIGNORED)
├── Claude.md # This file
├── README.md # User documentation
@@ -146,20 +137,20 @@ All admin pages are accessible via the **Admin dropdown** in the dashboard heade
| `/admin/custom-fields` | Define custom fields per category |
| `/admin/user-activity` | View per-user activity statistics |
| `/admin/audit-log` | Browse all audit log entries |
| `/admin/api-keys` | Generate and manage API keys |
## Database Schema
**Database**: `ticketing_system` at 10.10.10.50
**User**: `tinkertickets`
**Connection**: All APIs create their own connections via config.php
### Core Tables
- `tickets` - Core ticket data with assignment
- `tickets` - Core ticket data with assignment and visibility
- `ticket_comments` - Markdown-supported comments
- `ticket_attachments` - File attachment metadata
- `ticket_dependencies` - Ticket relationships (blocks/blocked_by/relates_to/duplicates)
- `users` - User accounts synced from LLDAP
- `ticket_dependencies` - Ticket relationships
- `users` - User accounts synced from LLDAP (includes groups)
- `user_preferences` - User settings and preferences
- `audit_log` - Complete audit trail
- `status_transitions` - Workflow configuration
@@ -169,125 +160,56 @@ All admin pages are accessible via the **Admin dropdown** in the dashboard heade
- `custom_field_values` - Custom field data per ticket
- `saved_filters` - User-saved dashboard filters
- `bulk_operations` - Bulk operation tracking
- `api_keys` - API key storage with hashes
## API Endpoints
### Authentication
All API endpoints check: `$_SESSION['user']['user_id']` for authentication.
Admin-only endpoints check: `$_SESSION['user']['is_admin']`.
### Core Endpoints
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/update_ticket.php` | POST | Update ticket with workflow validation |
| `/api/assign_ticket.php` | POST | Assign ticket to user |
| `/api/add_comment.php` | POST | Add comment to ticket |
| `/api/get_template.php` | GET | Fetch ticket template |
| `/api/get_users.php` | GET | Get user list for assignments |
| `/api/bulk_operation.php` | POST | Perform bulk operations (admin) |
| `/api/ticket_dependencies.php` | GET/POST/DELETE | Manage ticket dependencies |
| `/api/upload_attachment.php` | GET/POST | List or upload attachments |
| `/api/delete_attachment.php` | POST/DELETE | Delete attachment |
| `/api/export_tickets.php` | GET | Export tickets to CSV/JSON |
| `/api/check_duplicates.php` | GET | Check for duplicate tickets |
### Ticket Visibility Columns
- `visibility` - ENUM('public', 'internal', 'confidential')
- `visibility_groups` - VARCHAR(500) comma-separated group names
## Dashboard Features
- **Stats Widgets**: Clickable cards for quick filtering (Open, Critical, Unassigned, Created Today, Closed Today)
- **Admin Dropdown**: Quick access to all admin pages
- **View Toggle**: Switch between Table view and Kanban card view
- **Collapsible Sidebar**: Click arrow to collapse/expand filter sidebar
- **Stats Widgets**: Clickable cards for quick filtering
- **Inline Ticket Preview**: Hover over ticket IDs for 300ms to see preview popup
- **Sortable Columns**: Click headers to sort
- **Advanced Search**: Date ranges, priority ranges, user filters
- **Saved Filters**: Save and load custom filter combinations
- **Bulk Actions** (admin): Select multiple tickets for bulk close/assign/priority/status
- **Bulk Actions** (admin): Select multiple tickets for bulk operations
- **Export**: Export selected tickets to CSV or JSON
- **Left Sidebar**: Status, Category, Type filters
## Terminal UI Design
## Ticket Visibility Levels
The application uses a retro terminal aesthetic with:
- **Box-drawing characters**: ╔═╗║╚═╝┌─┐│└─┘
- **Monospace fonts**: Courier New, Consolas, Monaco
- **Terminal colors**: Green (#00ff41), Amber (#ffb000), Cyan (#00ffff)
- **CRT effects**: Scanlines, subtle flicker
- **Glow effects**: Text shadows for terminal phosphor look
- **ASCII art**: Boot sequence, empty states, headers
## Configuration
### Environment Variables (`.env`)
```ini
DB_HOST=10.10.10.50
DB_USER=tinkertickets
DB_PASS=password
DB_NAME=ticketing_system
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
```
**CRITICAL**: `.env` is gitignored! Never commit this file.
## Deployment
### Git Auto-Deploy
**Repository**: https://code.lotusguild.org/LotusGuild/tinker_tickets
**Flow**:
1. Push to `main` branch
2. Auto-deploys to `/root/code/tinker_tickets` on 10.10.10.45
3. `.env` is preserved
## Development Guidelines
### Code Style
- **PHP**: Tabs for indentation, prepared statements, `htmlspecialchars()` for output
- **JavaScript**: Vanilla JS, `fetch()` for AJAX, clear function names
- **CSS**: CSS variables for theming, mobile-responsive
- **Security**: No SQL injection, XSS prevention, session validation
### Error Handling
- APIs return JSON with `{success: bool, error: string}`
- Debug logging to `/tmp/api_debug.log`
- User-friendly error messages
### Adding New Features
1. **Model**: Add methods to relevant Model class
2. **API**: Create API endpoint in `api/` (with auth check)
3. **Controller**: Update controller to load data
4. **View**: Add UI elements
5. **JavaScript**: Add interactivity
6. **CSS**: Style with terminal aesthetic
7. **Test**: Test thoroughly before pushing
- **Public**: All authenticated users can view
- **Internal**: Only users in specified groups can view
- **Confidential**: Only creator, assignee, and admins can view
## Important Notes for AI Assistants
1. **All features are complete and deployed**
2. **Terminal UI redesign is complete** - maintain the aesthetic
3. **Database at 10.10.10.50**, can't access directly from dev machine
4. **Auto-deploy is active**, test carefully before pushing
5. **Session format**: `$_SESSION['user']['user_id']` (not `$_SESSION['user_id']`)
6. **API auth**: Check `$_SESSION['user']['user_id']` exists
7. **Admin check**: `$_SESSION['user']['is_admin'] ?? false`
8. **Config path**: `config/config.php` (not `config/db.php`)
9. **Comments table**: `ticket_comments` (not `comments`)
10. **CSRF**: Required for POST/DELETE requests via `X-CSRF-Token` header
1. **Session format**: `$_SESSION['user']['user_id']` (not `$_SESSION['user_id']`)
2. **API auth**: Check `$_SESSION['user']['user_id']` exists
3. **Admin check**: `$_SESSION['user']['is_admin'] ?? false`
4. **Config path**: `config/config.php` (not `config/db.php`)
5. **Comments table**: `ticket_comments` (not `comments`)
6. **CSRF**: Required for POST/DELETE requests via `X-CSRF-Token` header
7. **Cache busting**: Use `?v=YYYYMMDD` query params on JS/CSS files
8. **Ticket linking**: Use `#123456789` in markdown-enabled comments
9. **User groups**: Stored in `users.groups` as comma-separated values
## File Reference Quick Guide
| File | Purpose |
|------|---------|
| `index.php` | Main router for all routes |
| `api/update_ticket.php` | Ticket updates with workflow validation |
| `api/ticket_dependencies.php` | Manage ticket dependencies |
| `models/TicketModel.php` | Ticket CRUD, assignment, filtering |
| `models/WorkflowModel.php` | Status transition validation |
| `models/DependencyModel.php` | Ticket dependency management |
| `controllers/DashboardController.php` | Dashboard logic, stats, filters |
| `assets/js/dashboard.js` | Dashboard UI, bulk actions, templates |
| `assets/js/ticket.js` | Ticket UI, comments, assignment |
| `assets/css/dashboard.css` | Terminal styling, layout, components |
| `api/update_ticket.php` | Ticket updates with workflow + visibility |
| `models/TicketModel.php` | Ticket CRUD, visibility filtering |
| `models/ApiKeyModel.php` | API key generation and validation |
| `assets/js/dashboard.js` | Dashboard UI, kanban, sidebar, bulk actions |
| `assets/js/ticket.js` | Ticket UI, visibility editing |
| `assets/js/markdown.js` | Markdown parsing + ticket linking |
| `assets/css/dashboard.css` | Terminal styling, kanban, sidebar |
## Repository & Contact
## Repository
- **Gitea**: https://code.lotusguild.org/LotusGuild/tinker_tickets
- **Production**: http://t.lotusguild.org
- **Infrastructure**: LotusGuild data center management