feat: implement rules engine and management panel for custom holiday optimization

This commit is contained in:
nessar committed 2026-05-30 15:00:07 +02:00
1 parent c0549de4dd
commit 08ee84e5c9
20 files changed
+3951 -16847

No files matched your search

@@ -5,8 +5,8 @@ import { CalendarMonth } from '../calendar-month/calendar-month';
import { CalendarService, SelectedDates } from '../../services/calendar-service';
import { MatProgressSpinner } from '@angular/material/progress-spinner';
import { CalendarSettingsService } from '../../services/calendar-settings-service';
import { DateCacheService } from '../../services/date-cache.service';
import { RuleService } from '../../services/rule-service';
@Component({
selector: 'app-calendar-year',
@@ -18,7 +18,7 @@ export class CalendarYear {
private dateCache = inject(DateCacheService);
private userInput = inject(UserInputService);
private calendarService = inject(CalendarService);
private calendarSettingsService = inject(CalendarSettingsService);
private ruleService = inject(RuleService);
protected isLoading = signal(true);
protected loadingProgress = signal(0);
@@ -38,9 +38,11 @@ export class CalendarYear {
this.selectedDates = this.calendarService.getSelectedDatesForYear();
const vacationData = untracked(() => this.userInput.vacationNumberSignal());
const c = untracked(() => this.calendarSettingsService.get('samediMalin')());
console.log('Samedi Malin setting:', c);
const currentRules = untracked(() => this.ruleService.rules);
console.log('Optimizing vacations with data:', vacationData);
console.log('Using rules:', currentRules);
this.isLoading.set(true);
this.loadingProgress.set(0);
// Defer execution to allow UI to update
@@ -51,7 +53,7 @@ export class CalendarYear {
const vacationDaysCopy = vacationData.map((vd) => ({ ...vd }));
const remainingDays = await this.selectedDates.optimizeVacations(
vacationDaysCopy,
this.calendarSettingsService,
currentRules,
this.calendarService,
(progress: number) => {
this.loadingProgress.set(progress);