removed cron job that made rentals active. Now whether or not the rental is active is determined on the fly
This commit is contained in:
@@ -182,8 +182,9 @@ const Renting: React.FC = () => {
|
||||
};
|
||||
|
||||
// Filter rentals - show only active rentals (declined go to history)
|
||||
// Use displayStatus for filtering as it includes computed "active" status
|
||||
const renterActiveRentals = rentals.filter((r) =>
|
||||
["pending", "confirmed", "active"].includes(r.status)
|
||||
["pending", "confirmed", "active"].includes(r.displayStatus || r.status)
|
||||
);
|
||||
|
||||
if (loading) {
|
||||
@@ -268,25 +269,25 @@ const Renting: React.FC = () => {
|
||||
<div className="mb-2">
|
||||
<span
|
||||
className={`badge ${
|
||||
rental.status === "active"
|
||||
(rental.displayStatus || rental.status) === "active"
|
||||
? "bg-success"
|
||||
: rental.status === "pending"
|
||||
: (rental.displayStatus || rental.status) === "pending"
|
||||
? "bg-warning"
|
||||
: rental.status === "confirmed"
|
||||
: (rental.displayStatus || rental.status) === "confirmed"
|
||||
? "bg-info"
|
||||
: rental.status === "declined"
|
||||
: (rental.displayStatus || rental.status) === "declined"
|
||||
? "bg-secondary"
|
||||
: "bg-danger"
|
||||
}`}
|
||||
>
|
||||
{rental.status === "pending"
|
||||
{(rental.displayStatus || rental.status) === "pending"
|
||||
? "Awaiting Owner Approval"
|
||||
: rental.status === "confirmed"
|
||||
: (rental.displayStatus || rental.status) === "confirmed"
|
||||
? "Confirmed & Paid"
|
||||
: rental.status === "declined"
|
||||
: (rental.displayStatus || rental.status) === "declined"
|
||||
? "Declined by Owner"
|
||||
: rental.status.charAt(0).toUpperCase() +
|
||||
rental.status.slice(1)}
|
||||
: (rental.displayStatus || rental.status).charAt(0).toUpperCase() +
|
||||
(rental.displayStatus || rental.status).slice(1)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -362,8 +363,8 @@ const Renting: React.FC = () => {
|
||||
|
||||
<div className="d-flex flex-column gap-2 mt-3">
|
||||
<div className="d-flex gap-2">
|
||||
{(rental.status === "pending" ||
|
||||
rental.status === "confirmed") && (
|
||||
{((rental.displayStatus || rental.status) === "pending" ||
|
||||
(rental.displayStatus || rental.status) === "confirmed") && (
|
||||
<button
|
||||
className="btn btn-sm btn-danger"
|
||||
onClick={() => handleCancelClick(rental)}
|
||||
@@ -371,7 +372,7 @@ const Renting: React.FC = () => {
|
||||
Cancel
|
||||
</button>
|
||||
)}
|
||||
{rental.status === "active" &&
|
||||
{(rental.displayStatus || rental.status) === "active" &&
|
||||
!rental.itemRating &&
|
||||
!rental.itemReviewSubmittedAt && (
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user