From 380b0e1adf593786b03cb0960970144bdb14994d Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Fri, 23 Jan 2026 10:39:55 -0500 Subject: [PATCH] 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 --- Claude.md | 192 ++++++++------------------- README.md | 61 +++++---- assets/css/dashboard.css | 45 +++---- assets/js/dashboard.js | 19 ++- migrations/008_ticket_visibility.sql | 15 --- views/DashboardView.php | 15 ++- 6 files changed, 129 insertions(+), 218 deletions(-) delete mode 100644 migrations/008_ticket_visibility.sql diff --git a/Claude.md b/Claude.md index 490304f..7cc43af 100644 --- a/Claude.md +++ b/Claude.md @@ -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 diff --git a/README.md b/README.md index f56419a..397cdd5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,9 @@ A feature-rich PHP-based ticketing system designed for tracking and managing dat ## Core Features ### 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) - **Full-Text Search**: Search across tickets, descriptions, and metadata - **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 - **Ticket Types**: Maintenance, Install, Task, Upgrade, Issue, Problem - **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 - **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 - **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 - **SSO Integration**: Authelia authentication with LLDAP backend - **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` - **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 Priority**: Change priority for multiple tickets - **Bulk Status**: Change status for multiple tickets +- **Checkbox Click Area**: Click anywhere in the checkbox cell to toggle ### Admin Pages 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/user-activity` | View per-user activity statistics | | `/admin/audit-log` | Browse all audit log entries | +| `/admin/api-keys` | Generate and manage API keys | ### 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 ### 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 - **Markdown**: Custom markdown parser with toolbar - **Terminal UI**: Box-drawing characters, monospace fonts, CRT effects +- **Mobile Responsive**: Touch-friendly controls, responsive layouts ### Database Tables | Table | Purpose | |-------|---------| -| `tickets` | Core ticket data | +| `tickets` | Core ticket data with visibility | | `ticket_comments` | Markdown-supported comments | | `ticket_attachments` | File attachment metadata | | `ticket_dependencies` | Ticket relationships | -| `users` | User accounts synced from LLDAP | -| `user_preferences` | User settings and preferences | +| `users` | User accounts with groups | +| `user_preferences` | User settings | | `audit_log` | Complete audit trail | | `status_transitions` | Workflow configuration | -| `ticket_templates` | Reusable ticket templates | -| `recurring_tickets` | Scheduled ticket definitions | +| `ticket_templates` | Reusable templates | +| `recurring_tickets` | Scheduled tickets | | `custom_field_definitions` | Custom field schemas | -| `custom_field_values` | Custom field data per ticket | -| `saved_filters` | User-saved dashboard filters | +| `custom_field_values` | Custom field data | +| `saved_filters` | Saved filter combinations | +| `api_keys` | API key storage | ### API Endpoints | 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_users.php` | GET | Get user list for assignments | | `/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/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 | +| `/api/generate_api_key.php` | POST | Generate API key (admin) | +| `/api/revoke_api_key.php` | POST | Revoke API key (admin) | ## Setup & Configuration @@ -140,11 +159,7 @@ DB_NAME=ticketing_system DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/... ``` -### 2. Database Setup - -The database schema should already be configured. For a fresh install, contact the system administrator for database setup instructions. - -### 3. Cron Jobs +### 2. Cron Jobs Add to crontab for recurring tickets: ```bash @@ -152,13 +167,7 @@ Add to crontab for recurring tickets: 0 * * * * php /var/www/html/tinkertickets/cron/create_recurring_tickets.php ``` -Optional cleanup job: -```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 +### 3. File Uploads Ensure the `uploads/` directory exists and is writable: ```bash @@ -167,7 +176,7 @@ chown www-data:www-data /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: - `Remote-User`: Username @@ -175,7 +184,7 @@ Tinker Tickets uses Authelia for SSO. User information is passed via headers: - `Remote-Email`: Email address - `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 diff --git a/assets/css/dashboard.css b/assets/css/dashboard.css index 7d3dbdb..bb8f2f9 100644 --- a/assets/css/dashboard.css +++ b/assets/css/dashboard.css @@ -1692,54 +1692,55 @@ input[type="checkbox"]:checked { } /* Collapsible Sidebar */ +.dashboard-layout { + position: relative; +} + .sidebar-toggle { position: absolute; - right: -16px; - top: 50%; - transform: translateY(-50%); - width: 32px; - height: 64px; + left: 250px; + top: 1rem; + width: 24px; + height: 48px; background: var(--bg-secondary); border: 2px solid var(--terminal-green); - border-left: none; color: var(--terminal-green); cursor: pointer; - z-index: 10; + z-index: 100; display: flex; align-items: center; justify-content: center; - transition: all 0.3s ease; + transition: left 0.3s ease, background 0.2s ease; padding: 0; -} - -.sidebar-toggle::before, -.sidebar-toggle::after { - content: ''; + border-radius: 0 4px 4px 0; } .sidebar-toggle:hover { - background: rgba(0, 255, 65, 0.15); + background: rgba(0, 255, 65, 0.2); color: var(--terminal-amber); border-color: var(--terminal-amber); } .toggle-arrow { transition: transform 0.3s ease; + font-size: 0.9rem; } .dashboard-sidebar { position: relative; - transition: width 0.3s ease, margin 0.3s ease; + transition: width 0.3s ease, opacity 0.3s ease; + overflow: hidden; } .sidebar-content { - overflow: hidden; transition: opacity 0.3s ease; + width: 250px; } +/* Collapsed state */ .dashboard-sidebar.collapsed { width: 0; - margin-right: 16px; + min-width: 0; } .dashboard-sidebar.collapsed .sidebar-content { @@ -1747,18 +1748,14 @@ input[type="checkbox"]:checked { pointer-events: none; } -.dashboard-sidebar.collapsed .sidebar-toggle { - right: -48px; +.dashboard-layout.sidebar-collapsed .sidebar-toggle { + left: 0; } -.dashboard-sidebar.collapsed .toggle-arrow { +.dashboard-layout.sidebar-collapsed .toggle-arrow { transform: rotate(180deg); } -.dashboard-layout.sidebar-collapsed { - /* Adjust layout when sidebar is collapsed */ -} - /* Hide toggle on mobile */ @media (max-width: 768px) { .sidebar-toggle { diff --git a/assets/js/dashboard.js b/assets/js/dashboard.js index 53d1652..975204b 100644 --- a/assets/js/dashboard.js +++ b/assets/js/dashboard.js @@ -10,12 +10,11 @@ function escapeHtml(text) { */ function toggleSidebar() { const sidebar = document.getElementById('dashboardSidebar'); - const layout = document.querySelector('.dashboard-layout'); + const layout = document.getElementById('dashboardLayout'); if (sidebar && layout) { - sidebar.classList.toggle('collapsed'); - layout.classList.toggle('sidebar-collapsed'); + const isCollapsed = sidebar.classList.toggle('collapsed'); + layout.classList.toggle('sidebar-collapsed', isCollapsed); // Store state in localStorage - const isCollapsed = sidebar.classList.contains('collapsed'); localStorage.setItem('sidebarCollapsed', isCollapsed ? 'true' : 'false'); } } @@ -23,13 +22,11 @@ function toggleSidebar() { // Restore sidebar state on page load document.addEventListener('DOMContentLoaded', function() { const savedState = localStorage.getItem('sidebarCollapsed'); - if (savedState === 'true') { - const sidebar = document.getElementById('dashboardSidebar'); - const layout = document.querySelector('.dashboard-layout'); - if (sidebar && layout) { - sidebar.classList.add('collapsed'); - layout.classList.add('sidebar-collapsed'); - } + const sidebar = document.getElementById('dashboardSidebar'); + const layout = document.getElementById('dashboardLayout'); + if (savedState === 'true' && sidebar && layout) { + sidebar.classList.add('collapsed'); + layout.classList.add('sidebar-collapsed'); } }); diff --git a/migrations/008_ticket_visibility.sql b/migrations/008_ticket_visibility.sql deleted file mode 100644 index e92e92f..0000000 --- a/migrations/008_ticket_visibility.sql +++ /dev/null @@ -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 diff --git a/views/DashboardView.php b/views/DashboardView.php index 57a1761..c890f2a 100644 --- a/views/DashboardView.php +++ b/views/DashboardView.php @@ -9,11 +9,11 @@ Ticket Dashboard - + - - + + -
+
+ +