From e488827335e2a28284abb91e3ff07a750d9cb1c4 Mon Sep 17 00:00:00 2001 From: Jonasz Bigda Date: Tue, 20 Oct 2020 19:37:45 +0200 Subject: [PATCH] added lunch hours | added restaurant type --- src/components/Dialogs/NewRestaurant.js | 43 ++++++++++++++++++- .../EditRestaurant/EditRestaurantInfo.js | 39 ++++++++++++++++- src/components/Output/AppBackdrop.js | 2 +- 3 files changed, 81 insertions(+), 3 deletions(-) diff --git a/src/components/Dialogs/NewRestaurant.js b/src/components/Dialogs/NewRestaurant.js index 0166fe0..0c88eba 100644 --- a/src/components/Dialogs/NewRestaurant.js +++ b/src/components/Dialogs/NewRestaurant.js @@ -24,6 +24,7 @@ import { useSelector, useDispatch } from "react-redux"; import { notification, refreshUserData } from "../../actions"; import { showBackdrop, hideBackdrop } from "../../actions/toggles.js"; import InputWorkingHours from "../Input/InputWorkingHours"; +import InputWorkingHoursSingle from "../Input/InputWorkingHoursSingle"; import { backend } from "../../config"; // ICONS import FastfoodIcon from "@material-ui/icons/Fastfood"; @@ -96,6 +97,7 @@ export default function NewRestaurant() { adress: "", coordinates: [52.354293, 19.42377], placesId: "", + type: "", imgUrl: "", workingHours: { pn: "8:00 - 22:00", @@ -106,6 +108,7 @@ export default function NewRestaurant() { sb: "8:00 - 22:00", nd: "8:00 - 22:00", }, + lunchHours: "12:30 - 13:30", description: "", tags: [], phone: "", @@ -118,6 +121,7 @@ export default function NewRestaurant() { cityError: false, adressError: false, descriptionError: false, + typeError: false, charLeft: 400, }; const steps = ["Informacje", "Zdjęcie", "Lokalizacja"]; @@ -146,6 +150,8 @@ export default function NewRestaurant() { adress: state.adress, coordinates: state.coordinates, placesId: state.placesId, + lunchHours: state.lunchHours, + type: state.type, imgUrl: state.imgUrl, workingHours: state.workingHours, description: state.description, @@ -187,6 +193,10 @@ export default function NewRestaurant() { }); }; + const setLunchHours = (hours) => { + setState({ ...state, lunchHours: hours }); + } + const setCoordinatesAndPlacesID = (coordinates, placesID) => { if (!placesID) { setState({ ...state, coordinates: coordinates }); @@ -234,6 +244,7 @@ export default function NewRestaurant() { nameValid: validator.isLength(state.name, { min: 1, max: 40 }), cityValid: validator.isLength(state.city, { min: 1, max: 40 }), adressValid: validator.isLength(state.name, { min: 1, max: 40 }), + typeValid: validator.isLength(state.type, { min: 1, max: 40 }), descriptionValid: validator.isLength(state.description, { min: 1, max: 400, @@ -243,6 +254,7 @@ export default function NewRestaurant() { ...state, nameError: !validation.nameValid, cityError: !validation.cityValid, + typeError: !validation.typeValid, adressError: !validation.adressValid, descriptionError: !validation.descriptionValid, }); @@ -251,7 +263,8 @@ export default function NewRestaurant() { validation.nameValid && validation.cityValid && validation.adressValid && - validation.descriptionValid + validation.descriptionValid && + validation.typeValid ); }; @@ -292,6 +305,7 @@ export default function NewRestaurant() { error={state.nameError} value={state.name} label="Nazwa lokalu" + placeholder="np. Pierożek" variant="outlined" onChange={(event) => setState({ ...state, name: event.target.value }) @@ -305,11 +319,33 @@ export default function NewRestaurant() { }} /> +
+ + setState({ ...state, type: event.target.value }) + } + InputProps={{ + startAdornment: ( + + + + ), + }} + /> +
+
+
+ setLunchHours(value)} day="Lunch hours" />
+
{ + setState({ ...state, lunchHours: hours }); + } + const handleSendForm = () => { if (validateForm()) { const formattedTags = prepareTags(state.tags); @@ -167,6 +177,7 @@ export default function EditRestaurantInfo(props) { adress: state.adress, coordinates: props.restaurant.location.coordinates, placesId: props.restaurant.placesId, + type: state.type, imgUrl: props.restaurant.imgUrl, workingHours: state.workingHours, lunchHours: state.lunchHours, @@ -231,6 +242,28 @@ export default function EditRestaurantInfo(props) { variant="outlined" />
+
+ + setState({ ...state, type: event.target.value }) + } + InputLabelProps={{ shrink: true }} + InputProps={{ + startAdornment: ( + + + + ), + }} + label="Kuchnia" + placeholder="np. Meksykańska" + variant="outlined" + /> +
setState({ ...state, workingHours: hours })} hours={state.workingHours} /> +
+
+ setLunchHours(value)} day="Lunch hours" />
+

Dane kontaktowe

diff --git a/src/components/Output/AppBackdrop.js b/src/components/Output/AppBackdrop.js index b89d94e..87247d5 100644 --- a/src/components/Output/AppBackdrop.js +++ b/src/components/Output/AppBackdrop.js @@ -6,7 +6,7 @@ import { makeStyles } from "@material-ui/core/styles"; const useStyles = makeStyles((theme) => ({ backdrop: { - zIndex: theme.zIndex.drawer + 1, + zIndex: theme.zIndex.drawer + 15, color: "#fff", }, }));