Refactored some of the job detail form to use context. Created claims component.

This commit is contained in:
Patrick Fic
2020-01-27 18:18:55 -08:00
parent b5e9c65aee
commit 265bc7d486
9 changed files with 169 additions and 81 deletions

View File

@@ -0,0 +1,44 @@
import React, { useContext } from "react";
import { Form, Input } from "antd";
import FormItemPhone from "../form-items-formatted/phone-form-item.component";
import JobDetailFormContext from "../../pages/jobs-detail/jobs-detail.page.context";
export default function JobsDetailClaims({ job }) {
const form = useContext(JobDetailFormContext);
const { getFieldDecorator, isFieldTouched } = form;
return (
<div>
<div>
<Form.Item label='Estimator Last Name'>
{isFieldTouched("est_ct_ln") ? "Yes" : "No"}
{getFieldDecorator("est_ct_ln", {
initialValue: job.est_ct_ln
})(<Input name='est_ct_ln' />)}
</Form.Item>
<Form.Item label='Estimator First Name'>
{getFieldDecorator("est_ct_fn", {
initialValue: job.est_ct_fn
})(<Input name='est_ct_fn' />)}
</Form.Item>
<Form.Item label='Estimator Phone #'>
{getFieldDecorator("est_ph1", {
initialValue: job.est_ph1
})(<FormItemPhone customInput={Input} name='est_ph1' />)}
</Form.Item>
<Form.Item label='Estimator Email'>
{getFieldDecorator("est_ea", {
initialValue: job.est_ea,
rules: [
{
type: "email",
message: "This is not a valid email address."
}
]
})(<Input name='est_ea' />)}
</Form.Item>
</div>
</div>
);
}

View File

@@ -1,14 +1,4 @@
import {
Avatar,
Button,
Descriptions,
notification,
PageHeader,
Tag,
Input,
Form,
Checkbox
} from "antd";
import { Avatar, Button, Checkbox, Descriptions, notification, PageHeader, Tag } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import Moment from "react-moment";
@@ -95,7 +85,7 @@ export default function JobsDetailHeader({
</Descriptions.Item>
<Descriptions.Item label={t("jobs.fields.customerowing")}>
$NO BINDING YET
##NO BINDING YET##
</Descriptions.Item>
<Descriptions.Item label={t("jobs.fields.specialcoveragepolicy")}>