Fix off-day med reminders and add medication editing
Scheduler: check_nagging() now calls _is_med_due_today() before creating on-demand schedules or processing existing ones — prevents nagging for specific_days / every_n_days meds on days they are not scheduled. Web client: add Edit button (pencil icon) on each medication card linking to /dashboard/medications/[id]/edit — new page pre-populates the full form (name, dosage, unit, frequency, times, days, interval, notes) and submits PUT /api/medications/:id on save. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import { useEffect, useState, useMemo } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import api from '@/lib/api';
|
||||
import { PlusIcon, CheckIcon, PillIcon, ClockIcon, TrashIcon } from '@/components/ui/Icons';
|
||||
import { PlusIcon, CheckIcon, PillIcon, ClockIcon, TrashIcon, EditIcon } from '@/components/ui/Icons';
|
||||
import Link from 'next/link';
|
||||
import PushNotificationToggle from '@/components/notifications/PushNotificationToggle';
|
||||
|
||||
@@ -380,12 +380,20 @@ export default function MedicationsPage() {
|
||||
<p className="text-gray-400 dark:text-gray-500 text-sm mt-1">Times: {med.times.join(', ')}</p>
|
||||
)}
|
||||
</div>
|
||||
<button
|
||||
onClick={() => handleDelete(med.id)}
|
||||
className="text-red-500 dark:text-red-400 p-2"
|
||||
>
|
||||
<TrashIcon size={18} />
|
||||
</button>
|
||||
<div className="flex items-center gap-1">
|
||||
<Link
|
||||
href={`/dashboard/medications/${med.id}/edit`}
|
||||
className="text-gray-400 dark:text-gray-500 hover:text-indigo-600 dark:hover:text-indigo-400 p-2"
|
||||
>
|
||||
<EditIcon size={18} />
|
||||
</Link>
|
||||
<button
|
||||
onClick={() => handleDelete(med.id)}
|
||||
className="text-red-500 dark:text-red-400 p-2"
|
||||
>
|
||||
<TrashIcon size={18} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Adherence */}
|
||||
|
||||
Reference in New Issue
Block a user