added lunch hours | added restaurant type

This commit is contained in:
2020-10-20 19:37:45 +02:00
parent 20c7dd18a7
commit e488827335
3 changed files with 81 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ import InstagramIcon from "@material-ui/icons/Instagram";
import LanguageIcon from "@material-ui/icons/Language";
import FastfoodIcon from "@material-ui/icons/Fastfood";
import LocationCityIcon from "@material-ui/icons/LocationCity";
import InputWorkingHoursSingle from "../Input/InputWorkingHoursSingle";
import Divider from "@material-ui/core/Divider";
import Link from "@material-ui/core/Link";
import { decodeTags } from "../../Services";
@@ -65,6 +66,7 @@ export default function EditRestaurantInfo(props) {
city: props.restaurant.city,
adress: props.restaurant.adress,
description: props.restaurant.description,
type: props.restaurant.type,
phone: props.restaurant.phone,
hidden: props.restaurant.hidden,
links: props.restaurant.links,
@@ -76,6 +78,7 @@ export default function EditRestaurantInfo(props) {
cityError: false,
adressError: false,
descriptionError: false,
typeError: false
};
const [state, setState] = useState(initialState);
const [passwordDialog, setPasswordDialog] = useState(false);
@@ -102,6 +105,7 @@ export default function EditRestaurantInfo(props) {
const validation = {
nameValid: validator.isLength(state.name, { min: 1, max: 40 }),
cityValid: validator.isLength(state.city, { min: 1, max: 40 }),
typeValid: validator.isLength(state.type, { min: 1, max: 40 }),
adressValid: validator.isLength(state.name, { min: 1, max: 40 }),
descriptionValid: validator.isLength(state.description, {
min: 1,
@@ -113,6 +117,7 @@ export default function EditRestaurantInfo(props) {
nameError: !validation.nameValid,
cityError: !validation.cityValid,
adressError: !validation.adressValid,
typeError: !validation.typeValid,
descriptionError: !validation.descriptionValid,
});
@@ -120,7 +125,8 @@ export default function EditRestaurantInfo(props) {
validation.nameValid &&
validation.cityValid &&
validation.adressValid &&
validation.descriptionValid
validation.descriptionValid &&
validation.typeValid
);
};
@@ -154,6 +160,10 @@ export default function EditRestaurantInfo(props) {
});
};
const setLunchHours = (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"
/>
</div>
<div className="editRestaurant-fullWidth">
<TextField
className={styles.textInputFullWidth}
fullWidth
value={state.type}
error={state.typeError}
onChange={(event) =>
setState({ ...state, type: event.target.value })
}
InputLabelProps={{ shrink: true }}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<FastfoodIcon color="primary" />
</InputAdornment>
),
}}
label="Kuchnia"
placeholder="np. Meksykańska"
variant="outlined"
/>
</div>
<TextField
className={styles.textInput}
@@ -308,6 +341,10 @@ export default function EditRestaurantInfo(props) {
setHours={(hours) => setState({ ...state, workingHours: hours })}
hours={state.workingHours}
/>
<div className="newRestaurant-content-fullwidth">
<div className="workingHours-container" style={{ marginTop: 14 }}>
<InputWorkingHoursSingle nieczynne={!state.lunchHours} hours={state.lunchHours} changeValue={(value) => setLunchHours(value)} day="Lunch hours" /></div>
</div>
<div className="editRestaurant-sectiontitle">
<h4>Dane kontaktowe</h4>
<Divider />