diff --git a/frontend/src/components/FilteredConsultantsList.tsx b/frontend/src/components/FilteredConsultantsList.tsx index ae3fc30d..3385e1ef 100644 --- a/frontend/src/components/FilteredConsultantsList.tsx +++ b/frontend/src/components/FilteredConsultantsList.tsx @@ -10,6 +10,7 @@ import { FilteredContext } from "@/hooks/ConsultantFilterProvider"; export default function StaffingTable() { const { + numWorkHours, filteredConsultants, weeklyTotalBillable, weeklyTotalBillableAndOffered, @@ -111,7 +112,11 @@ export default function StaffingTable() { {filteredConsultants.map((consultant) => ( - + ))} (consultant); @@ -226,6 +228,7 @@ export default function ConsultantRows({ columnCount={columnCount} isLastCol={index == currentConsultant.bookings.length - 1} isSecondLastCol={index == currentConsultant.bookings.length - 2} + numWorkHours={numWorkHours} /> ))} diff --git a/frontend/src/components/Staffing/WeekCell.tsx b/frontend/src/components/Staffing/WeekCell.tsx index c22f639d..14544068 100644 --- a/frontend/src/components/Staffing/WeekCell.tsx +++ b/frontend/src/components/Staffing/WeekCell.tsx @@ -15,6 +15,7 @@ export function WeekCell(props: { columnCount: number; isLastCol: boolean; isSecondLastCol: boolean; + numWorkHours: number; }) { const { bookedHoursPerWeek: bookedHoursPerWeek, @@ -26,6 +27,7 @@ export function WeekCell(props: { columnCount, isLastCol, isSecondLastCol, + numWorkHours, } = props; let pillNumber = 0; @@ -152,11 +154,34 @@ export function WeekCell(props: { isListElementVisible ? "normal-medium" : "normal" }`} > - {bookedHoursPerWeek.bookingModel.totalBillable.toLocaleString( - "nb-No", - )} + {bookedHoursPerWeek.bookingModel.totalPlannedAbsences > 0 && + checkIfNotStartedOrQuit(consultant, bookedHoursPerWeek, numWorkHours) + ? "-" + : bookedHoursPerWeek.bookingModel.totalBillable.toLocaleString( + "nb-No", + )}

); } + +function checkIfNotStartedOrQuit( + consultant: ConsultantReadModel, + bookedHoursPerWeek: BookedHoursPerWeek, + numWorkHours: number, +) { + const project = consultant.detailedBooking.find( + (b) => b.bookingDetails.projectName == "Ikke startet eller sluttet", + ); + const hours = project?.hours.find( + (h) => h.week == bookedHoursPerWeek.sortableWeek, + ); + + if (!hours?.hours) return false; + + return ( + hours?.hours == + numWorkHours - bookedHoursPerWeek.bookingModel.totalHolidayHours + ); +} diff --git a/frontend/src/hooks/staffing/useConsultantsFilter.ts b/frontend/src/hooks/staffing/useConsultantsFilter.ts index 420a1828..0cae1188 100644 --- a/frontend/src/hooks/staffing/useConsultantsFilter.ts +++ b/frontend/src/hooks/staffing/useConsultantsFilter.ts @@ -82,6 +82,7 @@ export function useConsultantsFilter() { ); return { + numWorkHours, filteredConsultants, weeklyTotalBillable, weeklyTotalBillableAndOffered,