From 100b567e3a92b69aa4d179044b8257a3843e6132 Mon Sep 17 00:00:00 2001 From: sazzadulalambd Date: Sun, 10 May 2026 03:33:38 +0600 Subject: [PATCH] feat: add document upload modal and handling logic to rental details page --- src/app/admin/rentals/[id]/page.tsx | 49 ++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/src/app/admin/rentals/[id]/page.tsx b/src/app/admin/rentals/[id]/page.tsx index bf66288..2d46615 100644 --- a/src/app/admin/rentals/[id]/page.tsx +++ b/src/app/admin/rentals/[id]/page.tsx @@ -296,6 +296,8 @@ export default function RentalDetailPage() { const [smsText, setSmsText] = useState(''); const [damages, setDamages] = useState(mockDamageHistory); const [documents, setDocuments] = useState(mockDocuments); + const [showUploadModal, setShowUploadModal] = useState(false); + const [uploadDocName, setUploadDocName] = useState(''); const [acceptPermission, setAcceptPermission] = useState(false); const [rejectPermission, setRejectPermission] = useState(false); @@ -462,6 +464,13 @@ export default function RentalDetailPage() { setShowDamageModal(false); }; + const handleUploadDocument = () => { + if (!uploadDocName.trim()) return; + setDocuments(prev => [...prev, { id: `DOC-${Date.now()}`, name: uploadDocName, type: 'other', uploadedAt: new Date().toISOString().split('T')[0], downloaded: false }]); + setUploadDocName(''); + setShowUploadModal(false); + }; + const handleSendSms = () => { if (!smsText.trim()) return; alert(`SMS sent to ${rental.userPhone}: ${smsText}`); @@ -841,7 +850,7 @@ export default function RentalDetailPage() {

Rental Documents

- @@ -1104,6 +1113,44 @@ export default function RentalDetailPage() { )} + + {showUploadModal && ( +
+
+
+

+ Upload Document +

+ +
+
+
+ + setUploadDocName(e.target.value)} + className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" + placeholder="Enter document name..." + /> +
+
+ +
+ +

Click to upload or drag and drop

+

PDF, PNG, JPG (max 10MB)

+ +
+
+
+
+ + +
+
+
+ )} ); } \ No newline at end of file