Refactored some of the job detail form to use context. Created claims component.
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user