Commit 179b6417 authored by TJHeeringa's avatar TJHeeringa

Minor fixes; creation of dummy Rented page

parent 126703fc
......@@ -19,7 +19,7 @@ import NumberField from "../Fields/NumberField";
import SelectField from "../Fields/SelectField";
const ProductForm = ({ association, product: propProduct, onProductChange}) => {
const ProductForm = ({ association, product: propProduct, onProductChange, update}) => {
const API = useAPI();
const alertHandler = useAlertHandler();
......
......@@ -2,6 +2,7 @@ import {MenuItem} from "@material-ui/core";
import Button from "@material-ui/core/Button";
import AccessTimeIcon from "@material-ui/icons/AccessTime";
import EuroIcon from "@material-ui/icons/Euro";
import PersonIcon from "@material-ui/icons/Person";
import TodayIcon from "@material-ui/icons/Today";
import IconHolder from "App/Components/Fields/IconHolder";
import Wrapper from "App/Components/Fields/Wrapper";
......@@ -51,6 +52,16 @@ const PurchaseForm = ({ association, purchase: propPurchase, onPurchaseChange})
onSubmit={handleSubmit}
onError={errors => console.log(errors)}
>
<Wrapper>
<IconHolder Icon={PersonIcon}/>
<SelectField
name={"member"}
value={purchase.profile}
onChange={(event)=>handlePurchaseChange("profile",event.target.value)}
>
<MenuItem value={"1234"}>John Doe</MenuItem>
</SelectField>
</Wrapper>
<Wrapper>
<FontAwesomeIconHolder icon={["fas", "cookie-bite"]}/>
<SelectField
......@@ -118,6 +129,7 @@ PurchaseForm.propTypes = {
association: PropTypes.object.isRequired,
onPurchaseChange: PropTypes.func.isRequired,
purchase: PropTypes.shape({
profile: PropTypes.string,
product: PropTypes.string,
amount: PropTypes.string,
price: PropTypes.string,
......
import Container from "@material-ui/core/Container";
import List from "@material-ui/core/List";
import Typography from "@material-ui/core/Typography";
import {capitalCase} from "change-case";
import PropTypes from "prop-types";
import React, {useEffect, useState} from "react";
import CollapsableList from "../../../Components/Lists/CollapsableList";
import ProductForm from "../../../Components/Forms/ProductForm";
import CollapsableListItem from "../../../Components/Lists/CollapsableListItem";
import Block from "../../../Components/PageLayout/Content/Block";
import {useAPI} from "../../../Contexts/API";
import {useAlertHandler} from "../../../Contexts/AlertHandler";
import ProductForm from "../../../Components/Forms/ProductForm";
import {useAPI} from "../../../Contexts/API";
import Divider from "@material-ui/core/Divider";
import CollapsableList from "../../../Components/Lists/CollapsableList";
const Products = ({ association }) => {
const API = useAPI();
const alerthandler = useAlertHandler();
const product = {
const products = [{
name: "Misc",
thumbnail: null,
type: "purchasable",
rental_period: 30,
price_fixed: true,
price: 0
};
}];
const onProductChange = () => {};
......@@ -31,14 +34,30 @@ const Products = ({ association }) => {
<Block>
<Typography variant={"h5"}>Products</Typography>
<hr className={"box-title-separator"}/>
<CollapsableList
component={ProductForm}
listItemText={"Misc"}
association={association}
product={product}
onProductChange={onProductChange}
/>
<List>
{ products.map((product, id)=>(
<CollapsableListItem
key={id}
component={ProductForm}
listItemText={product.name}
association={association}
product={product}
onProductChange={onProductChange}
// onSuccess={updateAssociationSpecificDataField}
// onDelete={deleteAssociationSpecificDataField}
/>
)) }
&nbsp;
<Divider/>
&nbsp;
<CollapsableListItem
component={ProductForm}
listItemText={"New"}
association={association}
onProductChange={onProductChange}
product={{}}
/>
</List>
</Block>
</Container>
);
......
import Button from "@material-ui/core/Button";
import Container from "@material-ui/core/Container";
import Typography from "@material-ui/core/Typography";
import {capitalCase} from "change-case";
import PropTypes from "prop-types";
import React, {useEffect, useState} from "react";
import Wrapper from "../../../Components/Fields/Wrapper";
import PurchaseForm from "../../../Components/Forms/PurchaseForm";
import CollapsableList from "../../../Components/Lists/CollapsableList";
import Block from "../../../Components/PageLayout/Content/Block";
import {useAPI} from "../../../Contexts/API";
import {useAlertHandler} from "../../../Contexts/AlertHandler";
import PurchaseForm from "../../../Components/Forms/PurchaseForm";
import ExtremeTable from "../../../Components/Tables/ExtremeTable";
import {useAlertHandler} from "../../../Contexts/AlertHandler";
import {useAPI} from "../../../Contexts/API";
const Purchases = ({ association }) => {
......@@ -17,6 +19,7 @@ const Purchases = ({ association }) => {
const alerthandler = useAlertHandler();
const purchase = {
profile: "John Doe",
product: "misc",
amount: 30,
price: 0,
......@@ -24,6 +27,7 @@ const Purchases = ({ association }) => {
archive: false
};
const purchases = Array.from({length: 100}, (_, i) => ({...purchase, id: i}));
const headers = [{name: "profile", title: "member"}, {name: "product"}, {name: "price"}, {name: "amount"}, {name: "purchase_date"}];
const onPurchaseChange = () => {};
return (
......@@ -31,6 +35,7 @@ const Purchases = ({ association }) => {
<Block>
<Typography variant={"h5"}>Purchases</Typography>
<hr className={"box-title-separator"}/>
// TODO: make this appear in a model when clicking &quot;New&quot; in the table below.
<CollapsableList
component={PurchaseForm}
listItemText={"Misc"}
......@@ -40,8 +45,12 @@ const Purchases = ({ association }) => {
/>
</Block>
<Block>
<Wrapper>
<Typography variant={"h5"}>Purchases</Typography>
<Button variant={"outlined"} color={"secondary"}>Import</Button>
</Wrapper>
<ExtremeTable
headers={[{name: "product"}, {name: "price"}, {name: "amount"}, {name: "purchase_date"}]}
headers={headers}
rows={purchases}
showSelect={false}
showEditing={true}
......
import Container from "@material-ui/core/Container";
import Typography from "@material-ui/core/Typography";
import React from "react";
import Block from "../../../Components/PageLayout/Content/Block";
const Rented = () => {
return (
<Container>
<Block>
<Typography variant={"h5"}>Rented</Typography>
<hr className={"box-title-separator"}/>
<Typography>
Want to use this? Please help us figure out a proper design.
</Typography>
</Block>
</Container>
);
};
export default Rented;
\ No newline at end of file
......@@ -24,6 +24,7 @@ import FinancialSettings from "../../../Pages/Financial/Settings";
import {GroupsRouter} from "../../../Pages/Groups/Board/GroupRouter";
import News from "../../../Pages/Association/News";
import Products from "../../../Pages/Inventory/Products/Products";
import Rented from "../../../Pages/Inventory/Rented/Rented";
import Purchases from "../../../Pages/Inventory/Purchases/Purchases";
import Members from "../../../Contexts/Members";
......@@ -184,6 +185,11 @@ const BoardMemberRoutes = (props) => {
association={association}
/>
</Route>
<Route path={path+"/inventory/rented"}>
<Rented
association={association}
/>
</Route>
{ /*Default route*/ }
<Route exact path={path}>
......
......@@ -101,7 +101,7 @@ const MemberRoutes = (props) => {
/>
}
/>
<Route>
<Route path={path + "/financial"}>
<MemberOverview
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