Added vehicle alert changes and group verification. RPS-74
This commit is contained in:
@@ -30,7 +30,8 @@ const models = [
|
||||
];
|
||||
|
||||
export default function VehicleGroupAlertAtom({ job, showGroup = false }) {
|
||||
const shouldWarn = models.includes(job.v_model.toLowerCase());
|
||||
const shouldWarn =
|
||||
models.includes(job.v_model.toLowerCase()) && !job.group_verified;
|
||||
|
||||
const vehicleText = `${job.v_model_yr} ${job.v_makedesc} ${job.v_model} (${
|
||||
job.v_type
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
import { DownOutlined, LoadingOutlined } from "@ant-design/icons";
|
||||
import {
|
||||
AlertFilled,
|
||||
DownOutlined,
|
||||
LoadingOutlined,
|
||||
CloseOutlined,
|
||||
CheckOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Dropdown, Menu, message } from "antd";
|
||||
import { Dropdown, Menu, message, Space, Switch } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { UPDATE_JOB } from "../../../graphql/jobs.queries";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
import { selectBodyshop } from "../../../redux/user/user.selectors";
|
||||
import { AlertFilled } from "@ant-design/icons";
|
||||
import JobsGroupModalMolecule from "../jobs-group-modal/jobs-group-modal.molecule";
|
||||
const { ipcRenderer } = window;
|
||||
|
||||
@@ -44,6 +49,20 @@ export function JobGroupMolecule({ bodyshop, jobId, group, job }) {
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const handleVerifyGroup = async (val) => {
|
||||
setLoading(true);
|
||||
const result = await updateJob({
|
||||
variables: { jobId: jobId, job: { group_verified: val } },
|
||||
});
|
||||
|
||||
if (!result.errors) {
|
||||
message.success("Vehicle group updated.");
|
||||
} else {
|
||||
message.error("Error updating job.");
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const menu = (
|
||||
<Menu onClick={handleMenuClick}>
|
||||
{bodyshop.groups.map((g, idx) => (
|
||||
@@ -53,21 +72,32 @@ export function JobGroupMolecule({ bodyshop, jobId, group, job }) {
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Space align="top">
|
||||
<Dropdown overlay={menu} trigger={["click"]}>
|
||||
<a href=" #" onClick={(e) => e.preventDefault()}>
|
||||
{group}
|
||||
<DownOutlined style={{ marginLeft: ".2rem" }} />
|
||||
{loading && <LoadingOutlined />}
|
||||
</a>
|
||||
</Dropdown>
|
||||
<JobsGroupModalMolecule />
|
||||
{!group && (
|
||||
<div style={{ marginLeft: ".2rem" }}>
|
||||
<AlertFilled style={{ color: "tomato" }} className="blink_me" />
|
||||
<span style={{ color: "tomato" }}>No group set.</span>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
{group && (
|
||||
<div style={{ marginLeft: ".2rem" }}>
|
||||
<Switch
|
||||
checkedChildren={<CheckOutlined />}
|
||||
unCheckedChildren={<CloseOutlined />}
|
||||
disabled={loading}
|
||||
defaultChecked={job.group_verified}
|
||||
onChange={handleVerifyGroup}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<JobsGroupModalMolecule />
|
||||
{loading && <LoadingOutlined />}
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export default function JobsDetailDescriptionMolecule({ loading, job }) {
|
||||
<Descriptions.Item
|
||||
label={
|
||||
<Tooltip title="This is the date you will submit for payment from MPI. This should always be the latest date in the case of supplements.">
|
||||
Ready for Payment Date
|
||||
R4P Date
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Input, Table } from "antd";
|
||||
import { Input, Table, Checkbox } from "antd";
|
||||
import moment from "moment";
|
||||
import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
@@ -46,7 +46,7 @@ export function ReportingJobsListMolecule({
|
||||
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
|
||||
},
|
||||
{
|
||||
title: "Ready for Payment Date",
|
||||
title: "R4P",
|
||||
dataIndex: "close_date",
|
||||
key: "close_date",
|
||||
render: (text, record) => moment(record.close_date).format("MM/DD/yyyy"),
|
||||
@@ -88,12 +88,21 @@ export function ReportingJobsListMolecule({
|
||||
render: (text, record) => record.dbPriceSum.toFormat(),
|
||||
},
|
||||
{
|
||||
title: "Actual Price Sum ",
|
||||
title: "Actual Price Sum",
|
||||
dataIndex: "actPriceSum",
|
||||
key: "actPriceSum",
|
||||
sorter: (a, b) => a.actPriceSum.getAmount() - b.actPriceSum.getAmount(),
|
||||
render: (text, record) => record.actPriceSum.toFormat(),
|
||||
},
|
||||
{
|
||||
title: "Group Verified?",
|
||||
dataIndex: "group_verified",
|
||||
key: "group_verified",
|
||||
sorter: (a, b) => a.group_verified - b.group_verified,
|
||||
render: (text, record) => (
|
||||
<Checkbox disabled={true} checked={record.group_verified} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "$ (Act./Target)",
|
||||
dataIndex: "jobRpsDollars",
|
||||
|
||||
@@ -154,6 +154,8 @@ export const UPDATE_JOB = gql`
|
||||
updated_at
|
||||
close_date
|
||||
v_age
|
||||
group
|
||||
group_verified
|
||||
joblines(order_by: { unq_seq: asc }) {
|
||||
id
|
||||
act_price
|
||||
|
||||
Reference in New Issue
Block a user