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) ## 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**: **Completed Features**:
- Activity Timeline (Feature 1) - Activity Timeline, Ticket Assignment, Status Transitions with Workflows
- Ticket Assignment (Feature 2) - Ticket Templates, Bulk Actions (Admin Only)
- ✅ Status Transitions with Workflows (Feature 3) - File Attachments, Ticket Dependencies, @Mentions in Comments
- ✅ Ticket Templates (Feature 4) - Recurring Tickets, Custom Fields, Advanced Search with Saved Filters
- ✅ Bulk Actions - Admin Only (Feature 5) - Export to CSV/JSON, API Key Management
- ✅ ANSI Art Terminal Redesign - Ticket Visibility Levels (public/internal/confidential)
- ✅ File Attachments - Collapsible Sidebar, Kanban Card View, Inline Ticket Preview
- ✅ Ticket Dependencies - Mobile Responsive Design, Ticket Linking in Comments
- @Mentions in Comments - Admin Pages (Templates, Workflow, Recurring, Custom Fields, User Activity, Audit Log, API Keys)
- ✅ 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
## Project Overview ## 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) - Database: MariaDB on separate LXC (10.10.10.50)
- Web Server: Apache on production (10.10.10.45) - Web Server: Apache on production (10.10.10.45)
- Authentication: Authelia SSO with LLDAP backend - Authentication: Authelia SSO with LLDAP backend
- External Libraries: marked.js (Markdown rendering)
**Production Environment:** **Production Environment:**
- **Primary URL**: http://t.lotusguild.org - **Primary URL**: http://t.lotusguild.org
@@ -64,11 +51,13 @@ Controllers → Models → Database
│ ├── check_duplicates.php # GET: Check for duplicate tickets │ ├── check_duplicates.php # GET: Check for duplicate tickets
│ ├── delete_attachment.php # POST/DELETE: Delete attachment │ ├── delete_attachment.php # POST/DELETE: Delete attachment
│ ├── export_tickets.php # GET: Export tickets to CSV/JSON │ ├── 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_template.php # GET: Fetch ticket template
│ ├── get_users.php # GET: Get user list │ ├── get_users.php # GET: Get user list
│ ├── manage_recurring.php # CRUD: Recurring tickets (admin) │ ├── manage_recurring.php # CRUD: Recurring tickets (admin)
│ ├── manage_templates.php # CRUD: Templates (admin) │ ├── manage_templates.php # CRUD: Templates (admin)
│ ├── manage_workflows.php # CRUD: Workflow rules (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 │ ├── ticket_dependencies.php # GET/POST/DELETE: Ticket dependencies
│ ├── update_ticket.php # POST: Update ticket (workflow validation) │ ├── update_ticket.php # POST: Update ticket (workflow validation)
│ └── upload_attachment.php # GET/POST: List or upload attachments │ └── upload_attachment.php # GET/POST: List or upload attachments
@@ -79,11 +68,11 @@ Controllers → Models → Database
│ ├── js/ │ ├── js/
│ │ ├── advanced-search.js # Advanced search modal │ │ ├── advanced-search.js # Advanced search modal
│ │ ├── ascii-banner.js # ASCII art banner │ │ ├── ascii-banner.js # ASCII art banner
│ │ ├── dashboard.js # Dashboard + bulk actions + templates │ │ ├── dashboard.js # Dashboard + bulk actions + kanban + sidebar
│ │ ├── keyboard-shortcuts.js # Keyboard shortcuts │ │ ├── keyboard-shortcuts.js # Keyboard shortcuts
│ │ ├── markdown.js # Markdown rendering │ │ ├── markdown.js # Markdown rendering + ticket linking
│ │ ├── settings.js # User preferences │ │ ├── settings.js # User preferences
│ │ ├── ticket.js # Ticket + comments + assignment │ │ ├── ticket.js # Ticket + comments + visibility
│ │ └── toast.js # Toast notifications │ │ └── toast.js # Toast notifications
│ └── images/ │ └── images/
│ └── favicon.png │ └── favicon.png
@@ -91,7 +80,7 @@ Controllers → Models → Database
│ └── config.php # Config + .env loading │ └── config.php # Config + .env loading
├── controllers/ ├── controllers/
│ ├── DashboardController.php # Dashboard with stats + filters │ ├── DashboardController.php # Dashboard with stats + filters
│ └── TicketController.php # Ticket CRUD + timeline + templates │ └── TicketController.php # Ticket CRUD + timeline + visibility
├── cron/ ├── cron/
│ └── create_recurring_tickets.php # Process recurring ticket schedules │ └── create_recurring_tickets.php # Process recurring ticket schedules
├── helpers/ ├── helpers/
@@ -102,6 +91,7 @@ Controllers → Models → Database
│ ├── RateLimitMiddleware.php # API rate limiting │ ├── RateLimitMiddleware.php # API rate limiting
│ └── SecurityHeadersMiddleware.php # Security headers │ └── SecurityHeadersMiddleware.php # Security headers
├── models/ ├── models/
│ ├── ApiKeyModel.php # API key generation/validation
│ ├── AuditLogModel.php # Audit logging + timeline │ ├── AuditLogModel.php # Audit logging + timeline
│ ├── BulkOperationsModel.php # Bulk operations tracking │ ├── BulkOperationsModel.php # Bulk operations tracking
│ ├── CommentModel.php # Comment data access │ ├── CommentModel.php # Comment data access
@@ -110,8 +100,8 @@ Controllers → Models → Database
│ ├── RecurringTicketModel.php # Recurring ticket schedules │ ├── RecurringTicketModel.php # Recurring ticket schedules
│ ├── StatsModel.php # Dashboard statistics │ ├── StatsModel.php # Dashboard statistics
│ ├── TemplateModel.php # Ticket templates │ ├── TemplateModel.php # Ticket templates
│ ├── TicketModel.php # Ticket CRUD + assignment │ ├── TicketModel.php # Ticket CRUD + assignment + visibility
│ ├── UserModel.php # User management │ ├── UserModel.php # User management + groups
│ ├── UserPreferencesModel.php # User preferences │ ├── UserPreferencesModel.php # User preferences
│ └── WorkflowModel.php # Status transition workflows │ └── WorkflowModel.php # Status transition workflows
├── scripts/ ├── scripts/
@@ -119,15 +109,16 @@ Controllers → Models → Database
├── uploads/ # File attachment storage ├── uploads/ # File attachment storage
├── views/ ├── views/
│ ├── admin/ │ ├── admin/
│ │ ├── ApiKeysView.php # API key management
│ │ ├── AuditLogView.php # Audit log browser │ │ ├── AuditLogView.php # Audit log browser
│ │ ├── CustomFieldsView.php # Custom field management │ │ ├── CustomFieldsView.php # Custom field management
│ │ ├── RecurringTicketsView.php # Recurring ticket management │ │ ├── RecurringTicketsView.php # Recurring ticket management
│ │ ├── TemplatesView.php # Template management │ │ ├── TemplatesView.php # Template management
│ │ ├── UserActivityView.php # User activity report │ │ ├── UserActivityView.php # User activity report
│ │ └── WorkflowDesignerView.php # Workflow transition designer │ │ └── WorkflowDesignerView.php # Workflow transition designer
│ ├── CreateTicketView.php # Ticket creation with templates │ ├── CreateTicketView.php # Ticket creation with visibility
│ ├── DashboardView.php # Dashboard with stats + bulk actions │ ├── DashboardView.php # Dashboard with kanban + sidebar
│ └── TicketView.php # Ticket view with timeline + assignment │ └── TicketView.php # Ticket view with visibility editing
├── .env # Environment variables (GITIGNORED) ├── .env # Environment variables (GITIGNORED)
├── Claude.md # This file ├── Claude.md # This file
├── README.md # User documentation ├── 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/custom-fields` | Define custom fields per category |
| `/admin/user-activity` | View per-user activity statistics | | `/admin/user-activity` | View per-user activity statistics |
| `/admin/audit-log` | Browse all audit log entries | | `/admin/audit-log` | Browse all audit log entries |
| `/admin/api-keys` | Generate and manage API keys |
## Database Schema ## Database Schema
**Database**: `ticketing_system` at 10.10.10.50 **Database**: `ticketing_system` at 10.10.10.50
**User**: `tinkertickets` **User**: `tinkertickets`
**Connection**: All APIs create their own connections via config.php
### Core Tables ### Core Tables
- `tickets` - Core ticket data with assignment - `tickets` - Core ticket data with assignment and visibility
- `ticket_comments` - Markdown-supported comments - `ticket_comments` - Markdown-supported comments
- `ticket_attachments` - File attachment metadata - `ticket_attachments` - File attachment metadata
- `ticket_dependencies` - Ticket relationships (blocks/blocked_by/relates_to/duplicates) - `ticket_dependencies` - Ticket relationships
- `users` - User accounts synced from LLDAP - `users` - User accounts synced from LLDAP (includes groups)
- `user_preferences` - User settings and preferences - `user_preferences` - User settings and preferences
- `audit_log` - Complete audit trail - `audit_log` - Complete audit trail
- `status_transitions` - Workflow configuration - `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 - `custom_field_values` - Custom field data per ticket
- `saved_filters` - User-saved dashboard filters - `saved_filters` - User-saved dashboard filters
- `bulk_operations` - Bulk operation tracking - `bulk_operations` - Bulk operation tracking
- `api_keys` - API key storage with hashes
## API Endpoints ### Ticket Visibility Columns
- `visibility` - ENUM('public', 'internal', 'confidential')
### Authentication - `visibility_groups` - VARCHAR(500) comma-separated group names
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 |
## Dashboard Features ## Dashboard Features
- **Stats Widgets**: Clickable cards for quick filtering (Open, Critical, Unassigned, Created Today, Closed Today) - **View Toggle**: Switch between Table view and Kanban card view
- **Admin Dropdown**: Quick access to all admin pages - **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 - **Sortable Columns**: Click headers to sort
- **Advanced Search**: Date ranges, priority ranges, user filters - **Advanced Search**: Date ranges, priority ranges, user filters
- **Saved Filters**: Save and load custom filter combinations - **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 - **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: - **Public**: All authenticated users can view
- **Box-drawing characters**: ╔═╗║╚═╝┌─┐│└─┘ - **Internal**: Only users in specified groups can view
- **Monospace fonts**: Courier New, Consolas, Monaco - **Confidential**: Only creator, assignee, and admins can view
- **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
## Important Notes for AI Assistants ## Important Notes for AI Assistants
1. **All features are complete and deployed** 1. **Session format**: `$_SESSION['user']['user_id']` (not `$_SESSION['user_id']`)
2. **Terminal UI redesign is complete** - maintain the aesthetic 2. **API auth**: Check `$_SESSION['user']['user_id']` exists
3. **Database at 10.10.10.50**, can't access directly from dev machine 3. **Admin check**: `$_SESSION['user']['is_admin'] ?? false`
4. **Auto-deploy is active**, test carefully before pushing 4. **Config path**: `config/config.php` (not `config/db.php`)
5. **Session format**: `$_SESSION['user']['user_id']` (not `$_SESSION['user_id']`) 5. **Comments table**: `ticket_comments` (not `comments`)
6. **API auth**: Check `$_SESSION['user']['user_id']` exists 6. **CSRF**: Required for POST/DELETE requests via `X-CSRF-Token` header
7. **Admin check**: `$_SESSION['user']['is_admin'] ?? false` 7. **Cache busting**: Use `?v=YYYYMMDD` query params on JS/CSS files
8. **Config path**: `config/config.php` (not `config/db.php`) 8. **Ticket linking**: Use `#123456789` in markdown-enabled comments
9. **Comments table**: `ticket_comments` (not `comments`) 9. **User groups**: Stored in `users.groups` as comma-separated values
10. **CSRF**: Required for POST/DELETE requests via `X-CSRF-Token` header
## File Reference Quick Guide ## File Reference Quick Guide
| File | Purpose | | File | Purpose |
|------|---------| |------|---------|
| `index.php` | Main router for all routes | | `index.php` | Main router for all routes |
| `api/update_ticket.php` | Ticket updates with workflow validation | | `api/update_ticket.php` | Ticket updates with workflow + visibility |
| `api/ticket_dependencies.php` | Manage ticket dependencies | | `models/TicketModel.php` | Ticket CRUD, visibility filtering |
| `models/TicketModel.php` | Ticket CRUD, assignment, filtering | | `models/ApiKeyModel.php` | API key generation and validation |
| `models/WorkflowModel.php` | Status transition validation | | `assets/js/dashboard.js` | Dashboard UI, kanban, sidebar, bulk actions |
| `models/DependencyModel.php` | Ticket dependency management | | `assets/js/ticket.js` | Ticket UI, visibility editing |
| `controllers/DashboardController.php` | Dashboard logic, stats, filters | | `assets/js/markdown.js` | Markdown parsing + ticket linking |
| `assets/js/dashboard.js` | Dashboard UI, bulk actions, templates | | `assets/css/dashboard.css` | Terminal styling, kanban, sidebar |
| `assets/js/ticket.js` | Ticket UI, comments, assignment |
| `assets/css/dashboard.css` | Terminal styling, layout, components |
## Repository & Contact ## Repository
- **Gitea**: https://code.lotusguild.org/LotusGuild/tinker_tickets - **Gitea**: https://code.lotusguild.org/LotusGuild/tinker_tickets
- **Production**: http://t.lotusguild.org - **Production**: http://t.lotusguild.org
- **Infrastructure**: LotusGuild data center management

