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" });
}
if (!["active", "confirmed"].includes(rental.status)) {
if (rental.status !== "active") {
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" });
}
if (!["confirmed", "active"].includes(rental.status)) {
if (rental.status !== "active") {
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);
// 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);
// Submit condition check with S3 keys
@@ -154,7 +157,9 @@ const ConditionCheckModal: React.FC<ConditionCheckModalProps> = ({
<div className="mb-3">
<label className="form-label">
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>
<input
type="file"
@@ -247,10 +252,7 @@ const ConditionCheckModal: React.FC<ConditionCheckModalProps> = ({
Submitting...
</>
) : (
<>
<i className="bi bi-check-lg me-2" />
Submit Condition Check
</>
<>Submit Condition Check</>
)}
</button>
</div>

View File

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