From 10c6745ba53209ece68410bc9d1637afdf6e8ece Mon Sep 17 00:00:00 2001 From: Jason Qin Date: Sat, 25 May 2024 11:28:07 +1000 Subject: [PATCH] autocommit 25-05-2024-11-28 --- pos-frontend/app/inventory/page.tsx | 112 ++++++++++++++++++---------- 1 file changed, 72 insertions(+), 40 deletions(-) diff --git a/pos-frontend/app/inventory/page.tsx b/pos-frontend/app/inventory/page.tsx index 255657e..2665992 100644 --- a/pos-frontend/app/inventory/page.tsx +++ b/pos-frontend/app/inventory/page.tsx @@ -1,49 +1,81 @@ -import { Container } from '@mantine/core' -import { Flex, Button } from '@mantine/core' -import React from "react" +import React, { useState } from 'react' +import { Container, Paper, Col, Table, Button, TextInput, useMantineTheme } from '@mantine/core' -const NavLink = (props: any) => -
  • - - {props.children} - -
  • - -const Text = (props: any) => -

    {props.children}

    +interface InventoryItem { + id: number + name: string + price: number + quantity: number +} export default function InventoryPage() { - const demoProps = { - bg: 'var(--mantine-color-blue-light)', - h: 50, - mt: 'md', + const theme = useMantineTheme() + const [items, setItems] = useState([]) + const [name, setName] = useState('') + const [price, setPrice] = useState('') + const [quantity, setQuantity] = useState('') + + const addItem = () => { + setItems([ + ...items, + { + id: items.length + 1, + name, + price: parseFloat(price), + quantity: parseInt(quantity), + }, + ]) + setName('') + setPrice('') + setQuantity('') } return ( - <> - Default Container + + + + + + + + + + + + + {items.map((item) => ( + + + + + + + ))} + +
    IDNamePriceQuantity
    {item.id}{item.name}{item.price}{item.quantity}
    +
    - - xs Container - - - - 30rem Container without padding - - - - - - - - + + setName(event.currentTarget.value)} + /> + setPrice(event.currentTarget.value)} + /> + setQuantity(event.currentTarget.value)} + /> + + +
    ) }