diff --git a/src/app/daily/DailyPageClient.tsx b/src/app/daily/DailyPageClient.tsx index f9ebf84..41a214c 100644 --- a/src/app/daily/DailyPageClient.tsx +++ b/src/app/daily/DailyPageClient.tsx @@ -103,12 +103,17 @@ export function DailyPageClient({ await refreshDailyDates(); }; - const handleUpdateCheckbox = async (checkboxId: string, text: string, type: DailyCheckboxType, taskId?: string) => { + const handleUpdateCheckbox = async (checkboxId: string, text: string, type: DailyCheckboxType, taskId?: string, date?: Date) => { await updateCheckbox(checkboxId, { text, type, - taskId // Permet la liaison tâche pour tous les types + taskId, // Permet la liaison tâche pour tous les types + date // Permet la modification de la date/heure }); + // Refresh dates après modification pour mettre à jour le calendrier si la date a changé + if (date) { + await refreshDailyDates(); + } }; const handleReorderCheckboxes = async (date: Date, checkboxIds: string[]) => { diff --git a/src/components/daily/DailyCheckboxItem.tsx b/src/components/daily/DailyCheckboxItem.tsx index c1cd6ec..884959b 100644 --- a/src/components/daily/DailyCheckboxItem.tsx +++ b/src/components/daily/DailyCheckboxItem.tsx @@ -9,7 +9,7 @@ import { EditCheckboxModal } from './EditCheckboxModal'; interface DailyCheckboxItemProps { checkbox: DailyCheckbox; onToggle: (checkboxId: string) => Promise; - onUpdate: (checkboxId: string, text: string, type: DailyCheckboxType, taskId?: string) => Promise; + onUpdate: (checkboxId: string, text: string, type: DailyCheckboxType, taskId?: string, date?: Date) => Promise; onDelete: (checkboxId: string) => Promise; saving?: boolean; } @@ -93,8 +93,8 @@ export function DailyCheckboxItem({ setEditingCheckbox(checkbox); }; - const handleSaveAdvancedEdit = async (text: string, type: DailyCheckboxType, taskId?: string) => { - await onUpdate(checkbox.id, text, type, taskId); + const handleSaveAdvancedEdit = async (text: string, type: DailyCheckboxType, taskId?: string, date?: Date) => { + await onUpdate(checkbox.id, text, type, taskId, date); setEditingCheckbox(null); }; diff --git a/src/components/daily/DailySection.tsx b/src/components/daily/DailySection.tsx index 15d5e48..a00920b 100644 --- a/src/components/daily/DailySection.tsx +++ b/src/components/daily/DailySection.tsx @@ -17,7 +17,7 @@ interface DailySectionProps { checkboxes: DailyCheckbox[]; onAddCheckbox: (text: string, type: DailyCheckboxType) => Promise; onToggleCheckbox: (checkboxId: string) => Promise; - onUpdateCheckbox: (checkboxId: string, text: string, type: DailyCheckboxType, taskId?: string) => Promise; + onUpdateCheckbox: (checkboxId: string, text: string, type: DailyCheckboxType, taskId?: string, date?: Date) => Promise; onDeleteCheckbox: (checkboxId: string) => Promise; onReorderCheckboxes: (date: Date, checkboxIds: string[]) => Promise; onToggleAll?: () => Promise; diff --git a/src/components/daily/EditCheckboxModal.tsx b/src/components/daily/EditCheckboxModal.tsx index 072687c..c6ea3ab 100644 --- a/src/components/daily/EditCheckboxModal.tsx +++ b/src/components/daily/EditCheckboxModal.tsx @@ -10,12 +10,13 @@ import { Card } from '@/components/ui/Card'; import { SearchInput } from '@/components/ui/SearchInput'; import { StatusBadge } from '@/components/ui/StatusBadge'; import { tasksClient } from '@/clients/tasks-client'; +import { formatDateForDateTimeInput, parseDateTimeInput } from '@/lib/date-utils'; interface EditCheckboxModalProps { checkbox: DailyCheckbox; isOpen: boolean; onClose: () => void; - onSave: (text: string, type: DailyCheckboxType, taskId?: string) => Promise; + onSave: (text: string, type: DailyCheckboxType, taskId?: string, date?: Date) => Promise; saving?: boolean; } @@ -29,6 +30,7 @@ export function EditCheckboxModal({ const [text, setText] = useState(checkbox.text); const [type, setType] = useState(checkbox.type); const [taskId, setTaskId] = useState(checkbox.taskId); + const [date, setDate] = useState(checkbox.date); const [selectedTask, setSelectedTask] = useState(undefined); const [allTasks, setAllTasks] = useState([]); const [tasksLoading, setTasksLoading] = useState(false); @@ -83,7 +85,7 @@ export function EditCheckboxModal({ if (!text.trim()) return; try { - await onSave(text.trim(), type, taskId); + await onSave(text.trim(), type, taskId, date); onClose(); } catch (error) { console.error('Erreur lors de la sauvegarde:', error); @@ -101,6 +103,7 @@ export function EditCheckboxModal({ setText(checkbox.text); setType(checkbox.type); setTaskId(checkbox.taskId); + setDate(checkbox.date); }; const handleClose = () => { @@ -161,6 +164,15 @@ export function EditCheckboxModal({ + {/* Date/Heure */} + setDate(parseDateTimeInput(e.target.value))} + disabled={saving} + /> + {/* Liaison tâche (pour tous les types) */}