feat: week numbers in schedule and week-wide assignment
Schedule table now shows ISO week number (W21) on the first row of each week visible in the 14-day window (first row and every Monday); other rows get a 4-space indent. Date column widened from 16→18 to accommodate the prefix. New W key in Schedule section opens the user picker in week-assign mode, which assigns the selected user to all 7 days (Mon–Sun) of the ISO week containing the cursor. The + key retains single-day assignment. The user picker header and footer reflect which mode is active.
This commit is contained in:
+29
-2
@@ -355,6 +355,20 @@ func (m Model) handleDashboardKey(msg tea.KeyMsg) (Model, tea.Cmd) {
|
||||
if m.activeSection != sectionSchedule || !m.connected {
|
||||
return m, nil
|
||||
}
|
||||
m.pickerAssignWeek = false
|
||||
m.mode = modeScheduleUserPicker
|
||||
if len(m.users) == 0 {
|
||||
m.usersLoading = true
|
||||
return m, fetchUsersCmd(m.client)
|
||||
}
|
||||
m.rebuildUserPickerTable()
|
||||
return m, nil
|
||||
|
||||
case "W":
|
||||
if m.activeSection != sectionSchedule || !m.connected {
|
||||
return m, nil
|
||||
}
|
||||
m.pickerAssignWeek = true
|
||||
m.mode = modeScheduleUserPicker
|
||||
if len(m.users) == 0 {
|
||||
m.usersLoading = true
|
||||
@@ -596,12 +610,25 @@ func (m Model) handleUserPickerKey(msg tea.KeyMsg) (Model, tea.Cmd) {
|
||||
m.mode = modeDashboard
|
||||
return m, nil
|
||||
}
|
||||
date := m.scheduleDays[scheduleCursor].date.Format("2006-01-02")
|
||||
d := m.scheduleDays[scheduleCursor].date
|
||||
var dates []string
|
||||
if m.pickerAssignWeek {
|
||||
weekday := int(d.Weekday())
|
||||
if weekday == 0 {
|
||||
weekday = 7 // ISO: Sunday = 7
|
||||
}
|
||||
monday := d.AddDate(0, 0, -(weekday - 1))
|
||||
for i := 0; i < 7; i++ {
|
||||
dates = append(dates, monday.AddDate(0, 0, i).Format("2006-01-02"))
|
||||
}
|
||||
} else {
|
||||
dates = []string{d.Format("2006-01-02")}
|
||||
}
|
||||
from := m.scheduleWindow
|
||||
to := m.scheduleWindow.AddDate(0, 0, 13)
|
||||
m.mode = modeDashboard
|
||||
m.scheduleLoading = true
|
||||
return m, assignScheduleCmd(m.client, user.ID, date, from, to)
|
||||
return m, assignScheduleCmd(m.client, user.ID, dates, from, to)
|
||||
}
|
||||
|
||||
return m, nil
|
||||
|
||||
Reference in New Issue
Block a user