View File

@@ -5,7 +5,9 @@ A feature-rich PHP-based ticketing system designed for tracking and managing dat
## Core Features ## Core Features
### Dashboard & Ticket Management ### Dashboard & Ticket Management
- **Smart Dashboard**: Sortable columns, advanced filtering by status/priority/category/type - **View Modes**: Toggle between Table view and Kanban card view
- **Collapsible Sidebar**: Click the arrow to collapse/expand the filter sidebar
- **Inline Ticket Preview**: Hover over ticket IDs for a quick preview popup
- **Stats Widgets**: Clickable cards for quick filtering (Open, Critical, Unassigned, Today's tickets) - **Stats Widgets**: Clickable cards for quick filtering (Open, Critical, Unassigned, Today's tickets)
- **Full-Text Search**: Search across tickets, descriptions, and metadata - **Full-Text Search**: Search across tickets, descriptions, and metadata
- **Advanced Search**: Date ranges, priority ranges, user filters with saved filter support - **Advanced Search**: Date ranges, priority ranges, user filters with saved filter support
@@ -14,6 +16,12 @@ A feature-rich PHP-based ticketing system designed for tracking and managing dat
- **Custom Categories**: Hardware, Software, Network, Security, General - **Custom Categories**: Hardware, Software, Network, Security, General
- **Ticket Types**: Maintenance, Install, Task, Upgrade, Issue, Problem - **Ticket Types**: Maintenance, Install, Task, Upgrade, Issue, Problem
- **Export**: Export selected tickets to CSV or JSON format - **Export**: Export selected tickets to CSV or JSON format
- **Ticket Linking**: Reference other tickets in comments using `#123456789` format
### Ticket Visibility Levels
- **Public**: All authenticated users can view the ticket
- **Internal**: Only users in specified groups can view the ticket
- **Confidential**: Only the creator, assignee, and admins can view the ticket
### Workflow Management ### Workflow Management
- **Status Transitions**: Enforced workflow rules (Open → Pending → In Progress → Closed) - **Status Transitions**: Enforced workflow rules (Open → Pending → In Progress → Closed)
@@ -46,9 +54,16 @@ A feature-rich PHP-based ticketing system designed for tracking and managing dat
- **Field Types**: Text, textarea, select, checkbox, date, number - **Field Types**: Text, textarea, select, checkbox, date, number
- **Required Fields**: Mark fields as required for validation - **Required Fields**: Mark fields as required for validation
### API Key Management
- **Admin UI**: Generate and manage API keys at `/admin/api-keys`
- **Bearer Token Auth**: Use API keys with `Authorization: Bearer YOUR_KEY` header
- **Expiration**: Optional expiration dates for keys
- **Revocation**: Revoke compromised keys instantly
### User Management & Authentication ### User Management & Authentication
- **SSO Integration**: Authelia authentication with LLDAP backend - **SSO Integration**: Authelia authentication with LLDAP backend
- **Role-Based Access**: Admin and standard user roles - **Role-Based Access**: Admin and standard user roles
- **User Groups**: Groups displayed in settings modal, used for visibility
- **User Activity**: View per-user stats at `/admin/user-activity` - **User Activity**: View per-user stats at `/admin/user-activity`
- **Session Management**: Secure PHP session handling with timeout - **Session Management**: Secure PHP session handling with timeout
@@ -57,6 +72,7 @@ A feature-rich PHP-based ticketing system designed for tracking and managing dat
- **Bulk Assign**: Assign multiple tickets to a user - **Bulk Assign**: Assign multiple tickets to a user
- **Bulk Priority**: Change priority for multiple tickets - **Bulk Priority**: Change priority for multiple tickets
- **Bulk Status**: Change status for multiple tickets - **Bulk Status**: Change status for multiple tickets
- **Checkbox Click Area**: Click anywhere in the checkbox cell to toggle
### Admin Pages ### Admin Pages
Access all admin pages via the **Admin dropdown** in the dashboard header. Access all admin pages via the **Admin dropdown** in the dashboard header.
@@ -69,9 +85,10 @@ Access all admin pages via the **Admin dropdown** in the dashboard header.
| `/admin/custom-fields` | Define custom fields per category | | `/admin/custom-fields` | Define custom fields per category |
| `/admin/user-activity` | View per-user activity statistics | | `/admin/user-activity` | View per-user activity statistics |
| `/admin/audit-log` | Browse all audit log entries | | `/admin/audit-log` | Browse all audit log entries |
| `/admin/api-keys` | Generate and manage API keys |
### Notifications ### Notifications
- **Discord Integration**: Webhook notifications for ticket creation and updates - **Discord Integration**: Webhook notifications for ticket creation
- **Rich Embeds**: Color-coded priority indicators and ticket links - **Rich Embeds**: Color-coded priority indicators and ticket links
### Security Features ### Security Features
@@ -94,23 +111,25 @@ Access all admin pages via the **Admin dropdown** in the dashboard header.
- **JavaScript**: Vanilla JS with Fetch API for AJAX - **JavaScript**: Vanilla JS with Fetch API for AJAX
- **Markdown**: Custom markdown parser with toolbar - **Markdown**: Custom markdown parser with toolbar
- **Terminal UI**: Box-drawing characters, monospace fonts, CRT effects - **Terminal UI**: Box-drawing characters, monospace fonts, CRT effects
- **Mobile Responsive**: Touch-friendly controls, responsive layouts
### Database Tables ### Database Tables
| Table | Purpose | | Table | Purpose |
|-------|---------| |-------|---------|
| `tickets` | Core ticket data | | `tickets` | Core ticket data with visibility |
| `ticket_comments` | Markdown-supported comments | | `ticket_comments` | Markdown-supported comments |
| `ticket_attachments` | File attachment metadata | | `ticket_attachments` | File attachment metadata |
| `ticket_dependencies` | Ticket relationships | | `ticket_dependencies` | Ticket relationships |
| `users` | User accounts synced from LLDAP | | `users` | User accounts with groups |
| `user_preferences` | User settings and preferences | | `user_preferences` | User settings |
| `audit_log` | Complete audit trail | | `audit_log` | Complete audit trail |
| `status_transitions` | Workflow configuration | | `status_transitions` | Workflow configuration |
| `ticket_templates` | Reusable ticket templates | | `ticket_templates` | Reusable templates |
| `recurring_tickets` | Scheduled ticket definitions | | `recurring_tickets` | Scheduled tickets |
| `custom_field_definitions` | Custom field schemas | | `custom_field_definitions` | Custom field schemas |
| `custom_field_values` | Custom field data per ticket | | `custom_field_values` | Custom field data |
| `saved_filters` | User-saved dashboard filters | | `saved_filters` | Saved filter combinations |
| `api_keys` | API key storage |
### API Endpoints ### API Endpoints
| Endpoint | Method | Description | | Endpoint | Method | Description |
@@ -121,11 +140,11 @@ Access all admin pages via the **Admin dropdown** in the dashboard header.
| `/api/get_template.php` | GET | Fetch ticket template | | `/api/get_template.php` | GET | Fetch ticket template |
| `/api/get_users.php` | GET | Get user list for assignments | | `/api/get_users.php` | GET | Get user list for assignments |
| `/api/bulk_operation.php` | POST | Perform bulk operations | | `/api/bulk_operation.php` | POST | Perform bulk operations |
| `/api/ticket_dependencies.php` | GET/POST/DELETE | Manage ticket dependencies | | `/api/ticket_dependencies.php` | GET/POST/DELETE | Manage dependencies |
| `/api/upload_attachment.php` | GET/POST | List or upload attachments | | `/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/export_tickets.php` | GET | Export tickets to CSV/JSON |
| `/api/check_duplicates.php` | GET | Check for duplicate tickets | | `/api/generate_api_key.php` | POST | Generate API key (admin) |
| `/api/revoke_api_key.php` | POST | Revoke API key (admin) |
## Setup & Configuration ## Setup & Configuration
@@ -140,11 +159,7 @@ DB_NAME=ticketing_system
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/... DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
``` ```
### 2. Database Setup ### 2. Cron Jobs
The database schema should already be configured. For a fresh install, contact the system administrator for database setup instructions.
### 3. Cron Jobs
Add to crontab for recurring tickets: Add to crontab for recurring tickets:
```bash ```bash
@@ -152,13 +167,7 @@ Add to crontab for recurring tickets:
0 * * * * php /var/www/html/tinkertickets/cron/create_recurring_tickets.php 0 * * * * php /var/www/html/tinkertickets/cron/create_recurring_tickets.php
``` ```
Optional cleanup job: ### 3. File Uploads
```bash
# Run weekly to clean up orphaned upload files
0 2 * * 0 php /var/www/html/tinkertickets/scripts/cleanup_orphan_uploads.php
```
### 4. File Uploads
Ensure the `uploads/` directory exists and is writable: Ensure the `uploads/` directory exists and is writable:
```bash ```bash
@@ -167,7 +176,7 @@ chown www-data:www-data /var/www/html/tinkertickets/uploads
chmod 755 /var/www/html/tinkertickets/uploads chmod 755 /var/www/html/tinkertickets/uploads
``` ```
### 5. Authelia Integration ### 4. Authelia Integration
Tinker Tickets uses Authelia for SSO. User information is passed via headers: Tinker Tickets uses Authelia for SSO. User information is passed via headers:
- `Remote-User`: Username - `Remote-User`: Username
@@ -175,7 +184,7 @@ Tinker Tickets uses Authelia for SSO. User information is passed via headers:
- `Remote-Email`: Email address - `Remote-Email`: Email address
- `Remote-Groups`: User groups (comma-separated) - `Remote-Groups`: User groups (comma-separated)
Admin users must be in the `admins` group in LLDAP. Admin users must be in the `admin` group in LLDAP.
## Project Structure ## Project Structure

