// assets/scripts/entries.js import { parseDuration, roundToQuarter, formatMinutes, initDurationBlurHandler, validateDuration } from './duration.js'; const LAST_PROJECT_KEY = 'tt_last_project_id'; const LAST_SERVICE_KEY = 'tt_last_service_id'; function t(key) { return window.TT?.i18n?.[key] ?? key; } function buildProjectOptions(selectedId = null) { const groups = {}; (window.TT?.projects ?? []).forEach(p => { if (!groups[p.clientName]) groups[p.clientName] = []; groups[p.clientName].push(p); }); let html = ``; for (const [client, projects] of Object.entries(groups)) { html += `'; } return html; } function buildServiceOptions(selectedId = null) { const billable = (window.TT?.services ?? []).filter(s => s.billable); const notBillable = (window.TT?.services ?? []).filter(s => !s.billable); let html = ``; if (billable.length) { html += `'; } if (notBillable.length) { html += `'; } return html; } function buildEntryRowHTML(entry, animate = false) { const servicePart = entry.serviceName ? ` / ${entry.serviceName}` : ''; const notePart = entry.note ? `
${t('noEntries')}
${t('noEntries')}