'use client'
import { useState } from 'react'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Plus, Trash2, Check } from 'lucide-react'
import { type JournalCheckItem, formatTime, formatDateTime } from '@/components/journal/types'
interface SomaModuleProps {
items: JournalCheckItem[]
canEdit: boolean
onToggle: (item: JournalCheckItem, field: 'confirmed' | 'ok') => void
onAdd: (label: string) => void
onDelete: (itemId: string) => void
}
/** SOMA-Checkliste — eingebautes Cockpit-Modul (JA/Ok mit Zeitstempel) */
export function SomaModule({ items, canEdit, onToggle, onAdd, onDelete }: SomaModuleProps) {
const [newLabel, setNewLabel] = useState('')
const submit = () => {
if (!newLabel.trim()) return
onAdd(newLabel.trim())
setNewLabel('')
}
return (
<>
{/* Spalten-Kopf */}
{items.map((item, idx) => (
{item.label}
{item.confirmedAt && item.confirmed && (
{formatTime(item.confirmedAt)}
)}
{canEdit && (
)}
))}
{canEdit && (
)}
>
)
}