View File

@@ -1692,54 +1692,55 @@ input[type="checkbox"]:checked {
} }
/* Collapsible Sidebar */ /* Collapsible Sidebar */
.dashboard-layout {
position: relative;
}
.sidebar-toggle { .sidebar-toggle {
position: absolute; position: absolute;
right: -16px; left: 250px;
top: 50%; top: 1rem;
transform: translateY(-50%); width: 24px;
width: 32px; height: 48px;
height: 64px;
background: var(--bg-secondary); background: var(--bg-secondary);
border: 2px solid var(--terminal-green); border: 2px solid var(--terminal-green);
border-left: none;
color: var(--terminal-green); color: var(--terminal-green);
cursor: pointer; cursor: pointer;
z-index: 10; z-index: 100;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
transition: all 0.3s ease; transition: left 0.3s ease, background 0.2s ease;
padding: 0; padding: 0;
} border-radius: 0 4px 4px 0;
.sidebar-toggle::before,
.sidebar-toggle::after {
content: '';
} }
.sidebar-toggle:hover { .sidebar-toggle:hover {
background: rgba(0, 255, 65, 0.15); background: rgba(0, 255, 65, 0.2);
color: var(--terminal-amber); color: var(--terminal-amber);
border-color: var(--terminal-amber); border-color: var(--terminal-amber);
} }
.toggle-arrow { .toggle-arrow {
transition: transform 0.3s ease; transition: transform 0.3s ease;
font-size: 0.9rem;
} }
.dashboard-sidebar { .dashboard-sidebar {
position: relative; position: relative;
transition: width 0.3s ease, margin 0.3s ease; transition: width 0.3s ease, opacity 0.3s ease;
overflow: hidden;
} }
.sidebar-content { .sidebar-content {
overflow: hidden;
transition: opacity 0.3s ease; transition: opacity 0.3s ease;
width: 250px;
} }
/* Collapsed state */
.dashboard-sidebar.collapsed { .dashboard-sidebar.collapsed {
width: 0; width: 0;
margin-right: 16px; min-width: 0;
} }
.dashboard-sidebar.collapsed .sidebar-content { .dashboard-sidebar.collapsed .sidebar-content {
@@ -1747,18 +1748,14 @@ input[type="checkbox"]:checked {
pointer-events: none; pointer-events: none;
} }
.dashboard-sidebar.collapsed .sidebar-toggle { .dashboard-layout.sidebar-collapsed .sidebar-toggle {
right: -48px; left: 0;
} }
.dashboard-sidebar.collapsed .toggle-arrow { .dashboard-layout.sidebar-collapsed .toggle-arrow {
transform: rotate(180deg); transform: rotate(180deg);
} }
.dashboard-layout.sidebar-collapsed {
/* Adjust layout when sidebar is collapsed */
}
/* Hide toggle on mobile */ /* Hide toggle on mobile */
@media (max-width: 768px) { @media (max-width: 768px) {
.sidebar-toggle { .sidebar-toggle {

View File

@@ -10,12 +10,11 @@ function escapeHtml(text) {
*/ */
function toggleSidebar() { function toggleSidebar() {
const sidebar = document.getElementById('dashboardSidebar'); const sidebar = document.getElementById('dashboardSidebar');
const layout = document.querySelector('.dashboard-layout'); const layout = document.getElementById('dashboardLayout');
if (sidebar && layout) { if (sidebar && layout) {
sidebar.classList.toggle('collapsed'); const isCollapsed = sidebar.classList.toggle('collapsed');
layout.classList.toggle('sidebar-collapsed'); layout.classList.toggle('sidebar-collapsed', isCollapsed);
// Store state in localStorage // Store state in localStorage
const isCollapsed = sidebar.classList.contains('collapsed');
localStorage.setItem('sidebarCollapsed', isCollapsed ? 'true' : 'false'); localStorage.setItem('sidebarCollapsed', isCollapsed ? 'true' : 'false');
} }
} }
@@ -23,14 +22,12 @@ function toggleSidebar() {
// Restore sidebar state on page load // Restore sidebar state on page load
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
const savedState = localStorage.getItem('sidebarCollapsed'); const savedState = localStorage.getItem('sidebarCollapsed');
if (savedState === 'true') {
const sidebar = document.getElementById('dashboardSidebar'); const sidebar = document.getElementById('dashboardSidebar');
const layout = document.querySelector('.dashboard-layout'); const layout = document.getElementById('dashboardLayout');
if (sidebar && layout) { if (savedState === 'true' && sidebar && layout) {
sidebar.classList.add('collapsed'); sidebar.classList.add('collapsed');
layout.classList.add('sidebar-collapsed'); layout.classList.add('sidebar-collapsed');
} }
}
}); });
// Main initialization // Main initialization

View File

@@ -1,15 +0,0 @@
-- Migration: Add ticket visibility levels
-- Run this migration to enable ticket visibility features
-- Add visibility columns to tickets table
ALTER TABLE tickets
ADD COLUMN visibility ENUM('public', 'internal', 'confidential') DEFAULT 'public' AFTER type,
ADD COLUMN visibility_groups VARCHAR(500) DEFAULT NULL AFTER visibility;
-- Create index for visibility filtering
CREATE INDEX idx_tickets_visibility ON tickets(visibility);
-- Example usage:
-- Public: All authenticated users can see the ticket
-- Internal: Only users in specified groups can see the ticket (visibility_groups contains comma-separated group names)
-- Confidential: Only creator, assignee, and admins can see the ticket

View File

@@ -9,11 +9,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ticket Dashboard</title> <title>Ticket Dashboard</title>
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png"> <link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260123"> <link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260123b">
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/ascii-banner.js"></script> <script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/ascii-banner.js"></script>
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script> <script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script>
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/markdown.js?v=20260123"></script> <script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/markdown.js?v=20260123b"></script>
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/dashboard.js?v=20260123"></script> <script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/dashboard.js?v=20260123b"></script>
<script> <script>
// CSRF Token for AJAX requests // CSRF Token for AJAX requests
window.CSRF_TOKEN = '<?php window.CSRF_TOKEN = '<?php
@@ -124,12 +124,13 @@
</script> </script>
<!-- Dashboard Layout with Sidebar --> <!-- Dashboard Layout with Sidebar -->
<div class="dashboard-layout"> <div class="dashboard-layout" id="dashboardLayout">
<!-- Sidebar Toggle Button (outside sidebar for always-visible) -->
<button class="sidebar-toggle" id="sidebarToggle" onclick="toggleSidebar()" title="Toggle Sidebar">
<span class="toggle-arrow" id="toggleArrow">◀</span>
</button>
<!-- Left Sidebar with Filters --> <!-- Left Sidebar with Filters -->
<aside class="dashboard-sidebar" id="dashboardSidebar"> <aside class="dashboard-sidebar" id="dashboardSidebar">
<button class="sidebar-toggle" onclick="toggleSidebar()" title="Toggle Sidebar">
<span class="toggle-arrow">◀</span>
</button>
<div class="sidebar-content"> <div class="sidebar-content">
<div class="ascii-frame-inner"> <div class="ascii-frame-inner">
<div class="ascii-subsection-header">Filters</div> <div class="ascii-subsection-header">Filters</div>