diff --git a/frontend/src/components/ConsultantRow.tsx b/frontend/src/components/ConsultantRow.tsx index e275f8f4..99ffc709 100644 --- a/frontend/src/components/ConsultantRow.tsx +++ b/frontend/src/components/ConsultantRow.tsx @@ -1,5 +1,10 @@ "use client"; -import { BookingType, Consultant, DetailedBooking } from "@/types"; +import { + BookedHoursPerWeek, + BookingType, + Consultant, + DetailedBooking, +} from "@/types"; import { ReactElement, useState } from "react"; import { AlertTriangle, @@ -10,7 +15,7 @@ import { Moon, Sun, } from "react-feather"; -import InfoPill, { InfoPillProps, InfoPillVariant } from "./InfoPill"; +import InfoPill, { InfoPillVariant } from "./InfoPill"; export default function ConsultantRows({ consultant, @@ -66,178 +71,31 @@ export default function ConsultantRows({

- {consultant.bookings?.map((b) => ( - -
0 - ? `bg-black text-white` - : b.bookingModel.totalSellableTime > 0 - ? `bg-semantic_4_l1` - : `bg-primary_l5` - }`} - onMouseEnter={() => setHoveredRowWeek(b.weekNumber)} - onMouseLeave={() => setHoveredRowWeek(-1)} - > -
- d.hours - .filter((h) => h.week % 100 == b.weekNumber) - .reduce((sum, h) => sum + h.hours, 0), - ) - .reduce((a, b) => a + b, 0) == 0) && - "hidden" - }`} - > -
- {consultant.detailedBooking.map((db, index) => ( - <> - {db.hours.find((hour) => hour.week % 100 == b.weekNumber) - ?.hours != 0 && ( -
- db.hours.find( - (hour) => hour.week % 100 == b.weekNumber, - )?.hours != 0, - ).length - - 1 && "border-b pb-2 border-hover_background" - }`} - > -
-
- {getIconByBookingType(db.bookingDetails.type)} -
-

- {db.bookingDetails.name} -

-
-

- { - db.hours.find( - (hour) => hour.week % 100 == b.weekNumber, - )?.hours - } -

-
- )} - - ))} -
-
-
-
- {b.bookingModel.totalOffered > 0 && ( - } - variant={getInfopillVariantByColumnCount(columnCount)} - /> - )} - {b.bookingModel.totalSellableTime > 0 && - getInfopillVariantByColumnCount(columnCount) !== "narrow" && ( - } - variant={getInfopillVariantByColumnCount(columnCount)} - /> - )} - {b.bookingModel.totalVacationHours > 0 && ( - } - variant={getInfopillVariantByColumnCount(columnCount)} - /> - )} - {b.bookingModel.totalOverbooking > 0 && ( - } - variant={getInfopillVariantByColumnCount(columnCount)} - /> - )} -
-

- {b.bookingModel.totalBillable} -

-
- + {consultant.bookings?.map((b, index) => ( + ))} {isListElementVisible && consultant.detailedBooking && - consultant.detailedBooking.map((db) => ( - - - -
- {getIconByBookingType(db.bookingDetails.type)} -
-
-

- {db.bookingDetails.type} -

-

- {db.bookingDetails.name} -

-
- - {db.hours - .sort((a, b) => a.week - b.week) - .map((h) => ( - -

- {h.hours} -

- - ))} - + consultant.detailedBooking.map((db, index) => ( + ))} {isListElementVisible && ( - +