| 1 | import React from "react";
|
|---|
| 2 | import {useNavigate} from "react-router-dom";
|
|---|
| 3 | import {Card, CardContent, CardHeader, CardMedia, IconButton, Typography} from "@mui/material";
|
|---|
| 4 | import {ManageAccountsRounded} from "@mui/icons-material";
|
|---|
| 5 | import {useAuthContext} from "../../configurations/AuthContext";
|
|---|
| 6 | import {UserRole} from "../../services/user-service";
|
|---|
| 7 | import RestourantImage from "../../assets/images/restorant-logo2.jpg";
|
|---|
| 8 |
|
|---|
| 9 | function MoreVertIcon() {
|
|---|
| 10 | return null;
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | const RestoranCard = ({restoran}) => {
|
|---|
| 14 | const navigate = useNavigate();
|
|---|
| 15 | const {loggedUserRole} = useAuthContext();
|
|---|
| 16 |
|
|---|
| 17 | return (
|
|---|
| 18 | restoran != null &&
|
|---|
| 19 | <Card className={`card-zoom m-3 cursor-pointer`} onClick={() => navigate(`/restorants/${restoran.id}`)}>
|
|---|
| 20 | <CardHeader
|
|---|
| 21 | avatar={
|
|---|
| 22 | restoran.manager.id === loggedUserRole?.roleId && loggedUserRole?.role === UserRole.Menager &&
|
|---|
| 23 | <ManageAccountsRounded/>
|
|---|
| 24 | }
|
|---|
| 25 | action={
|
|---|
| 26 | <IconButton aria-label="settings">
|
|---|
| 27 | <MoreVertIcon/>
|
|---|
| 28 | </IconButton>
|
|---|
| 29 | }
|
|---|
| 30 | title={restoran.manager.korisnik.username.toUpperCase()}
|
|---|
| 31 | subheader="Manager"
|
|---|
| 32 | />
|
|---|
| 33 | <CardMedia
|
|---|
| 34 | component="img"
|
|---|
| 35 | height="200"
|
|---|
| 36 | image={RestourantImage}
|
|---|
| 37 | alt="Paella dish"
|
|---|
| 38 | />
|
|---|
| 39 | <CardContent className={" text-center"}>
|
|---|
| 40 | <Typography variant={"h5"}
|
|---|
| 41 | className={"font-weight-bold mt-3 text-center"}
|
|---|
| 42 | >{restoran.ime}
|
|---|
| 43 | </Typography>
|
|---|
| 44 | <Typography className={"text-center card-description m-0 mb-4"}
|
|---|
| 45 | >{restoran.lokacija}
|
|---|
| 46 | </Typography>
|
|---|
| 47 | <Typography className={"text-center card-description m-0 mb-4"}
|
|---|
| 48 | > {restoran.rabotnoVreme}
|
|---|
| 49 | </Typography>
|
|---|
| 50 | </CardContent>
|
|---|
| 51 | </Card>
|
|---|
| 52 | )
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | export default RestoranCard; |
|---|