Add basic line level checks.

This commit is contained in:
Patrick Fic
2025-07-24 15:27:38 -07:00
parent dcc59ab2fe
commit 49562bc095
3 changed files with 45 additions and 56 deletions

View File

@@ -3,7 +3,7 @@
"productName": "ImEX RPS",
"author": "ImEX Systems Inc. <support@thinkimex.com>",
"description": "ImEX RPS",
"version": "1.4.2-alpha.1",
"version": "1.4.2-alpha.3",
"main": "electron/main.js",
"homepage": "./",
"dependencies": {

View File

@@ -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
</Space>
</Descriptions.Item>
</Descriptions>
{hasQuantityGreaterThan1 && (
<Alert
type="warning"
showIcon
message="At least one estimate line has multiple quantities. MPI best practices for RPS recognition is to create multiple lines rather than increase quantity."
/>
)}
</PageHeader>
);
}

View File

@@ -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) => (
// <Space wrap size={"small"}>
// {record.line_desc}
// {record.alerts &&
// record.alerts.length > 0 &&
// record.alerts.map((alert) => (
// <Tag key={`${record.id}-${alert.key}`} color="red">
// {alert.key}
// </Tag>
// ))}
// </Space>
// )
render: (text, record) => (
<Space wrap size={"small"}>
{record.line_desc}
{record.part_qty > 1 && <Tag color="orange">Quantity {">"} 1</Tag>}
{record.price_diff < 0 && record.db_ref?.startsWith("9005") && <Tag color="orange">Negative Savings</Tag>}
{/* {record.alerts &&
record.alerts.length > 0 &&
record.alerts.map((alert) => (
<Tag key={`${record.id}-${alert.key}`} color="red">
{alert.key}
</Tag>
))} */}
</Space>
)
},
{
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 (
<div>
<Space direction="vertical" style={{ width: "100%" }}>
<Input.Search
placeholder="Search"
onSearch={(val) => {
@@ -160,6 +161,6 @@ export default function JobLinesTableMolecule({ loading, job }) {
// y: "20rem"
}}
/>
</div>
</Space>
);
}