diff --git a/_reference/DeploymentChecklist.md b/_reference/DeploymentChecklist.md index dd6c96e29..a1ea46e38 100644 --- a/_reference/DeploymentChecklist.md +++ b/_reference/DeploymentChecklist.md @@ -8,4 +8,7 @@ Bucket= __React Based__ REACT_APP_GRAPHQL_ENDPOINT -REACT_APP_GRAPHQL_ENDPOINT_WS \ No newline at end of file +REACT_APP_GRAPHQL_ENDPOINT_WS + +__MetaData__ +Region based OpCodes \ No newline at end of file diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx index 010b92df0..60da20fd3 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -1,15 +1,18 @@ -import { Button, Table, Form, Input, Alert } from "antd"; -import React, { useState, useContext } from "react"; +import { Input, Table } from "antd"; +import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { alphaSort } from "../../utils/sorters"; //import EditableCell from "./job-lines-cell.component"; -export default function JobLinesComponent({ jobLines, form, handleSubmit }) { - const { getFieldDecorator, isFieldsTouched, resetFields } = form; +export default function JobLinesComponent({ + jobLines, + form, + handleSubmit, + setSearchText +}) { const [state, setState] = useState({ - sortedInfo: {}, - filteredInfo: { text: "" } + sortedInfo: {} }); const { t } = useTranslation(); @@ -51,6 +54,7 @@ export default function JobLinesComponent({ jobLines, form, handleSubmit }) { state.sortedInfo.columnKey === "oem_partno" && state.sortedInfo.order, ellipsis: true, editable: true, + width: "20%", render: (text, record) => ( {record.oem_partno ? record.oem_partno : record.op_code_desc} @@ -65,7 +69,8 @@ export default function JobLinesComponent({ jobLines, form, handleSubmit }) { sortOrder: state.sortedInfo.columnKey === "part_type" && state.sortedInfo.order, ellipsis: true, - editable: true + editable: true, + width: "10%" }, { title: t("joblines.fields.db_price"), @@ -75,6 +80,7 @@ export default function JobLinesComponent({ jobLines, form, handleSubmit }) { sortOrder: state.sortedInfo.columnKey === "db_price" && state.sortedInfo.order, ellipsis: true, + width: "10%", render: (text, record) => ( {record.db_price} ) @@ -87,6 +93,7 @@ export default function JobLinesComponent({ jobLines, form, handleSubmit }) { sortOrder: state.sortedInfo.columnKey === "act_price" && state.sortedInfo.order, ellipsis: true, + width: "10%", render: (text, record) => ( {record.act_price} ) @@ -113,31 +120,24 @@ export default function JobLinesComponent({ jobLines, form, handleSubmit }) { }; return ( -
-
Testing Place
- - {isFieldsTouched() ? ( - - {t("general.messages.unsavedchanges")} - - - } - closable - /> - ) : null} - - ({ ...item }))} - rowKey="id" - dataSource={jobLines} - onChange={handleTableChange} - /> - +
{ + return ( + { + e.preventDefault(); + setSearchText(e.target.value); + }} + /> + ); + }} + size="small" + pagination={{ position: "bottom", defaultPageSize: 50 }} + columns={columns.map(item => ({ ...item }))} + rowKey="id" + dataSource={jobLines} + onChange={handleTableChange} + /> ); } diff --git a/client/src/components/job-detail-lines/job-lines.container.jsx b/client/src/components/job-detail-lines/job-lines.container.jsx index d91845908..668b0ef63 100644 --- a/client/src/components/job-detail-lines/job-lines.container.jsx +++ b/client/src/components/job-detail-lines/job-lines.container.jsx @@ -1,52 +1,83 @@ -import React from "react"; -import JobLinesComponent from "./job-lines.component"; import { useQuery } from "@apollo/react-hooks"; -import AlertComponent from "../alert/alert.component"; -import { Form, notification } from "antd"; -import { GET_JOB_LINES_BY_PK } from "../../graphql/jobs-lines.queries"; +import { notification } from "antd"; +import React, { useState } from "react"; import { useTranslation } from "react-i18next"; +import { GET_JOB_LINES_BY_PK } from "../../graphql/jobs-lines.queries"; +import AlertComponent from "../alert/alert.component"; +import JobLinesComponent from "./job-lines.component"; -export default Form.create({ name: "JobsDetailJobLines" })( - function JobLinesContainer({ jobId, form }) { - const { loading, error, data } = useQuery(GET_JOB_LINES_BY_PK, { - variables: { id: jobId }, - fetchPolicy: "network-only" +//export default Form.create({ name: "JobsDetailJobLines" })( + +export default function JobLinesContainer({ jobId, form }) { + const { loading, error, data } = useQuery(GET_JOB_LINES_BY_PK, { + variables: { id: jobId }, + fetchPolicy: "network-only" + }); + + const [searchText, setSearchText] = useState(""); + const { t } = useTranslation(); + + const handleSubmit = e => { + e.preventDefault(); + + form.validateFieldsAndScroll((err, values) => { + if (err) { + notification["error"]({ + message: t("jobs.errors.validationtitle"), + description: t("jobs.errors.validation") + }); + } + if (!err) { + console.log("Save the est lines!", values); + // mutationUpdateJob({ + // variables: { jobId: data.jobs_by_pk.id, job: values } + // }).then(r => { + // notification["success"]({ + // message: t("jobs.successes.savetitle") + // }); + // //TODO: Better way to reset the field decorators? + // refetch().then(r => form.resetFields()); + // }); + } }); - const { t } = useTranslation(); - const handleSubmit = e => { - e.preventDefault(); + }; - form.validateFieldsAndScroll((err, values) => { - if (err) { - notification["error"]({ - message: t("jobs.errors.validationtitle"), - description: t("jobs.errors.validation") - }); - } - if (!err) { - console.log("Save the est lines!", values); - // mutationUpdateJob({ - // variables: { jobId: data.jobs_by_pk.id, job: values } - // }).then(r => { - // notification["success"]({ - // message: t("jobs.successes.savetitle") - // }); - // //TODO: Better way to reset the field decorators? - // refetch().then(r => form.resetFields()); - // }); - } - }); - }; + if (error) return ; - if (error) return ; - - return ( - - ); - } -); + return ( + + jl.unq_seq + ?.toString() + .toLowerCase() + .includes(searchText.toLowerCase()) || + jl.line_desc + ?.toLowerCase() + .includes(searchText.toLowerCase()) || + jl.part_type + ?.toLowerCase() + .includes(searchText.toLowerCase()) || + jl.oem_partno + ?.toLowerCase() + .includes(searchText.toLowerCase()) || + jl.op_code_desc + ?.toLowerCase() + .includes(searchText.toLowerCase()) || + jl.db_price?.toString().includes(searchText.toLowerCase()) || + jl.act_price?.toString().includes(searchText.toLowerCase()) + ) + : data.joblines + : null + } + handleSubmit={handleSubmit} + form={form} + setSearchText={setSearchText} + /> + ); +} +//); diff --git a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx index b9da502d5..6d89061d2 100644 --- a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx +++ b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx @@ -18,7 +18,7 @@ export default function JobsDetailHeader({ job, mutationConvertJob, refetch, - getFieldDecorator + handleSubmit }) { const { t } = useTranslation(); @@ -76,7 +76,12 @@ export default function JobsDetailHeader({ > {t("jobs.actions.convert")} , - ]; diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index b4baa1503..63cdfb102 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -41,11 +41,12 @@ export default function JobsDetailPage({ return (
-
+ {isFieldsTouched() ? (