In Progress work for Jobs Form.
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user