In Progress work for Jobs Form.

This commit is contained in:
Patrick Fic
2019-12-12 15:43:03 -08:00
parent bca375251e
commit d0244e0767
16 changed files with 553 additions and 257 deletions

View File

@@ -0,0 +1,49 @@
import React, { useState } from "react";
import AlertComponent from "../alert/alert.component";
import { Form, Icon, Input, Row, Col } from "antd";
function JobTombstone({ job, ...otherProps }) {
const [jobContext, setJobContext] = useState(job);
if (!job) {
return (
<AlertComponent
message="This job does not exist or you do not have access to it."
type="error"
/>
);
}
const handleSubmit = e => {
e.preventDefault();
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
console.log("Received values of form: ", values);
}
});
};
const handleChange = event => {
const { name, value } = event.target;
setJobContext({ ...jobContext, [name]: value });
console.log("jobContext", jobContext);
};
console.log("#DEBUG", job);
const { getFieldDecorator } = otherProps.form;
return (
<Form onSubmit={handleSubmit}>
<Col span={22} offset={1}>
<Row>
<Form.Item label="RO #">
{getFieldDecorator("ro_number", {
initialValue: jobContext.ro_number
})(<Input name="ro_number" onChange={handleChange} />)}
</Form.Item>
</Row>
</Col>
</Form>
);
}
export default Form.create({ name: "JobTombstone" })(JobTombstone);