Skip to content

Commit

Permalink
sales page complete
Browse files Browse the repository at this point in the history
  • Loading branch information
JASH-PATEL-6566 committed Apr 9, 2023
1 parent 698b0de commit 8a5a41c
Show file tree
Hide file tree
Showing 29 changed files with 579 additions and 309 deletions.
19 changes: 13 additions & 6 deletions Components/HistoryTable/HistoryTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import TableHead from '@mui/material/TableHead';
import TablePagination from '@mui/material/TablePagination';
import TableRow from '@mui/material/TableRow';
import { columns } from './columns';
import ArrowDropUpIcon from '@mui/icons-material/ArrowDropUp';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';

export default function HistoryTable({ rows }) {
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const [rowsPerPage, setRowsPerPage] = React.useState(7);

const handleChangePage = (event, newPage) => {
setPage(newPage);
Expand Down Expand Up @@ -57,10 +59,15 @@ export default function HistoryTable({ rows }) {
)
}
return (
<TableCell key={column.id} align={column.align}>
{column.format && typeof value === 'number'
? column.format(value)
: value}
<TableCell key={column.id} align={column.align} update={column.id === "quantity" ? (row["type"] === 'add' ? 'green_color' : row["type"] === 'sale' ? "orange_color" : "red_color") : ''}>
<div>
{
column.id === "quantity" ? row["type"] === "add" ? <ArrowDropUpIcon /> : <ArrowDropDownIcon /> : ""
}
{column.format && typeof value === 'number'
? column.format(value)
: value}
</div>
</TableCell>
);
})}
Expand All @@ -71,7 +78,7 @@ export default function HistoryTable({ rows }) {
</Table>
</TableContainer>
<TablePagination
sx={{ overflow: "hidden" }}
sx={{ overflow: "hidden", display: "flex", alignItems: 'center', justifyContent: "flex-end" }}
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rows.length}
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion Components/Loading/Loading.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classes from './loading.module.css';
import Head from 'next/Head';
import Head from 'next/head';

export default function Loading() {
return (
Expand Down
4 changes: 2 additions & 2 deletions Components/SideLayout/Navigation/NavigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import Button from '@mui/material/Button';
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
import { useRouter } from 'next/router';

function NavigationBar() {
function NavigationBar({ dest }) {
const router = useRouter();
return (
<div className={classes.nav}>
<Button color="info" onClick={() => router.replace('/user/items')}>
<Button color="info" onClick={() => router.replace(`/user/${dest}`)}>
<ArrowBackIosIcon /> Back
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion Components/subNavbar/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IconButton } from '@mui/material/';
import { auth } from "../../firebase/firebase";

export default function Navbar({ title }) {
const { currentUser, logout } = useAuth();
const { logout } = useAuth();
const [loading, setLoading] = useState(false);
const router = useRouter();
return (
Expand Down
11 changes: 11 additions & 0 deletions Models/sales.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Schema } from 'mongoose';

const salesSchema = new Schema({
name: String,
quantity: Number,
remaining_quantity: Number,
sales_ammount: Number,
date: String,
})

export default salesSchema;
2 changes: 2 additions & 0 deletions Models/user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Schema, model, models } from 'mongoose';
import historySchema from './history';
import medicineSchema from './medicine';
import salesSchema from './sales';

const userSchema = new Schema({
_id: {
Expand All @@ -17,6 +18,7 @@ const userSchema = new Schema({
},
stock: [medicineSchema],
history: [historySchema],
sales: [salesSchema]
})

const User = models.user || model('user', userSchema);
Expand Down
Loading

0 comments on commit 8a5a41c

Please sign in to comment.