Add in RCC toggle & use parts threshold inclusion.

This commit is contained in:
Patrick Fic
2026-05-05 12:02:20 -07:00
parent c63a33c83e
commit 946fd03fa6
16 changed files with 177 additions and 76 deletions

View File

@@ -213,5 +213,10 @@
"title": "Release Notes for 1.6.0-beta.2",
"date": "05/04/2026",
"notes": "New Features:\r\n* Added projected targets for SGI claims.\r\n"
},
"1.6.0-beta.3": {
"title": "Release Notes for 1.6.0-beta.3",
"date": "05/05/2026",
"notes": "New Features:\r\n* Added a toggle for SGI RCC Claims to set targets to $0.\r\n* Added handling for used parts thresholds for SGI claims. Please re-import previous jobs for accurate scoring."
}
}

View File

@@ -687,6 +687,11 @@ function SGI_V1Ruleset(jobline, joblines) {
jobline.ignore = true;
}
//Is it the use parts line threshold? Added at the end to undo the 900500 lines.
if (jobline.line_desc.toUpperCase().includes("USED PARTS THRESHOLD")) {
jobline.ignore = false;
}
return jobline;
}

View File

@@ -8,7 +8,7 @@ const log = require("electron-log");
const contextMenu = require("electron-context-menu");
const Sentry = require("@sentry/electron/main");
const enableDevTools = true; // Always enable dev tools (was: isDev || process.env.ELECTRON_ENABLE_DEVTOOLS === "1")
const enableDevTools = isDev || process.env.ELECTRON_ENABLE_DEVTOOLS === "1"; // Always enable dev tools (was: isDev || process.env.ELECTRON_ENABLE_DEVTOOLS === "1")
//const Nucleus = require("nucleus-nodejs");
require("./ipc-main-handler");
@@ -204,7 +204,7 @@ function createWindow() {
// Open the DevTools when explicitly enabled.
if (enableDevTools) {
mainWindow.webContents.openDevTools({
mode: "detach"
// mode: "detach"
});
}

View File

@@ -23,88 +23,90 @@ insert_permissions:
authid:
_eq: X-Hasura-User-Id
columns:
- id
- bodyshopid
- created_at
- updated_at
- ro_number
- ins_co_nm
- clm_no
- clm_total
- ownr_ln
- ownr_fn
- v_vin
- v_makedesc
- v_model
- v_model_yr
- v_type
- group
- v_mileage
- v_age
- loss_date
- close_date
- group_verified
- requires_reimport
- created_at
- ded_amt
- loss_desc
- ownr_addr1
- ownr_city
- ownr_ph1
- v_stage
- rates
- totals
- supp_amt
- est_system
- g_bett_amt
- group
- group_verified
- id
- id_pro_nam
- impact_1
- impact_2
- est_system
- tlos_ind
- theft_ind
- ins_co_nm
- insp_date
- loss_date
- loss_desc
- ownr_addr1
- ownr_city
- ownr_fn
- ownr_ln
- ownr_ph1
- rates
- requires_reimport
- ro_number
- sgi_rcc
- supp_amt
- theft_ind
- tlos_ind
- totals
- updated_at
- v_age
- v_makedesc
- v_mileage
- v_model
- v_model_yr
- v_stage
- v_type
- v_vin
select_permissions:
- role: user
permission:
columns:
- group_verified
- requires_reimport
- theft_ind
- tlos_ind
- close_date
- insp_date
- loss_date
- rates
- totals
- clm_total
- ded_amt
- g_bett_amt
- supp_amt
- v_age
- v_mileage
- v_stage
- bodyshopid
- clm_no
- clm_total
- close_date
- created_at
- ded_amt
- est_system
- g_bett_amt
- group
- group_verified
- id
- id_pro_nam
- impact_1
- impact_2
- ins_co_nm
- insp_date
- loss_date
- loss_desc
- ownr_addr1
- ownr_city
- ownr_fn
- ownr_ln
- ownr_ph1
- rates
- requires_reimport
- ro_number
- sgi_rcc
- supp_amt
- theft_ind
- tlos_ind
- totals
- updated_at
- v_age
- v_makedesc
- v_mileage
- v_model
- v_model_yr
- v_stage
- v_type
- v_vin
- created_at
- updated_at
- bodyshopid
- id
filter:
bodyshop:
associations:
@@ -116,45 +118,46 @@ update_permissions:
- role: user
permission:
columns:
- group_verified
- requires_reimport
- theft_ind
- tlos_ind
- close_date
- insp_date
- loss_date
- rates
- totals
- clm_total
- ded_amt
- g_bett_amt
- supp_amt
- v_age
- v_mileage
- v_stage
- bodyshopid
- clm_no
- clm_total
- close_date
- created_at
- ded_amt
- est_system
- g_bett_amt
- group
- group_verified
- id
- id_pro_nam
- impact_1
- impact_2
- ins_co_nm
- insp_date
- loss_date
- loss_desc
- ownr_addr1
- ownr_city
- ownr_fn
- ownr_ln
- ownr_ph1
- rates
- requires_reimport
- ro_number
- sgi_rcc
- supp_amt
- theft_ind
- tlos_ind
- totals
- updated_at
- v_age
- v_makedesc
- v_mileage
- v_model
- v_model_yr
- v_stage
- v_type
- v_vin
- created_at
- updated_at
- bodyshopid
- id
filter:
bodyshop:
associations:

View File

@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."jobs" add column "sgi_rcc" boolean
-- null;

View File

@@ -0,0 +1,2 @@
alter table "public"."jobs" add column "sgi_rcc" boolean
null;

View File

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

View File

@@ -1,6 +1,6 @@
import { AlertFilled, DownOutlined, LoadingOutlined } from "@ant-design/icons";
import { useMutation } from "@apollo/client";
import { Dropdown, Menu, message, Space } from "antd";
import { Dropdown, Menu, message, Space, Tooltip } from "antd";
import React, { useState } from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
@@ -10,6 +10,7 @@ import { selectBodyshop } from "../../../redux/user/user.selectors";
import GroupVerifySwitch from "../group-verify-switch/group-verify-switch.component";
import JobsGroupModalMolecule from "../jobs-group-modal/jobs-group-modal.molecule";
import { WhichMPIRulesetToApply } from "../../../util/constants";
import SGIRccSwitch from "../sgi-rcc-switch/sgi-rcc-switch.component";
const { ipcRenderer } = window;
const mapStateToProps = createStructuredSelector({
@@ -80,7 +81,7 @@ export function JobGroupMolecule({ bodyshop, jobId, group, job }) {
const menuToUse = bodyshop.ins_rule_set === "MPI" ? MPImenu : SGImenu;
return (
<Space align="top">
<Space align="center" wrap>
<Dropdown overlay={menuToUse} trigger={["click"]}>
<a href=" #" onClick={(e) => e.preventDefault()}>
{group}
@@ -93,11 +94,17 @@ export function JobGroupMolecule({ bodyshop, jobId, group, job }) {
<span style={{ color: "tomato" }}>No group set.</span>
</div>
)}
{group && (
{bodyshop.ins_rule_set === "MPI" && group && (
<div style={{ marginLeft: ".2rem" }}>
<GroupVerifySwitch job={job} loading={loading} loadingCallback={setLoading} />
</div>
)}
{bodyshop.ins_rule_set === "SGI" && (
<Tooltip title="Is this an RCC job?">
<SGIRccSwitch job={job} loading={loading} loadingCallback={setLoading} />
</Tooltip>
)}
<JobsGroupModalMolecule job={job} />
{loading && <LoadingOutlined />}

View File

@@ -63,6 +63,11 @@ export function JobsTargetsStatsMolecule({ loading, job, selectedJobTargetPc, bo
<WarningOutlined style={{ color: "seagreen" }} />
</Tooltip>
)}
{bodyshop.ins_rule_set === "SGI" && job.sgi_rcc && (
<Tooltip title="This claim has replacement cost coverage. No expected savings.">
<WarningOutlined style={{ color: "seagreen" }} />
</Tooltip>
)}
</Space>
}
style={{ margin: "0rem .5rem" }}

View File

@@ -0,0 +1,46 @@
import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
import { useMutation } from "@apollo/client";
import { message, Switch } from "antd";
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { UPDATE_JOB } from "../../../graphql/jobs.queries";
import { toggleSGIRcc } from "../../../redux/reporting/reporting.actions";
const mapStateToProps = createStructuredSelector({});
const mapDispatchToProps = (dispatch) => ({
toggleSGIRcc: (jobId) => dispatch(toggleSGIRcc(jobId))
});
export default connect(mapStateToProps, mapDispatchToProps)(SGIRccSwitch);
export function SGIRccSwitch({ job, loading, loadingCallback, toggleSGIRcc }) {
const [updateJob] = useMutation(UPDATE_JOB);
const handleChange = async (val) => {
if (loadingCallback) loadingCallback(true);
const result = await updateJob({
variables: { jobId: job.id, job: { sgi_rcc: val } }
});
if (!result.errors) {
message.success("Vehicle group updated.");
toggleSGIRcc(job.id);
} else {
message.error("Error updating job.");
}
if (loadingCallback) loadingCallback(false);
};
return (
<Switch
checkedChildren="Has RCC"
unCheckedChildren="No RCC"
disabled={loading}
checked={job.sgi_rcc}
onChange={handleChange}
title="Replacement Cost Coverage?"
/>
);
}

View File

@@ -94,6 +94,7 @@ export const QUERY_JOB_BY_PK = gql`
updated_at
group
group_verified
sgi_rcc
v_age
v_type
loss_date
@@ -175,6 +176,7 @@ export const UPDATE_JOB = gql`
v_age
group
group_verified
sgi_rcc
requires_reimport
v_mileage
joblines(order_by: { line_no: asc }) {
@@ -218,6 +220,7 @@ export const QUERY_JOB_ESTIMATE_SCRUBBER = gql`
updated_at
group
group_verified
sgi_rcc
v_age
v_type
loss_date

View File

@@ -16,6 +16,7 @@ export const REPORTING_GET_JOBS = gql`
ins_co_nm
group
group_verified
sgi_rcc
clm_total
clm_no
close_date

View File

@@ -26,6 +26,10 @@ export const toggleGroupVerified = (jobId) => ({
type: ReportingActionTypes.TOGGLE_GROUP_VERIFIED,
payload: jobId
});
export const toggleSGIRcc = (jobId) => ({
type: ReportingActionTypes.TOGGLE_SGI_RCC,
payload: jobId
});
export const calculateAudit = (claimsArrayFromAudit) => ({
type: ReportingActionTypes.CALCULATE_AUDIT,
payload: claimsArrayFromAudit

View File

@@ -58,6 +58,17 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
}
})
};
case ReportingActionTypes.TOGGLE_SGI_RCC:
return {
...state,
data: state.data.map((d) => {
if (d.id === action.payload) {
return { ...d, sgi_rcc: !d.sgi_rcc };
} else {
return d;
}
})
};
default:
return state;
}

View File

@@ -11,6 +11,7 @@ const ReportingActionTypes = {
ADD_EXCLUDED_ID: "ADD_EXCLUDED_ID",
REMOVE_EXCLUDED_ID: "REMOVE_EXCLUDED_ID",
CLEAR_EXCLUDED_IDS: "CLEAR_EXCLUDED_IDS",
SET_CACHED_JOBS: "SET_CACHED_JOBS"
SET_CACHED_JOBS: "SET_CACHED_JOBS",
TOGGLE_SGI_RCC: "TOGGLE_SGI_RCC"
};
export default ReportingActionTypes;

View File

@@ -13,6 +13,10 @@ export default function GetJobTarget({ group, v_age, targets, close_date, v_mile
&& job.v_age >= f.ageGte
&& (f.ageLt === null ? true : job.v_age < f.ageLt)
);
//Check if this is an RCC job.
if (job.sgi_rcc) {
return 0;
}
return sgiTarget?.target || 0;
case "MPI":