Major clean up and alpha.1 release.

This commit is contained in:
Patrick Fic
2026-02-26 12:31:24 -08:00
parent 4915e05ac9
commit 1c44e92fb0
20 changed files with 285 additions and 546 deletions

View File

@@ -36,6 +36,8 @@ import { DecodedTtl } from "./decode-ttl.interface";
import DecodeVeh from "./decode-veh";
import { DecodedVeh } from "./decode-veh.interface";
import UploadEmsToS3 from "./emsbackup";
import getMainWindow from "../../util/getMainWindow";
import newWindow from "../../util/newWindow";
async function ImportJob(filepath: string): Promise<void> {
const parsedFilePath = path.parse(filepath);
@@ -136,7 +138,7 @@ async function ImportJob(filepath: string): Promise<void> {
console.log("Available Job record to upload;", newAvailableJob);
//Scrub the estimate
const scrubResults = await ScrubEstimate({ job: jobObject });
const scrubPdfURL = await ScrubEstimate({ job: jobObject });
setAppProgressbar(0.95);
const esApiKey = store.get("settings.esApiKey") as string;
@@ -149,17 +151,42 @@ async function ImportJob(filepath: string): Promise<void> {
});
setAppProgressbar(-1);
const items = ["One", "Two", "Three"];
const n = new Notification({
title: "Choose an Action!",
actions: [
{ type: "button", text: "Action 1" },
{ type: "button", text: "Action 2" },
{ type: "selection", text: "Apply", items },
],
});
const uploadNotification = new Notification({
title: "Job Scrubbed",
//subtitle: `${newAvailableJob.ownr_name} - ${newAvailableJob.vehicle_info}`,
body: `${newAvailableJob.ownr_name} - ${newAvailableJob.vehicle_info}. Click to view.`,
actions: [{ text: "View Job", type: "button" }],
actions: [
{ text: "View in App", type: "button" as const },
...(scrubPdfURL ? [{ text: "View PDF", type: "button" as const }] : []),
],
});
uploadNotification.on("click", () => {
if (scrubResults?.data?.resultPDFUrl) {
shell.openExternal(scrubResults.data.resultPDFUrl);
uploadNotification.on("action", (e) => {
// e.actionIndex
if (e.actionIndex === 0) {
const mainWindow = getMainWindow();
mainWindow?.show();
} else if (e.actionIndex === 1) {
if (scrubPdfURL) {
newWindow(scrubPdfURL);
}
}
});
// uploadNotification.on("click", () => {
// if (scrubPdfURL) {
// shell.openExternal(scrubPdfURL);
// }
// });
uploadNotification.show();
} catch (error) {
log.error("Error encountered while decoding job. ", errorTypeCheck(error));