diff --git a/electron/changelog.json b/electron/changelog.json index 9e67ee1..2a0399b 100644 --- a/electron/changelog.json +++ b/electron/changelog.json @@ -186,7 +186,7 @@ }, "1.3.5": { "title": "Release Notes for 1.3.5", - "date": "TBD", - "notes": "Bug Fix\n*Fix typos on application labels." + "date": "10/17/2024", + "notes": "Improvements:\r\n* Improved group detection for latest RPS rule sets.\r\n* Audit functionality will now rely on header names instead of order." } } diff --git a/package.json b/package.json index 9bc3046..cc9cc38 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "ImEX RPS", "author": "ImEX Systems Inc. ", "description": "ImEX RPS", - "version": "1.3.5-alpha.1", + "version": "1.3.5", "main": "electron/main.js", "homepage": "./", "dependencies": { diff --git a/src/components/atoms/no-date-set/no-date-set.atom.jsx b/src/components/atoms/no-date-set/no-date-set.atom.jsx new file mode 100644 index 0000000..1fd0749 --- /dev/null +++ b/src/components/atoms/no-date-set/no-date-set.atom.jsx @@ -0,0 +1,13 @@ +import React from "react"; +import { WarningOutlined } from "@ant-design/icons"; +export default function NoDateSetWarning({ job }) { + return ( + !job.close_date && ( + + ) + ); +} diff --git a/src/components/atoms/requires-reimport/requires-reimport.atom.jsx b/src/components/atoms/requires-reimport/requires-reimport.atom.jsx new file mode 100644 index 0000000..e3177f7 --- /dev/null +++ b/src/components/atoms/requires-reimport/requires-reimport.atom.jsx @@ -0,0 +1,14 @@ +import React from "react"; +import { CloudUploadOutlined } from "@ant-design/icons"; + +export default function RequiresReimportDisplay({ job }) { + return ( + job.requires_reimport && ( + + ) + ); +} diff --git a/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx b/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx index e21996d..ad4e0e2 100644 --- a/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx +++ b/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx @@ -39,7 +39,7 @@ export default function JobsDetailDescriptionMolecule({ loading, job }) { ), diff --git a/src/components/molecules/jobs-list-item/jobs-list-item.molecule.jsx b/src/components/molecules/jobs-list-item/jobs-list-item.molecule.jsx index 53e3e6b..0ab6928 100644 --- a/src/components/molecules/jobs-list-item/jobs-list-item.molecule.jsx +++ b/src/components/molecules/jobs-list-item/jobs-list-item.molecule.jsx @@ -7,6 +7,7 @@ import { setSelectedJobId } from "../../../redux/application/application.actions import { selectSelectedJobId } from "../../../redux/application/application.selectors"; import TimeAgoFormatter from "../../atoms/time-ago-formatter/time-ago-formatter.atom"; import "./jobs-list-item.styles.scss"; +import RequiresReimportDisplay from "../../atoms/requires-reimport/requires-reimport.atom"; const mapStateToProps = createStructuredSelector({ selectedJobId: selectSelectedJobId @@ -51,12 +52,7 @@ export function JobsListItemMolecule({ selectedJobId, setSelectedJobId, item, re style={{ marginLeft: ".5rem", color: "tomato" }} /> )} - {item.requires_reimport && ( - - )} + {item.updated_at} diff --git a/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx b/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx index 1870f05..4a8e89b 100644 --- a/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx +++ b/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx @@ -11,6 +11,7 @@ import dayjs from "../../../util/day.js"; import { alphaSort } from "../../../util/sorters"; import VehicleGroupAlertAtom from "../../atoms/vehicle-group-alert/vehicle-group-alert.atom"; import GroupVerifySwitch from "../group-verify-switch/group-verify-switch.component"; +import RequiresReimportDisplay from "../../atoms/requires-reimport/requires-reimport.atom.jsx"; const { ipcRenderer } = window; @@ -35,12 +36,7 @@ export function ReportingJobsListMolecule({ scoreCard, reportingLoading, reportD setSelectedJobId(record.id)} to={"/"}> {text} - {record.requires_reimport && ( - - )} + ), diff --git a/src/components/organisms/audit-results/audit-results.organism.jsx b/src/components/organisms/audit-results/audit-results.organism.jsx index 2644666..493af47 100644 --- a/src/components/organisms/audit-results/audit-results.organism.jsx +++ b/src/components/organisms/audit-results/audit-results.organism.jsx @@ -2,13 +2,14 @@ import { Card, Col, Divider, Empty, Result, Space, Table, Tooltip } from "antd"; import Dinero from "dinero.js"; import React from "react"; import { connect } from "react-redux"; +import { Link } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { setSelectedJobId, setSelectedJobTargetPc } from "../../../redux/application/application.actions"; import { selectAuditData, selectAuditLoading } from "../../../redux/reporting/reporting.selectors"; import { DateFormat } from "../../../util/constants"; import dayjs from "../../../util/day"; import { alphaSort, dateSort } from "../../../util/sorters"; -import { Link } from "react-router-dom"; +import RequiresReimportDisplay from "../../atoms/requires-reimport/requires-reimport.atom"; const mapStateToProps = createStructuredSelector({ selectAuditData: selectAuditData, @@ -81,7 +82,10 @@ export function AuditResultsOrganism({ auditLoading, setSelectedJobId, selectAud render: (text, record) => record.rps?.id ? ( setSelectedJobId(record.rps.id)} to={"/"}> - {text} + + {text} + + ) : ( text diff --git a/src/components/pages/admin/admin.page.jsx b/src/components/pages/admin/admin.page.jsx index c55e31b..6a79756 100644 --- a/src/components/pages/admin/admin.page.jsx +++ b/src/components/pages/admin/admin.page.jsx @@ -1,6 +1,6 @@ import { ApolloClient, gql, InMemoryCache, useApolloClient } from "@apollo/client"; import { HttpLink } from "@apollo/client/link/http"; //"apollo-link-http"; -import { Button, Table } from "antd"; +import { Button, Space, Table } from "antd"; import React, { useState } from "react"; import { LOCAL_DOESNOTUpsertEstimate } from "../../../ipc/ipc-estimate-utils"; import _ from "lodash"; @@ -10,11 +10,14 @@ import { dateSort } from "../../../util/sorters"; const httpLink = new HttpLink({ uri: import.meta.env.VITE_APP_GRAPHQL_ENDPOINT, headers: { - "x-hasura-admin-secret": `ImEXRPSDataBase` + "x-hasura-admin-secret": `TOBEPOPULATED` } }); const localCLient = new ApolloClient({ link: httpLink, cache: new InMemoryCache({}) }); + +const startingDate = "2024-01-01"; + export default function AdminPage() { const client = useApolloClient(); const clientToUse = client; @@ -26,13 +29,18 @@ export default function AdminPage() { const { data: { jobs } } = await clientToUse.query({ - variables: { createdAt: "2024-01-01" }, + variables: { + createdAtStart: startingDate, + createdAtEnd: moment(startingDate).add(365, "days").format("YYYY-MM-DD") + }, query: gql` - query ADMIN_GET_JOBS($createdAt: timestamptz) { + query ADMIN_GET_JOBS($createdAtStart: timestamptz, $createdAtEnd: timestamptz) { jobs( where: { _and: [ - { created_at: { _gte: $createdAt } } + { requires_reimport: { _eq: false } } + { created_at: { _gte: $createdAtStart } } + { created_at: { _lte: $createdAtEnd } } { _or: [{ close_date: { _is_null: true } }, { close_date: { _gte: "2024-09-01" } }] } ] } @@ -57,23 +65,6 @@ export default function AdminPage() { v_type requires_reimport v_mileage - joblines { - act_price - db_price - part_qty - part_type - price_diff - price_diff_pc - updated_at - oem_partno - line_no - line_ind - line_desc - ignore - id - db_ref - unq_seq - } } } ` @@ -88,7 +79,6 @@ export default function AdminPage() { const initialJob = { ...job }; const calcedGroup = await LOCAL_DOESNOTUpsertEstimate(initialJob); - console.log("🚀 ~ handleQuery ~ calcedGroup:", calcedGroup); AllJobResults.push({ close_date: job.close_date, make: initialJob.v_makedesc, @@ -111,9 +101,31 @@ export default function AdminPage() { const jobsToMarkForReimport = [...NoDateSetJobs, ...JobsInWrongGroup]; }; + const handleUpdate = async () => { + //TODO: MAKE SURE THIS USES THE ADMIN SECRET INSTEAD. + const data = await clientToUse.mutate({ + variables: { + jobs: wrongGroups.map((j) => j.id) + }, + mutation: gql` + mutation ADMIN_UPDATE_JOBS($jobs: [uuid!]!) { + update_jobs(where: { id: { _in: $jobs } }, _set: { requires_reimport: true }) { + affected_rows + } + } + ` + }); + + console.log("Updated Rows", data); + }; return (
- + + + + "Jobs with the wrong group set."} dataSource={wrongGroups} @@ -125,7 +137,12 @@ export default function AdminPage() { sorter: (a, b) => dateSort(a.created_at, b.created_at), render: (record) => moment(record).format("YYYY-MM-DD") }, - { key: "close_date", dataIndex: "close_date", title: "Close Date" }, + { + key: "close_date", + dataIndex: "close_date", + title: "Close Date", + sorter: (a, b) => dateSort(a.close_date, b.close_date) + }, { key: "clm_no", dataIndex: "clm_no", title: "Claim" }, { key: "v_makedesc", dataIndex: "v_makedesc", title: "Make" }, { key: "v_model", dataIndex: "v_model", title: "Model" },