Capture per-menu schedules and compute business hours

- Store schedule per menu from Claude extraction
- Show schedule in progress messages
- Compute combined business hours from all menu schedules
- Display schedule summary in final result

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-03-14 17:45:12 -07:00
parent bc1f8d4f4b
commit 5fb7710344

View file

@ -1539,13 +1539,17 @@
});
// Add items (already tagged with menu name by backend)
(data.items || []).forEach(item => allItems.push(item));
allMenus.push({ name: page.name });
// Store menu with its schedule
const menuEntry = { name: page.name };
if (result.menuSchedule) menuEntry.schedule = result.menuSchedule;
allMenus.push(menuEntry);
totalProcessed++;
// Update with progress
const scheduleNote = result.menuSchedule ? ` (${result.menuSchedule})` : '';
document.getElementById('conversation').innerHTML = '';
addMessage('ai', `
<p>Extracted <strong>${page.name}</strong>: ${data.items?.length || 0} items in ${data.categories?.length || 0} categories</p>
<p>Extracted <strong>${page.name}</strong>${scheduleNote}: ${data.items?.length || 0} items in ${data.categories?.length || 0} categories</p>
`);
} else {
document.getElementById('conversation').innerHTML = '';
@ -1560,6 +1564,14 @@
}
}
// Compute max business hours from all menu schedules
if (allMenus.some(m => m.schedule) && !businessInfo.hours) {
businessInfo.hours = allMenus
.filter(m => m.schedule)
.map(m => `${m.name}: ${m.schedule}`)
.join('; ');
}
// Build final combined data
document.getElementById('conversation').innerHTML = '';
config.extractedData = {
@ -1577,8 +1589,10 @@
const totalItems = allItems.length;
const totalCats = allCategories.length;
const schedSummary = allMenus.filter(m => m.schedule).map(m => `${m.name}: ${m.schedule}`).join(', ');
addMessage('ai', `
<p>Done! Found <strong>${totalItems} items</strong> across <strong>${totalCats} categories</strong> in <strong>${allMenus.length} menus</strong>.</p>
${schedSummary ? `<p style="font-size:13px;color:var(--gray-500);">${schedSummary}</p>` : ''}
`);
console.log('=== MULTI-PAGE EXTRACT RESULT ===', config.extractedData);