feature/IO-3702-ESPD-UI-AND-FIXES - Stage 4

This commit is contained in:
Dave
2026-05-27 13:27:54 -04:00
parent c806ef67a0
commit 1e7e13ff32
11 changed files with 141 additions and 27 deletions

View File

@@ -5,6 +5,7 @@ import fs from "fs";
import _ from "lodash";
import path from "path";
import errorTypeCheck from "../../util/errorTypeCheck";
import ipcTypes from "../../util/ipcTypes.json";
import { ScrubEstimate } from "../estimate-scrubber/estimate-scrubber";
import store from "../store/store";
import setAppProgressbar from "../util/setAppProgressBar";
@@ -138,7 +139,9 @@ async function ImportJob(filepath: string): Promise<void> {
console.log("Available Job record to upload;", newAvailableJob);
//Scrub the estimate
const scrubPdfURL = await ScrubEstimate({ job: jobObject });
const scrubResult = await ScrubEstimate({ job: jobObject });
const scrubPdfURL = scrubResult?.pdfUrl;
const scrubHistoryJobId = scrubResult?.jobId;
setAppProgressbar(0.95);
const esApiKey = store.get("settings.esApiKey") as string;
@@ -160,11 +163,27 @@ async function ImportJob(filepath: string): Promise<void> {
],
});
const openScrubHistoryItem = (): void => {
const mainWindow = getMainWindow();
if (!mainWindow || mainWindow.isDestroyed()) return;
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
mainWindow.show();
mainWindow.focus();
if (scrubHistoryJobId) {
mainWindow.webContents.send(
ipcTypes.toRenderer.scrub.openHistoryItem,
{ jobId: scrubHistoryJobId },
);
}
};
uploadNotification.on("click", openScrubHistoryItem);
uploadNotification.on("action", (e) => {
// e.actionIndex
if (e.actionIndex === 0) {
const mainWindow = getMainWindow();
mainWindow?.show();
openScrubHistoryItem();
} else if (e.actionIndex === 1) {
if (scrubPdfURL) {
newWindow(scrubPdfURL);