Document Upload Dialogue update

This commit is contained in:
Koncept Kit
2026-01-02 15:35:30 +07:00
parent a6c2475092
commit 33a4d8f4c4
3 changed files with 47 additions and 26 deletions

View File

@@ -42,7 +42,7 @@ const AdminFinancials = () => {
year: new Date().getFullYear(),
title: '',
document_url: '',
document_type: 'google_drive'
document_type: 'link'
});
const [submitting, setSubmitting] = useState(false);
@@ -67,8 +67,9 @@ const AdminFinancials = () => {
year: new Date().getFullYear(),
title: '',
document_url: '',
document_type: 'google_drive'
document_type: 'link'
});
setUploadedFile(null);
setDialogOpen(true);
};
@@ -274,14 +275,16 @@ const AdminFinancials = () => {
<Label htmlFor="document_type">Document Type *</Label>
<Select
value={formData.document_type}
onValueChange={(value) => setFormData({ ...formData, document_type: value })}
onValueChange={(value) => {
setFormData({ ...formData, document_type: value, document_url: '' });
setUploadedFile(null);
}}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="google_drive">Google Drive</SelectItem>
<SelectItem value="pdf">PDF</SelectItem>
<SelectItem value="link">Link</SelectItem>
<SelectItem value="upload">Upload</SelectItem>
</SelectContent>
</Select>
@@ -302,6 +305,11 @@ const AdminFinancials = () => {
Selected: {uploadedFile.name}
</p>
)}
{selectedReport && !uploadedFile && (
<p className="text-sm text-[#664fa3] mt-1">
Current file will be kept if no new file is selected
</p>
)}
</div>
) : (
<div>
@@ -310,12 +318,11 @@ const AdminFinancials = () => {
id="document_url"
value={formData.document_url}
onChange={(e) => setFormData({ ...formData, document_url: e.target.value })}
placeholder="https://drive.google.com/file/d/..."
placeholder="https://docs.google.com/... or https://example.com/file.pdf"
required
/>
<p className="text-sm text-[#664fa3] mt-1">
{formData.document_type === 'google_drive' && 'Paste the shareable link to your Google Drive file'}
{formData.document_type === 'pdf' && 'Paste the URL to your PDF file'}
Paste the shareable link to your document (Google Drive, Dropbox, PDF URL, etc.)
</p>
</div>
)}