/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ /** * GenerateAdvancedPanel — disclosure-expanded "Advanced" section of the * Generate dialog. Holds rarely-touched fields (lag, PredefinedType, * schedule name, sequence linking toggle, skip-empty toggle). Extracted * so the main dialog stays readable. */ import { ChevronDown, ChevronRight } from 'lucide-react'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Switch } from '@/components/ui/switch'; import type { GenerateScheduleOptions, SpatialGroupStrategy } from './generate-schedule'; const TASK_TYPES = [ 'CONSTRUCTION', 'INSTALLATION', 'DEMOLITION', 'DISMANTLE', 'DISPOSAL', 'LOGISTIC', 'MAINTENANCE', 'MOVE', 'OPERATION', 'REMOVAL', 'RENOVATION', 'ATTENDANCE', 'USERDEFINED', 'NOTDEFINED', ] as const; export interface GenerateAdvancedPanelProps { open: boolean; onOpenChange: (next: boolean) => void; strategy: SpatialGroupStrategy; lagDays: number; predefinedType: string; scheduleName: string; linkSequences: boolean; skipEmptyGroups: boolean; onChange: ( key: K, value: GenerateScheduleOptions[K], ) => void; } export function GenerateAdvancedPanel({ open, onOpenChange, strategy, lagDays, predefinedType, scheduleName, linkSequences, skipEmptyGroups, onChange, }: GenerateAdvancedPanelProps) { return (
{open && (
{ const v = parseFloat(e.target.value); onChange('lagDays', Number.isFinite(v) && v >= 0 ? v : 0); }} />
onChange('scheduleName', e.target.value)} placeholder="Construction schedule" />
onChange('linkSequences', v)} /> onChange('skipEmptyGroups', v)} />
)}
); } interface ToggleRowProps { label: string; description: string; checked: boolean; onChange: (next: boolean) => void; } function ToggleRow({ label, description, checked, onChange }: ToggleRowProps) { return ( ); }