The code is getting quite messy so let's break it down
After a bit of back and forth with AI I came up with this structure:

Implement this structure within the code and clean up these files a bit
In case further changes are needed, this is the UML in text form for Mermaid
---
config:
layout: dagre
---
classDiagram
direction TB
class TableManager {
- summaryRow: HTMLElement
- headerRow: HTMLElement
- timesheetBody: HTMLElement
+ initializeTable()
+ clearTable()
+ renderHeaderRow(days: int, currentMonth: int, year: int)
+ renderSummaryRow(dailyTotals: Map~int, int~)
+ renderTimesheetBody(ticketData: Ticket[])
+ createCell(content: String, classes: String[]) : HTMLElement
+ updateCell(cellIdentifier: String, newValue: String)
}
class DataManager {
+ loadLogs()
+ saveLogs()
}
class Ticket {
- String name
- Activity[] activities
+ createTicketCell()
+ createTotalCell()
+ addActivity(activity: Activity)
}
class Timesheet {
- int selectedMonth
- Ticket[] tickets
- Map~int, int~ dailyTotals
+ generateDays()
+ generateTimesheet()
+ updateSummaryRow()
+ addTicket(Ticket)
}
class Activity {
- String name
- LogEntry[] logs
- Map~int, int~ dailyDurations
+ groupActivitiesByName()
+ addLog(log: LogEntry)
}
class LogEntry {
- String ticket
- String activity
- Date time
- int duration
}
Timesheet "1" --> "*" Ticket : contains
Ticket "1" --> "*" Activity : groups
Activity "1" --> "*" LogEntry : aggregates
Timesheet --> DataManager : uses
Timesheet --> TableManager : uses
The code is getting quite messy so let's break it down
After a bit of back and forth with AI I came up with this structure:
Implement this structure within the code and clean up these files a bit
In case further changes are needed, this is the UML in text form for Mermaid