diff --git a/client/package.json b/client/package.json
index d994efdca..635a86e66 100644
--- a/client/package.json
+++ b/client/package.json
@@ -16,6 +16,7 @@
"react": "^16.12.0",
"react-apollo": "^3.1.3",
"react-dom": "^16.12.0",
+ "react-number-format": "^4.3.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.2.0",
"react-trello": "^2.2.3",
diff --git a/client/src/App/App.container.jsx b/client/src/App/App.container.jsx
index 148ed0fe0..54ccd8791 100644
--- a/client/src/App/App.container.jsx
+++ b/client/src/App/App.container.jsx
@@ -49,14 +49,14 @@ class AppContainer extends Component {
// split based on operation type
({ query }) => {
const definition = getMainDefinition(query);
- console.log(
- "##Intercepted GQL Transaction : " +
- definition.operation +
- "|" +
- definition.name.value +
- "##",
- query
- );
+ // console.log(
+ // "##Intercepted GQL Transaction : " +
+ // definition.operation +
+ // "|" +
+ // definition.name.value +
+ // "##",
+ // query
+ // );
return (
definition.kind === "OperationDefinition" &&
definition.operation === "subscription"
diff --git a/client/src/App/App.js b/client/src/App/App.js
index 3935637b4..4d60a8be2 100644
--- a/client/src/App/App.js
+++ b/client/src/App/App.js
@@ -23,23 +23,24 @@ export default () => {
useEffect(() => {
//Run the auth code only on the first render.
- const unsubscribeFromAuth = auth.onIdTokenChanged(async user => {
+ const unsubscribeFromAuth = auth.onAuthStateChanged(async user => {
if (user) {
let token;
token = await user.getIdToken();
const idTokenResult = await user.getIdTokenResult();
const hasuraClaim =
idTokenResult.claims["https://hasura.io/jwt/claims"];
+ if (!hasuraClaim) {
+ // Check if refresh is required.
+ const metadataRef = firebase
+ .database()
+ .ref("metadata/" + user.uid + "/refreshTime");
- // Check if refresh is required.
- const metadataRef = firebase
- .database()
- .ref("metadata/" + user.uid + "/refreshTime");
- metadataRef.on("value", async params => {
- console.log("params", params);
- // Force refresh to pick up the latest custom claims changes.
- token = await user.getIdToken(true);
- });
+ metadataRef.on("value", async () => {
+ // Force refresh to pick up the latest custom claims changes.
+ token = await user.getIdToken(true);
+ });
+ }
apolloClient.writeData({
data: {
diff --git a/client/src/components/form-items-formatted/phone-form-item.component.jsx b/client/src/components/form-items-formatted/phone-form-item.component.jsx
new file mode 100644
index 000000000..30638a00c
--- /dev/null
+++ b/client/src/components/form-items-formatted/phone-form-item.component.jsx
@@ -0,0 +1,14 @@
+import React, { forwardRef } from "react";
+import NumberFormat from "react-number-format";
+function FormItemPhone(props, ref) {
+ return (
+
+ );
+}
+
+export default forwardRef(FormItemPhone);
diff --git a/client/src/components/job-lines/job-lines.component.jsx b/client/src/components/job-lines/job-lines.component.jsx
new file mode 100644
index 000000000..3117b4072
--- /dev/null
+++ b/client/src/components/job-lines/job-lines.component.jsx
@@ -0,0 +1,53 @@
+import React, { useState } from "react";
+import { Table } from "antd";
+import { alphaSort } from "../../utils/sorters";
+
+export default function JobLinesComponent({ loading, joblines }) {
+ const [state, setState] = useState({
+ sortedInfo: {},
+ filteredInfo: { text: "" }
+ });
+
+ const columns = [
+ {
+ title: "Line #",
+ dataIndex: "line_ind",
+ key: "line_ind",
+ // onFilter: (value, record) => record.ro_number.includes(value),
+ // filteredValue: state.filteredInfo.text || null,
+ sorter: (a, b) => alphaSort(a, b),
+ sortOrder:
+ state.sortedInfo.columnKey === "line_ind" && state.sortedInfo.order,
+ ellipsis: true
+ },
+ {
+ title: "Description",
+ dataIndex: "line_desc",
+ key: "line_desc",
+ sorter: (a, b) => alphaSort(a, b),
+ sortOrder:
+ state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order,
+ ellipsis: true
+ }
+ ];
+
+ const handleTableChange = (pagination, filters, sorter) => {
+ setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
+ };
+
+ const handleChange = event => {
+ const { value } = event.target;
+ setState({ ...state, filterinfo: { text: [value] } });
+ };
+console.log('joblines', joblines)
+ return (
+
({ ...item }))}
+ rowKey="id"
+ dataSource={joblines}
+ onChange={handleTableChange}
+ />
+ );
+}
diff --git a/client/src/components/job-lines/job-lines.container.component.jsx b/client/src/components/job-lines/job-lines.container.component.jsx
new file mode 100644
index 000000000..c5f4a994a
--- /dev/null
+++ b/client/src/components/job-lines/job-lines.container.component.jsx
@@ -0,0 +1,19 @@
+import React from "react";
+import JobLinesComponent from "./job-lines.component";
+import { useQuery } from "@apollo/react-hooks";
+import AlertComponent from "../../components/alert/alert.component";
+
+import { GET_JOB_LINES_BY_PK } from "../../graphql/jobs-lines.queries";
+
+export default function JobLinesContainer({ match }) {
+ const { jobId } = match.params;
+
+ const { loading, error, data } = useQuery(GET_JOB_LINES_BY_PK, {
+ variables: { id: jobId },
+ fetchPolicy: "network-only"
+ });
+ if (error) return ;
+ return (
+
+ );
+}
diff --git a/client/src/components/job-tombstone/job-tombstone.component.jsx b/client/src/components/job-tombstone/job-tombstone.component.jsx
index caad9477a..61bf67b9d 100644
--- a/client/src/components/job-tombstone/job-tombstone.component.jsx
+++ b/client/src/components/job-tombstone/job-tombstone.component.jsx
@@ -1,8 +1,30 @@
import React, { useState } from "react";
import AlertComponent from "../alert/alert.component";
-import { Form, Input, Row, Col, Button } from "antd";
+import {
+ Form,
+ Input,
+ Row,
+ Col,
+ Button,
+ Typography,
+ PageHeader,
+ Descriptions,
+ Tag
+} from "antd";
import { UPDATE_JOB } from "../../graphql/jobs.queries";
import { useMutation } from "@apollo/react-hooks";
+import FormItemPhone from "../form-items-formatted/phone-form-item.component";
+
+const formItemLayout = {
+ labelCol: {
+ xs: { span: 24 },
+ sm: { span: 5 }
+ },
+ wrapperCol: {
+ xs: { span: 24 },
+ sm: { span: 12 }
+ }
+};
function JobTombstone({ job, ...otherProps }) {
const [jobContext, setJobContext] = useState(job);
@@ -22,8 +44,6 @@ function JobTombstone({ job, ...otherProps }) {
otherProps.form.validateFieldsAndScroll((err, values) => {
if (!err) {
- console.log("Received values of form: ", values);
-
mutationUpdateJob({
variables: { jobId: jobContext.id, job: values }
}).then(r => console.log("result", r));
@@ -32,27 +52,102 @@ function JobTombstone({ job, ...otherProps }) {
};
const handleChange = event => {
- const { name, value } = event.target;
+ const { name, value } = event.target ? event.target : event;
setJobContext({ ...jobContext, [name]: value });
};
const { getFieldDecorator } = otherProps.form;
return (
-
-
+ ]}
+ >
+
+
+ $ {jobContext.claim_total?.toFixed(2)}
+
+
+ $ {jobContext.deductible?.toFixed(2)}
+
+
+
+
+
+ Information
+
+ {getFieldDecorator("ro_number", {
+ initialValue: jobContext.ro_number
+ })()}
-
+
+
+ {getFieldDecorator("est_number", {
+ initialValue: jobContext.est_number
+ })()}
+
+
+
+
+ Insurance Information
+
+ {getFieldDecorator("est_co_nm", {
+ initialValue: jobContext.est_co_nm
+ })()}
+
+
+
+ {getFieldDecorator("est_ct_ln", {
+ initialValue: jobContext.est_ct_ln
+ })()}
+
+
+ {getFieldDecorator("est_ct_fn", {
+ initialValue: jobContext.est_ct_fn
+ })()}
+
+
+
+
+ {getFieldDecorator("est_ph1", {
+ initialValue: jobContext.est_ph1
+ })(
+
+ )}
+
+
+ {getFieldDecorator("est_ea", {
+ initialValue: jobContext.est_ea,
+ rules: [
+ {
+ type: "email",
+ message: "This is not a valid email address."
+ }
+ ]
+ })()}
+
+
+
);
}
diff --git a/client/src/components/jobs-list/jobs-list.component.jsx b/client/src/components/jobs-list/jobs-list.component.jsx
index 3a69bd18b..bfc3e40ae 100644
--- a/client/src/components/jobs-list/jobs-list.component.jsx
+++ b/client/src/components/jobs-list/jobs-list.component.jsx
@@ -6,7 +6,7 @@ import { alphaSort } from "../../utils/sorters";
export default function JobsPage({ loading, jobs }) {
const [state, setState] = useState({
sortedInfo: {},
- filteredInfo: null
+ filteredInfo: { text: "" }
});
const columns = [
@@ -14,8 +14,8 @@ export default function JobsPage({ loading, jobs }) {
title: "RO #",
dataIndex: "ro_number",
key: "ro_number",
- onFilter: (value, record) => record.ro_number.includes(value),
- filteredValue: state.filteredInfo.text || null,
+ // onFilter: (value, record) => record.ro_number.includes(value),
+ // filteredValue: state.filteredInfo.text || null,
sorter: (a, b) => alphaSort(a, b),
sortOrder:
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
@@ -88,7 +88,7 @@ export default function JobsPage({ loading, jobs }) {
};
const handleChange = event => {
- const { name, value } = event.target;
+ const { value } = event.target;
setState({ ...state, filterinfo: { text: [value] } });
};
diff --git a/client/src/graphql/jobs-lines.queries.js b/client/src/graphql/jobs-lines.queries.js
new file mode 100644
index 000000000..4203fdf06
--- /dev/null
+++ b/client/src/graphql/jobs-lines.queries.js
@@ -0,0 +1,11 @@
+import { gql } from "apollo-boost";
+
+export const GET_JOB_LINES_BY_PK = gql`
+ query GET_JOB_LINES_BY_PK($id: uuid!) {
+ joblines(where: { jobid: { _eq: $id } }) {
+ id
+ line_ind
+ line_desc
+ }
+ }
+`;
diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js
index 92cdaf83a..dd8f3bf3b 100644
--- a/client/src/graphql/jobs.queries.js
+++ b/client/src/graphql/jobs.queries.js
@@ -62,29 +62,11 @@ export const GET_JOB_BY_PK = gql`
last_name
phone
}
- rate_atp
- rate_la1
- rate_la2
- rate_la3
- rate_la4
- rate_lab
- rate_lad
- rate_lae
- rate_laf
- rate_lag
- rate_lam
- rate_lar
- rate_las
- rate_lau
- rate_ma2s
- rate_ma2t
- rate_mabl
- rate_ma3s
- rate_macs
- rate_mahw
- rate_mapa
- rate_mash
- rate_matd
+ est_co_nm
+ est_ph1
+ est_ea
+ est_ct_fn
+ est_ct_ln
regie_number
ro_number
scheduled_completion
@@ -92,6 +74,8 @@ export const GET_JOB_BY_PK = gql`
scheduled_delivery
status
updated_at
+ claim_total
+ deductible
vehicle {
plate_no
v_vin
@@ -109,6 +93,8 @@ export const UPDATE_JOB = gql`
update_jobs(where: { id: { _eq: $jobId } }, _set: $job) {
returning {
id
+ est_ph1
+ est_ea
}
}
}
diff --git a/client/src/graphql/resolvers.js b/client/src/graphql/resolvers.js
index 296cf8344..b293bfd8b 100644
--- a/client/src/graphql/resolvers.js
+++ b/client/src/graphql/resolvers.js
@@ -1,8 +1,5 @@
import { gql } from "apollo-boost";
-import {
- GET_CURRENT_USER,
- GET_WHITE_BOARD_LEFT_SIDER_VISIBLE
-} from "./local.queries";
+import { GET_CURRENT_USER } from "./local.queries";
export const typeDefs = gql`
extend type Mutation {
diff --git a/client/src/pages/jobs-detail/jobs-detail.page.jsx b/client/src/pages/jobs-detail/jobs-detail.page.jsx
index c3e4aacba..abe320abe 100644
--- a/client/src/pages/jobs-detail/jobs-detail.page.jsx
+++ b/client/src/pages/jobs-detail/jobs-detail.page.jsx
@@ -4,7 +4,8 @@ import SpinComponent from "../../components/loading-spinner/loading-spinner.comp
import AlertComponent from "../../components/alert/alert.component";
import JobTombstone from "../../components/job-tombstone/job-tombstone.component";
import { GET_JOB_BY_PK } from "../../graphql/jobs.queries";
-import { Breadcrumb } from "antd";
+import { Tabs, Icon, Row } from "antd";
+import JobLinesContainer from "../../components/job-lines/job-lines.container.component";
function JobsDetailPage({ match }) {
const { jobId } = match.params;
@@ -17,7 +18,46 @@ function JobsDetailPage({ match }) {
return (
-
+
+
+
+
+
+
+
+ Lines
+
+ }
+ key="lines"
+ >
+
+
+
+
+ Rates
+
+ }
+ key="rates"
+ >
+ Estimate Rates
+
+
+
+ Parts
+
+ }
+ key="parts"
+ >
+ Estimate Parts
+
+
+
);
}
diff --git a/client/src/pages/manage/manage.page.jsx b/client/src/pages/manage/manage.page.jsx
index b4cf8133e..8239a7475 100644
--- a/client/src/pages/manage/manage.page.jsx
+++ b/client/src/pages/manage/manage.page.jsx
@@ -8,7 +8,7 @@ import JobsDetailPage from "../jobs-detail/jobs-detail.page";
import HeaderContainer from "../../components/header/header.container";
import FooterComponent from "../../components/footer/footer.component";
-import { Layout, BackTop } from "antd";
+import { Layout, BackTop, Col } from "antd";
const { Header, Content, Footer } = Layout;
//This page will handle all routing for the entire application.
@@ -20,10 +20,15 @@ export default function Manage({ match }) {
-
+
+
-
-
+
+
+