Add API key to estimate scrubber.
This commit is contained in:
@@ -4,6 +4,7 @@ const path = require("path");
|
|||||||
const { BrowserWindow } = require("electron");
|
const { BrowserWindow } = require("electron");
|
||||||
const { default: ipcTypes } = require("../../src/ipc.types.commonjs");
|
const { default: ipcTypes } = require("../../src/ipc.types.commonjs");
|
||||||
const { promises: fsPromises } = require("fs");
|
const { promises: fsPromises } = require("fs");
|
||||||
|
const { autoUpdater } = require("electron-updater")
|
||||||
|
|
||||||
// Function to write job object to logs subfolder
|
// Function to write job object to logs subfolder
|
||||||
async function writeJobToLogsFolder(job, fileName) {
|
async function writeJobToLogsFolder(job, fileName) {
|
||||||
@@ -35,9 +36,11 @@ async function ScrubEstimate({ job }) {
|
|||||||
//No secret or private information is exposed.
|
//No secret or private information is exposed.
|
||||||
const basicAuthUser = "Imex2";
|
const basicAuthUser = "Imex2";
|
||||||
const basicAuthpassword = "Patrick";
|
const basicAuthpassword = "Patrick";
|
||||||
const estimateScrubberUrl = "https://insurtechtoolkit.com/api/sendems";
|
const currentChannel = autoUpdater.channel
|
||||||
|
const estimateScrubberUrl = process.env.NODE_ENV !== undefined || currentChannel === 'alpha' ? 'https://4284-79073.el-alt.com/api/sendems' : "https://insurtechtoolkit.com/api/sendems";
|
||||||
|
console.log("*** ~ ScrubEstimate ~ process.env.NODE_ENV:", process.env.NODE_ENV);
|
||||||
const sendingEntityId = "87330f61-412b-4251-baaa-d026565b23c5";
|
const sendingEntityId = "87330f61-412b-4251-baaa-d026565b23c5";
|
||||||
try {
|
try { const esApiKey = job?.bodyshop?.es_api_key
|
||||||
//Perform data manipulation on the job object
|
//Perform data manipulation on the job object
|
||||||
if (!job) {
|
if (!job) {
|
||||||
console.error("No job provided to ScrubEstimate");
|
console.error("No job provided to ScrubEstimate");
|
||||||
@@ -105,7 +108,7 @@ async function ScrubEstimate({ job }) {
|
|||||||
username: basicAuthUser,
|
username: basicAuthUser,
|
||||||
password: basicAuthpassword
|
password: basicAuthpassword
|
||||||
},
|
},
|
||||||
headers: formData.getHeaders ? formData.getHeaders() : {}
|
headers: { ...formData.getHeaders ? formData.getHeaders() : {}, 'APIkey': esApiKey }
|
||||||
});
|
});
|
||||||
|
|
||||||
const resultPDFUrl = result?.data?.report_link;
|
const resultPDFUrl = result?.data?.report_link;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"productName": "ImEX RPS",
|
"productName": "ImEX RPS",
|
||||||
"author": "ImEX Systems Inc. <support@thinkimex.com>",
|
"author": "ImEX Systems Inc. <support@thinkimex.com>",
|
||||||
"description": "ImEX RPS",
|
"description": "ImEX RPS",
|
||||||
"version": "1.4.2-beta.2",
|
"version": "1.4.2-alpha.13",
|
||||||
"main": "electron/main.js",
|
"main": "electron/main.js",
|
||||||
"homepage": "./",
|
"homepage": "./",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ export function JobsDetailDescriptionMolecule({ bodyshop, loading, job, jobDetai
|
|||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
),
|
),
|
||||||
bodyshop.phone && <EstimateScrubberButton key="es" jobid={job ? job.id : null} job={job ? job : null} />,
|
bodyshop.es_api_key && <EstimateScrubberButton key="es" jobid={job ? job.id : null} job={job ? job : null} />,
|
||||||
<DeleteJobAtom key="delete" jobId={job.id} />,
|
<DeleteJobAtom key="delete" jobId={job.id} />,
|
||||||
<Button key="print" onClick={handlePrint}>
|
<Button key="print" onClick={handlePrint}>
|
||||||
<PrinterFilled />
|
<PrinterFilled />
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export function JobsDetailOrganism({ bodyshop, selectedJobId, setSelectedJobTarg
|
|||||||
<Card title="Estimate Lines">
|
<Card title="Estimate Lines">
|
||||||
<JobsLinesTableMolecule loading={loading} job={data ? data.jobs_by_pk : {}} />
|
<JobsLinesTableMolecule loading={loading} job={data ? data.jobs_by_pk : {}} />
|
||||||
</Card>
|
</Card>
|
||||||
{bodyshop.phone && (
|
{bodyshop.es_api_key && (
|
||||||
<Card id="es-results-card" title="Estimate Scrubber Results" extra={[]}>
|
<Card id="es-results-card" title="Estimate Scrubber Results" extra={[]}>
|
||||||
<EstimateScrubberResultsMolecule loading={loading} job={data ? data.jobs_by_pk : {}} />
|
<EstimateScrubberResultsMolecule loading={loading} job={data ? data.jobs_by_pk : {}} />
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {
|
|||||||
AuditOutlined,
|
AuditOutlined,
|
||||||
BarChartOutlined,
|
BarChartOutlined,
|
||||||
CloseOutlined,
|
CloseOutlined,
|
||||||
|
DashboardFilled,
|
||||||
FileAddFilled,
|
FileAddFilled,
|
||||||
LogoutOutlined,
|
LogoutOutlined,
|
||||||
MoonOutlined,
|
MoonOutlined,
|
||||||
@@ -48,6 +49,11 @@ export function SiderMenuOrganism({ darkMode, toggleDarkMode }) {
|
|||||||
}}
|
}}
|
||||||
mode="inline"
|
mode="inline"
|
||||||
items={[
|
items={[
|
||||||
|
{
|
||||||
|
key: "/dashboard",
|
||||||
|
icon: <DashboardFilled />,
|
||||||
|
label: <Link to="/dashboard">Dashboard</Link>
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: "/",
|
key: "/",
|
||||||
icon: <PieChartOutlined />,
|
icon: <PieChartOutlined />,
|
||||||
|
|||||||
61
src/components/pages/dashboard/dashboard.page.jsx
Normal file
61
src/components/pages/dashboard/dashboard.page.jsx
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import { Card, Typography } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { setSelectedJobId } from "../../../redux/application/application.actions";
|
||||||
|
import { selectDates, selectReportingError } from "../../../redux/reporting/reporting.selectors";
|
||||||
|
import ReportingTitleAtom from "../../atoms/reporting-title/reporting-title.atom";
|
||||||
|
import ReportingDatesMolecule from "../../molecules/reporting-dates/reporting-dates.molecule";
|
||||||
|
import ReportingJobsListMolecule from "../../molecules/reporting-jobs-list/reporting-jobs-list.molecule";
|
||||||
|
import ReportingScatterChartMolecule from "../../molecules/reporting-scatterchart/reporting-scatterchart.molecule";
|
||||||
|
import ReportingTotalsStatsMolecule from "../../molecules/reporting-totals-stats/reporting-totals-stats.molecule";
|
||||||
|
import "./dashboard.page.styles.scss";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
dates: selectDates,
|
||||||
|
error: selectReportingError
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
setSelectedJobId: (id) => dispatch(setSelectedJobId(id))
|
||||||
|
});
|
||||||
|
|
||||||
|
export function DashboardPage({ dates, error, setSelectedJobId }) {
|
||||||
|
return (
|
||||||
|
<div className="reporting-container">
|
||||||
|
<Card>
|
||||||
|
<ReportingDatesMolecule />
|
||||||
|
</Card>
|
||||||
|
{error && (
|
||||||
|
<div>
|
||||||
|
<Typography.Title level={4}>{error.message}</Typography.Title>
|
||||||
|
<ul>
|
||||||
|
{error.jobs.map((j, idx) => (
|
||||||
|
<li key={idx}>
|
||||||
|
<Link onClick={() => setSelectedJobId(j.id)} to={"/"}>
|
||||||
|
{`${j.clm_no} - ${j.error}`}
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{!error && dates && dates.startDate && dates.endDate && (
|
||||||
|
<div className="reporting-cards">
|
||||||
|
<Card>
|
||||||
|
<ReportingTitleAtom />
|
||||||
|
<ReportingTotalsStatsMolecule />
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<ReportingJobsListMolecule />
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<ReportingScatterChartMolecule />
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(DashboardPage);
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
.reporting-container {
|
||||||
|
height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
//background-color: rgb(244, 244, 244);
|
||||||
|
& > .reporting-cards > * {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
import { Layout } from "antd";
|
import { Layout } from "antd";
|
||||||
import React from "react";
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Routes } from "react-router-dom";
|
import { Route, Routes } from "react-router-dom";
|
||||||
import { Route } from "react-router-dom";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop, selectDarkMode } from "../../../redux/user/user.selectors";
|
import { selectBodyshop, selectDarkMode } from "../../../redux/user/user.selectors";
|
||||||
import ErrorResultAtom from "../../atoms/error-result/error-result.atom";
|
import ErrorResultAtom from "../../atoms/error-result/error-result.atom";
|
||||||
@@ -10,12 +8,13 @@ import ReleaseNotes from "../../molecules/release-notes/release-notes.molecule";
|
|||||||
import NotificationModalOrganism from "../../organisms/notification-modal/notification-modal.organism";
|
import NotificationModalOrganism from "../../organisms/notification-modal/notification-modal.organism";
|
||||||
import SiderMenuOrganism from "../../organisms/sider-menu/sider-menu.organism";
|
import SiderMenuOrganism from "../../organisms/sider-menu/sider-menu.organism";
|
||||||
import UpdateManagerOrganism from "../../organisms/update-manager/update-manager.organism";
|
import UpdateManagerOrganism from "../../organisms/update-manager/update-manager.organism";
|
||||||
|
import AdminPage from "../admin/admin.page";
|
||||||
|
import AuditPage from "../audit/audit.page";
|
||||||
|
import DashboardPage from "../dashboard/dashboard.page";
|
||||||
import JobsPage from "../jobs/jobs.page";
|
import JobsPage from "../jobs/jobs.page";
|
||||||
import ReportingPage from "../reporting/reporting.page";
|
import ReportingPage from "../reporting/reporting.page";
|
||||||
import ScanPage from "../scan/scan.page";
|
import ScanPage from "../scan/scan.page";
|
||||||
import SettingsPage from "../settings/settings.page";
|
import SettingsPage from "../settings/settings.page";
|
||||||
import AuditPage from "../audit/audit.page";
|
|
||||||
import AdminPage from "../admin/admin.page";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, darkMode: selectDarkMode });
|
const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, darkMode: selectDarkMode });
|
||||||
const mapDispatchToProps = (dispatch) => ({});
|
const mapDispatchToProps = (dispatch) => ({});
|
||||||
@@ -39,6 +38,7 @@ export function RoutesPage({ bodyshop, darkMode }) {
|
|||||||
<NotificationModalOrganism />
|
<NotificationModalOrganism />
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route exact path="/settings" element={<SettingsPage />} />
|
<Route exact path="/settings" element={<SettingsPage />} />
|
||||||
|
<Route exact path="/dashboard" element={<DashboardPage />} />
|
||||||
<Route exact path="/reporting" element={<ReportingPage />} />
|
<Route exact path="/reporting" element={<ReportingPage />} />
|
||||||
<Route exact path="/audit" element={<AuditPage />} />
|
<Route exact path="/audit" element={<AuditPage />} />
|
||||||
<Route exact path="/scan" element={<ScanPage />} />
|
<Route exact path="/scan" element={<ScanPage />} />
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const QUERY_BODYSHOP = gql`
|
|||||||
channel
|
channel
|
||||||
zip_post
|
zip_post
|
||||||
phone
|
phone
|
||||||
|
es_api_key
|
||||||
}
|
}
|
||||||
targets {
|
targets {
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -243,6 +243,7 @@ export const QUERY_JOB_ESTIMATE_SCRUBBER = gql`
|
|||||||
id
|
id
|
||||||
zip_post
|
zip_post
|
||||||
phone
|
phone
|
||||||
|
es_api_key
|
||||||
}
|
}
|
||||||
joblines(order_by: {line_no: asc}) {
|
joblines(order_by: {line_no: asc}) {
|
||||||
line_no
|
line_no
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import ReportingActionTypes from "./reporting.types";
|
|||||||
const INITIAL_STATE = {
|
const INITIAL_STATE = {
|
||||||
dates: { startDate: null, endDate: null },
|
dates: { startDate: null, endDate: null },
|
||||||
data: [],
|
data: [],
|
||||||
|
dashboardData: [],
|
||||||
scoreCard: null,
|
scoreCard: null,
|
||||||
error: null,
|
error: null,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ const ReportingActionTypes = {
|
|||||||
ADD_EXCLUDED_ID: "ADD_EXCLUDED_ID",
|
ADD_EXCLUDED_ID: "ADD_EXCLUDED_ID",
|
||||||
REMOVE_EXCLUDED_ID: "REMOVE_EXCLUDED_ID",
|
REMOVE_EXCLUDED_ID: "REMOVE_EXCLUDED_ID",
|
||||||
CLEAR_EXCLUDED_IDS: "CLEAR_EXCLUDED_IDS",
|
CLEAR_EXCLUDED_IDS: "CLEAR_EXCLUDED_IDS",
|
||||||
SET_CACHED_JOBS: "SET_CACHED_JOBS"
|
SET_CACHED_JOBS: "SET_CACHED_JOBS",
|
||||||
|
SET_DASHBOARD_DATA: "SET_DASHBOARD_DATA"
|
||||||
};
|
};
|
||||||
export default ReportingActionTypes;
|
export default ReportingActionTypes;
|
||||||
|
|||||||
Reference in New Issue
Block a user