Add support for free days off.

This commit is contained in:
2026-03-01 10:19:29 +01:00
parent 576ab90180
commit d71abe29b0
2 changed files with 13 additions and 2 deletions

View File

@@ -69,6 +69,9 @@ public class CalendarPanel extends JPanel {
} }
private void toggleSelection(LocalDate date) { private void toggleSelection(LocalDate date) {
if (pointEngine.getPointsOfDay(date) == 0.0)
return;
if (selectedDates.contains(date)) { if (selectedDates.contains(date)) {
selectedDates.remove(date); selectedDates.remove(date);
} else { } else {
@@ -156,8 +159,12 @@ public class CalendarPanel extends JPanel {
LocalDate cellDate = currentMonth.atDay(day); LocalDate cellDate = currentMonth.atDay(day);
boolean isToday = cellDate.equals(today); boolean isToday = cellDate.equals(today);
boolean isSelected = selectedDates.contains(cellDate); boolean isSelected = selectedDates.contains(cellDate);
double points = pointEngine.getPointsOfDay(cellDate);
if (isSelected && isToday) { if (points == 0.0) {
g.setColor(new Color(255, 100, 100));
g.fillRect(x, y, cellWidth, cellHeight);
} else if (isSelected && isToday) {
g.setColor(new Color(123, 166, 180)); g.setColor(new Color(123, 166, 180));
g.fillRect(x, y, cellWidth, cellHeight); g.fillRect(x, y, cellWidth, cellHeight);
} else if (isSelected) { } else if (isSelected) {
@@ -176,7 +183,7 @@ public class CalendarPanel extends JPanel {
int textY = y + (cellHeight - fm.getHeight()) / 2 + fm.getAscent() - 8; int textY = y + (cellHeight - fm.getHeight()) / 2 + fm.getAscent() - 8;
g.drawString(dayStr, textX, textY); g.drawString(dayStr, textX, textY);
String pointsStr = "(" + pointEngine.getPointsOfDay(cellDate) + ")"; String pointsStr = "(" + points + ")";
Font smallFont = new Font("Arial", Font.PLAIN, 10); Font smallFont = new Font("Arial", Font.PLAIN, 10);
FontMetrics smallFm = g.getFontMetrics(smallFont); FontMetrics smallFm = g.getFontMetrics(smallFont);
g.setFont(smallFont); g.setFont(smallFont);

View File

@@ -4,3 +4,7 @@ m=Jul 0.825
m=Aug 0.825 m=Aug 0.825
2026-12-24 0.5 2026-12-24 0.5
2026-12-31 0.5 2026-12-31 0.5
dow=Sun 0.0
dow=Sat 0.0
2026-01-01 0.0
2026-12-25 0.0