Inversed ignoring of lines and included default filter. RPS-1 RPS-5
This commit is contained in:
@@ -4,7 +4,10 @@ const log = require("electron-log");
|
||||
const Nucleus = require("nucleus-nodejs");
|
||||
const { default: ipcTypes } = require("../src/ipc.types");
|
||||
|
||||
Nucleus.init("5f91b569b95bac34eefdb63a", { debug: true });
|
||||
Nucleus.init("5f91b569b95bac34eefdb63a", {
|
||||
disableInDev: false,
|
||||
debug: false,
|
||||
});
|
||||
|
||||
Nucleus.setProps({
|
||||
version: app.getVersion().toString(),
|
||||
|
||||
18
package-lock.json
generated
18
package-lock.json
generated
@@ -4227,6 +4227,15 @@
|
||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz",
|
||||
"integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ=="
|
||||
},
|
||||
"bindings": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"file-uri-to-path": "1.0.0"
|
||||
}
|
||||
},
|
||||
"block-stream": {
|
||||
"version": "0.0.9",
|
||||
"resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz",
|
||||
@@ -8218,6 +8227,12 @@
|
||||
"schema-utils": "^2.5.0"
|
||||
}
|
||||
},
|
||||
"file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
|
||||
"optional": true
|
||||
},
|
||||
"filelist": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.1.tgz",
|
||||
@@ -10665,6 +10680,7 @@
|
||||
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"bindings": "^1.5.0",
|
||||
"nan": "^2.12.1"
|
||||
}
|
||||
},
|
||||
@@ -19376,6 +19392,7 @@
|
||||
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"bindings": "^1.5.0",
|
||||
"nan": "^2.12.1"
|
||||
}
|
||||
},
|
||||
@@ -19780,6 +19797,7 @@
|
||||
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"bindings": "^1.5.0",
|
||||
"nan": "^2.12.1"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
"pack": "electron-builder --dir",
|
||||
"dist": "npm run build && electron-builder",
|
||||
"distp": "npm run build && electron-builder --publish always",
|
||||
"distpnb": "npm run build && electron-builder --publish always",
|
||||
"postinstall": "npm run build && electron-builder install-app-deps"
|
||||
"distpnb": "lectron-builder --publish always",
|
||||
"postinstall": "electron-builder install-app-deps"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
|
||||
@@ -9,15 +9,16 @@ export default function IgnoreJobLineAtom({ ignore, lineId, line_desc }) {
|
||||
const [updateJobLine] = useMutation(UPDATE_JOB_LINE);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const handleChange = async (checked) => {
|
||||
console.log("handleChange -> checked", checked);
|
||||
setLoading(true);
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "TOGGLE_IGNORE_LINE",
|
||||
line_desc: line_desc,
|
||||
ignore: checked,
|
||||
ignore: !checked,
|
||||
});
|
||||
|
||||
const result = await updateJobLine({
|
||||
variables: { lineId: lineId, line: { ignore: checked } },
|
||||
variables: { lineId: lineId, line: { ignore: !checked } },
|
||||
});
|
||||
if (result.errors) {
|
||||
message.error("Error updating line.");
|
||||
@@ -27,5 +28,5 @@ export default function IgnoreJobLineAtom({ ignore, lineId, line_desc }) {
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return <Switch checked={ignore} onChange={handleChange} loading={loading} />;
|
||||
return <Switch checked={!ignore} onChange={handleChange} loading={loading} />;
|
||||
}
|
||||
|
||||
@@ -48,9 +48,6 @@ export default function JobPartsGraphAtom({
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Typography.Title level={4}>
|
||||
{price === "act_price" ? "Actual Price" : "Database Price"}
|
||||
</Typography.Title>
|
||||
<ResponsiveContainer>
|
||||
<PieChart>
|
||||
<Pie
|
||||
@@ -71,6 +68,9 @@ export default function JobPartsGraphAtom({
|
||||
</Pie>
|
||||
</PieChart>
|
||||
</ResponsiveContainer>
|
||||
<Typography.Title level={4}>
|
||||
{price === "act_price" ? "Actual Price" : "Database Price"}
|
||||
</Typography.Title>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,11 +6,12 @@ import CurrencyFormatterAtom from "../../atoms/currency-formatter/currency-forma
|
||||
import IgnoreJobLine from "../../atoms/ignore-job-line/ignore-job-line.atom";
|
||||
import partTypeConverterAtom from "../../atoms/part-type-converter/part-type-converter.atom";
|
||||
import PriceDiffPcFormatterAtom from "../../atoms/price-diff-pc-formatter/price-diff-pc-formatter.atom";
|
||||
|
||||
import { CalculatorOutlined } from "@ant-design/icons";
|
||||
const { ipcRenderer } = window;
|
||||
|
||||
export default function JobLinesTableMolecule({ loading, job }) {
|
||||
const [searchText, setSearchText] = useState("");
|
||||
const [filters, setFilters] = useState({ ignore: ["false"] });
|
||||
|
||||
const { joblines } = job;
|
||||
const columns = [
|
||||
@@ -19,23 +20,27 @@ export default function JobLinesTableMolecule({ loading, job }) {
|
||||
dataIndex: "line_no",
|
||||
key: "line_no",
|
||||
sorter: (a, b) => a.line_no - b.line_no,
|
||||
width: "5%",
|
||||
},
|
||||
{
|
||||
title: "S#",
|
||||
dataIndex: "line_ind",
|
||||
key: "line_ind",
|
||||
width: "5%",
|
||||
sorter: (a, b) => alphaSort(a.line_ind, b.line_ind),
|
||||
},
|
||||
{
|
||||
title: "Line Description",
|
||||
dataIndex: "line_desc",
|
||||
key: "line_desc",
|
||||
width: "25%",
|
||||
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
||||
},
|
||||
{
|
||||
title: "Part Type",
|
||||
dataIndex: "part_type",
|
||||
key: "part_type",
|
||||
width: "5%",
|
||||
sorter: (a, b) => alphaSort(a.part_type, b.part_type),
|
||||
render: (text, record) => partTypeConverterAtom(text),
|
||||
},
|
||||
@@ -43,12 +48,14 @@ export default function JobLinesTableMolecule({ loading, job }) {
|
||||
title: "Part Number",
|
||||
dataIndex: "oem_partno",
|
||||
key: "oem_partno",
|
||||
width: "15%",
|
||||
sorter: (a, b) => alphaSort(a.oem_partno, b.oem_partno),
|
||||
},
|
||||
{
|
||||
title: "Database Price",
|
||||
dataIndex: "db_price",
|
||||
key: "db_price",
|
||||
width: "10%",
|
||||
sorter: (a, b) => a.db_price - b.db_price,
|
||||
render: (text, record) => (
|
||||
<CurrencyFormatterAtom>{record.db_price}</CurrencyFormatterAtom>
|
||||
@@ -58,6 +65,7 @@ export default function JobLinesTableMolecule({ loading, job }) {
|
||||
title: "Actual Price",
|
||||
dataIndex: "act_price",
|
||||
key: "act_price",
|
||||
width: "10%",
|
||||
sorter: (a, b) => a.act_price - b.act_price,
|
||||
render: (text, record) => (
|
||||
<CurrencyFormatterAtom>{record.act_price}</CurrencyFormatterAtom>
|
||||
@@ -67,6 +75,7 @@ export default function JobLinesTableMolecule({ loading, job }) {
|
||||
title: "Price Diff.",
|
||||
dataIndex: "price_diff",
|
||||
key: "price_diff",
|
||||
width: "10%",
|
||||
sorter: (a, b) => a.price_diff - b.price_diff,
|
||||
render: (text, record) => (
|
||||
<CurrencyFormatterAtom>{record.price_diff}</CurrencyFormatterAtom>
|
||||
@@ -76,6 +85,7 @@ export default function JobLinesTableMolecule({ loading, job }) {
|
||||
title: "Price Diff. %",
|
||||
dataIndex: "price_diff_pc",
|
||||
key: "price_diff_pc",
|
||||
width: "10%",
|
||||
sorter: (a, b) => a.price_diff_pc - b.price_diff_pc,
|
||||
render: (text, record) => (
|
||||
<PriceDiffPcFormatterAtom
|
||||
@@ -86,13 +96,15 @@ export default function JobLinesTableMolecule({ loading, job }) {
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "Ignore?",
|
||||
title: <CalculatorOutlined />,
|
||||
dataIndex: "ignore",
|
||||
key: "ignore",
|
||||
filters: [
|
||||
{ text: "True", value: true },
|
||||
{ text: "False", value: false },
|
||||
{ text: "Eligible for RPS Calculation", value: false },
|
||||
{ text: "Ineligible RPS Calculation", value: true },
|
||||
],
|
||||
width: "5%",
|
||||
filteredValue: filters.ignore || null,
|
||||
onFilter: (value, record) => value === record.ignore,
|
||||
render: (text, record) => (
|
||||
<IgnoreJobLine
|
||||
@@ -111,6 +123,11 @@ export default function JobLinesTableMolecule({ loading, job }) {
|
||||
)
|
||||
: joblines;
|
||||
|
||||
const handleChange = (pagination, filters, sorter) => {
|
||||
console.log("Various parameters", pagination, filters, sorter);
|
||||
setFilters(filters);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Table
|
||||
@@ -134,6 +151,7 @@ export default function JobLinesTableMolecule({ loading, job }) {
|
||||
size="small"
|
||||
pagination={false}
|
||||
dataSource={data}
|
||||
onChange={handleChange}
|
||||
scroll={{
|
||||
x: true,
|
||||
y: "20rem",
|
||||
|
||||
@@ -43,7 +43,7 @@ export function JobsTargetsStatsMolecule({
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-around",
|
||||
marginTop: "1rem",
|
||||
marginTop: "2rem",
|
||||
marginBottom: "1rem",
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Result } from "antd";
|
||||
import { Divider, Result } from "antd";
|
||||
import React, { useEffect } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -78,7 +78,9 @@ export function JobsDetailOrganism({ selectedJobId, setSelectedJobTargetPc }) {
|
||||
loading={loading}
|
||||
/>
|
||||
</div>
|
||||
<DeleteJobAtom jobId={data ? data.jobs_by_pk.id : null} />
|
||||
<DeleteJobAtom
|
||||
jobId={data ? data.jobs_by_pk && data.jobs_by_pk.id : null}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user