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