generated from purwadhikafullstack/final-project-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ogwa-58 (#72) * bug fixing * fix search bar bug * Update index.js * add continue button * Update UserLoginPage.jsx * Ogwa 39 (#73) * create api for send, cancel, confirm payment, and reject payment * add frontend send button * add sweetalert * add cancel, confirm, and reject button * add user auth guard * add logic to hide/show login/logout button * edit desktop navbar * add alt * update desktop navbar * fix bug product card * add profile on account menu * fix seeder bug * disabled add to cart if not logged * add stock increment * add order list * fix bug product * fix bug rajaongkir * add order detail page * add order detail * add action button * add delete alert * add cancel order handler * fix product card bug * fix search bar * update account icon * refactor * finish backend for addProduct to Carts models * commit test * fix bug order detail * add seeders * working ogwa-42 * new works on ogwa-42 * working on CartPage * finish ogwa-42 and ogwa-43 but need cleansing log and // again * finish early OGWA-42 and OGWA-43 * finish early OGWA-42 and OGWA-43 new * finish OGWA-49 and OGWA-22 * working on OGWA-39 Sales report * checkpoint backend and frontend ogwa-39 * finish OGWA-39 * fix bug --------- Co-authored-by: Muhamad Danang Priambodo <68808411+mcdanang@users.noreply.github.com> * fix for deployment --------- Co-authored-by: Muhamad Danang Priambodo <68808411+mcdanang@users.noreply.github.com> Co-authored-by: farrez30 <59773413+farrez30@users.noreply.github.com>
- Loading branch information
1 parent
b991886
commit 4240005
Showing
52 changed files
with
1,130 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,4 @@ jobs: | |
script: | | ||
cd ${{ secrets.SSH_FOLDER }} | ||
npm install | ||
pm2 start deploy.config.js | ||
pm2 start deploy.config.js |
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
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
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,17 @@ | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
const ContinueButton = () => { | ||
const navigate = useNavigate(); | ||
return ( | ||
<> | ||
<button | ||
className="rounded-lg font-bold h-fit bg-green-500 text-green-100 px-4 py-2 ml-auto mr-10 my-10" | ||
onClick={() => navigate("/cart/checkout")} | ||
> | ||
Continue | ||
</button> | ||
</> | ||
); | ||
}; | ||
|
||
export default ContinueButton; |
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
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
10 changes: 10 additions & 0 deletions
10
...ts/client/src/components/SalesReport/ProductSalesReport/ProductSalesReportBodyContent.jsx
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,10 @@ | ||
import React from "react"; | ||
import ProductSalesViewMode from "./ProductSalesViewMode"; | ||
|
||
const ProductSalesReportBodyContent = ({ datas }) => { | ||
return datas.map((item, index) => { | ||
return <ProductSalesViewMode item={item} key={index} index={index} />; | ||
}); | ||
}; | ||
|
||
export default ProductSalesReportBodyContent; |
27 changes: 27 additions & 0 deletions
27
projects/client/src/components/SalesReport/ProductSalesReport/ProductSalesReportTable.jsx
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,27 @@ | ||
import React from "react"; | ||
import ProductSalesReportTableHead from "./ProductSalesReportTableHead.jsx"; | ||
import ProductSalesReportTableBody from "./ProductSalesReportTableBody.jsx"; | ||
|
||
const ProductSalesReportTable = ({ name, filterBy, filter, sort, order, page, setMaxPage, startDate, endDate }) => { | ||
return ( | ||
<div className="flex overflow-x-auto rounded-lg border border-green-300 border-2 mx-6"> | ||
<table className="w-full"> | ||
<ProductSalesReportTableHead /> | ||
|
||
<ProductSalesReportTableBody | ||
name={name} | ||
filterBy={filterBy} | ||
filter={filter} | ||
sort={sort} | ||
order={order} | ||
page={page} | ||
setMaxPage={setMaxPage} | ||
startDate={startDate} | ||
endDate={endDate} | ||
/> | ||
</table> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProductSalesReportTable; |
31 changes: 31 additions & 0 deletions
31
...ects/client/src/components/SalesReport/ProductSalesReport/ProductSalesReportTableBody.jsx
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,31 @@ | ||
import React from "react"; | ||
import { getSalesReportByProduct } from "../handlers/SalesReportHandler.js"; | ||
import ProductSalesReportBodyContent from "./ProductSalesReportBodyContent"; | ||
// import { generateUrlQuery, getBranchInventories } from "../handlers/SalesReportHandler.js"; | ||
|
||
const ProductSalesReportTableBody = ({ name, filterBy, filter, sort, order, page, setMaxPage, startDate, endDate }) => { | ||
const [datas, setDatas] = React.useState([]); | ||
React.useEffect(() => { | ||
getSalesReportByProduct() | ||
.then((result) => { | ||
setDatas(result.data); | ||
// setMaxPage(Math.ceil(result.data.count / 3)); | ||
}) | ||
.catch((error) => alert("Server Unavailable")); | ||
}, []); | ||
|
||
// React.useEffect(() => { | ||
// const query = generateUrlQuery(name, page, filterBy, filter, sort, order, startDate, endDate); | ||
|
||
// getBranchInventories(query) | ||
// .then((result) => { | ||
// setDatas(result.data.rows); | ||
// setMaxPage(Math.ceil(result.data.count / 3)); | ||
// }) | ||
// .catch((error) => alert("Server Unavailable")); | ||
// }, [filter, order, page, name, startDate, endDate]); | ||
|
||
return datas && <ProductSalesReportBodyContent datas={datas} />; | ||
}; | ||
|
||
export default ProductSalesReportTableBody; |
62 changes: 62 additions & 0 deletions
62
...cts/client/src/components/SalesReport/ProductSalesReport/ProductSalesReportTableGroup.jsx
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,62 @@ | ||
import React from "react"; | ||
|
||
import { orderDefault, sortDefault } from "../handlers/SalesReportHandler"; | ||
import SearchConfiguration from "../SearchConfiguration.jsx"; | ||
import Pagination from "../../Pagination.jsx"; | ||
|
||
import SalesReportTable from "./ProductSalesReportTable.jsx"; | ||
import ProductSalesReportTable from "./ProductSalesReportTable.jsx"; | ||
|
||
const ProductSalesReportTableGroup = () => { | ||
const [name, setName] = React.useState(""); | ||
const [filterBy, setFilterBy] = React.useState(""); | ||
const [filter, setFilter] = React.useState(""); | ||
const [sort, setSort] = React.useState(""); | ||
const [order, setOrder] = React.useState(""); | ||
const [page, setPage] = React.useState(1); | ||
const [maxPage, setMaxPage] = React.useState(1); | ||
const [startDate, setStartDate] = React.useState(""); | ||
const [endDate, setEndDate] = React.useState(""); | ||
|
||
React.useEffect(() => { | ||
setPage(1); | ||
}, [name, filter, order, startDate, endDate]); | ||
|
||
return ( | ||
<div className="flex flex-col justify-start pt-0.5 mt-7 px-4 h-full"> | ||
<h1>Product report</h1> | ||
<SearchConfiguration | ||
setPage={setPage} | ||
setName={setName} | ||
filterBy={filterBy} | ||
setFilterBy={setFilterBy} | ||
filter={filter} | ||
setFilter={setFilter} | ||
sort={sort} | ||
setSort={setSort} | ||
order={order} | ||
setOrder={setOrder} | ||
startDate={startDate} | ||
endDate={endDate} | ||
setStartDate={setStartDate} | ||
setEndDate={setEndDate} | ||
/> | ||
<ProductSalesReportTable | ||
name={name} | ||
sort={sort} | ||
filterBy={filterBy} | ||
filter={filter} | ||
order={order} | ||
page={page} | ||
setMaxPage={setMaxPage} | ||
startDate={startDate} | ||
endDate={endDate} | ||
/> | ||
<div className="mx-auto mt-16"> | ||
<Pagination page={page} setPage={setPage} maxPage={maxPage} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProductSalesReportTableGroup; |
16 changes: 16 additions & 0 deletions
16
...ects/client/src/components/SalesReport/ProductSalesReport/ProductSalesReportTableHead.jsx
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,16 @@ | ||
import React from "react"; | ||
|
||
const ProductSalesReportTableHead = () => { | ||
const thClassName = "py-6 bg-green-500 text-green-100 px-10 whitespace-nowrap"; | ||
return ( | ||
<thead className="uppercase"> | ||
<tr className="text-center"> | ||
<th className={"py-6 bg-green-500 text-green-100 px-1 whitespace-nowrap"}>No.</th> | ||
<th className={"py-6 bg-green-500 text-green-100 px-1 whitespace-nowrap"}>Product's Name</th> | ||
<th className={"py-6 bg-green-500 text-green-100 px-1 whitespace-nowrap"}>Quantity</th> | ||
</tr> | ||
</thead> | ||
); | ||
}; | ||
|
||
export default ProductSalesReportTableHead; |
45 changes: 45 additions & 0 deletions
45
projects/client/src/components/SalesReport/ProductSalesReport/ProductSalesViewMode.jsx
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,45 @@ | ||
const Mutation = ({ item }) => { | ||
const changes = item.stock_after - item.stock_before; | ||
const isNegative = changes < 0; | ||
|
||
const string = isNegative ? changes.toString() : `+${changes}`; | ||
const className = isNegative ? "text-red font-bold" : "text-green-300 font-bold"; | ||
|
||
return <span className={className}>{string}</span>; | ||
}; | ||
|
||
const Time = ({ item }) => { | ||
const fullDate = new Date(item.created_at).toString(); | ||
const date = fullDate.split(" ").slice(0, 4).join(" ").replace(" ", ", "); | ||
const time = fullDate.split(" ").slice(4, 5).join(" "); | ||
|
||
return ( | ||
<span> | ||
{date} - {time} | ||
</span> | ||
); | ||
}; | ||
|
||
const ProductSalesViewMode = ({ item, index }) => { | ||
const tdClassName = index % 2 ? "py-4 bg-green-100 text-xs text-center" : "py-4 bg-white text-xs text-center"; | ||
return ( | ||
<tbody key={index}> | ||
<tr> | ||
{/* <td className={tdClassName}> | ||
<img src={item.Inventory.Product.image} className="max-w-[80px] mx-auto" /> | ||
</td> */} | ||
<td className={tdClassName}>{index + 1}</td> | ||
<td className={tdClassName}>{item.name}</td> | ||
<td className={tdClassName}>{item.qty}</td> | ||
{/* <td className={tdClassName}> | ||
<Mutation item={item} /> | ||
</td> | ||
<td className={tdClassName}> | ||
<Time item={item} /> | ||
</td> */} | ||
</tr> | ||
</tbody> | ||
); | ||
}; | ||
|
||
export default ProductSalesViewMode; |
10 changes: 10 additions & 0 deletions
10
projects/client/src/components/SalesReport/SalesTable/SalesReportBodyContent.jsx
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,10 @@ | ||
// import React from "react"; | ||
// // import ViewMode from "./ViewMode"; | ||
|
||
// const SalesReportBodyContent = ({ datas }) => { | ||
// return datas.map((item, index) => { | ||
// return <ViewMode item={item} key={index} index={index} />; | ||
// }); | ||
// }; | ||
|
||
// export default SalesReportBodyContent; |
Oops, something went wrong.