Owner should only be able to complete an active rental not a confirmed rental. Removed an icon

This commit is contained in:
jackiettran
2026-01-01 23:49:03 -05:00
parent 0682494ee0
commit 0104f369a9
3 changed files with 18 additions and 24 deletions

View File

@@ -875,9 +875,9 @@ router.post("/:id/mark-completed", authenticateToken, async (req, res) => {
.json({ error: "Only owners can mark rentals as completed" }); .json({ error: "Only owners can mark rentals as completed" });
} }
if (!["active", "confirmed"].includes(rental.status)) { if (rental.status !== "active") {
return res.status(400).json({ return res.status(400).json({
error: "Can only mark active or confirmed rentals as completed", error: "Can only mark active rentals as completed",
}); });
} }
@@ -1197,9 +1197,9 @@ router.post("/:id/mark-return", authenticateToken, async (req, res, next) => {
.json({ error: "Only the item owner can mark return status" }); .json({ error: "Only the item owner can mark return status" });
} }
if (!["confirmed", "active"].includes(rental.status)) { if (rental.status !== "active") {
return res.status(400).json({ return res.status(400).json({
error: "Can only mark return status for confirmed or active rentals", error: "Can only mark return status for active rentals",
}); });
} }

View File

@@ -85,7 +85,10 @@ const ConditionCheckModal: React.FC<ConditionCheckModalProps> = ({
setError(null); setError(null);
// Upload photos to S3 first (with resizing) // Upload photos to S3 first (with resizing)
const uploadResults = await uploadImagesWithVariants("condition-check", photos); const uploadResults = await uploadImagesWithVariants(
"condition-check",
photos
);
const imageFilenames = uploadResults.map((result) => result.baseKey); const imageFilenames = uploadResults.map((result) => result.baseKey);
// Submit condition check with S3 keys // Submit condition check with S3 keys
@@ -154,7 +157,9 @@ const ConditionCheckModal: React.FC<ConditionCheckModalProps> = ({
<div className="mb-3"> <div className="mb-3">
<label className="form-label"> <label className="form-label">
Photos <span className="text-danger">*</span> Photos <span className="text-danger">*</span>
<small className="text-muted ms-2">(Maximum {IMAGE_LIMITS.conditionChecks} photos)</small> <small className="text-muted ms-2">
(Maximum {IMAGE_LIMITS.conditionChecks} photos)
</small>
</label> </label>
<input <input
type="file" type="file"
@@ -247,10 +252,7 @@ const ConditionCheckModal: React.FC<ConditionCheckModalProps> = ({
Submitting... Submitting...
</> </>
) : ( ) : (
<> <>Submit Condition Check</>
<i className="bi bi-check-lg me-2" />
Submit Condition Check
</>
)} )}
</button> </button>
</div> </div>

View File

@@ -513,20 +513,12 @@ const Owning: React.FC = () => {
</> </>
)} )}
{rental.status === "confirmed" && ( {rental.status === "confirmed" && (
<> <button
<button className="btn btn-sm btn-outline-danger"
className="btn btn-sm btn-success" onClick={() => handleCancelClick(rental)}
onClick={() => handleCompleteClick(rental)} >
> Cancel
Complete </button>
</button>
<button
className="btn btn-sm btn-outline-danger"
onClick={() => handleCancelClick(rental)}
>
Cancel
</button>
</>
)} )}
{rental.status === "active" && ( {rental.status === "active" && (
<button <button