gthdst ghfdrb
This commit is contained in:
@@ -28,7 +28,6 @@ const emptyFilter = {
|
|||||||
glass: [],
|
glass: [],
|
||||||
category: [],
|
category: [],
|
||||||
alcohol: [],
|
alcohol: [],
|
||||||
tags: [],
|
|
||||||
iCount: [],
|
iCount: [],
|
||||||
ingredient: [],
|
ingredient: [],
|
||||||
inMenu: "",
|
inMenu: "",
|
||||||
@@ -210,17 +209,6 @@ const CocktailsPageContent = () => {
|
|||||||
.then(() => setRows(newState))
|
.then(() => setRows(newState))
|
||||||
.catch(() => createError("Ошибка сохранения данных"))
|
.catch(() => createError("Ошибка сохранения данных"))
|
||||||
}
|
}
|
||||||
const editMenuBlock = (row) => {
|
|
||||||
if (user.role === "USER" || user.role === "ADMIN_NOT_BARMEN") {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<Button color={row.inMenu ? 'error' : 'success'} variant='contained'
|
|
||||||
onClick={() => handleEditMenu(row, !row.inMenu)}>
|
|
||||||
{(row.inMenu ? 'Удалить из' : 'Добавить в') + ' меню'}
|
|
||||||
</Button>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
@@ -254,7 +242,6 @@ const CocktailsPageContent = () => {
|
|||||||
<Cocktail key={row.id} row={row} handleFavourite={handleFavourite}
|
<Cocktail key={row.id} row={row} handleFavourite={handleFavourite}
|
||||||
handleChangeRating={handleChangeRating}
|
handleChangeRating={handleChangeRating}
|
||||||
handleSelect={handleSelectCocktail}
|
handleSelect={handleSelectCocktail}
|
||||||
editMenuBlock={editMenuBlock}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ export function EditCocktailPage() {
|
|||||||
|
|
||||||
const [glass, setGlass] = useState([]);
|
const [glass, setGlass] = useState([]);
|
||||||
const [category, setCategory] = useState([]);
|
const [category, setCategory] = useState([]);
|
||||||
const [tags, setTags] = useState([])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
api().get(requests.cocktails.simple)
|
api().get(requests.cocktails.simple)
|
||||||
@@ -98,16 +97,12 @@ export function EditCocktailPage() {
|
|||||||
.catch(() => createError("Ошибка получения данных"))
|
.catch(() => createError("Ошибка получения данных"))
|
||||||
|
|
||||||
api().get(requests.bar.category)
|
api().get(requests.bar.category)
|
||||||
.then((r) => setCategory(r.data.sort(getComparator("asc", "name"))))
|
.then((r) => setCategory(r.data.sort(getComparator())))
|
||||||
.catch(() => createError("Ошибка получения категорий"))
|
.catch(() => createError("Ошибка получения категорий"))
|
||||||
|
|
||||||
api().get(requests.bar.glass)
|
api().get(requests.bar.glass)
|
||||||
.then((r) => setGlass(r.data.sort(getComparator("asc", "name"))))
|
.then((r) => setGlass(r.data.sort(getComparator())))
|
||||||
.catch(() => createError("Ошибка получения посуды"))
|
.catch(() => createError("Ошибка получения посуды"))
|
||||||
|
|
||||||
api().get(requests.bar.tags)
|
|
||||||
.then((r) => setTags(r.data.sort(getComparator("asc", "name"))))
|
|
||||||
.catch(() => createError("Ошибка получения тегов"))
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, []);
|
}, []);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -235,8 +230,6 @@ export function EditCocktailPage() {
|
|||||||
<SelectEdit value={cocktail.alcoholic} label={"Алкогольность"} width={300} margin={1}
|
<SelectEdit value={cocktail.alcoholic} label={"Алкогольность"} width={300} margin={1}
|
||||||
array={alcohol}
|
array={alcohol}
|
||||||
attributeName={"alcoholic"} handler={changeCocktailValue}/>
|
attributeName={"alcoholic"} handler={changeCocktailValue}/>
|
||||||
<CheckMarks rows={tags} width={300} name={"Теги"} handleChange={changeCocktailValue}
|
|
||||||
filterValue={cocktail.tags.split(",")} filterName={"tags"}/>
|
|
||||||
</Box>
|
</Box>
|
||||||
{/*Рецепт*/}
|
{/*Рецепт*/}
|
||||||
<EditCocktailReceipt receipt={cocktail.receipt} handler={changeCocktailValue}/>
|
<EditCocktailReceipt receipt={cocktail.receipt} handler={changeCocktailValue}/>
|
||||||
|
|||||||
@@ -34,16 +34,7 @@ function renderRating(handleChangeRating, row) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Cocktail({row, handleFavourite, handleChangeRating, handleSelect, editMenuBlock}) {
|
export function Cocktail({row, handleFavourite, handleChangeRating, handleSelect}) {
|
||||||
const {createAlert, createError} = useAlert();
|
|
||||||
const {session, user} = useUser();
|
|
||||||
|
|
||||||
function pay(cocktailId) {
|
|
||||||
api().post(`${requests.bar.pay}cocktail=${cocktailId}`)
|
|
||||||
.then(() => createAlert("Ожидайте свой заказ", "success"))
|
|
||||||
.catch(() => createError("Ошибка во время создания заказа"))
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid item sx={{pr: 2}}>
|
<Grid item sx={{pr: 2}}>
|
||||||
<CocktailItemStyled>
|
<CocktailItemStyled>
|
||||||
@@ -71,6 +62,9 @@ export function Cocktail({row, handleFavourite, handleChangeRating, handleSelect
|
|||||||
<Typography variant="h5" minHeight={'50px'} mt={2}>{row.name} </Typography>
|
<Typography variant="h5" minHeight={'50px'} mt={2}>{row.name} </Typography>
|
||||||
<CocktailDescription row={row}/>
|
<CocktailDescription row={row}/>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
<CardActions>
|
||||||
|
<Button variant={'contained'} color={"error"}>Удалить</Button>
|
||||||
|
</CardActions>
|
||||||
</Box>
|
</Box>
|
||||||
</CocktailItemStyled>
|
</CocktailItemStyled>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -15,22 +15,10 @@ import {useAlert} from "../../hooks/useAlert";
|
|||||||
import {api} from "../../lib/clients/api";
|
import {api} from "../../lib/clients/api";
|
||||||
import {sortList} from "./sortingList";
|
import {sortList} from "./sortingList";
|
||||||
|
|
||||||
const inMenuFilter = [
|
|
||||||
{
|
|
||||||
id: true,
|
|
||||||
name: "Есть в меню"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: false,
|
|
||||||
name: "Нет в меню"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
export function FilterBlock({filter, handleFilterChange, handleClearFilter, barmen}) {
|
export function FilterBlock({filter, handleFilterChange, handleClearFilter, barmen}) {
|
||||||
const {createError} = useAlert();
|
const {createError} = useAlert();
|
||||||
const [glass, setGlass] = useState([]);
|
const [glass, setGlass] = useState([]);
|
||||||
const [category, setCategory] = useState([]);
|
const [category, setCategory] = useState([]);
|
||||||
const [tags, setTags] = useState([])
|
|
||||||
const alcohol = [
|
const alcohol = [
|
||||||
{
|
{
|
||||||
name: "Алкогольный",
|
name: "Алкогольный",
|
||||||
@@ -70,10 +58,6 @@ export function FilterBlock({filter, handleFilterChange, handleClearFilter, barm
|
|||||||
api().get(requests.bar.glass)
|
api().get(requests.bar.glass)
|
||||||
.then((r) => setGlass(r.data))
|
.then((r) => setGlass(r.data))
|
||||||
.catch(() => createError("Ошибка получения посуды"))
|
.catch(() => createError("Ошибка получения посуды"))
|
||||||
|
|
||||||
api().get(requests.bar.tags)
|
|
||||||
.then((r) => setTags(r.data))
|
|
||||||
.catch(() => createError("Ошибка получения тегов"))
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -141,9 +125,6 @@ export function FilterBlock({filter, handleFilterChange, handleClearFilter, barm
|
|||||||
{/*Фильтр по посуде*/}
|
{/*Фильтр по посуде*/}
|
||||||
{glass.length > 0 && (<CheckMarks rows={glass} name={"Подача"} handleChange={handleFilterChange}
|
{glass.length > 0 && (<CheckMarks rows={glass} name={"Подача"} handleChange={handleFilterChange}
|
||||||
filterValue={filter.glass} filterName={"glass"}/>)}
|
filterValue={filter.glass} filterName={"glass"}/>)}
|
||||||
{/*Фильтр по тегам*/}
|
|
||||||
{tags.length > 0 && (<CheckMarks rows={tags} name={"Теги"} handleChange={handleFilterChange}
|
|
||||||
filterValue={filter.tags} filterName={"tags"}/>)}
|
|
||||||
{/*Фильтр по нехватке ингредиентов*/}
|
{/*Фильтр по нехватке ингредиентов*/}
|
||||||
{(barmen && filter.all) && (<CheckMarks rows={ingredientCount} name={"Не хватает ингредиентов"}
|
{(barmen && filter.all) && (<CheckMarks rows={ingredientCount} name={"Не хватает ингредиентов"}
|
||||||
handleChange={handleFilterChange}
|
handleChange={handleFilterChange}
|
||||||
|
|||||||
4
pom.xml
4
pom.xml
@@ -34,10 +34,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.kafka</groupId>
|
|
||||||
<artifactId>spring-kafka</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
@@ -37,17 +37,17 @@ public class BarController {
|
|||||||
return unitRepository.findAll();
|
return unitRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("glass")
|
@GetMapping("/glass")
|
||||||
public List<String> getGlass() {
|
public List<String> getGlass() {
|
||||||
return Arrays.stream(Glass.values()).map(Glass::getName).toList();
|
return Arrays.stream(Glass.values()).map(Glass::getName).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("category")
|
@GetMapping("/category")
|
||||||
public List<String> getCategory() {
|
public List<String> getCategory() {
|
||||||
return Arrays.stream(Category.values()).map(Category::getName).toList();
|
return Arrays.stream(Category.values()).map(Category::getName).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("receipt")
|
@GetMapping("/receipt")
|
||||||
public List<ReceiptResponseDto> getReceipt(@RequestParam("id") Long id) {
|
public List<ReceiptResponseDto> getReceipt(@RequestParam("id") Long id) {
|
||||||
return sessionService.getReceiptList(id);
|
return sessionService.getReceiptList(id);
|
||||||
}
|
}
|
||||||
@@ -56,18 +56,12 @@ public class BarController {
|
|||||||
public VisitorResponseDto getMe() {
|
public VisitorResponseDto getMe() {
|
||||||
Visitor visitor = visitorService.getCurrentVisitor();
|
Visitor visitor = visitorService.getCurrentVisitor();
|
||||||
String role;
|
String role;
|
||||||
Boolean invited;
|
|
||||||
boolean active;
|
|
||||||
role = UserRole.ADMIN.toString();
|
role = UserRole.ADMIN.toString();
|
||||||
invited = true;
|
VisitorResponseDto dto = VisitorResponseDto.mapToDto(visitor, true, role, true);
|
||||||
active = true;
|
log.info("Запрос информации о пользователе: {}-{} {}, вошел в бар",
|
||||||
VisitorResponseDto dto = VisitorResponseDto.mapToDto(visitor, invited, role, active);
|
|
||||||
log.info("Запрос информации о пользователе: {}-{} {}, вошел в бар{},в роли {}",
|
|
||||||
dto.getId(),
|
dto.getId(),
|
||||||
dto.getName().strip(),
|
dto.getName().strip(),
|
||||||
dto.getLastName() != null ? dto.getLastName().strip() : "",
|
dto.getLastName() != null ? dto.getLastName().strip() : "");
|
||||||
invited ? "" : "не ",
|
|
||||||
role);
|
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user