Finished job detail insurance component

This commit is contained in:
Patrick Fic
2020-01-28 09:33:47 -08:00
parent bbad8a76ab
commit cc27a8c228
22 changed files with 1707 additions and 67 deletions

View File

@@ -0,0 +1,16 @@
import { Icon, Input } from "antd";
import React, { forwardRef } from "react";
function FormItemEmail(props, ref) {
return (
<Input
{...props}
addonAfter={
<a href={`mailto:${props.email}`}>
<Icon type='mail' />
</a>
}
/>
);
}
export default forwardRef(FormItemEmail);

View File

@@ -2,7 +2,6 @@ import { Form, Input, Switch } from "antd";
import React, { useContext } from "react";
import { useTranslation } from "react-i18next";
import JobDetailFormContext from "../../pages/jobs-detail/jobs-detail.page.context";
import FormItemPhone from "../form-items-formatted/phone-form-item.component";
export default function JobsDetailClaims({ job }) {
const form = useContext(JobDetailFormContext);
@@ -60,22 +59,6 @@ export default function JobsDetailClaims({ job }) {
initialValue: job.referral_source
})(<Input name='referral_source' />)}
</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>
);
}

View File

@@ -1,12 +1,12 @@
import { Form, Input, Button, Icon } from "antd";
import { Divider, Form, Input } from "antd";
import React, { useContext } from "react";
import { useTranslation } from "react-i18next";
import JobDetailFormContext from "../../pages/jobs-detail/jobs-detail.page.context";
import FormItemEmail from "../form-items-formatted/email-form-item.component";
import FormItemPhone from "../form-items-formatted/phone-form-item.component";
export default function JobsDetailInsurance({ job }) {
const form = useContext(JobDetailFormContext);
const { getFieldDecorator } = form;
const { getFieldDecorator, getFieldValue } = form;
const { t } = useTranslation();
return (
@@ -79,9 +79,37 @@ export default function JobsDetailInsurance({ job }) {
message: "This is not a valid email address."
}
]
})(<Input name='ins_ea' />)}
})(<FormItemEmail name='ins_ea' email={getFieldValue("ins_ea")} />)}
</Form.Item>
<Form.Item label='Estimator Email'>
<Divider />
Appraiser Info
<Form.Item label={t("jobs.fields.est_co_nm")}>
{getFieldDecorator("est_co_nm", {
initialValue: job.est_co_nm
})(<Input name='est_co_nm' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.est_ct_fn")}>
{getFieldDecorator("est_ct_fn", {
initialValue: job.est_ct_fn
})(<Input name='est_ct_fn' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.est_ct_ln")}>
{getFieldDecorator("est_ct_ln", {
initialValue: job.est_ct_ln
})(<Input name='est_ct_ln' />)}
</Form.Item>
TODO: Field is pay date but title is inspection date. Likely incorrect?
<Form.Item label={t("jobs.fields.pay_date")}>
{getFieldDecorator("pay_date", {
initialValue: job.pay_date
})(<Input name='pay_date' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.est_ph1")}>
{getFieldDecorator("est_ph1", {
initialValue: job.est_ph1
})(<Input name='est_ph1' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.est_ea")}>
{getFieldDecorator("est_ea", {
initialValue: job.est_ea,
rules: [
@@ -90,12 +118,29 @@ export default function JobsDetailInsurance({ job }) {
message: "This is not a valid email address."
}
]
})(<Input name='est_ea' />)}
})(<FormItemEmail name='est_ea' email={getFieldValue("est_ea")} />)}
</Form.Item>
<Button>
<Icon type='mail' />
</Button>
<Form.Item label={t("jobs.fields.selling_dealer")}>
{getFieldDecorator("selling_dealer", {
initialValue: job.selling_dealer
})(<Input name='selling_dealer' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.servicing_dealer")}>
{getFieldDecorator("servicing_dealer", {
initialValue: job.servicing_dealer
})(<Input name='servicing_dealer' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.selling_dealer_contact")}>
{getFieldDecorator("selling_dealer_contact", {
initialValue: job.selling_dealer_contact
})(<Input name='selling_dealer_contact' />)}
</Form.Item>
<Form.Item label={t("jobs.fields.servicing_dealer_contact")}>
{getFieldDecorator("servicing_dealer_contact", {
initialValue: job.servicing_dealer_contact
})(<Input name='servicing_dealer_contact' />)}
</Form.Item>
TODO: Adding servicing/selling dealer contact info?
</div>
);
}