/** * Entity Selector Component * Checkbox grid for selecting entities to sync */ 'use client'; import { EntityType } from '@/lib/types/sync'; import { getEntityDisplayName } from '@/lib/utils/sync-helpers'; import { Checkbox } from '@/components/ui/checkbox'; import { Label } from '@/components/ui/label'; interface EntitySelectorProps { selectedEntities: EntityType[]; onChange: (entities: EntityType[]) => void; disabled?: boolean; } const ALL_ENTITIES: EntityType[] = [ EntityType.COMPANIES, EntityType.RESOURCES, EntityType.STATUSES, EntityType.ISSUE_TYPES, EntityType.SUB_ISSUE_TYPES, EntityType.WORK_TYPES, EntityType.CONTACTS, EntityType.PROJECTS, EntityType.TICKETS, EntityType.TASKS, EntityType.CONFIGURATION_ITEMS, EntityType.CONTRACTS, EntityType.BILLING_ITEMS, EntityType.TIME_ENTRIES, ]; export default function EntitySelector({ selectedEntities, onChange, disabled = false, }: EntitySelectorProps) { const handleToggle = (entity: EntityType) => { if (selectedEntities.includes(entity)) { onChange(selectedEntities.filter(e => e !== entity)); } else { onChange([...selectedEntities, entity]); } }; const handleSelectAll = () => { if (selectedEntities.length === ALL_ENTITIES.length) { onChange([]); } else { onChange([...ALL_ENTITIES]); } }; const allSelected = selectedEntities.length === ALL_ENTITIES.length; return (