generated from Arquisoft/dede_0
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #145 from Arquisoft/develop
Develop new features
- Loading branch information
Showing
17 changed files
with
670 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import "../../css/OrderCard.css"; | ||
|
||
import { styled } from '@mui/material/styles'; | ||
import Card from '@mui/material/Card'; | ||
import CardContent from '@mui/material/CardContent'; | ||
import Typography from '@mui/material/Typography'; | ||
import { Order } from "../../shared/shareddtypes"; | ||
import OrderAdminDetails from "./OrderAdminDetails"; | ||
import React from "react"; | ||
import { CardActions, Collapse, IconButton, IconButtonProps } from "@mui/material"; | ||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; | ||
|
||
type OrderAdminCardProps = { | ||
order: Order; | ||
} | ||
|
||
interface ExpandMoreAdminProps extends IconButtonProps { | ||
expand: boolean; | ||
} | ||
|
||
const ExpandMoreAdmin = styled((props: ExpandMoreAdminProps) => { | ||
const { expand, ...other } = props; | ||
return <IconButton {...other} />; | ||
})(({ theme, expand }) => ({ | ||
transform: !expand ? 'rotate(0deg)' : 'rotate(180deg)', | ||
marginLeft: 'auto', | ||
transition: theme.transitions.create('transform', { | ||
duration: theme.transitions.duration.shortest, | ||
}), | ||
})); | ||
|
||
export default function OrderAdminCard(props: OrderAdminCardProps) { | ||
|
||
const [expanded, setExpanded] = React.useState(false); | ||
const handleExpandClick = () => { | ||
setExpanded(!expanded); | ||
}; | ||
|
||
return ( | ||
<Card id="orderAdminCard" variant="outlined"> | ||
<CardContent> | ||
<Typography gutterBottom variant="h5" component="div"> | ||
Order {props.order.createdAt.toString().substring(0, 10)} | ||
</Typography> | ||
<Typography gutterBottom variant="h5" component="div"> | ||
{props.order.userId.toString()} | ||
</Typography> | ||
Items: | ||
<CardActions disableSpacing> | ||
<ExpandMoreAdmin | ||
expand={expanded} | ||
onClick={handleExpandClick} | ||
aria-expanded={expanded} | ||
aria-label="show more" | ||
> | ||
<ExpandMoreIcon /> | ||
</ExpandMoreAdmin> | ||
</CardActions> | ||
<Collapse in={expanded} timeout="auto" unmountOnExit> | ||
<CardContent> | ||
{props.order.products.map(product => ( | ||
<OrderAdminDetails orderId={props.order.id} productOrdered={product}></OrderAdminDetails> | ||
))} | ||
</CardContent> | ||
</Collapse> | ||
|
||
<Typography variant="body2" color="text.secondary"> | ||
Total: {props.order.subTotal} € | ||
</Typography> | ||
<Typography variant="body2" color="text.secondary"> | ||
Shipping cost: {props.order.deliveryPrice} € | ||
</Typography> | ||
</CardContent> | ||
</Card> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
|
||
import Card from '@mui/material/Card'; | ||
import CardHeader from '@mui/material/CardHeader'; | ||
import CardMedia from '@mui/material/CardMedia'; | ||
|
||
import { baseApiEndPoint } from '../../api/api'; | ||
|
||
import { ProductOrdered } from "../../shared/shareddtypes"; | ||
|
||
import "../../css/OrderDetails.css"; | ||
import { Grid} from '@mui/material'; | ||
|
||
type ProductCardAdminProps = { | ||
productOrdered: ProductOrdered; | ||
orderId: string; | ||
} | ||
export default function OrderAdminDetails(props: ProductCardAdminProps) { | ||
|
||
console.log(props); | ||
const imgAdminPath = baseApiEndPoint + "/cars/" + props.productOrdered.product.image + "/" + props.productOrdered.product.image + " (1).jpg" | ||
return ( | ||
<Card id="mainAdminCard"> | ||
<Grid container spacing={2}> | ||
<Grid item xs={2.5}> | ||
<CardHeader | ||
title={props.productOrdered.product.name} | ||
subheader={"Price: " + props.productOrdered.product.price + "€/unit Quantity: " + props.productOrdered.quantity} | ||
|
||
/> | ||
</Grid> | ||
|
||
<Grid item xs={8}> | ||
<CardMedia | ||
id="cardImg" | ||
component="img" | ||
height="194" | ||
image={imgAdminPath} | ||
alt={props.productOrdered.product.name} | ||
/> | ||
</Grid> | ||
</Grid> | ||
|
||
</Card> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.