diff --git a/.gitignore b/.gitignore index 35e9e76..0b5ceac 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,4 @@ firebase/.yarn-integrity # dotenv environment variables file firebase/.env +.eslintcache diff --git a/WIP Changelog.txt b/WIP Changelog.txt index cccc10f..3709afa 100644 --- a/WIP Changelog.txt +++ b/WIP Changelog.txt @@ -1,7 +1,6 @@ New Features: -- Added 'This Quarter' and 'Last Quarter' date quick select. +- Renamed 'Close Date' to 'Ready for Payment' to better align with MPI terminology. +- Changed vehicle age calculation to use 'Ready for Payment' instead of loss date as per new MPI practices. Bug Fixes: -- Resolved an issue where launching a second instance of RPS would cause the program to freeze. -- Date filtering will now ensure only correct dates are reported on, regardless of time zone. -- Added negative RPS calculations on combined estimate lines like assemblies. \ No newline at end of file +- Updated grouping typo on group lookup popup. \ No newline at end of file diff --git a/electron/changelog.json b/electron/changelog.json index c4810cb..d37226b 100644 --- a/electron/changelog.json +++ b/electron/changelog.json @@ -28,5 +28,10 @@ "title": "Release Notes for 1.0.14", "date": "12/18/2020", "notes": "Bug Fixes: \n- Resolved an issue where launching a second instance of RPS could cause the program to occasionally freeze.\n- Fixed an issue where date filtering could include dates outside the range depending on time zone.\n- Added negative RPS calculations on combined estimate lines like assemblies." + }, + "1.0.15": { + "title": "Release Notes for 1.0.15", + "date": "01/12/2021", + "notes": "New Features: \n- Renamed 'Close Date' to 'Ready for Payment' to better align with MPI terminology.\n- Changed vehicle age calculation to use 'Ready for Payment' instead of loss date as per new MPI practices.\n\nBug Fixes: \n- Updated grouping typo on group lookup popup." } } diff --git a/electron/decoder/decoder.js b/electron/decoder/decoder.js index c726b90..652d696 100644 --- a/electron/decoder/decoder.js +++ b/electron/decoder/decoder.js @@ -372,6 +372,10 @@ async function DecodeLinFile(extensionlessFilePath) { // jobline.db_price = jobline.act_price; // } + //*****TODO LINE**** + //Any PAL, Remanufactured, Recycled, Aftermarket, Used, + // If DB Price 0, ignore them. + //RPS-46 Ignore NA Line Items. if ( jobline.part_type === "PAN" && diff --git a/package.json b/package.json index db48ca6..83475a2 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "ImEX RPS", "author": "ImEX Systems Inc. ", "description": "ImEX RPS", - "version": "1.0.14", + "version": "1.0.15", "main": "electron/main.js", "homepage": "./", "dependencies": { diff --git a/src/components/molecules/close-date-display/close-date-display.molecule.jsx b/src/components/molecules/close-date-display/close-date-display.molecule.jsx index 7618087..ef9b716 100644 --- a/src/components/molecules/close-date-display/close-date-display.molecule.jsx +++ b/src/components/molecules/close-date-display/close-date-display.molecule.jsx @@ -5,9 +5,11 @@ import moment from "moment"; import React, { useState } from "react"; import { UPDATE_JOB } from "../../../graphql/jobs.queries"; import ipcTypes from "../../../ipc.types"; +import { CalculateVehicleAge } from "../../../ipc/ipc-estimate-utils"; import { DateFormat } from "../../../util/constants"; const { ipcRenderer } = window; -export default function CloseDateDisplayMolecule({ jobId, close_date }) { + +export default function CloseDateDisplayMolecule({ job, jobId, close_date }) { const [editMode, setEditMode] = useState(false); const [value, setValue] = useState(moment(close_date)); const [loading, setLoading] = useState(false); @@ -19,12 +21,21 @@ export default function CloseDateDisplayMolecule({ jobId, close_date }) { }); setLoading(true); setValue(newDate); + + //Recalculate vehicle age. + const result = await updateJob({ - variables: { jobId: jobId, job: { close_date: newDate } }, + variables: { + jobId: jobId, + job: { + close_date: newDate, + v_age: CalculateVehicleAge({ ...job, close_date: newDate }), + }, + }, }); if (!result.errors) { - message.success("Close date updated."); + message.success("R4P date updated."); } else { message.error("Error updating job."); } 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 19286a6..43601a2 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 @@ -42,12 +42,13 @@ export default function JobsDetailDescriptionMolecule({ loading, job }) { - Close Date + + Ready for Payment Date } > diff --git a/src/components/molecules/jobs-group-modal/jobs-group-modal.molecule.jsx b/src/components/molecules/jobs-group-modal/jobs-group-modal.molecule.jsx index 136a5b1..e6035ed 100644 --- a/src/components/molecules/jobs-group-modal/jobs-group-modal.molecule.jsx +++ b/src/components/molecules/jobs-group-modal/jobs-group-modal.molecule.jsx @@ -23,7 +23,8 @@ const data = [ "MERCEDES BENZ", "RAM-Van", "GENESIS", - "AUDI BMW-Truck", + "AUDI", + "BMW-Truck", ], }, { 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 b4bae83..9a29feb 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 @@ -59,7 +59,7 @@ export function JobsListItemMolecule({ {item.clm_no || "No Claim Number"} {!item.close_date && ( )} diff --git a/src/components/molecules/jobs-search-fields/jobs-search-fields.molecule.jsx b/src/components/molecules/jobs-search-fields/jobs-search-fields.molecule.jsx index b5b2c65..ec198d6 100644 --- a/src/components/molecules/jobs-search-fields/jobs-search-fields.molecule.jsx +++ b/src/components/molecules/jobs-search-fields/jobs-search-fields.molecule.jsx @@ -40,7 +40,7 @@ export default function JobsSearchFieldsMolecule({ callSearchQuery }) { - Only Jobs with No Close Date + Only Jobs with No Ready For Payment Date {() => { diff --git a/src/components/molecules/reporting-dates/reporting-dates.molecule.jsx b/src/components/molecules/reporting-dates/reporting-dates.molecule.jsx index f380f4d..72bc710 100644 --- a/src/components/molecules/reporting-dates/reporting-dates.molecule.jsx +++ b/src/components/molecules/reporting-dates/reporting-dates.molecule.jsx @@ -29,7 +29,7 @@ export function ReportingDatesMolecule({ queryReportingData }) {
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 a697395..3733240 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 @@ -9,7 +9,7 @@ import { setSelectedJobId } from "../../../redux/application/application.actions import { selectReportData, selectReportLoading, - selectScorecard + selectScorecard, } from "../../../redux/reporting/reporting.selectors"; import { alphaSort } from "../../../util/sorters"; import VehicleGroupAlertAtom from "../../atoms/vehicle-group-alert/vehicle-group-alert.atom"; @@ -46,7 +46,7 @@ export function ReportingJobsListMolecule({ sorter: (a, b) => alphaSort(a.clm_no, b.clm_no), }, { - title: "Close Date", + title: "Ready for Payment Date", dataIndex: "close_date", key: "close_date", render: (text, record) => moment(record.close_date).format("MM/DD/yyyy"), diff --git a/src/graphql/jobs.queries.js b/src/graphql/jobs.queries.js index 6c35e10..3025ddd 100644 --- a/src/graphql/jobs.queries.js +++ b/src/graphql/jobs.queries.js @@ -151,6 +151,7 @@ export const UPDATE_JOB = gql` ro_number updated_at close_date + v_age joblines(order_by: { unq_seq: asc }) { id act_price diff --git a/src/ipc/ipc-estimate-utils.js b/src/ipc/ipc-estimate-utils.js index 3c85b23..3c9ab58 100644 --- a/src/ipc/ipc-estimate-utils.js +++ b/src/ipc/ipc-estimate-utils.js @@ -12,21 +12,28 @@ import { QUERY_GROUPS_BY_MAKE_TYPE } from "../graphql/veh_group.queries"; import { store } from "../redux/store"; const { logger } = window; +export function CalculateVehicleAge(job) { + const parsedYr = parseInt(job.v_model_yr); + + let ret = + moment(job.close_date || new Date()).year() - + (parsedYr >= 0 ? 2000 + parsedYr : 1900 + parsedYr); + + if (ret < 0) ret = 0; + + return ret; +} + export async function UpsertEstimate(job) { const shopId = store.getState().user.bodyshop.id; logger.info("Beginning Upserting job from Renderer."); - const parsedYr = parseInt(job.v_model_yr); job = { ...job, group: await DetermineVehicleGroup(job), - v_age: - moment(job.loss_date).year() - - (parsedYr >= 0 ? 2000 + parsedYr : 1900 + parsedYr), + v_age: CalculateVehicleAge(job), }; - if (job.v_age < 0) job.v_age = 0; - const existingJobs = await client.query({ query: QUERY_JOB_BY_CLM_NO, variables: { clm_no: job.clm_no },