-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
394 additions
and
55 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
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
22 changes: 22 additions & 0 deletions
22
frontend/src/AgroShopAI/components/Pages/components/ReturnAdminFilter.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,22 @@ | ||
import React from "react"; | ||
|
||
export default function ReturnFilter({ filter, setFilter }) { | ||
return ( | ||
<div className="flex items-center"> | ||
<label htmlFor="filter" className="mr-4 text-green-700"> | ||
Filter by Status: | ||
</label> | ||
<select | ||
id="filter" | ||
value={filter} | ||
onChange={(e) => setFilter(e.target.value)} | ||
className="p-2 border rounded" | ||
> | ||
<option value="All">All</option> | ||
<option value="Eligible">Eligible</option> | ||
<option value="Pending">Pending</option> | ||
<option value="Returned">Returned</option> | ||
</select> | ||
</div> | ||
); | ||
} |
9 changes: 9 additions & 0 deletions
9
frontend/src/AgroShopAI/components/Pages/components/ReturnAdminHeader.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,9 @@ | ||
import React from "react"; | ||
|
||
export default function ReturnHeader() { | ||
return ( | ||
<header className="bg-green-700 text-white p-4"> | ||
<h1 className="text-3xl font-bold">Return Rented Equipment</h1> | ||
</header> | ||
); | ||
} |
26 changes: 26 additions & 0 deletions
26
frontend/src/AgroShopAI/components/Pages/components/ReturnAdminHistory.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,26 @@ | ||
import React from "react"; | ||
|
||
export default function ReturnHistory({ history }) { | ||
return ( | ||
<div className="mt-8"> | ||
<h3 className="text-2xl font-semibold text-green-800 mb-4"> | ||
Return History | ||
</h3> | ||
<ul> | ||
{history.map((item, index) => ( | ||
<li | ||
key={index} | ||
className="mb-4 p-4 border rounded bg-white shadow-md" | ||
> | ||
<p className="font-semibold">{item.name}</p> | ||
<p className="text-sm text-gray-600"> | ||
Returned on: {item.returnDate} | ||
</p> | ||
<p className="text-sm text-gray-600">Condition: {item.condition}</p> | ||
<p className="text-sm text-gray-600">Comment: {item.comment}</p> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
} |
81 changes: 81 additions & 0 deletions
81
frontend/src/AgroShopAI/components/Pages/components/ReturnAdminModal.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,81 @@ | ||
import React from "react"; | ||
|
||
export default function ReturnModal({ | ||
isModalOpen, | ||
setIsModalOpen, | ||
selectedProduct, | ||
handleSubmitReturn, | ||
returnDate, | ||
setReturnDate, | ||
condition, | ||
setCondition, | ||
comment, | ||
setComment, | ||
}) { | ||
if (!isModalOpen || !selectedProduct) return null; | ||
|
||
return ( | ||
<div className="fixed inset-0 flex items-center justify-center bg-gray-700 bg-opacity-50"> | ||
<div className="bg-white p-6 rounded shadow-lg max-w-md w-full"> | ||
<h2 className="text-xl font-semibold mb-4"> | ||
Return {selectedProduct.name} | ||
</h2> | ||
<form onSubmit={handleSubmitReturn}> | ||
<div className="mb-4"> | ||
<label htmlFor="returnDate" className="block text-sm text-gray-700"> | ||
Return Date: | ||
</label> | ||
<input | ||
type="date" | ||
id="returnDate" | ||
value={returnDate} | ||
onChange={(e) => setReturnDate(e.target.value)} | ||
className="w-full p-2 border rounded" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label htmlFor="condition" className="block text-sm text-gray-700"> | ||
Condition: | ||
</label> | ||
<select | ||
id="condition" | ||
value={condition} | ||
onChange={(e) => setCondition(e.target.value)} | ||
className="w-full p-2 border rounded" | ||
> | ||
<option value="Good">Good</option> | ||
<option value="Damaged">Damaged</option> | ||
<option value="Broken">Broken</option> | ||
</select> | ||
</div> | ||
<div className="mb-4"> | ||
<label htmlFor="comment" className="block text-sm text-gray-700"> | ||
Comment: | ||
</label> | ||
<textarea | ||
id="comment" | ||
value={comment} | ||
onChange={(e) => setComment(e.target.value)} | ||
className="w-full p-2 border rounded" | ||
/> | ||
</div> | ||
<div className="flex justify-between"> | ||
<button | ||
type="button" | ||
onClick={() => setIsModalOpen(false)} | ||
className="px-4 py-2 bg-gray-500 text-white rounded" | ||
> | ||
Cancel | ||
</button> | ||
<button | ||
type="submit" | ||
className="px-4 py-2 bg-green-600 text-white rounded" | ||
> | ||
Submit Return | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
frontend/src/AgroShopAI/components/Pages/components/ReturnAdminProductCard.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,20 @@ | ||
import React from "react"; | ||
|
||
export default function ReturnProductCard({ product, handleReturn }) { | ||
return ( | ||
<div className="border p-4 rounded shadow-lg bg-white"> | ||
<img src={product.image} alt={product.name} className="w-full h-32 object-cover mb-4" /> | ||
<h3 className="text-xl font-semibold">{product.name}</h3> | ||
<p className="text-sm text-gray-600">{product.model}</p> | ||
<div className="mt-4 flex justify-between"> | ||
<span className="text-sm text-gray-500">Status: {product.status}</span> | ||
<button | ||
onClick={() => handleReturn(product)} | ||
className="px-4 py-2 bg-green-600 text-white rounded" | ||
> | ||
Return | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.