import { CalendarOutlined, EyeFilled, DownloadOutlined, PauseCircleOutlined, BranchesOutlined, } from "@ant-design/icons"; import { Card, Col, Row, Space, Tooltip } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { DateTimeFormatter } from "../../utils/DateFormatter"; import ProductionAlert from "../production-list-columns/production-list-columns.alert.component"; import ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component"; import ProductionSubletsManageComponent from "../production-sublets-manage/production-sublets-manage.component"; import "./production-board-card.styles.scss"; import dayjs from "../../utils/day"; import OwnerNameDisplay from "../owner-name-display/owner-name-display.component"; import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component"; const cardColor = (ssbuckets, totalHrs) => { const bucket = ssbuckets.filter( (bucket) => bucket.gte <= totalHrs && (!!bucket.lt ? bucket.lt > totalHrs : true) )[0]; let color = { r: 255, g: 255, b: 255 }; if (bucket && bucket.color) { color = bucket.color; if (bucket.color.rgb) { color = bucket.color.rgb; } } return color; }; function getContrastYIQ(bgColor) { const yiq = (bgColor.r * 299 + bgColor.g * 587 + bgColor.b * 114) / 1000; return yiq >= 128 ? "black" : "white"; } export default function ProductionBoardCard( technician, card, bodyshop, cardSettings ) { const { t } = useTranslation(); let employee_body, employee_prep, employee_refinish, employee_csr; if (card.employee_body) { employee_body = bodyshop.employees.find((e) => e.id === card.employee_body); } if (card.employee_prep) { employee_prep = bodyshop.employees.find((e) => e.id === card.employee_prep); } if (card.employee_refinish) { employee_refinish = bodyshop.employees.find( (e) => e.id === card.employee_refinish ); } if (card.employee_csr) { employee_csr = bodyshop.employees.find((e) => e.id === card.employee_csr); } // if (card.employee_csr) { // employee_csr = bodyshop.employees.find((e) => e.id === card.employee_csr); // } const pastDueAlert = !!card.scheduled_completion && ((dayjs().isSameOrAfter(dayjs(card.scheduled_completion), "day") && "production-completion-past") || (dayjs() .add(1, "day") .isSame(dayjs(card.scheduled_completion), "day") && "production-completion-soon")); const totalHrs = card.labhrs.aggregate.sum.mod_lb_hrs + card.larhrs.aggregate.sum.mod_lb_hrs; const bgColor = cardColor(bodyshop.ssbuckets, totalHrs); return ( {card.suspended && ( )} {card.iouparent && ( )} {card.ro_number || t("general.labels.na")} } extra={ } > {cardSettings && cardSettings.ownr_nm && ( {cardSettings && cardSettings.compact ? (
{`${card.ownr_ln || ""} ${ card.ownr_co_nm || "" }`}
) : (
)} )}
{`${card.v_model_yr || ""} ${ card.v_make_desc || "" } ${card.v_model_desc || ""}`}
{cardSettings && cardSettings.ins_co_nm && card.ins_co_nm && (
{card.ins_co_nm || ""}
)} {cardSettings && cardSettings.clm_no && card.clm_no && (
{card.clm_no || ""}
)} {cardSettings && cardSettings.employeeassignments && ( {`B: ${ employee_body ? `${employee_body.first_name.substr( 0, 3 )} ${employee_body.last_name.charAt(0)}` : "" } ${card.labhrs.aggregate.sum.mod_lb_hrs || "?"}h`} {`P: ${ employee_prep ? `${employee_prep.first_name.substr( 0, 3 )} ${employee_prep.last_name.charAt(0)}` : "" }`} {`R: ${ employee_refinish ? `${employee_refinish.first_name.substr( 0, 3 )} ${employee_refinish.last_name.charAt(0)}` : "" } ${card.larhrs.aggregate.sum.mod_lb_hrs || "?"}h`} {`C: ${ employee_csr ? `${employee_csr.first_name} ${employee_csr.last_name}` : "" }`} )} {/* {cardSettings && cardSettings.laborhrs && ( {`B: ${ card.labhrs.aggregate.sum.mod_lb_hrs || "?" } hrs`} {`R: ${ card.larhrs.aggregate.sum.mod_lb_hrs || "?" } hrs`} )} */} {cardSettings && cardSettings.actual_in && card.actual_in && ( {card.actual_in} )} {cardSettings && cardSettings.scheduled_completion && card.scheduled_completion && ( {card.scheduled_completion} )} {cardSettings && cardSettings.ats && card.alt_transport && (
{card.alt_transport || ""}
)} {cardSettings && cardSettings.sublets && ( )} {cardSettings && cardSettings.production_note && ( {cardSettings && cardSettings.production_note && ( )} )} {cardSettings && cardSettings.partsstatus && ( )}
); }