Changes to job edit view

This commit is contained in:
Patrick Fic
2020-08-06 11:32:52 -07:00
parent a80dd12caa
commit 4c869ceddf
7 changed files with 199 additions and 105 deletions

View File

@@ -7,6 +7,7 @@
"@testing-library/jest-dom": "^5.11.2",
"@testing-library/react": "^10.4.8",
"@testing-library/user-event": "^12.1.0",
"@types/prop-types": "^15.7.3",
"apollo-boost": "^0.4.9",
"apollo-link-context": "^1.0.20",
"apollo-link-logger": "^1.2.3",
@@ -18,6 +19,7 @@
"react": "^16.13.1",
"react-admin": "^3.7.2",
"react-dom": "^16.13.1",
"react-icons": "^3.10.0",
"react-scripts": "3.4.1"
},
"scripts": {

View File

@@ -1,4 +1,4 @@
import { ApolloClient, InMemoryCache, ApolloProvider } from "@apollo/client";
import { ApolloClient, ApolloProvider, InMemoryCache } from "@apollo/client";
import { ApolloLink } from "apollo-boost";
import { setContext } from "apollo-link-context";
import { HttpLink } from "apollo-link-http";
@@ -12,6 +12,7 @@ import {
Resource,
ShowGuesser,
} from "react-admin";
import { FaFileInvoiceDollar } from "react-icons/fa";
import { auth } from "../../firebase/admin-firebase-utils";
import authProvider from "../auth-provider/auth-provider";
import JoblinesCreate from "../joblines/joblines.create";
@@ -91,6 +92,7 @@ class AdminRoot extends Component {
<ApolloProvider client={client}>
<Admin dataProvider={dataProvider} authProvider={authProvider}>
<Resource
icon={FaFileInvoiceDollar}
name="jobs"
list={JobsList}
edit={JobsEdit}

View File

@@ -1,15 +1,12 @@
import React from "react";
import {
Edit,
EmailField,
DateTimeInput,
DateField,
NumberInput,
BooleanInput,
DateField,
Edit,
NumberInput,
SimpleForm,
TextInput,
} from "react-admin";
import { number } from "prop-types";
const JoblinesEdit = (props) => (
<Edit {...props}>

View File

@@ -1,53 +1,150 @@
import React from "react";
import { Edit, SimpleForm, TextInput } from "react-admin";
//@ts-ignore
import {
AutocompleteInput,
Edit,
FormTab,
NumberInput,
ReferenceInput,
SelectInput,
TabbedForm,
TextInput,
} from "react-admin";
const JobsEdit = (props) => (
<Edit {...props}>
<SimpleForm margin="normal" variant="standard">
<div
style={{
columns: "3 auto",
// display: "flex",
width: "100%",
// justifyContent: "space-around",
}}
>
<TextInput fullWidth source="id" />
<TextInput fullWidth source="created_at" />
<TextInput fullWidth source="updated_at" />
<TabbedForm margin="normal" variant="standard">
<FormTab label="Record Info">
<div
style={{
columns: "3 auto",
// display: "flex",
width: "100%",
// justifyContent: "space-around",
}}
>
<TextInput disabled fullWidth source="id" />
<TextInput disabled fullWidth source="created_at" />
<TextInput disabled fullWidth source="updated_at" />
</div>
</FormTab>
<FormTab label="Job Info">
<div
style={{
columns: "3 auto",
// display: "flex",
width: "100%",
// justifyContent: "space-around",
}}
>
<ReferenceInput label="Shopid" source="shopid" reference="bodyshops">
<SelectInput disabled optionText="shopname" />
</ReferenceInput>
<TextInput fullWidth source="ro_number" />
<ReferenceInput label="Owner ID" source="ownerid" reference="owners">
<AutocompleteInput
matchSuggestion={(filter, choice) =>
choice.ownr_fn &&
choice.ownr_fn.toLowerCase().includes(filter.toLowerCase())
}
optionText={(record) =>
`${record.ownr_fn || ""} ${record.ownr_ln || ""} ${
record.ownr_co_nm || ""
} (${record.ownr_ph1 || ""})`
}
/>
</ReferenceInput>
<ReferenceInput
label="Vehicle Id"
source="vehicleid"
reference="vehicles"
>
<SelectInput optionText="v_vin" />
</ReferenceInput>
<ReferenceInput label="Shopid" source="shopid" reference="bodyshops">
<SelectInput disabled optionText="shopname" />
</ReferenceInput>
<TextInput fullWidth source="ro_number" />
<ReferenceInput label="Owner ID" source="ownerid" reference="owners">
<AutocompleteInput
matchSuggestion={(filter, choice) =>
choice.ownr_fn &&
choice.ownr_fn.toLowerCase().includes(filter.toLowerCase())
}
optionText={(record) =>
`${record.ownr_fn || ""} ${record.ownr_ln || ""} ${
record.ownr_co_nm || ""
} (${record.ownr_ph1 || ""})`
}
/>
</ReferenceInput>
<ReferenceInput
label="Vehicle Id"
source="vehicleid"
reference="vehicles"
>
<SelectInput optionText="v_vin" />
</ReferenceInput>
<TextInput fullWidth source="inproduction" />
<TextInput fullWidth source="converted" />
</div>
</FormTab>
<TextInput fullWidth source="shopid" disabled />
<TextInput fullWidth source="ro_number" />
<TextInput fullWidth source="ownerid" />
<TextInput fullWidth source="vehicleid" />
<TextInput fullWidth source="labor_rate_id" />
<TextInput fullWidth source="labor_rate_desc" />
<TextInput fullWidth source="rate_lab" />
<TextInput fullWidth source="rate_lad" />
<TextInput fullWidth source="rate_lae" />
<TextInput fullWidth source="rate_lar" />
<TextInput fullWidth source="rate_las" />
<TextInput fullWidth source="rate_laf" />
<TextInput fullWidth source="rate_lam" />
<TextInput fullWidth source="rate_lag" />
<TextInput fullWidth source="rate_atp" />
<TextInput fullWidth source="rate_lau" />
<TextInput fullWidth source="rate_la1" />
<TextInput fullWidth source="rate_la2" />
<TextInput fullWidth source="rate_la3" />
<TextInput fullWidth source="rate_la4" />
<TextInput fullWidth source="rate_mapa" />
<TextInput fullWidth source="rate_mash" />
<TextInput fullWidth source="rate_mahw" />
<TextInput fullWidth source="rate_ma2s" />
<TextInput fullWidth source="rate_ma3s" />
<TextInput fullWidth source="rate_ma2t" />
<TextInput fullWidth source="rate_mabl" />
<TextInput fullWidth source="rate_macs" />
<TextInput fullWidth source="rate_matd" />
<TextInput fullWidth source="federal_tax_rate" />
<TextInput fullWidth source="state_tax_rate" />
<TextInput fullWidth source="local_tax_rate" />
<FormTab label="Labor Rates">
<div
style={{
columns: "3 auto",
// display: "flex",
width: "100%",
// justifyContent: "space-around",
}}
>
<NumberInput fullWidth source="labor_rate_id" />
<NumberInput fullWidth source="labor_rate_desc" />
<NumberInput fullWidth source="rate_lab" />
<NumberInput fullWidth source="rate_lad" />
<NumberInput fullWidth source="rate_lae" />
<NumberInput fullWidth source="rate_lar" />
<NumberInput fullWidth source="rate_las" />
<NumberInput fullWidth source="rate_laf" />
<NumberInput fullWidth source="rate_lam" />
<NumberInput fullWidth source="rate_lag" />
<NumberInput fullWidth source="rate_atp" />
<NumberInput fullWidth source="rate_lau" />
<NumberInput fullWidth source="rate_la1" />
<NumberInput fullWidth source="rate_la2" />
<NumberInput fullWidth source="rate_la3" />
<NumberInput fullWidth source="rate_la4" />
<NumberInput fullWidth source="rate_mapa" />
<NumberInput fullWidth source="rate_mash" />
<NumberInput fullWidth source="rate_mahw" />
<NumberInput fullWidth source="rate_ma2s" />
<NumberInput fullWidth source="rate_ma3s" />
<NumberInput fullWidth source="rate_ma2t" />
<NumberInput fullWidth source="rate_mabl" />
<NumberInput fullWidth source="rate_macs" />
<NumberInput fullWidth source="rate_matd" />
<NumberInput fullWidth source="federal_tax_rate" />
<NumberInput fullWidth source="state_tax_rate" />
<NumberInput fullWidth source="local_tax_rate" />
</div>
</FormTab>
<FormTab label="Dates">
<TextInput fullWidth source="scheduled_in" />
<TextInput fullWidth source="actual_in" />
<TextInput fullWidth source="scheduled_completion" />
<TextInput fullWidth source="actual_completion" />
<TextInput fullWidth source="scheduled_delivery" />
<TextInput fullWidth source="actual_delivery" />
<TextInput fullWidth source="invoice_date" />
<TextInput fullWidth source="date_estimated" />
<TextInput fullWidth source="date_open" />
<TextInput fullWidth source="date_scheduled" />
<TextInput fullWidth source="date_invoiced" />
<TextInput fullWidth source="date_closed" />
<TextInput fullWidth source="date_exported" />
</FormTab>
<FormTab label="Insurance info">
<TextInput fullWidth source="est_co_nm" />
<TextInput fullWidth source="est_addr1" />
<TextInput fullWidth source="est_addr2" />
@@ -59,15 +156,7 @@ const JobsEdit = (props) => (
<TextInput fullWidth source="est_ea" />
<TextInput fullWidth source="est_ct_ln" />
<TextInput fullWidth source="est_ct_fn" />
<TextInput fullWidth source="scheduled_in" />
<TextInput fullWidth source="actual_in" />
<TextInput fullWidth source="scheduled_completion" />
<TextInput fullWidth source="actual_completion" />
<TextInput fullWidth source="scheduled_delivery" />
<TextInput fullWidth source="actual_delivery" />
<TextInput fullWidth source="regie_number" />
<TextInput fullWidth source="invoice_date" />
<TextInput fullWidth source="inproduction" />
<TextInput fullWidth source="statusid" />
<TextInput fullWidth source="ins_co_id" />
<TextInput fullWidth source="ins_co_nm" />
@@ -98,15 +187,31 @@ const JobsEdit = (props) => (
<TextInput fullWidth source="asgn_type" />
<TextInput fullWidth source="clm_no" />
<TextInput fullWidth source="clm_ofc_id" />
<TextInput fullWidth source="date_estimated" />
<TextInput fullWidth source="date_open" />
<TextInput fullWidth source="date_scheduled" />
<TextInput fullWidth source="date_invoiced" />
<TextInput fullWidth source="date_closed" />
<TextInput fullWidth source="date_exported" />
<TextInput fullWidth source="clm_total" />
<TextInput fullWidth source="owner_owing" />
<TextInput fullWidth source="converted" />
<TextInput fullWidth source="agt_co_id" />
<TextInput fullWidth source="agt_co_nm" />
<TextInput fullWidth source="agt_addr1" />
<TextInput fullWidth source="agt_addr2" />
<TextInput fullWidth source="agt_city" />
<TextInput fullWidth source="agt_st" />
<TextInput fullWidth source="agt_zip" />
<TextInput fullWidth source="agt_ctry" />
<TextInput fullWidth source="agt_ph1" />
<TextInput fullWidth source="agt_ph1x" />
<TextInput fullWidth source="agt_ph2" />
<TextInput fullWidth source="agt_ph2x" />
<TextInput fullWidth source="agt_fax" />
<TextInput fullWidth source="agt_faxx" />
<TextInput fullWidth source="agt_ct_ln" />
<TextInput fullWidth source="agt_ct_fn" />
<TextInput fullWidth source="agt_ct_ph" />
<TextInput fullWidth source="agt_ct_phx" />
<TextInput fullWidth source="agt_ea" />
<TextInput fullWidth source="agt_lic_no" />
<TextInput fullWidth source="loss_type" />
<TextInput fullWidth source="loss_desc" />
<TextInput fullWidth source="theft_ind" />
<TextInput fullWidth source="cat_no" />
<TextInput fullWidth source="tlos_ind" />
<TextInput fullWidth source="ciecaid" />
<TextInput fullWidth source="loss_date" />
<TextInput fullWidth source="clm_ofc_nm" />
@@ -133,31 +238,8 @@ const JobsEdit = (props) => (
<TextInput fullWidth source="pay_date" />
<TextInput fullWidth source="pay_chknm" />
<TextInput fullWidth source="pay_amt" />
<TextInput fullWidth source="agt_co_id" />
<TextInput fullWidth source="agt_co_nm" />
<TextInput fullWidth source="agt_addr1" />
<TextInput fullWidth source="agt_addr2" />
<TextInput fullWidth source="agt_city" />
<TextInput fullWidth source="agt_st" />
<TextInput fullWidth source="agt_zip" />
<TextInput fullWidth source="agt_ctry" />
<TextInput fullWidth source="agt_ph1" />
<TextInput fullWidth source="agt_ph1x" />
<TextInput fullWidth source="agt_ph2" />
<TextInput fullWidth source="agt_ph2x" />
<TextInput fullWidth source="agt_fax" />
<TextInput fullWidth source="agt_faxx" />
<TextInput fullWidth source="agt_ct_ln" />
<TextInput fullWidth source="agt_ct_fn" />
<TextInput fullWidth source="agt_ct_ph" />
<TextInput fullWidth source="agt_ct_phx" />
<TextInput fullWidth source="agt_ea" />
<TextInput fullWidth source="agt_lic_no" />
<TextInput fullWidth source="loss_type" />
<TextInput fullWidth source="loss_desc" />
<TextInput fullWidth source="theft_ind" />
<TextInput fullWidth source="cat_no" />
<TextInput fullWidth source="tlos_ind" />
</FormTab>
<FormTab label="Owner Data on Job">
<TextInput fullWidth source="cust_pr" />
<TextInput fullWidth source="insd_ln" />
<TextInput fullWidth source="insd_fn" />
@@ -193,6 +275,12 @@ const JobsEdit = (props) => (
<TextInput fullWidth source="ownr_fax" />
<TextInput fullWidth source="ownr_faxx" />
<TextInput fullWidth source="ownr_ea" />
</FormTab>
<FormTab label="Financial">
<TextInput fullWidth source="clm_total" />
<TextInput fullWidth source="owner_owing" />
</FormTab>
<FormTab label="Other">
<TextInput fullWidth source="area_of_damage" />
<TextInput fullWidth source="loss_cat" />
<TextInput fullWidth source="est_number" />
@@ -247,8 +335,8 @@ const JobsEdit = (props) => (
<TextInput fullWidth source="employee_body" />
<TextInput fullWidth source="employee_refinish" />
<TextInput fullWidth source="employee_prep" />
</div>
</SimpleForm>
</FormTab>
</TabbedForm>
</Edit>
);

View File

@@ -2,14 +2,12 @@ import React from "react";
import {
Datagrid,
EditButton,
NumberField,
ReferenceManyField,
Show,
Tab, TabbedShowLayout,
TextField
Tab,
TabbedShowLayout,
TextField,
} from "react-admin";
const JobsShow = (props) => (
@@ -31,7 +29,7 @@ const JobsShow = (props) => (
label="Job Lines"
>
<Datagrid>
<TextField source="id" />
<TextField source="id" />
<TextField source="line_ref" />
<TextField source="line_desc" />

View File

@@ -2028,7 +2028,7 @@
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==
"@types/prop-types@*":
"@types/prop-types@*", "@types/prop-types@^15.7.3":
version "15.7.3"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7"
integrity sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==
@@ -9802,6 +9802,13 @@ react-final-form@^6.3.3:
dependencies:
"@babel/runtime" "^7.10.0"
react-icons@^3.10.0:
version "3.10.0"
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-3.10.0.tgz#6c217a2dde2e8fa8d293210023914b123f317297"
integrity sha512-WsQ5n1JToG9VixWilSo1bHv842Cj5aZqTGiS3Ud47myF6aK7S/IUY2+dHcBdmkQcCFRuHsJ9OMUI0kTDfjyZXQ==
dependencies:
camelcase "^5.0.0"
react-is@^16.12.0, react-is@^16.5.2, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"

View File

@@ -1,7 +1,7 @@
import React, { useState, useMemo } from "react";
import React, { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Pie, PieChart, Sector } from "recharts";
import CardTemplate from "./job-detail-cards.template.component";
import { PieChart, Pie, Sector, ResponsiveContainer } from "recharts";
export default function JobDetailCardsPartsComponent({ loading, data }) {
const { t } = useTranslation();