Updates for dynamic ruleset choices.

This commit is contained in:
Patrick Fic
2023-02-09 12:52:57 -08:00
parent 7e12247f8b
commit 1f0bcf5611
8 changed files with 147 additions and 39 deletions

View File

@@ -5,6 +5,7 @@ import moment from "moment";
import client from "../graphql/GraphQLClient";
import {
INSERT_NEW_JOB,
QUERY_CLOSE_DATE_BY_CLM_NO,
QUERY_JOB_BY_CLM_NO,
UPDATE_JOB,
} from "../graphql/jobs.queries";
@@ -48,6 +49,14 @@ export function CalculateVehicleAge(job) {
return ret;
}
export async function GetR4PDateWithClaim(clm_no) {
const existingJobs = await client.query({
query: QUERY_CLOSE_DATE_BY_CLM_NO,
variables: { clm_no: clm_no },
});
return existingJobs.data.jobs[0] && existingJobs.data.jobs[0].close_date;
}
export async function UpsertEstimate(job) {
const shopId = store.getState().user.bodyshop.id;
//logger.info("Beginning Upserting job from Renderer.");

View File

@@ -8,7 +8,7 @@ import {
setWatcherStatus,
} from "../redux/application/application.actions";
import { store } from "../redux/store";
import { UpsertEstimate } from "./ipc-estimate-utils";
import { GetR4PDateWithClaim, UpsertEstimate } from "./ipc-estimate-utils";
import { setScanEstimateList } from "../redux/scan/scan.actions";
import { signOutStart } from "../redux/user/user.actions";
const { ipcRenderer } = window;
@@ -44,16 +44,19 @@ ipcRenderer.on(ipcTypes.default.fileWatcher.toRenderer.error, (event, obj) => {
//Estimate Section
ipcRenderer.on(
ipcTypes.default.estimate.toRenderer.estimateDecodeStart,
(event, obj) => {
console.log("Decoding started!");
ipcTypes.default.estimate.toRenderer.getCloseDate,
async (event, { filepath, clm_no }) => {
const close_date = await GetR4PDateWithClaim(clm_no);
ipcRenderer.send(ipcTypes.default.app.toMain.importJob, {
filepath,
close_date,
});
}
);
ipcRenderer.on(
ipcTypes.default.estimate.toRenderer.estimateDecodeSuccess,
async (event, obj) => {
await UpsertEstimate(obj);
}
);