Inversed ignoring of lines and included default filter. RPS-1 RPS-5
This commit is contained in:
@@ -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",
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user