Commit 99b5416a authored by TJHeeringa's avatar TJHeeringa

Updated AssociationForm

parent 3e3e23c9
......@@ -10,12 +10,10 @@ const useStyles = makeStyles(theme=>({
},
}));
const IconHolder = (props) => {
const IconHolder = ({ Icon, ...rest_props }) => {
const theme = useTheme();
const classes = useStyles(theme);
const { Icon, ...rest_props } = props;
return (
<Icon className={classes.icon} color={"action"} {...rest_props} />
);
......
import MenuItem from "@material-ui/core/MenuItem";
import makeStyles from "@material-ui/core/styles/makeStyles";
import useTheme from "@material-ui/core/styles/useTheme";
import { padStart } from "lodash";
import PropTypes from "prop-types";
import React from "react";
import MenuItem from "@material-ui/core/MenuItem";
import SelectField from "./SelectField";
import Wrapper from "./Wrapper";
import makeStyles from "@material-ui/core/styles/makeStyles";
import useTheme from "@material-ui/core/styles/useTheme";
const useStyles = makeStyles(theme=>({
}));
const YearlessDateField = (props) => {
const { value, onChange } = props;
const YearlessDateField = ({ value, onChange, name }) => {
const theme = useTheme();
const classes = useStyles(theme);
......@@ -49,12 +47,12 @@ const YearlessDateField = (props) => {
return (
<>
<SelectField
name={"Start date - month"}
name={name + " - month"}
validators={["required"]}
errorMessages={["A type has to be set"]}
value={value.split("-")[0]}
onChange={(event) => {
onChange("start_date", event.target.value + "-" + value.split("-")[1]);
onChange(event.target.value + "-" + value.split("-")[1]);
}}
>
<MenuItem value={"01"}>January</MenuItem>
......@@ -71,12 +69,12 @@ const YearlessDateField = (props) => {
<MenuItem value={"12"}>December</MenuItem>
</SelectField>
<SelectField
name={"Start date - day"}
name={name + " - day"}
validators={["required"]}
errorMessages={["A type has to be set"]}
value={value.split("-")[1]}
onChange={(event) => {
onChange("start_date", value.split("-")[0] + "-" + event.target.value);
onChange(value.split("-")[0] + "-" + event.target.value);
}}
>
{ [...Array(monthToNumberOfDays[value.split("-")[0]]).keys()].map((day, id) =>
......@@ -88,6 +86,7 @@ const YearlessDateField = (props) => {
};
YearlessDateField.propTypes = {
name: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired
};
......
import Container from "@material-ui/core/Container";
import Typography from "@material-ui/core/Typography";
import { AssociationInfoForm } from "App/Components/Forms/AssociationInfoForm";
import { AssociationForm } from "App/Components/Forms/AssociationForm";
import { AssociationInfo } from "App/Components/Info/AssociationInfo";
import { Helper } from "App/Helper";
import React, { Component } from "react";
......@@ -61,7 +61,7 @@ export class AssociationInfoScreen extends Component {
<hr className={"box-title-separator"}/>
{ this.state.form_type === "form"
?
<AssociationInfoForm
<AssociationForm
association={this.state.association}
handleAssociationChange={(association)=>this.setState({association: association})}
/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment