️ This Gitlab will be shut down at 2021-12-31 23:59:59.
Students and staff can migrate to gitlab.utwente.nl.
SNT members can migrate to gitlab.snt.utwente.nl.
Contact bestuur@snt.utwente.nl for more information.

Migrate your projects today!
Export your project using the webinterface or use a script.

Commit 07ee6672 authored by TJHeeringa's avatar TJHeeringa

Moved a lot of files into the new file structure v2

parent 6617fd68
14.8.0
\ No newline at end of file
14.18.1
import Button from "@material-ui/core/Button";
import PropTypes from "prop-types";
import React from "react";
const EventAgenda = ({ event, handleEventSelect }) => {
return (
<span>
<b>{ event.name }</b>
<p>{ event.description }</p>
<Button color={"primary"} onClick={()=>handleEventSelect(event)}>Read More</Button>
</span>
);
};
EventAgenda.propTypes = {
handleEventSelect: PropTypes.func.isRequired,
event: PropTypes.object.isRequired,
};
export default EventAgenda;
\ No newline at end of file
import PropTypes from "prop-types";
import React from "react";
const Event = ({ event }) => {
return (
<span>
<strong>{ event.name }</strong>
</span>
);
};
Event.propTypes = {
event: PropTypes.object.isRequired
};
export default Event;
\ No newline at end of file
......@@ -16,7 +16,7 @@ import { loremIpsum } from "react-lorem-ipsum";
import { useHistory } from "react-router-dom";
import Image from "../../../img/default_photo.jpg";
import Info from "../Info/Info";
import Info from "../../Forms/InfoForms/Info";
const useStyles = makeStyles(theme => ({
......
......@@ -10,7 +10,7 @@ import PropTypes from "prop-types";
import React from "react";
import Image from "../../../img/default_photo.jpg";
import Info from "../Info/Info";
import Info from "../../Forms/InfoForms/Info";
const useStyles = makeStyles(theme => ({
......
......@@ -5,7 +5,7 @@ import PropTypes from "prop-types";
import React from "react";
import {ValidatorComponent} from "react-material-ui-form-validator";
import useFieldStyles from "./fieldStyles";
import useFieldStyles from "../fieldStyles";
const useStyles = makeStyles(theme => ({
......
import TextField from "@material-ui/core/TextField";
import React from "react";
import useFieldStyles from "./fieldStyles";
import useFieldStyles from "../fieldStyles";
const FileField = (props) => {
......
......@@ -3,7 +3,7 @@ import TextField from "@material-ui/core/TextField";
import Autocomplete from "@material-ui/lab/Autocomplete";
import React, {useMemo} from "react";
import {useGetCurrentMembersByAssociationQuery} from "../../Store/services/members";
import {useGetCurrentMembersByAssociationQuery} from "../../../Store/services/members";
const useStyles = makeStyles({
option: {
......
......@@ -3,7 +3,7 @@ import MuiPhoneInput from "material-ui-phone-number";
import React from "react";
import { ValidatorComponent } from "react-form-validator-core";
import useFieldStyles from "./fieldStyles";
import useFieldStyles from "../fieldStyles";
const useStyles = makeStyles(theme => ({
......
......@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import React from "react";
import {SelectValidator} from "react-material-ui-form-validator";
import useFieldStyles from "./fieldStyles";
import useFieldStyles from "../fieldStyles";
const SelectField = ({name, children, value, ...remaining_props}) => {
......
......@@ -68,8 +68,6 @@ const SpecificDataField = (props) =>{
name={field.name}
value={parseInt(value)}
onChange={(event)=>onChange(field.url, event.target.value.toString())}
validators={["minNumber:0"]}
errorMessages={["This needs to be 0 or larger"]}
{...rest_props}
/>
);
......
......@@ -2,7 +2,7 @@ import PropTypes from "prop-types";
import React from "react";
import {TextValidator} from "react-material-ui-form-validator";
import useFieldStyles from "./fieldStyles";
import useFieldStyles from "../fieldStyles";
const TextField = ({name, value, ...remaining_props}) => {
const classes = useFieldStyles();
......@@ -20,9 +20,22 @@ const TextField = ({name, value, ...remaining_props}) => {
);
};
const TextFieldV2 = (props) => {
const classes = useFieldStyles();
return (
<TextValidator
variant={"outlined"}
className={classes.field}
containerProps={{className: classes.field}}
name={name}
{...props}
/>
);
};
TextField.propTypes = {
name: PropTypes.string.isRequired,
value: PropTypes.any
};
export { TextFieldV2 };
export default TextField;
\ No newline at end of file
......@@ -25,12 +25,12 @@ import PropTypes from "prop-types";
import React from "react";
import { ValidatorForm } from "react-material-ui-form-validator";
import DateField from "../Fields/DateField";
import FileField from "../Fields/FileField";
import FontAwesomeIconHolder from "../Fields/FontAwesomeIconHolder";
import IconHolder from "../Fields/IconHolder";
import TextField from "../Fields/TextField";
import Wrapper from "../Fields/Wrapper";
import DateField from "../FormComponents/Fields/DateField";
import FileField from "../FormComponents/Fields/FileField";
import TextField from "../FormComponents/Fields/TextField";
import FontAwesomeIconHolder from "../FormComponents/FontAwesomeIconHolder";
import IconHolder from "../FormComponents/IconHolder";
import Wrapper from "../FormComponents/Wrapper";
export const AssociationForm = ({ association, handleChange, onSubmit, onCancel }) => {
......
......@@ -7,9 +7,9 @@ import { ValidatorForm } from "react-material-ui-form-validator";
import { useAlertHandler } from "../../Contexts/AlertHandler";
import {useAPI} from "../../Contexts/API";
import IconHolder from "../Fields/IconHolder";
import TextField from "../Fields/TextField";
import Wrapper from "../Fields/Wrapper";
import TextField from "../FormComponents/Fields/TextField";
import IconHolder from "../FormComponents/IconHolder";
import Wrapper from "../FormComponents/Wrapper";
const EmailTemplateForm = ({ association, emailTemplate, onTemplateChange}) => {
......
......@@ -8,10 +8,10 @@ import {ValidatorForm} from "react-material-ui-form-validator";
import {useAlertHandler} from "../../Contexts/AlertHandler";
import {useAPI} from "../../Contexts/API";
import IconHolder from "../Fields/IconHolder";
import NumberField from "../Fields/NumberField";
import TextField from "../Fields/TextField";
import Wrapper from "../Fields/Wrapper";
import NumberField from "../FormComponents/Fields/NumberField";
import TextField from "../FormComponents/Fields/TextField";
import IconHolder from "../FormComponents/IconHolder";
import Wrapper from "../FormComponents/Wrapper";
const EnrollmentOptionForm = ({ enrollment_option: initEnrollmentOption, association, calendarEvent, update, onSucces, onCancel}) => {
const API = useAPI();
......
......@@ -15,12 +15,12 @@ import {useHistory} from "react-router-dom";
import { useAlertHandler } from "../../Contexts/AlertHandler";
import {useAPI} from "../../Contexts/API";
import {useGetEventTypesByAssociationQuery} from "../../Store/services/eventTypes";
import DateTimeField from "../Fields/DateTimeField";
import IconHolder from "../Fields/IconHolder";
import NumberField from "../Fields/NumberField";
import SelectField from "../Fields/SelectField";
import TextField from "../Fields/TextField";
import Wrapper from "../Fields/Wrapper";
import DateTimeField from "../FormComponents/Fields/DateTimeField";
import NumberField from "../FormComponents/Fields/NumberField";
import SelectField from "../FormComponents/Fields/SelectField";
import TextField from "../FormComponents/Fields/TextField";
import IconHolder from "../FormComponents/IconHolder";
import Wrapper from "../FormComponents/Wrapper";
export const EventForm = ({ association, event, handleEventChange, update, onSucces, onCancel}) => {
......
......@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import React from "react";
import { ValidatorForm } from "react-material-ui-form-validator";
import Wrapper from "../Fields/Wrapper";
import Wrapper from "../FormComponents/Wrapper";
export const GenericInfoFormForm = ({ Form, formObject, handleFormObjectChange, onSubmit, onCancel, allowDelete, submitButtonText }) => {
......
......@@ -3,7 +3,7 @@ import React from "react";
import { ValidatorForm } from "react-material-ui-form-validator";
import {useLocale} from "../../Contexts/Locale";
import SelectField from "../Fields/SelectField";
import SelectField from "../FormComponents/Fields/SelectField";
const LocaleSwitch = (props) => {
......
......@@ -13,12 +13,12 @@ import { ValidatorForm } from "react-material-ui-form-validator";
import { useAlertHandler } from "../../Contexts/AlertHandler";
import {useAPI} from "../../Contexts/API";
import BooleanField from "../Fields/BooleanField";
import IconHolder from "../Fields/IconHolder";
import NumberField from "../Fields/NumberField";
import TextField from "../Fields/TextField";
import Wrapper from "../Fields/Wrapper";
import YearlessDateField from "../Fields/YearlessDateField";
import BooleanField from "../FormComponents/Fields/BooleanField";
import NumberField from "../FormComponents/Fields/NumberField";
import TextField from "../FormComponents/Fields/TextField";
import YearlessDateField from "../FormComponents/Fields/YearlessDateField";
import IconHolder from "../FormComponents/IconHolder";
import Wrapper from "../FormComponents/Wrapper";
const MemberTypeForm = ({
......
......@@ -10,13 +10,13 @@ import { ValidatorForm } from "react-material-ui-form-validator";
import { useAlertHandler } from "../../Contexts/AlertHandler";
import {useAPI} from "../../Contexts/API";
import FileField from "../Fields/FileField";
import FontAwesomeIconHolder from "../Fields/FontAwesomeIconHolder";
import IconHolder from "../Fields/IconHolder";
import NumberField from "../Fields/NumberField";
import SelectField from "../Fields/SelectField";
import TextField from "../Fields/TextField";
import Wrapper from "../Fields/Wrapper";
import FileField from "../FormComponents/Fields/FileField";
import NumberField from "../FormComponents/Fields/NumberField";
import SelectField from "../FormComponents/Fields/SelectField";
import TextField from "../FormComponents/Fields/TextField";
import FontAwesomeIconHolder from "../FormComponents/FontAwesomeIconHolder";
import IconHolder from "../FormComponents/IconHolder";
import Wrapper from "../FormComponents/Wrapper";
const ProductForm = ({ association, product: propProduct, onProductChange, update}) => {
......
......@@ -9,12 +9,12 @@ import { ValidatorForm } from "react-material-ui-form-validator";
import { useAlertHandler} from "../../Contexts/AlertHandler";
import {useAPI} from "../../Contexts/API";
import { useGetStudiesQuery } from "../../Store/services/studies";
import CountryField, { countries } from "../Fields/CountryField";
import DateField from "../Fields/DateField";
import PhoneNumberField from "../Fields/PhoneNumberField";
import SelectField from "../Fields/SelectField";
import TextField from "../Fields/TextField";
import Wrapper from "../Fields/Wrapper";
import CountryField, { countries } from "../FormComponents/Fields/CountryField";
import DateField from "../FormComponents/Fields/DateField";
import PhoneNumberField from "../FormComponents/Fields/PhoneNumberField";
import SelectField from "../FormComponents/Fields/SelectField";
import TextField from "../FormComponents/Fields/TextField";
import Wrapper from "../FormComponents/Wrapper";
import Block from "../PageLayout/Content/Block";
import isIban from "../ValidatorRules/isIban";
import { Osiris } from "./Osiris";
......
......@@ -10,12 +10,12 @@ import { ValidatorForm } from "react-material-ui-form-validator";
import { useAlertHandler } from "../../Contexts/AlertHandler";
import {useAPI} from "../../Contexts/API";
import DateField from "../Fields/DateField";
import FontAwesomeIconHolder from "../Fields/FontAwesomeIconHolder";
import IconHolder from "../Fields/IconHolder";
import NumberField from "../Fields/NumberField";
import SelectField from "../Fields/SelectField";
import Wrapper from "../Fields/Wrapper";
import DateField from "../FormComponents/Fields/DateField";
import NumberField from "../FormComponents/Fields/NumberField";
import SelectField from "../FormComponents/Fields/SelectField";
import FontAwesomeIconHolder from "../FormComponents/FontAwesomeIconHolder";
import IconHolder from "../FormComponents/IconHolder";
import Wrapper from "../FormComponents/Wrapper";
const PurchaseForm = ({ association, purchase: propPurchase, onPurchaseChange}) => {
......
......@@ -12,11 +12,11 @@ import { ValidatorForm } from "react-material-ui-form-validator";
import { useAlertHandler } from "../../Contexts/AlertHandler";
import {useAPI} from "../../Contexts/API";
import IconHolder from "../Fields/IconHolder";
import SelectField from "../Fields/SelectField";
import SpecificDataField from "../Fields/SpecificDataField";
import TextField from "../Fields/TextField";
import Wrapper from "../Fields/Wrapper";
import SelectField from "../FormComponents/Fields/SelectField";
import SpecificDataField from "../FormComponents/Fields/SpecificDataField";
import TextField from "../FormComponents/Fields/TextField";
import IconHolder from "../FormComponents/IconHolder";
import Wrapper from "../FormComponents/Wrapper";
const SpecificDataFieldForm = ({ data_field: propDataField, association, onSuccess, onDelete, update}) => {
......
......@@ -6,10 +6,9 @@ import {ValidatorForm} from "react-material-ui-form-validator";
import {useAlertHandler} from "../../Contexts/AlertHandler";
import {useAPI} from "../../Contexts/API";
import {useDataFields} from "../../Contexts/Members";
import {useGetDataFieldsByAssociationQuery} from "../../Store/services/dataFields";
import SpecificDataField from "../Fields/SpecificDataField";
import Wrapper from "../Fields/Wrapper";
import SpecificDataField from "../FormComponents/Fields/SpecificDataField";
import Wrapper from "../FormComponents/Wrapper";
export const SpecificDataForm = ({ specificData: propSpecificData, association, membership, onUpdate, onCancel }) => {
......
......@@ -2,9 +2,9 @@ import React from "react";
import {useAlertHandler} from "../../Contexts/AlertHandler";
import {useAPI} from "../../Contexts/API";
import AssociationInfo from "../../Forms/InfoForms/Association/AssociationInfo";
import InfoForm from "../../Forms/InfoForms/InfoForm";
import AssociationForm from "../Forms/AssociationForm";
import AssociationInfo from "../Info/AssociationInfo";
import AssociationType from "../Types/Association";
const AssociationInfoWrapper = ({ info }) => <AssociationInfo association={info}/>;
......
import PropTypes from "prop-types";
import React, {useEffect, useState} from "react";
import EventInfo from "../../Forms/InfoForms/Event/EventInfo";
import {EventForm} from "../Forms/EventForm";
import EventInfo from "../Info/EventInfo";
const Event = ({association, event: propEvent, infoOrForm, ...props}) => {
......
import PropTypes from "prop-types";
import React, {useState} from "react";
import ProfileInfo from "../../Forms/InfoForms/Profile/ProfileInfo";
import ProfileForm from "../Forms/ProfileForm";
import ProfileInfo from "../Info/ProfileInfo";
export const Profile = ({profile: propProfile, infoOrForm, ...props}) => {
const [profile, setProfile] = useState(propProfile);
......
// Taken from https://github.com/DevExpress/devextreme-reactive/issues/3016
import * as React from "react";
import CircularProgress from "@material-ui/core/CircularProgress";
import { makeStyles } from "@material-ui/core/styles";
import * as React from "react";
const useStyles = makeStyles({
loadingShading: {
......@@ -21,13 +20,13 @@ const useStyles = makeStyles({
}
});
function Loading() {
const Loading = () => {
const classes = useStyles();
return (
<div className={classes.loadingShading}>
<CircularProgress className={classes.loadingIcon} />
</div>
);
}
};
export default Loading;
......@@ -3,7 +3,7 @@ import Button from "@material-ui/core/Button";
import PropTypes from "prop-types";
import React from "react";
import Wrapper from "../Fields/Wrapper";
import Wrapper from "../FormComponents/Wrapper";
const ConfirmationModal = ({ onConfirm, onCancel, title, description, open, cancelButtonText, confirmButtonText, secondaryAction, secondaryButtonText, size }) => {
return (
......
......@@ -10,7 +10,7 @@ import PropTypes from "prop-types";
import React from "react";
import {ValidatorForm} from "react-material-ui-form-validator";
import Wrapper from "../Fields/Wrapper";
import Wrapper from "../FormComponents/Wrapper";
const useStyles = makeStyles(theme => ({
......
......@@ -240,6 +240,8 @@ const CurrencyFormatter = ({ value }) => value?.toLocaleString("en-GB", { style:
const DateFormatter = ({ value }) => value ? moment(value).format("L") : "";
const DateTimeFormatter = ({ value }) => value ? moment(value).format("lll") : "";
// ****** Editors ******
const BooleanEditor = ({ value, onValueChange, disabled }) => {
......@@ -361,6 +363,15 @@ const DateTypeProvider = props => (
/>
);
const DateTimeTypeProvider = props => (
<DataTypeProvider
editorComponent={DateEditor}
formatterComponent={DateTimeFormatter}
availableFilterOperations={DateOperations}
{...props}
/>
);
const NumberTypeProvider = props => (
<DataTypeProvider
editorComponent={NumberEditor}
......@@ -372,7 +383,7 @@ const NumberTypeProvider = props => (
const ExtremeTable = ({ headers, rows, getRowId, defaultSorting, defaultFilters, defaultHiddenColumnNames,
pageSizes, showDetail, RowDetail, showSelect, showSelectAll, showEditing, showExporter, showGrouping,
showColumnBands, selectByRowClick, booleanColumns, choiceColumns, choiceSelectionOptions, currencyColumns,
showColumnBands, selectByRowClick, booleanColumns, choiceColumns, choiceSelectionOptions, currencyColumns, dateTimeColumns,
dateColumns, numberColumns, rowSelectionEnabledFilter, editingStateColumnExtensions, virtual, messages,
selection: {selection: selection, setSelection:setSelection}, allowAdd, allowDelete, allowEdit, onAdd, onDelete,
onEdit, showColumnChooser, showSearch, columnBands, custom_formatting_plugins, custom_state_controlling_plugins,
......@@ -571,6 +582,7 @@ const ExtremeTable = ({ headers, rows, getRowId, defaultSorting, defaultFilters,
<ChoiceTypeProvider for={choiceColumns} choiceSelectionOptions={choiceSelectionOptions}/>,
<CurrencyTypeProvider for={currencyColumns} />,
<DateTypeProvider for={dateColumns} />,
<DateTimeTypeProvider for={dateTimeColumns}/>,
<NumberTypeProvider for={numberColumns} />,
];
const state_controlling_plugins = [
......@@ -833,6 +845,7 @@ ExtremeTable.propTypes = {
currencyColumns: PropTypes.arrayOf(PropTypes.string),
/* List of column names that determines which columns need to rendered as dates */
dateColumns: PropTypes.arrayOf(PropTypes.string),
dateTimeColumns: PropTypes.arrayOf(PropTypes.string),
/* List of column names that determines which columns need to rendered as numbers */
numberColumns: PropTypes.arrayOf(PropTypes.string),
/* Function that decides whether rows should be selectable based on the current selection */
......@@ -884,6 +897,7 @@ ExtremeTable.defaultProps = {
choiceSelectionOptions: {},
currencyColumns: [],
dateColumns: [],
dateTimeColumns: [],
numberColumns: [],
rowSelectionEnabledFilter: (row, selection) => true,
selection: {selection: [], setSelection: ()=>{}},
......
const isBiggerThanOrBlank = {
name: "isBiggerThanOrBlank",
validate: (lowerBound) => (value) => value ? lowerBound <= value : true
};
export default isBiggerThanOrBlank;
\ No newline at end of file
......@@ -16,9 +16,10 @@ export function useLocale() {
}
const LocaleProvider = ({ children }) => {
const [locale, setLocale] = useState("en");
// TODO: look in navigator.languages and see if an imported language is available;
// if not set the locale to a default like "en" or "nl"
const [locale, setLocale] = useState(navigator.language);
moment.locale(locale);
console.log(locale);
const handleSetLocale = (locale) => {
moment.locale(locale);
......
import PropTypes from "prop-types";
import React from "react";
import DropDownFormContainer from "../dropDownForm";
import EnrollmentOptionsForm from "./EnrollmentOptionsForm";
const dropDownObjectToEnrollmentOptionsFormPropsMap = ({ formObject, handleFormObjectChange, ...rest_props}) =>
({ EnrollmentOption: formObject, handleEnrollmentOptionChange: handleFormObjectChange, ...rest_props});
const EnrollmentOptionToTitle = (EnrollmentOption) => EnrollmentOption.type;
const fieldAndValueToStateChanges = (field, value) => ({ [field]: value} );