Patent Filing Timeline Planner

Patent Filing Timeline Planner

Projected Patent Timeline

${item.name}

${item.description || ''}

`; timelineContainer.insertAdjacentHTML('beforeend', itemHtml); }); }; // --- TAB NAVIGATION LOGIC --- window.switchTab = (tabName) => { currentTab = tabName; Object.keys(tabs).forEach(key => { tabs[key].classList.toggle('active', key === tabName); tabs[key].classList.toggle('inactive', key !== tabName); }); Object.keys(contents).forEach(key => { contents[key].classList.toggle('hidden', key !== tabName); }); updateNavButtons(); }; window.navigateTabs = (direction) => { const tabKeys = Object.keys(tabs); const currentIndex = tabKeys.indexOf(currentTab); let newIndex = (direction === 'next') ? currentIndex + 1 : currentIndex - 1; if (newIndex >= 0 && newIndex < tabKeys.length) { if (tabKeys[newIndex] === 'dashboard') { calculateTimeline(); renderTimeline(); } switchTab(tabKeys[newIndex]); } }; const updateNavButtons = () => { const tabKeys = Object.keys(tabs); const currentIndex = tabKeys.indexOf(currentTab); navButtons.prev.disabled = currentIndex === 0; navButtons.next.disabled = currentIndex === tabKeys.length - 1; }; // --- PDF GENERATION --- const generatePdf = () => { if(calculatedTimeline.length === 0) return; const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFontSize(18); doc.text('Patent Filing Timeline Report', 14, 22); doc.setFontSize(11); doc.text(`Based on initial filing date: ${formatDate(new Date(filingDateInput.value + 'T00:00:00'))}`, 14, 30); const tableColumn = ["Stage", "Description", "Projected Date"]; const tableRows = calculatedTimeline.map(item => [ item.name, item.description || '-', formatDate(item.date) ]); doc.autoTable({ head: [tableColumn], body: tableRows, startY: 40, theme: 'grid', headStyles: { fillColor: [79, 70, 229] }, }); doc.save('Patent_Filing_Timeline.pdf'); }; // --- INITIALIZATION & EVENT LISTENERS --- const initialize = () => { // Set default filing date to today for USA context const today = new Date(); const offset = today.getTimezoneOffset(); const todayLocal = new Date(today.getTime() - (offset*60*1000)); filingDateInput.value = todayLocal.toISOString().split('T')[0]; renderDurationInputs(); calculateTimeline(); renderTimeline(); updateNavButtons(); }; filingTypeSelect.addEventListener('change', renderDurationInputs); includePctCheckbox.addEventListener('change', renderDurationInputs); updateTimelineBtn.addEventListener('click', () => { calculateTimeline(); renderTimeline(); switchTab('dashboard'); }); downloadPdfBtn.addEventListener('click', generatePdf); initialize(); });
Scroll to Top