Added file scanning module.

This commit is contained in:
Patrick Fic
2020-10-21 14:33:45 -07:00
parent ee3136a3ac
commit 34e244783c
24 changed files with 435 additions and 61 deletions

View File

@@ -1,13 +1,13 @@
import { Input, Table } from "antd";
import React, { useState } from "react";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { setSelectedJobId } from "../../../redux/application/application.actions";
import {
selectReportData,
selectReportLoading,
} from "../../../redux/reporting/reporting.selectors";
import { setSelectedJobId } from "../../../redux/application/application.actions";
import { Link } from "react-router-dom";
const mapStateToProps = createStructuredSelector({
reportingLoading: selectReportLoading,
reportData: selectReportData,
@@ -108,9 +108,11 @@ export function ReportingJobsListMolecule({
searchText !== ""
? reportData.filter(
(j) =>
j.v_makedesc.toLowerCase().includes(searchText.toLowerCase()) ||
j.v_model.toLowerCase().includes(searchText.toLowerCase()) ||
j.ownr_fn.toLowerCase().includes(searchText.toLowerCase()) ||
j.ownr_ln.toLowerCase().includes(searchText.toLowerCase()) ||
j.ownr_clm_no.toLowerCase().includes(searchText.toLowerCase())
j.clm_no.toLowerCase().includes(searchText.toLowerCase())
)
: reportData;

View File

@@ -0,0 +1,116 @@
import { Button, Input, Table } from "antd";
import React, { useState } from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import ipcTypes from "../../../ipc.types";
import {
selectScanEstimates,
selectScanLoading,
} from "../../../redux/scan/scan.selectors";
import LastScannedAtom from "../../atoms/last-scanned/last-scanned.atom";
import ScanRefreshAtom from "../../atoms/scan-refresh/scan-refresh.atom";
const { ipcRenderer } = window;
const mapStateToProps = createStructuredSelector({
scanLoading: selectScanLoading,
estimates: selectScanEstimates,
});
const mapDispatchToProps = (dispatch) => ({});
export function ScanEstimateListMolecule({ scanLoading, estimates }) {
const [searchText, setSearchText] = useState("");
const columns = [
{
title: "Claim No.",
dataIndex: "clm_no",
key: "clm_no",
},
{
title: "Ins Co.",
dataIndex: "ins_co_nm",
key: "ins_co_nm",
},
{
title: "First Name",
dataIndex: "ownr_fn",
key: "ownr_fn",
},
{
title: "Last Name",
dataIndex: "ownr_ln",
key: "ownr_ln",
},
{
title: "Vehicle",
dataIndex: "vehicle",
key: "vehicle",
render: (text, record) =>
`${record.v_model_yr} ${record.v_makedesc} ${record.v_model} (${record.v_type})`,
},
{
title: "Import",
dataIndex: "import",
key: "import",
render: (text, record) => (
<Button
onClick={() =>
ipcRenderer.send(
ipcTypes.default.fileScan.toMain.importJob,
record.filepath
)
}
>
Import
</Button>
),
},
];
const data =
searchText !== ""
? estimates.filter(
(j) =>
j.v_makedesc.toLowerCase().includes(searchText.toLowerCase()) ||
j.v_model.toLowerCase().includes(searchText.toLowerCase()) ||
j.ownr_fn.toLowerCase().includes(searchText.toLowerCase()) ||
j.ownr_ln.toLowerCase().includes(searchText.toLowerCase()) ||
j.clm_no.toLowerCase().includes(searchText.toLowerCase())
)
: estimates;
return (
<div>
<Table
title={() => (
<div className="imex-table-header">
<ScanRefreshAtom />
<LastScannedAtom />
<Input.Search
className="imex-table-header__search"
placeholder="Search"
onSearch={(val) => {
setSearchText(val);
}}
enterButton
allowClear
/>
</div>
)}
columns={columns}
rowKey="filepath"
loading={scanLoading}
size="small"
pagination={false}
dataSource={data}
scroll={{
x: true,
}}
/>
</div>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(ScanEstimateListMolecule);