From b5599806bf34a648bfaed4e7b87d4681011efb19 Mon Sep 17 00:00:00 2001 From: "D. Alvarado" Date: Fri, 22 May 2020 13:56:53 -0500 Subject: [PATCH 01/14] Added funded line, ability to edit groups, and fixed what was ailing volunteer selection. --- .../component/AddressInput/AddressInput.jsx | 13 ++- src/app/component/UsersAutocomplete.jsx | 63 +++++++------- src/app/dashboard/Missions/DetailsView.jsx | 27 +----- src/app/dashboard/Missions/ListView.jsx | 1 + .../dashboard/Missions/MissionEditView.jsx | 82 ++++++++++--------- .../Missions/MissionFundedStatusRow.jsx | 44 ++++++++++ .../Missions/component/AddToGroupPopover.jsx | 54 +----------- .../Missions/component/GroupAutoComplete.jsx | 63 ++++++++++++++ 8 files changed, 201 insertions(+), 146 deletions(-) create mode 100644 src/app/dashboard/Missions/MissionFundedStatusRow.jsx create mode 100644 src/app/dashboard/Missions/component/GroupAutoComplete.jsx diff --git a/src/app/component/AddressInput/AddressInput.jsx b/src/app/component/AddressInput/AddressInput.jsx index b1f7bf2c..c0243045 100644 --- a/src/app/component/AddressInput/AddressInput.jsx +++ b/src/app/component/AddressInput/AddressInput.jsx @@ -22,7 +22,17 @@ const useStyles = makeStyles((theme) => ({ const AddressInput = (props) => { const classes = useStyles(); - const { disabled, error, location, onClear, placeholder, setLocation, showMap, value } = props; + const { + disabled, + error, + id, + location, + onClear, + placeholder, + setLocation, + showMap, + value, + } = props; const [zoom, setZoom] = useState(0); const [position, setPosition] = useState([0, 0]); @@ -107,6 +117,7 @@ const AddressInput = (props) => { ) : ( ({ root: { @@ -31,39 +32,43 @@ const SearchUsers = ({ editable, handleChange, selected, users }) => { }; const options = users?.reduce(reducer, []) || []; const optionSelected = options.find((option) => option && selected && option.id === selected.id); - const defaultValue = editable ? optionSelected : ""; - const value = !editable ? optionSelected : ""; + const defaultValue = editable ? optionSelected : null; return ( - user.searchString} - onChange={(event, newValue) => handleChange(newValue)} - value={value} - defaultValue={defaultValue} - renderInput={(params) => ( - + {editable ? ( + user.searchString} + onChange={(event, newValue) => handleChange(newValue)} + defaultValue={defaultValue} + renderInput={(params) => ( + + )} + renderOption={(user) => ( + + + + {user.displayName} + {user.phoneNumber} + + + )} /> + ) : ( +
{selected.displayName + " " + selected.phoneNumber}
)} - renderOption={(user) => ( - - - - {user.displayName} - {user.phoneNumber} - - - )} - /> + ); }; diff --git a/src/app/dashboard/Missions/DetailsView.jsx b/src/app/dashboard/Missions/DetailsView.jsx index 541a37f7..89c0fb34 100644 --- a/src/app/dashboard/Missions/DetailsView.jsx +++ b/src/app/dashboard/Missions/DetailsView.jsx @@ -2,7 +2,6 @@ import { Box, Container, Grid, Paper } from "@material-ui/core"; import { makeStyles } from "@material-ui/core/styles"; import AccessTimeIcon from "@material-ui/icons/AccessTime"; import ArrowBackIcon from "@material-ui/icons/ArrowBack"; -import AttachMoneyIcon from "@material-ui/icons/AttachMoney"; import LocationOnIcon from "@material-ui/icons/LocationOn"; import PanToolIcon from "@material-ui/icons/PanTool"; import PersonIcon from "@material-ui/icons/Person"; @@ -10,6 +9,7 @@ import React from "react"; import { isEmpty, isLoaded } from "react-redux-firebase"; import EditIcon from "@material-ui/icons/Edit"; import Button from "@material-ui/core/Button"; +import MissionFundedStatusRow from "./MissionFundedStatusRow"; import { Body2, H3 } from "../../component"; import { Mission } from "../../model"; @@ -142,31 +142,6 @@ const VolunteerRow = ({ mission }) => { return {assigned}; }; -const MissionFundedStatusRow = ({ classes, mission }) => { - let missionFundedStatusText; - switch (mission?.fundedStatus) { - case Mission.FundedStatus.fundedbydonation: - missionFundedStatusText = "Funded By Donation"; - break; - case Mission.FundedStatus.fundedbyrecipient: - missionFundedStatusText = "Funded By Recipient"; - break; - case Mission.FundedStatus.fundingnotneeded: - missionFundedStatusText = "Funding Not Needed"; - break; - case Mission.FundedStatus.notfunded: - missionFundedStatusText = "Not Yet Funded"; - break; - default: - throw Error("mission funded status not exist", mission.fundedStatus); - } - return ( - - {missionFundedStatusText} - - ); -}; - const FoodBoxDetailsRow = ({ details }) => { return ( diff --git a/src/app/dashboard/Missions/ListView.jsx b/src/app/dashboard/Missions/ListView.jsx index 2218e3ec..1a1b99eb 100644 --- a/src/app/dashboard/Missions/ListView.jsx +++ b/src/app/dashboard/Missions/ListView.jsx @@ -184,6 +184,7 @@ const MissionsListView = ({