feat: add PlanningDurationService for estimating planning duration

- Implemented PlanningDurationService to provide an indicative wait time before calculation based on user input and calendar settings.
- Introduced duration estimation logic that considers horizon dates, balances, and rules without triggering a calculation.
- Enhanced user input component to display estimated duration using the new service.
- Updated translation files to include new duration estimate strings in multiple languages.
- Added tests for PlanningDurationService to ensure accurate duration estimation and calibration.
- Refactored leave planner service to remove hardcoded deadlines and improve worker responsiveness.
This commit is contained in:
nessar committed 2026-10-05 17:06:17 +02:00
1 parent 2edf2004f5
commit bc8570d8ca
29 files changed
+1064 -123

No files matched your search

@@ -9,6 +9,7 @@ import { MatButtonModule } from '@angular/material/button';
import { VacDay } from '../../services/calendar-service';
import { TranslationService } from '../../services/translation-service';
import { CalendarSettingsService } from '../../services/calendar-settings-service';
import { PlanningDurationService } from '../../services/planning-duration.service';
@Component({
selector: 'app-user-input',
@@ -28,7 +29,18 @@ import { CalendarSettingsService } from '../../services/calendar-settings-servic
export class UserInput {
private userInputService: UserInputService = inject(UserInputService);
protected readonly calendarSettings = inject(CalendarSettingsService);
protected readonly duration = inject(PlanningDurationService);
protected readonly translationService = inject(TranslationService);
protected readonly durationLabel = computed(() => {
const estimate = this.duration.estimate();
if (!estimate) return '';
return this.tr()
.userInput.durationEstimate.replace(
'{range}',
`${estimate.minimum}–${estimate.maximum}`,
)
.replace('{unit}', this.tr().userInput.durationUnits[estimate.unit]);
});
get tr() {
return this.translationService.tr;