diff --git a/package.json b/package.json index 406b30f..1d43d24 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "ImEX RPS", "author": "ImEX Systems Inc. ", "description": "ImEX RPS", - "version": "1.4.2-alpha.1", + "version": "1.4.2-alpha.3", "main": "electron/main.js", "homepage": "./", "dependencies": { diff --git a/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx b/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx index 4aa6fda..545e22a 100644 --- a/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx +++ b/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx @@ -1,7 +1,9 @@ import { PrinterFilled, WarningOutlined } from "@ant-design/icons"; import { PageHeader } from "@ant-design/pro-layout"; import { Alert, Button, Descriptions, Skeleton, Space, Tooltip } from "antd"; -import React, { useMemo, useRef } from "react"; +import moment from "moment"; +import { useMemo, useRef } from "react"; +import { useReactToPrint } from "react-to-print"; import { DateFormat, WhichRulesetToApply } from "../../../util/constants"; import dayjs from "../../../util/day.js"; import CurrencyFormatterAtom from "../../atoms/currency-formatter/currency-formatter.atom"; @@ -11,14 +13,8 @@ import TimeAgoFormatter from "../../atoms/time-ago-formatter/time-ago-formatter. import VehicleGroupAlertAtom from "../../atoms/vehicle-group-alert/vehicle-group-alert.atom"; import CloseDateDisplayMolecule from "../close-date-display/close-date-display.molecule"; import JobGroupMolecule from "../job-group/job-group.molecule"; -import moment from "moment"; -import { useReactToPrint } from "react-to-print"; export default function JobsDetailDescriptionMolecule({ loading, job, jobDetailRef }) { - const hasQuantityGreaterThan1 = useMemo(() => { - return job?.joblines?.find((jl) => !jl.ignore && jl.quantity > 1); - }, [job]); - // Store original theme state const originalThemeRef = useRef(null); @@ -28,43 +24,43 @@ export default function JobsDetailDescriptionMolecule({ loading, job, jobDetailR onBeforeGetContent: () => { // Store original theme state originalThemeRef.current = { - dataTheme: document.documentElement.getAttribute('data-theme'), + dataTheme: document.documentElement.getAttribute("data-theme"), bodyClasses: Array.from(document.body.classList), - htmlClasses: Array.from(document.documentElement.classList), + htmlClasses: Array.from(document.documentElement.classList) }; - + // Force light mode for printing - document.documentElement.setAttribute('data-theme', 'light'); - document.body.classList.remove('dark', 'ant-dark'); - document.documentElement.classList.remove('dark', 'ant-dark'); - + document.documentElement.setAttribute("data-theme", "light"); + document.body.classList.remove("dark", "ant-dark"); + document.documentElement.classList.remove("dark", "ant-dark"); + // Set light mode CSS variables for Ant Design - document.documentElement.style.setProperty('--ant-color-bg-base', '#ffffff'); - document.documentElement.style.setProperty('--ant-color-text', '#000000'); - document.documentElement.style.setProperty('--ant-color-text-secondary', 'rgba(0, 0, 0, 0.65)'); - document.documentElement.style.setProperty('--ant-color-border', '#d9d9d9'); + document.documentElement.style.setProperty("--ant-color-bg-base", "#ffffff"); + document.documentElement.style.setProperty("--ant-color-text", "#000000"); + document.documentElement.style.setProperty("--ant-color-text-secondary", "rgba(0, 0, 0, 0.65)"); + document.documentElement.style.setProperty("--ant-color-border", "#d9d9d9"); }, onAfterPrint: () => { // Restore original theme after printing if (originalThemeRef.current) { const { dataTheme, bodyClasses, htmlClasses } = originalThemeRef.current; - + if (dataTheme) { - document.documentElement.setAttribute('data-theme', dataTheme); + document.documentElement.setAttribute("data-theme", dataTheme); } else { - document.documentElement.removeAttribute('data-theme'); + document.documentElement.removeAttribute("data-theme"); } - + // Restore original classes - document.body.className = bodyClasses.join(' '); - document.documentElement.className = htmlClasses.join(' '); + document.body.className = bodyClasses.join(" "); + document.documentElement.className = htmlClasses.join(" "); } - + // Reset CSS variables - document.documentElement.style.removeProperty('--ant-color-bg-base'); - document.documentElement.style.removeProperty('--ant-color-text'); - document.documentElement.style.removeProperty('--ant-color-text-secondary'); - document.documentElement.style.removeProperty('--ant-color-border'); + document.documentElement.style.removeProperty("--ant-color-bg-base"); + document.documentElement.style.removeProperty("--ant-color-text"); + document.documentElement.style.removeProperty("--ant-color-text-secondary"); + document.documentElement.style.removeProperty("--ant-color-border"); } }); @@ -141,14 +137,6 @@ export default function JobsDetailDescriptionMolecule({ loading, job, jobDetailR - - {hasQuantityGreaterThan1 && ( - - )} ); } diff --git a/src/components/molecules/jobs-lines-table/jobs-lines-table.molecule.jsx b/src/components/molecules/jobs-lines-table/jobs-lines-table.molecule.jsx index bc9aac0..e7b23de 100644 --- a/src/components/molecules/jobs-lines-table/jobs-lines-table.molecule.jsx +++ b/src/components/molecules/jobs-lines-table/jobs-lines-table.molecule.jsx @@ -1,6 +1,6 @@ import { CalculatorOutlined } from "@ant-design/icons"; import { Input, Space, Table, Tag } from "antd"; -import React, { useState } from "react"; +import { useState } from "react"; import ipcTypes from "../../../ipc.types"; import { alphaSort } from "../../../util/sorters"; import CurrencyFormatterAtom from "../../atoms/currency-formatter/currency-formatter.atom"; @@ -40,19 +40,20 @@ export default function JobLinesTableMolecule({ loading, job }) { key: "line_desc", width: "25%", sorter: (a, b) => alphaSort(a.line_desc, b.line_desc), - //2025-05-27 Removing CC AI - // render: (text, record) => ( - // - // {record.line_desc} - // {record.alerts && - // record.alerts.length > 0 && - // record.alerts.map((alert) => ( - // - // {alert.key} - // - // ))} - // - // ) + render: (text, record) => ( + + {record.line_desc} + {record.part_qty > 1 && Quantity {">"} 1} + {record.price_diff < 0 && record.db_ref?.startsWith("9005") && Negative Savings} + {/* {record.alerts && + record.alerts.length > 0 && + record.alerts.map((alert) => ( + + {alert.key} + + ))} */} + + ) }, { title: "Part Type", @@ -116,8 +117,8 @@ export default function JobLinesTableMolecule({ loading, job }) { key: "ignore", filters: [ { text: "Eligible for RPS Calculation", value: false }, - { text: "Ineligible for RPS Calculation", value: true }, - // { text: "Lines with identified issues", value: "ai" } + { text: "Ineligible for RPS Calculation", value: true } + // { text: "Lines with identified issues", value: "ai" } ], width: "5%", filteredValue: filters.ignore || null, @@ -134,7 +135,7 @@ export default function JobLinesTableMolecule({ loading, job }) { }; return ( -
+ { @@ -160,6 +161,6 @@ export default function JobLinesTableMolecule({ loading, job }) { // y: "20rem" }} /> -
+ ); }