Add basic alerts back.

This commit is contained in:
Patrick Fic
2025-08-21 15:39:42 -07:00
parent 1de87a4280
commit 5a4970c440
3 changed files with 28 additions and 46 deletions

View File

@@ -1,6 +1,5 @@
import { Badge, Card, Collapse, Skeleton, Space } from "antd";
import { Badge, Card, List, Skeleton, Space } from "antd";
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import ErrorResultAtom from "../../atoms/error-result/error-result.atom";
@@ -18,42 +17,24 @@ export function JobsClaimClerk({ loading, job }) {
if (!job)
return <ErrorResultAtom title="Error displaying job." errorMessage="It looks like this job doesn't exist." />;
const alertData = job.joblines
.map((jobline) =>
jobline.alerts?.map((alert, idx) => ({
key: `${jobline.line_no}-${alert.key}-${idx}`,
label: `Line ${jobline.line_no}: ${alert.key}`,
children: <div dangerouslySetInnerHTML={{ __html: alert.alert }} />
// style: {
// backgroundColor: token.colorErrorBgHover
//
}))
)
const alertData = job.alerts
?.map((alert, idx) => ({
key: `${alert.line_no}-${alert.key}-${idx}`,
label: `Line ${alert.line_no}: ${alert.key}`,
children: <div dangerouslySetInnerHTML={{ __html: alert.alert }} />,
alert: alert.alert
}))
.flat();
return (
<Card
title={
<Space>
Claims Clerk AI <Badge count={alertData.length} />
Estimate Review <Badge count={alertData.length} />
</Space>
}
>
<Collapse
//bordered={false}
// ghost
items={[
{
key: "main",
label:
alertData.length > 0
? `Claims Clerk AI has found ${alertData.length} issues or savings opportunities on this job.`
: `Congratulations! Claims Clerk AI did not find any additional opportunities for this job.`,
children: <Collapse items={alertData} bordered={false} />
}
]}
/>
<List mode="left" dataSource={alertData} renderItem={(item) => <List.Item>{item.alert}</List.Item>} />
</Card>
);
}

View File

@@ -55,8 +55,7 @@ export function ReportingJobsListMolecule({
<Space>
{text}
{false &&
record.alerts &&
{record.alerts &&
record.alerts.length > 0 && ( //2025-05-27 Removing CC AI
<Tooltip title="Claims Clerk AI has detected possible issues with this estimate. Review the estimate to ensure you are following MPI guidelines.">
<Badge count={record.alerts.length} />
@@ -102,7 +101,7 @@ export function ReportingJobsListMolecule({
title: "Vehicle",
dataIndex: "vehicle",
key: "vehicle",
render: (text, record) => <VehicleGroupAlertAtom job={record} showGroup />,
render: (text, record) => <VehicleGroupAlertAtom job={record} showGroup />
//ellipsis: true
},
{

View File

@@ -188,7 +188,7 @@ export function* handleCalculateScoreCard({ payload: queriedJobs }) {
job.joblines.forEach((jobline) => {
if (jobline.part_qty > 1) {
simpleJobAlerts.push({
key: `line-${jobline.id}`,
key: `line-${jobline.id}-q`,
alert: `Line ${jobline.line_no} has a quantity greater than 1 (${jobline.part_qty})`,
line_no: jobline.line_no,
line_desc: jobline.line_desc,
@@ -197,7 +197,7 @@ export function* handleCalculateScoreCard({ payload: queriedJobs }) {
}
if (jobline.price_diff < 0 && !jobline.db_ref?.startsWith("9005")) {
simpleJobAlerts.push({
key: `line-${jobline.id}`,
key: `line-${jobline.id}-p`,
alert: `Line ${jobline.line_no} has negative savings (${jobline.price_diff})`,
line_no: jobline.line_no,
line_desc: jobline.line_desc,
@@ -206,18 +206,20 @@ export function* handleCalculateScoreCard({ payload: queriedJobs }) {
}
});
const jobAlerts = [...simpleJobAlerts, ...job.joblines
.map((jobline) =>
jobline.alerts?.map((alert, idx) => ({
key: idx,
label: `Line ${jobline.line_no}: ${alert.key}`,
children: alert.alert
// style: {
// backgroundColor: token.colorErrorBgHover
// }
}))
)
.flat()];
const jobAlerts = [...simpleJobAlerts,
// ...job.joblines
// .map((jobline) =>
// jobline.alerts?.map((alert, idx) => ({
// key: idx,
// label: `Line ${jobline.line_no}: ${alert.key}`,
// children: alert.alert
// // style: {
// // backgroundColor: token.colorErrorBgHover
// // }
// }))
// )
// .flat()
];
//sum db price * percentage expected.
return {