Commit 5c768165 authored by TJHeeringa's avatar TJHeeringa

Massive Project Structure changes and Added Matches

parent 35f49f71
......@@ -4058,9 +4058,9 @@
}
},
"clsx": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz",
"integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA=="
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz",
"integrity": "sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA=="
},
"cmd-shim": {
"version": "3.0.3",
......@@ -15215,7 +15215,8 @@
"dependencies": {
"minimist": {
"version": "1.2.0",
"resolved": ""
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
}
}
},
import React, { Component } from 'react'
import { Main } from './Main/Main'
import { AuthenticationContext} from "./Contexts/Authentication";
import { Routing } from './Routing/Routing'
import { AuthenticationContext } from "./Contexts/Authentication";
import { PageLayoutContext } from "./Contexts/PageLayout";
import { library } from '@fortawesome/fontawesome-svg-core'
import {faBars,faCheck,faHome,faIgloo,faPlus,faSignOutAlt,faTimes,faUser,faChevronLeft} from '@fortawesome/free-solid-svg-icons'
import { createMuiTheme, ThemeProvider, MuiThemeProvider } from '@material-ui/core/styles';
import '@devexpress/dx-react-grid-bootstrap4/dist/dx-react-grid-bootstrap4.css'
import '@icon/open-iconic/open-iconic.css'
import PublicPageLayout from "./Components/PageLayout/PublicPageLayout";
import { BrowserRouter as Router, Route, } from "react-router-dom"
require('bootstrap');
library.add(faSignOutAlt, faUser, faIgloo, faBars, faCheck, faTimes, faHome, faPlus, faChevronLeft);
const theme_dark = createMuiTheme({
palette: {
type: "dark",
}
});
const theme_light = createMuiTheme();
class App extends Component {
constructor(props){
super(props);
const login = () => this.setState({});
const logout = ()=> this.setState({});
const login = () => this.setState({authentication:{}});
const logout = ()=> this.setState({authentication:{}});
const setLayout = (component)=> this.setState({pagelayout: {component:component}});
this.state = {authentication: {
authenticated: false,
login: login,
logout: logout
}}
this.state = {
authentication: {
authenticated: false,
login: login,
logout: logout
},
pagelayout: {
component: PublicPageLayout,
setLayout: setLayout
}
}
}
render() {
const PageLayout = this.state.pagelayout.component;
return (
<div className="App">
<AuthenticationContext.Provider value={this.state.authentication}>
<Main/>
<MuiThemeProvider theme={theme_light}>
<PageLayoutContext.Provider value={this.state.pagelayout}>
<Routing/>
</PageLayoutContext.Provider>
</MuiThemeProvider>
</AuthenticationContext.Provider>
</div>
);
......
......@@ -18,6 +18,13 @@ export class AssociationInfo extends Component {
"Phone number": association.phone_number,
"Email": association.email
};
data["Legal"] = {
"Articles of Association": <a href={"articles_of_association"}>Articles of Association</a>,
"Bylaws": <a href={"bylaws"}>Bylaws</a>,
"Privacy Statement": <a href={"privacy_statements"}>Privacy Statement</a>,
"Terms of Service": <a href={"terms_of_service"}>Terms of Service</a>
};
return data
};
......
......@@ -6,7 +6,7 @@ import "react-datepicker/dist/react-datepicker.css";
import 'App/Components/DatePicker.css'
import { Helper } from "App/Helper";
import {AlertHandlerContext} from "../../Contexts/AlertHandler";
import {Authorized} from "../../Main/Authorized/Authorized";
import {Authorized} from "../../Routing/Authenticated/Authorized";
export class AssociationInfoForm extends Component {
......
.FormGroup{
width: 25%;
}
\ No newline at end of file
import React, { Component } from 'react'
import { Button, FormGroup} from "reactstrap";
import { AvForm, AvInput, AvField } from "availity-reactstrap-validation";
import { Row, Col } from 'reactstrap'
import { Helper } from "App/Helper";
import NumericInput from 'react-numeric-input';
import { v4 as uuidv4 } from 'uuid';
import {AlertHandlerContext} from "../../Contexts/AlertHandler";
export class AssociationMembertypeForm extends Component {
constructor(props) {
super(props);
let { membertype } = this.props;
if (membertype === undefined) {
membertype = {
type: '',
only_chooseable_by_board: false,
membership_fee: 0,
association: this.props.association.url
};
}
this.state = {membertype: membertype};
}
resetState = () => {
let membertype = {
type: '',
only_chooseable_by_board: false,
membership_fee: 0,
association: this.props.association.url
};
this.setState({membertype: membertype})
};
handleValidSubmit = (event, values) => {
const {onAdd} = this.props;
console.log(values);
let membertype = this.state.membertype;
if (onAdd !== undefined) {
this.postMembertype(membertype)
} else {
this.putMembertype(membertype);
}
};
putMembertype(membertype){
return Helper.api_call(membertype.url, "PUT", membertype, 'json',
()=>{this.context.handleAlertHandler('green', 'Save successful')},
()=>{this.context.handleAlertHandler('red', 'Save failed')},
);
};
postMembertype(membertype){
return Helper.api_call(process.env.REACT_APP_API_URL + "/membertypes", "POST", membertype, 'json',
()=>{
this.props.onAdd();
this.resetState();
this.context.handleAlertHandler('green', 'Save successful')},
()=>{this.context.handleAlertHandler('red', 'Save failed')},
);
};
handleDataChange = (field, value) => {
this.setState(prevState => {
let membertype = prevState.membertype;
membertype[field] = value;
return {membertype: membertype}
});
};
render() {
const { onAdd } = this.props;
return (
<AvForm id="associationsettingsform" onValidSubmit={this.handleValidSubmit} ref={c => (this.form = c)}>
<Row>
<Col lg="3">
<FormGroup className="FormGroup">
<AvInput
type="text"
name="type"
value={this.state.membertype.type}
onChange={(event)=>{this.handleDataChange('type',event.target.value)}}
/>
</FormGroup>
</Col>
<Col lg="3">
<FormGroup className="FormGroup">
<AvField
type="select"
name="only_chooseable_by_board"
value={this.state.membertype.only_chooseable_by_board.toString()}
onChange={(event)=>{this.handleDataChange('only_chooseable_by_board', event.target.value)}}
>
<option key={uuidv4()} value="true">Yes</option>
<option key={uuidv4()} value="false">No</option>
</AvField>
</FormGroup>
</Col>
<Col lg="3">
<NumericInput
precision={2}
step={0.01}
value={this.state.membertype.membership_fee}
onChange={(fee)=>{this.handleDataChange('membership_fee', fee)}}
/>
</Col>
<Col lg="1">
{onAdd !== undefined ?
<Button className="acceptbutton" color='primary'>Add</Button>
:
<Button className="acceptbutton" color='success'>Save</Button>
}
</Col>
<Col lg="1">
{onAdd === undefined &&
<Button className="acceptbutton" onClick={()=>{}}>Delete</Button>
}
</Col>
</Row>
</AvForm>
)
}
}
AssociationMembertypeForm.contextType = AlertHandlerContext;
\ No newline at end of file
.FormGroup{
width: 25%;
}
\ No newline at end of file
import React, { Component } from 'react'
import { Button, FormGroup } from "reactstrap";
import { AvForm, AvInput, AvField } from "availity-reactstrap-validation";
import { Row, Col } from 'reactstrap'
import { v4 as uuidv4 } from 'uuid';
import { Helper } from "App/Helper";
import {AlertHandlerContext} from "../../Contexts/AlertHandler";
import {Authorized} from "../../Main/Authorized/Authorized";
export class AssociationSpecificDataFieldForm extends Component {
constructor(props) {
super(props);
let { association_specific_data_field } = this.props;
if (association_specific_data_field === undefined) {
association_specific_data_field = {
name: '',
type: "Boolean",
choices: '',
mandatory: false,
board_only: false,
default: ''
};
}
association_specific_data_field['board_only'] = false;
this.state = {association_specific_data_field: association_specific_data_field};
}
handleDataChange = (field, value) => {
this.setState(prevState => {
let association_specific_data_field = prevState.association_specific_data_field;
association_specific_data_field[field] = value;
if (field === 'type'){
association_specific_data_field['default'] = null;
}
return {association_specific_data_field: association_specific_data_field}
});
};
resetState = () => {
let association_specific_data_field = {
name: '',
type: "Boolean",
choices: '',
mandatory: false,
board_only: false,
default: ''
};
this.setState({association_specific_data_field: association_specific_data_field})
};
typeValueToTypeOption = (value) => {
const type_dict = {
'Boolean': 'Yes/No',
'String': 'Text',
'Number': 'Number',
'Choice': 'Choice'
};
return type_dict[value];
};
typeOptionToTypeValue = (option) => {
const type_dict = {
'Yes/No': 'Boolean',
'Text': 'String',
'Number': 'Number',
'Choice': 'Choice'
};
return type_dict[option];
};
typeValueToFormType = (option) => {
const type_dict = {
'Boolean': 'select',
'String': 'Text',
'Number': 'number',
'Choice': 'select'
};
return type_dict[option]
};
handleValidSubmit = (event, values) => {
const {onAdd} = this.props;
let specific_data_field = this.state.association_specific_data_field;
specific_data_field.default = specific_data_field.default.toString();
if (onAdd !== undefined) {
specific_data_field.association = this.props.association.url;
this.postSpecificDataFieldSettings(specific_data_field)
} else {
this.putSpecificDataFieldSettings(specific_data_field);
}
};
putSpecificDataFieldSettings(specific_data_field){
return Helper.api_call(specific_data_field.url, "PUT", specific_data_field, 'json',
()=>{this.context.handleAlertHandler('green', 'Save successful')},
()=>{this.context.handleAlertHandler('red', 'Save failed')}
);
};
postSpecificDataFieldSettings(specific_data_field){
return Helper.api_call(process.env.REACT_APP_API_URL + "/association_data_fields", "POST", specific_data_field, 'json',
()=> {
this.props.onAdd();
this.resetState();
this.context.handleAlertHandler('green', 'Save successful')},
()=>{this.context.handleAlertHandler('red', 'Save failed')},
);
};
render() {
const {onAdd} = this.props;
return (
<AvForm id="associationsettingsform" onValidSubmit={this.handleValidSubmit} ref={c => (this.form = c)}>
<Row>
<Col xs="15" sm="2">
<FormGroup className="FormGroup">
<AvInput
type="text"
name="name"
value={this.state.association_specific_data_field.name}
onChange={(event)=>this.handleDataChange('name', event.target.value)}
required
/>
</FormGroup>
</Col>
<Col xs="15" sm="1">
<FormGroup className="FormGroup">
<AvField
type="select"
name="type"
value={this.typeValueToTypeOption(this.state.association_specific_data_field.type)}
onChange={(event)=>this.handleDataChange('type', this.typeOptionToTypeValue(event.target.value))}
required
disabled={onAdd === undefined}
>
<option>Text</option>
<option>Number</option>
<option>Choice</option>
<option>Yes/No</option>
</AvField>
</FormGroup>
</Col>
<Col xs="15" sm="2">
{this.state.association_specific_data_field.type === "Choice" &&
<FormGroup className="FormGroup">
<AvField
type="text"
name="choices"
placeholder="pizza,pancakes,pie"
value={this.state.association_specific_data_field.choices}
onChange={(event)=>this.handleDataChange('choices', event.target.value)}
disabled={onAdd === undefined}
/>
</FormGroup>
}
</Col>
<Col xs="15" sm="1">
{this.state.association_specific_data_field.type === "Boolean" &&
<AvField
type="select"
name="mandatory"
value={this.state.association_specific_data_field.mandatory.toString()}
onChange={(event)=>{
this.handleDataChange('mandatory', event.target.value);
if(event.target.value === "true"){
this.handleDataChange('board_only', "false");
this.handleDataChange('default', "No");
}
}}
disabled={onAdd === undefined}
>
<option key={uuidv4()} value="true">Yes</option>
<option key={uuidv4()} value="false">No</option>
</AvField>
}
</Col>
<Col xs="15" sm="1">
{this.state.association_specific_data_field.mandatory === "true" ||
<AvField
type="select"
name="board_only"
value={this.state.association_specific_data_field.board_only.toString()}
onChange={(event) => this.handleDataChange('board_only', event.target.value)}
>
<option key={uuidv4()} value="true">Yes</option>
<option key={uuidv4()} value="false">No</option>
</AvField>
}
</Col>
<Col xs="15" sm="1">
{this.state.association_specific_data_field.mandatory === "true" ||
<FormGroup className="FormGroup">
{this.state.association_specific_data_field.type === "Choice"
?
<AvField
type={this.typeValueToFormType(this.state.association_specific_data_field.type)}
name="default"
placeholder=""
value={this.state.association_specific_data_field.default}
onChange={(event) => this.handleDataChange('default', event.target.value)}
>
{/*{this.state.association_specific_data_field.mandatory && <option key={uuid.v4()} value={null}></option>}*/}
{this.state.association_specific_data_field.choices.split(',').map((choice) => {
return <option key={uuidv4()} value={choice}>{choice}</option>
})}
</AvField>
: this.state.association_specific_data_field.type === "Boolean"
?
<AvField
type={this.typeValueToFormType(this.state.association_specific_data_field.type)}
name="default"
placeholder=""
value={this.state.association_specific_data_field.default}
onChange={(event) => this.handleDataChange('default', event.target.value)}
>
<option key={uuidv4()} value="true">Yes</option>
<option key={uuidv4()} value="false">No</option>
</AvField>
:
<AvField
type={this.typeValueToFormType(this.state.association_specific_data_field.type)}
name="default"
placeholder=""
value={this.state.association_specific_data_field.default}
onChange={(event) => this.handleDataChange('default',
this.state.association_specific_data_field.type === 'Boolean' ? event.target.checked : event.target.value)}
/>
}
</FormGroup>
}
</Col>
<Col xs="15" sm="0">
{onAdd !== undefined ?
<Button className="acceptbutton" color='primary'>Add</Button>
:
<Button className="acceptbutton" color='success'>Save</Button>
}
</Col>
<Col xs="15" sm="1">
{onAdd === undefined &&
<Button className="acceptbutton" onClick={()=>{}}>Delete</Button>
}
</Col>
</Row>
</AvForm>
)
}
}
AssociationSpecificDataFieldForm.contextType = AlertHandlerContext;
\ No newline at end of file
......@@ -5,7 +5,6 @@ import {Button, Col, FormGroup, Row} from "reactstrap";
import {Helper} from "App/Helper";
import { v4 as uuidv4 } from 'uuid';
import {AlertHandlerContext} from "../../Contexts/AlertHandler";
import {Authorized} from "../../Main/Authorized/Authorized";
export class AssociationSpecificDataForm extends Component {
......
import React from 'react';
import GroupCard from './GroupCard'
import GroupCardV2 from './GroupCardV2'
const DummyGroupCard = () => {
return <GroupCard
return <GroupCardV2
title={'www.com'}
description={'We are going to learn different kinds of species in nature that live together to form amazing environment.'}
photo={'https://image.freepik.com/free-photo/river-foggy-mountains-landscape_1204-511.jpg'}
......
import React from 'react';
import cx from 'clsx';
import { makeStyles, useTheme } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardMedia from '@material-ui/core/CardMedia';
import CardContent from '@material-ui/core/CardContent';
import Button from '@material-ui/core/Button';
import TextInfoContent from '@mui-treasury/components/content/textInfo';
import { useBlogTextInfoContentStyles } from '@mui-treasury/styles/textInfoContent/blog';