replaced vague notes with specific intended use, also fixed modal on top of modal for reviews
This commit is contained in:
@@ -24,7 +24,6 @@ const ReturnStatusModal: React.FC<ReturnStatusModalProps> = ({
|
||||
lost: false,
|
||||
});
|
||||
const [actualReturnDateTime, setActualReturnDateTime] = useState("");
|
||||
const [notes, setNotes] = useState("");
|
||||
const [conditionNotes, setConditionNotes] = useState("");
|
||||
const [photos, setPhotos] = useState<File[]>([]);
|
||||
const [processing, setProcessing] = useState(false);
|
||||
@@ -56,7 +55,6 @@ const ReturnStatusModal: React.FC<ReturnStatusModalProps> = ({
|
||||
lost: false,
|
||||
});
|
||||
setActualReturnDateTime("");
|
||||
setNotes("");
|
||||
setConditionNotes("");
|
||||
setPhotos([]);
|
||||
setError(null);
|
||||
@@ -71,13 +69,13 @@ const ReturnStatusModal: React.FC<ReturnStatusModalProps> = ({
|
||||
|
||||
// Create blob URLs for photo previews and clean them up
|
||||
const photoBlobUrls = useMemo(() => {
|
||||
return photos.map(photo => URL.createObjectURL(photo));
|
||||
return photos.map((photo) => URL.createObjectURL(photo));
|
||||
}, [photos]);
|
||||
|
||||
// Cleanup blob URLs when photos change or component unmounts
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
photoBlobUrls.forEach(url => URL.revokeObjectURL(url));
|
||||
photoBlobUrls.forEach((url) => URL.revokeObjectURL(url));
|
||||
};
|
||||
}, [photoBlobUrls]);
|
||||
|
||||
@@ -202,6 +200,7 @@ const ReturnStatusModal: React.FC<ReturnStatusModalProps> = ({
|
||||
);
|
||||
if (!hasSelection) {
|
||||
setError("Please select at least one return status option");
|
||||
setProcessing(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -316,7 +315,6 @@ const ReturnStatusModal: React.FC<ReturnStatusModalProps> = ({
|
||||
const data: any = {
|
||||
status: primaryStatus,
|
||||
statusOptions, // Send all selected options
|
||||
notes: notes.trim() || undefined,
|
||||
};
|
||||
|
||||
if (statusOptions.returned_late) {
|
||||
@@ -346,7 +344,6 @@ const ReturnStatusModal: React.FC<ReturnStatusModalProps> = ({
|
||||
lost: false,
|
||||
});
|
||||
setActualReturnDateTime("");
|
||||
setNotes("");
|
||||
setConditionNotes("");
|
||||
setPhotos([]);
|
||||
setError(null);
|
||||
@@ -950,7 +947,7 @@ const ReturnStatusModal: React.FC<ReturnStatusModalProps> = ({
|
||||
>
|
||||
<span className="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
Processing...
|
||||
Submitting...
|
||||
</>
|
||||
) : (
|
||||
"Submit"
|
||||
|
||||
@@ -69,6 +69,18 @@ const ReviewItemModal: React.FC<ReviewItemModalProps> = ({
|
||||
|
||||
if (!show) return null;
|
||||
|
||||
// Show success modal instead of review modal after successful submission
|
||||
if (showSuccessModal) {
|
||||
return (
|
||||
<SuccessModal
|
||||
show={true}
|
||||
onClose={handleSuccessModalClose}
|
||||
title="Thank you for your review!"
|
||||
message={successMessage}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="modal d-block"
|
||||
@@ -212,13 +224,6 @@ const ReviewItemModal: React.FC<ReviewItemModalProps> = ({
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SuccessModal
|
||||
show={showSuccessModal}
|
||||
onClose={handleSuccessModalClose}
|
||||
title="Thank you for your review!"
|
||||
message={successMessage}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -69,6 +69,18 @@ const ReviewRenterModal: React.FC<ReviewRenterModalProps> = ({
|
||||
|
||||
if (!show) return null;
|
||||
|
||||
// Show success modal instead of review modal after successful submission
|
||||
if (showSuccessModal) {
|
||||
return (
|
||||
<SuccessModal
|
||||
show={true}
|
||||
onClose={handleSuccessModalClose}
|
||||
title="Thank you for your review!"
|
||||
message={successMessage}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="modal d-block"
|
||||
@@ -212,13 +224,6 @@ const ReviewRenterModal: React.FC<ReviewRenterModalProps> = ({
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SuccessModal
|
||||
show={showSuccessModal}
|
||||
onClose={handleSuccessModalClose}
|
||||
title="Thank you for your review!"
|
||||
message={successMessage}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user