feature/IO-3702-ESPD-UI-AND-FIXES - Stage 4
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user