From 690de731725f15a864582d35743d7999377169a0 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Wed, 26 Aug 2026 11:53:54 +0000 Subject: [PATCH] Fix duplicate template due date being silently cleared MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit duplicate() blanked next_due along with location/asset, but title/ description/notes/etc. all stayed filled in — so a duplicated template looked fully populated while due date was actually empty, and the combined 'Title and first due date are required' error didn't say which field was missing. Adding another room to an existing schedule normally wants the same due date as the rest of the group anyway, so carry it over from the source template instead of clearing it; only location/asset genuinely need re-picking. Error messages now name the specific missing field. --- frontend/src/pages/Recurring.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/Recurring.tsx b/frontend/src/pages/Recurring.tsx index cc50644..ce22be8 100644 --- a/frontend/src/pages/Recurring.tsx +++ b/frontend/src/pages/Recurring.tsx @@ -124,7 +124,7 @@ export default function Recurring() { title: t.title, description: t.description || '', location_id: '', asset_id: '', priority: t.priority, unusable: t.unusable, interval_value: t.interval_value, interval_unit: t.interval_unit, - next_due: '', template_notes: t.template_notes, active: true, + next_due: t.next_due.slice(0, 10), template_notes: t.template_notes, active: true, schedule_mode: t.schedule_mode, group_name: t.group_name || '', assignment: { assigned_type: t.assigned_type, assigned_to: t.assigned_to, @@ -145,10 +145,9 @@ export default function Recurring() { } async function save() { - if (!form || !form.title.trim() || !form.next_due) { - setError('Title and first due date are required') - return - } + if (!form) return + if (!form.title.trim()) { setError('Title is required'); return } + if (!form.next_due) { setError(form.id ? 'Next due date is required' : 'First due date is required'); return } if (form.multiLocation) { if (!form.group_name.trim()) { setError('A group name is required when creating for multiple locations'); return } if (form.location_ids.length === 0) { setError('Select at least one location'); return }