feat: Add ticket permission UI and fix assignee dropdown

Assignee Dropdown:
- Fix useUsers hook to fetch from /api/staff/ endpoint
- Add useStaffForAssignment hook for formatted dropdown data
- Update TicketModal to use new hook for assignee selection

Staff Permissions UI:
- Add "Can access support tickets" permission to invite modal for both managers and staff
- Add permission to edit modal for both managers and staff
- Managers default to having ticket access enabled
- Staff default to having ticket access disabled (must be explicitly granted)

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
poduck
2025-11-28 05:49:40 -05:00
parent 9dabb0cb83
commit 4acea4f876
3 changed files with 139 additions and 8 deletions

View File

@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
import { X, User, Send, MessageSquare, Clock, AlertCircle } from 'lucide-react';
import { Ticket, TicketComment, TicketStatus, TicketPriority, TicketCategory, TicketType } from '../types';
import { useCreateTicket, useUpdateTicket, useTicketComments, useCreateTicketComment } from '../hooks/useTickets';
import { useUsers } from '../hooks/useUsers'; // Assuming a useUsers hook exists to fetch users for assignee dropdown
import { useStaffForAssignment } from '../hooks/useUsers';
import { useQueryClient } from '@tanstack/react-query';
interface TicketModalProps {
@@ -34,7 +34,7 @@ const TicketModal: React.FC<TicketModalProps> = ({ ticket, onClose, defaultTicke
const [isInternalComment, setIsInternalComment] = useState(false);
// Fetch users for assignee dropdown
const { data: users = [] } = useUsers(); // Assuming useUsers fetches all relevant users (staff/platform admins)
const { data: users = [] } = useStaffForAssignment();
// Fetch comments for the ticket if in detail/edit mode
const { data: comments, isLoading: isLoadingComments } = useTicketComments(ticket?.id);