Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Apoorva64 committed Sep 22, 2024
2 parents ff0c9a6 + 82a7952 commit 39d6310
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 34 deletions.
84 changes: 64 additions & 20 deletions libs/ui/common/src/lib/groupBillingPage/groupBillingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,49 @@ export function GroupBilling() {
{ quantity: 1, item: { id: 3, name: "Orangina", price: 1.5 } },
{ quantity: 6, item: { id: 4, name: "Mozzarella stick", price: 1 } }
]
}
},
{
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 } }
]
},
{
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 } }
]
},
{
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 }) => {
Expand All @@ -35,28 +77,30 @@ export function GroupBilling() {
<Box sx={{ backgroundColor: '#d9d9d9', minHeight: '100dvh', paddingTop: '5dvh', paddingLeft: '5dvw', paddingRight: '5dvw',
display: 'flex', flexDirection: 'column', justifyContent: 'space-around'}}>
<Box sx={{ minHeight: '75dvh'}}>
<Typography variant="h2" component="h2" sx={{ fontSize: '8vw', fontWeight: 'bold', paddingLeft: '100px' }}>
<Typography variant="h2" component="h2" sx={{ fontSize: '8vw', fontWeight: 'bold', textAlign: 'center' }}>
Billing
</Typography>
{billingData.map((table, index) => (
<Box key={index} sx={{ margin: '2vh 0', backgroundColor: '#d9d9d9' }}>
<Typography variant="h3" component="h3" sx={{ fontSize: '5vw', fontWeight: 'bold', textDecoration: 'underline' }}>
{"Table " + table.number}
</Typography>
<Box sx={{ padding: '2vh 0' }}>
{table.elements.map((element, index) => (
<Box key={index} sx={{ display: 'flex', justifyContent: 'space-between', padding: '1vh 3vw' }}>
<Typography variant="body1" component="span" fontWeight={400} fontSize={'3vw'}>
{element.quantity} x {element.item.name}
</Typography>
<Typography variant="body1" component="span" fontWeight={400} fontSize={'3vw'}>
${element.quantity * element.item.price}
</Typography>
</Box>
))}
<Box sx={{overflow: 'auto', maxHeight: '70dvh'}}>
{billingData.map((table, index) => (
<Box key={index} sx={{ margin: '2vh 0', backgroundColor: '#d9d9d9' }}>
<Typography variant="h3" component="h3" sx={{ fontSize: '5vw', fontWeight: 'bold', textDecoration: 'underline' }}>
{"Table " + table.number}
</Typography>
<Box sx={{ padding: '2vh 0' }}>
{table.elements.map((element, index) => (
<Box key={index} sx={{ display: 'flex', justifyContent: 'space-between', padding: '0 3vw' }}>
<Typography variant="body1" component="span" fontWeight={400} fontSize={'3vw'}>
{element.quantity} x {element.item.name}
</Typography>
<Typography variant="body1" component="span" fontWeight={400} fontSize={'3vw'}>
{element.quantity * element.item.price}$
</Typography>
</Box>
))}
</Box>
</Box>
</Box>
))}
))}
</Box>
</Box>
<Box sx={{ padding: '3vh 5vw', backgroundColor: '#d9d9d9' }}>
<hr style={{border: 'none', borderTop:'1px solid rgba(0, 0, 0, 1)', margin: '20px 0'}} />
Expand Down
30 changes: 16 additions & 14 deletions libs/ui/common/src/lib/tableBillingPage/tableBilling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function TableBilling() {
return (
<Box sx={{minHeight: '100dvh', display: 'flex', flexDirection: 'row'}}>
<Box sx={{boxSizing: 'border-box', width: 'fit-content', borderRight: '2px solid #000'}}>
<NavBar
<NavBar
tables={tablesData}
setSelectedTable={(tableId) => setSelectedTableById(tablesData, tableId, setSelectedTable)
}/>
Expand All @@ -76,7 +76,7 @@ export function TableBilling() {
paddingTop: '5dvh', paddingLeft: '5dvw', paddingRight: '5dvw'
}}>
<div id="billing-section" style={{minHeight: '75dvh'}}>
<Typography variant="h2" component="h2" sx={{ fontSize: '8vw', fontWeight: 'bold', paddingLeft: '100px' }}>
<Typography variant="h2" component="h2" sx={{ fontSize: '8vw', fontWeight: 'bold', textAlign: 'center' }}>
Billing
</Typography>
<div style={{display: "flex", justifyContent: "space-between", alignItems: "center"}}>
Expand All @@ -96,19 +96,21 @@ export function TableBilling() {
</Button>
</div>
</div>
{data.map((element, index) => (
<div key={index} style={{display: "flex", flexDirection: "row",
justifyContent: "space-between", padding: '1vh 3vw', fontSize: '4vw',
alignItems: "center"}}>
<div>
<Button sx={{fontSize: '4vw', color: '#000'}} onClick={() => handleIncrementDecrement(index, -1)}>-</Button>
<span>{quantities[index].quantity}/{element.remaining}</span>
<Button sx={{fontSize: '4vw', color: '#000'}} onClick={() => handleIncrementDecrement(index, 1)}>+</Button>
<span> {element.item.name}</span>
<Box sx={{overflow: 'auto', maxHeight: '60dvh'}}>
{data.map((element, index) => (
<div key={index} style={{display: "flex", flexDirection: "row",
justifyContent: "space-between", padding: '0vh 3vw', fontSize: '4vw',
alignItems: "center"}}>
<div>
<Button sx={{fontSize: '4vw', color: '#000'}} onClick={() => handleIncrementDecrement(index, -1)}>-</Button>
<span>{quantities[index].quantity}/{element.remaining}</span>
<Button sx={{fontSize: '4vw', color: '#000'}} onClick={() => handleIncrementDecrement(index, 1)}>+</Button>
<span> {element.item.name}</span>
</div>
<span>{element.item.price}$</span>
</div>
<span>{element.item.price}$</span>
</div>
))}
))}
</Box>
</div>
<Box sx={{ padding: '3vh 5vw', backgroundColor: '#d9d9d9' }}>
<hr style={theme.hr} />
Expand Down

0 comments on commit 39d6310

Please sign in to comment.