107 lines
4.0 KiB
JavaScript
107 lines
4.0 KiB
JavaScript
import { Button, Col, Form, Input, Row, Switch } from "antd";
|
|
import React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import FormItemEmail from "../form-items-formatted/email-form-item.component";
|
|
import FormItemPhone from "../form-items-formatted/phone-form-item.component";
|
|
import ResetForm from "../form-items-formatted/reset-form-item.component";
|
|
|
|
export default function OwnerDetailFormComponent({ form, owner }) {
|
|
const { t } = useTranslation();
|
|
const {
|
|
isFieldsTouched,
|
|
resetFields,
|
|
getFieldDecorator,
|
|
getFieldValue
|
|
} = form;
|
|
|
|
return (
|
|
<div>
|
|
{isFieldsTouched() ? <ResetForm resetFields={resetFields} /> : null}
|
|
<Button type="primary" key="submit" htmlType="submit">
|
|
{t("general.labels.save")}
|
|
</Button>
|
|
<Row>
|
|
<Col span={8}>
|
|
<Form.Item label={t("owners.fields.ownr_ln")}>
|
|
{getFieldDecorator("ownr_ln", {
|
|
initialValue: owner.ownr_ln
|
|
})(<Input name="ownr_ln" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("owners.fields.ownr_fn")}>
|
|
{getFieldDecorator("ownr_fn", {
|
|
initialValue: owner.ownr_fn
|
|
})(<Input name="ownr_fn" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("owners.fields.allow_text_message")}>
|
|
{getFieldDecorator("allow_text_message", {
|
|
initialValue: owner.allow_text_message,
|
|
valuePropName: "checked"
|
|
})(<Switch name="allow_text_message" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("owners.fields.ownr_addr1")}>
|
|
{getFieldDecorator("ownr_addr1", {
|
|
initialValue: owner.ownr_addr1
|
|
})(<Input name="ownr_addr1" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("owners.fields.ownr_addr2")}>
|
|
{getFieldDecorator("ownr_addr2", {
|
|
initialValue: owner.ownr_addr2
|
|
})(<Input name="ownr_addr2" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("owners.fields.ownr_city")}>
|
|
{getFieldDecorator("ownr_city", {
|
|
initialValue: owner.ownr_city
|
|
})(<Input name="ownr_city" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("owners.fields.ownr_ctry")}>
|
|
{getFieldDecorator("ownr_ctry", {
|
|
initialValue: owner.ownr_ctry
|
|
})(<Input name="ownr_ctry" />)}
|
|
</Form.Item>
|
|
</Col>
|
|
<Col span={8}>
|
|
{" "}
|
|
<Form.Item label={t("owners.fields.ownr_ea")}>
|
|
{getFieldDecorator("ownr_ea", {
|
|
initialValue: owner.ownr_ea,
|
|
rules: [
|
|
{
|
|
type: "email",
|
|
message: "This is not a valid email address."
|
|
}
|
|
]
|
|
})(
|
|
<FormItemEmail name="ownr_ea" email={getFieldValue("ownr_ea")} />
|
|
)}
|
|
</Form.Item>
|
|
<Form.Item label={t("owners.fields.ownr_ph1")}>
|
|
{getFieldDecorator("ownr_ph1", {
|
|
initialValue: owner.ownr_ph1
|
|
})(<FormItemPhone customInput={Input} name="ownr_ph1" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("owners.fields.ownr_st")}>
|
|
{getFieldDecorator("ownr_st", {
|
|
initialValue: owner.ownr_st
|
|
})(<Input name="ownr_st" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("owners.fields.ownr_zip")}>
|
|
{getFieldDecorator("ownr_zip", {
|
|
initialValue: owner.ownr_zip
|
|
})(<Input name="ownr_zip" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("owners.fields.preferred_contact")}>
|
|
{getFieldDecorator("preferred_contact", {
|
|
initialValue: owner.preferred_contact
|
|
})(<Input name="preferred_contact" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("owners.fields.ownr_title")}>
|
|
{getFieldDecorator("ownr_title", {
|
|
initialValue: owner.ownr_title
|
|
})(<Input name="ownr_title" />)}
|
|
</Form.Item>
|
|
</Col>
|
|
</Row>
|
|
</div>
|
|
);
|
|
}
|