-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend-workflow): Addition of group billing page
- Loading branch information
1 parent
9e7ed3c
commit a00eee9
Showing
9 changed files
with
226 additions
and
11 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
90 changes: 90 additions & 0 deletions
90
libs/ui/common/src/lib/groupBillingPage/groupBillingPage.css
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,90 @@ | ||
html { | ||
min-height: 100%; | ||
width: 100%; | ||
padding: 0; | ||
} | ||
|
||
body { | ||
background-color: #d9d9d9; | ||
font-family: 'Montserrat', sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
|
||
min-height: 100vh; | ||
width: 100%; | ||
} | ||
|
||
#billing-container { | ||
padding-top: 8dvh; | ||
padding-left: 5dvw; | ||
padding-right: 5dvw; | ||
|
||
min-height: 100vh; | ||
width: 100%; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
} | ||
|
||
h2 { | ||
font-weight: normal; /* You can change to 400 for regular weight */ | ||
font-size: 5vw; | ||
padding-left: 100px; | ||
} | ||
|
||
#table-title { | ||
text-decoration: underline; | ||
} | ||
|
||
#billing-section { | ||
margin-top: 2vw; | ||
} | ||
|
||
#billing-section > div:not(:first-child) { | ||
margin-top: 2dvh; | ||
} | ||
|
||
table { | ||
width: 100%; | ||
} | ||
|
||
table > tbody > tr { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
padding-left: 3dvw; | ||
} | ||
|
||
td { | ||
font-weight: 400; | ||
font-size: 3vw; | ||
|
||
align-items: center; | ||
} | ||
|
||
#summary-section { | ||
padding-left: 5dvw; | ||
padding-right: 5dvw; | ||
padding-top: 1vw; | ||
|
||
background-color: #d9d9d9; /* Ajoute un fond clair */ | ||
padding-bottom: 3vh; | ||
} | ||
|
||
hr { | ||
border: none; | ||
border-top: 1px solid rgba(0, 0, 0, 1); /* Couleur de la ligne de séparation */ | ||
margin: 20px 0; | ||
} | ||
|
||
#summary-section > div { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
#summary-section > div > p { | ||
font-size: 3vw; | ||
} |
75 changes: 75 additions & 0 deletions
75
libs/ui/common/src/lib/groupBillingPage/groupBillingPage.tsx
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,75 @@ | ||
import './groupBillingPage.css'; | ||
import { Button, Typography, Box } from "@mui/material"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
export function GroupBilling() { | ||
const navigate = useNavigate(); | ||
const billingData = [ | ||
{ | ||
number : 1, | ||
elements : [ | ||
{quantity : 1, item: {id: 1, name: "Coca", price: 1.5}}, | ||
{quantity : 2, item: {id: 2, name: "Fried chicken", price: 4.35}} | ||
] | ||
}, | ||
{ | ||
number : 2, | ||
elements : [ | ||
{quantity : 1, item: {id: 3, name: "Orangina", price: 1.5}}, | ||
{quantity : 6, item: {id: 4, name: "Mozzarella stick", price: 1}} | ||
] | ||
} | ||
]; | ||
|
||
const totalPrice = billingData.reduce((total, { elements }) => { | ||
return total + elements.reduce((sum, { quantity, item }) => { | ||
return sum + quantity * item.price; | ||
}, 0); | ||
}, 0); | ||
|
||
const validatePayment = () => { | ||
console.log({totalPrice}) | ||
navigate("/") | ||
} | ||
|
||
return ( | ||
<div id='billing-container' className='container'> | ||
<Box className="group-billing"> | ||
<Typography align='left' variant="h1" component="h2" fontSize="8vw" fontWeight="bold"> | ||
Billing | ||
</Typography> | ||
<div id="billing-section"> | ||
{billingData.map(table => ( | ||
<div key={table.number}> | ||
<Typography id='table-title' align='left' variant="h3" component="h3" fontSize="5vw" fontWeight="bold" > | ||
{"Table " + table.number} | ||
</Typography> | ||
<table> | ||
{table.elements.map(element => ( | ||
<tbody key={element.item.id}> | ||
<tr> | ||
<td>{element.quantity} x {element.item.name}</td> | ||
<td>{element.quantity * element.item.price}$</td> | ||
</tr> | ||
</tbody> | ||
))} | ||
</table> | ||
</div> | ||
))} | ||
</div> | ||
</Box> | ||
<Box id="summary-section"> | ||
<hr /> | ||
<div> | ||
<p>Total : {totalPrice}$</p> | ||
<Button onClick={validatePayment} variant="contained" color="inherit" | ||
style={{padding: '20px 50px', borderRadius: '50px', fontSize: '4vw'}}> | ||
Paid | ||
</Button> | ||
</div> | ||
</Box> | ||
</div> | ||
); | ||
} | ||
|
||
export default GroupBilling; |
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