update
This commit is contained in:
@@ -14,7 +14,6 @@ import LanguageIcon from "@material-ui/icons/Language";
|
||||
import FastfoodIcon from "@material-ui/icons/Fastfood";
|
||||
import LocationCityIcon from "@material-ui/icons/LocationCity";
|
||||
import Divider from "@material-ui/core/Divider";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import { decodeTags } from "../../Services";
|
||||
import validator from "validator";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
@@ -29,6 +28,7 @@ import MenuItem from "@material-ui/core/MenuItem";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Switch from '@material-ui/core/Switch';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
textInput: {
|
||||
@@ -159,9 +159,36 @@ export default function EditRestaurantInfo(props) {
|
||||
setState(initialState);
|
||||
};
|
||||
|
||||
const handleDelete = (password) => {
|
||||
const handleSetHidden = () => {
|
||||
dispatch(showBackdrop());
|
||||
axios({
|
||||
url: "http://localhost:4000/restaurant/delete",
|
||||
url: `${backend}restaurant/visibility`,
|
||||
method: "POST",
|
||||
data: {
|
||||
restaurantId: props.restaurant._id,
|
||||
visible: state.hidden
|
||||
},
|
||||
headers: {
|
||||
"x-auth-token": jwt,
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
dispatch(refreshUserData(jwt));
|
||||
setState({ ...state, hidden: !state.hidden });
|
||||
dispatch(hideBackdrop());
|
||||
dispatch(notification("Widoczność zmieniona poprawnie", "success"));
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
dispatch(hideBackdrop());
|
||||
dispatch(notification("Wystąpił błąd :(", "error"));
|
||||
});
|
||||
}
|
||||
|
||||
const handleDelete = (password) => {
|
||||
dispatch(showBackdrop());
|
||||
axios({
|
||||
url: `${backend}restaurant/delete`,
|
||||
method: "POST",
|
||||
data: {
|
||||
restaurantId: props.restaurant._id,
|
||||
@@ -452,10 +479,17 @@ export default function EditRestaurantInfo(props) {
|
||||
<div className="editRestaurant-sectiontitle">
|
||||
<h4>Zaawansowane</h4>
|
||||
<Divider />
|
||||
<div className="editRestaurant-settings">
|
||||
<h4>Ukryj restaurację (nie wymaga zatwierdzania)</h4>
|
||||
<Switch checked={state.hidden} color="primary" onChange={handleSetHidden}/>
|
||||
</div>
|
||||
<div className="editRestaurant-settings">
|
||||
<h4>
|
||||
Usuń restaurację (operacja jest nieodwracalna!)
|
||||
</h4>
|
||||
<ButtonPrimary text="Usuń" onClick={() => setPasswordDialog(true)} />
|
||||
</div>
|
||||
</div>
|
||||
<Link className={styles.link} onClick={() => setPasswordDialog(true)}>
|
||||
Usuń restaurację
|
||||
</Link>
|
||||
</div>
|
||||
<div className="editRestaurant-bottom">
|
||||
<ButtonPrimary text="Anuluj" onClick={cancelChanges} />
|
||||
|
||||
@@ -6,5 +6,5 @@ export default function DishPrices(props) {
|
||||
const display2 = prices.price2.price !== "";
|
||||
const display3 = prices.price3.price !== "";
|
||||
|
||||
return <p>{display2 || display3 && prices.price1.priceName}{" " + prices.price1.price}zł{ display2 && " / " + prices.price2.priceName + " " + prices.price2.price + "zł"}{ display3 && " / " + prices.price3.priceName + " " + prices.price3.price + "zł"}</p>
|
||||
return <p>{(display2 || display3) ? prices.price1.priceName : ""}{" " + prices.price1.price}zł{ display2 && " / " + prices.price2.priceName + " " + prices.price2.price + "zł"}{ display3 && " / " + prices.price3.priceName + " " + prices.price3.price + "zł"}</p>
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import soy from "../../public/i_soy.svg";
|
||||
import vegan from "../../public/i_vegan.svg";
|
||||
import vegetarian from "../../public/i_vegetarian.svg";
|
||||
|
||||
export default function (props) {
|
||||
export default function Pictograms(props) {
|
||||
const pictograms = props.pictograms.map((pictogram, index) => (
|
||||
<Tooltip key={index} title={getTooltip(pictogram)}>
|
||||
<img className="pictogram" src={getImage(pictogram)} alt={pictogram} />
|
||||
|
||||
@@ -16,7 +16,7 @@ import soy from "../../public/i_soy.svg";
|
||||
import vegan from "../../public/i_vegan.svg";
|
||||
import vegetarian from "../../public/i_vegetarian.svg";
|
||||
|
||||
export default function (props) {
|
||||
export default function PictogramsSeparate(props) {
|
||||
const pictogramsSeparated = props.pictograms.map((pictogram, index) => (
|
||||
<div key={index} className="separate-pictogram">
|
||||
<h4>{getName(pictogram)}</h4>
|
||||
|
||||
Reference in New Issue
Block a user