Document Upload Dialogue update
This commit is contained in:
@@ -44,7 +44,7 @@ const AdminBylaws = () => {
|
|||||||
version: '',
|
version: '',
|
||||||
effective_date: '',
|
effective_date: '',
|
||||||
document_url: '',
|
document_url: '',
|
||||||
document_type: 'google_drive',
|
document_type: 'link',
|
||||||
is_current: false
|
is_current: false
|
||||||
});
|
});
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
@@ -71,9 +71,10 @@ const AdminBylaws = () => {
|
|||||||
version: '',
|
version: '',
|
||||||
effective_date: new Date().toISOString().split('T')[0],
|
effective_date: new Date().toISOString().split('T')[0],
|
||||||
document_url: '',
|
document_url: '',
|
||||||
document_type: 'google_drive',
|
document_type: 'link',
|
||||||
is_current: bylaws.length === 0 // Auto-check if this is the first bylaws
|
is_current: bylaws.length === 0 // Auto-check if this is the first bylaws
|
||||||
});
|
});
|
||||||
|
setUploadedFile(null);
|
||||||
setDialogOpen(true);
|
setDialogOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -246,7 +247,7 @@ const AdminBylaws = () => {
|
|||||||
<div className="flex items-center gap-4 text-sm text-[#664fa3]">
|
<div className="flex items-center gap-4 text-sm text-[#664fa3]">
|
||||||
<span>Effective Date: <strong>{formatDate(currentBylaws.effective_date)}</strong></span>
|
<span>Effective Date: <strong>{formatDate(currentBylaws.effective_date)}</strong></span>
|
||||||
<span>•</span>
|
<span>•</span>
|
||||||
<span>Document Type: <strong>{currentBylaws.document_type === 'google_drive' ? 'Google Drive' : currentBylaws.document_type.toUpperCase()}</strong></span>
|
<span>Document Type: <strong>{currentBylaws.document_type === 'upload' ? 'PDF Upload' : 'Link'}</strong></span>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
) : (
|
) : (
|
||||||
@@ -363,14 +364,16 @@ const AdminBylaws = () => {
|
|||||||
<Label htmlFor="document_type">Document Type *</Label>
|
<Label htmlFor="document_type">Document Type *</Label>
|
||||||
<Select
|
<Select
|
||||||
value={formData.document_type}
|
value={formData.document_type}
|
||||||
onValueChange={(value) => setFormData({ ...formData, document_type: value })}
|
onValueChange={(value) => {
|
||||||
|
setFormData({ ...formData, document_type: value, document_url: '' });
|
||||||
|
setUploadedFile(null);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue />
|
<SelectValue />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="google_drive">Google Drive</SelectItem>
|
<SelectItem value="link">Link</SelectItem>
|
||||||
<SelectItem value="pdf">PDF</SelectItem>
|
|
||||||
<SelectItem value="upload">Upload</SelectItem>
|
<SelectItem value="upload">Upload</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
@@ -391,6 +394,11 @@ const AdminBylaws = () => {
|
|||||||
Selected: {uploadedFile.name}
|
Selected: {uploadedFile.name}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
{selectedBylaws && !uploadedFile && (
|
||||||
|
<p className="text-sm text-[#664fa3] mt-1">
|
||||||
|
Current file will be kept if no new file is selected
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
@@ -399,12 +407,11 @@ const AdminBylaws = () => {
|
|||||||
id="document_url"
|
id="document_url"
|
||||||
value={formData.document_url}
|
value={formData.document_url}
|
||||||
onChange={(e) => setFormData({ ...formData, document_url: e.target.value })}
|
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
|
required
|
||||||
/>
|
/>
|
||||||
<p className="text-sm text-[#664fa3] mt-1">
|
<p className="text-sm text-[#664fa3] mt-1">
|
||||||
{formData.document_type === 'google_drive' && 'Paste the shareable link to your Google Drive file'}
|
Paste the shareable link to your document (Google Drive, Dropbox, PDF URL, etc.)
|
||||||
{formData.document_type === 'pdf' && 'Paste the URL to your PDF file'}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const AdminFinancials = () => {
|
|||||||
year: new Date().getFullYear(),
|
year: new Date().getFullYear(),
|
||||||
title: '',
|
title: '',
|
||||||
document_url: '',
|
document_url: '',
|
||||||
document_type: 'google_drive'
|
document_type: 'link'
|
||||||
});
|
});
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
|
|
||||||
@@ -67,8 +67,9 @@ const AdminFinancials = () => {
|
|||||||
year: new Date().getFullYear(),
|
year: new Date().getFullYear(),
|
||||||
title: '',
|
title: '',
|
||||||
document_url: '',
|
document_url: '',
|
||||||
document_type: 'google_drive'
|
document_type: 'link'
|
||||||
});
|
});
|
||||||
|
setUploadedFile(null);
|
||||||
setDialogOpen(true);
|
setDialogOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -274,14 +275,16 @@ const AdminFinancials = () => {
|
|||||||
<Label htmlFor="document_type">Document Type *</Label>
|
<Label htmlFor="document_type">Document Type *</Label>
|
||||||
<Select
|
<Select
|
||||||
value={formData.document_type}
|
value={formData.document_type}
|
||||||
onValueChange={(value) => setFormData({ ...formData, document_type: value })}
|
onValueChange={(value) => {
|
||||||
|
setFormData({ ...formData, document_type: value, document_url: '' });
|
||||||
|
setUploadedFile(null);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue />
|
<SelectValue />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="google_drive">Google Drive</SelectItem>
|
<SelectItem value="link">Link</SelectItem>
|
||||||
<SelectItem value="pdf">PDF</SelectItem>
|
|
||||||
<SelectItem value="upload">Upload</SelectItem>
|
<SelectItem value="upload">Upload</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
@@ -302,6 +305,11 @@ const AdminFinancials = () => {
|
|||||||
Selected: {uploadedFile.name}
|
Selected: {uploadedFile.name}
|
||||||
</p>
|
</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>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
@@ -310,12 +318,11 @@ const AdminFinancials = () => {
|
|||||||
id="document_url"
|
id="document_url"
|
||||||
value={formData.document_url}
|
value={formData.document_url}
|
||||||
onChange={(e) => setFormData({ ...formData, document_url: e.target.value })}
|
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
|
required
|
||||||
/>
|
/>
|
||||||
<p className="text-sm text-[#664fa3] mt-1">
|
<p className="text-sm text-[#664fa3] mt-1">
|
||||||
{formData.document_type === 'google_drive' && 'Paste the shareable link to your Google Drive file'}
|
Paste the shareable link to your document (Google Drive, Dropbox, PDF URL, etc.)
|
||||||
{formData.document_type === 'pdf' && 'Paste the URL to your PDF file'}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const AdminNewsletters = () => {
|
|||||||
description: '',
|
description: '',
|
||||||
published_date: '',
|
published_date: '',
|
||||||
document_url: '',
|
document_url: '',
|
||||||
document_type: 'google_docs'
|
document_type: 'link'
|
||||||
});
|
});
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
|
|
||||||
@@ -70,8 +70,9 @@ const AdminNewsletters = () => {
|
|||||||
description: '',
|
description: '',
|
||||||
published_date: new Date().toISOString().split('T')[0],
|
published_date: new Date().toISOString().split('T')[0],
|
||||||
document_url: '',
|
document_url: '',
|
||||||
document_type: 'google_docs'
|
document_type: 'link'
|
||||||
});
|
});
|
||||||
|
setUploadedFile(null);
|
||||||
setDialogOpen(true);
|
setDialogOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -232,7 +233,7 @@ const AdminNewsletters = () => {
|
|||||||
{formatDate(newsletter.published_date)}
|
{formatDate(newsletter.published_date)}
|
||||||
</Badge>
|
</Badge>
|
||||||
<Badge variant="outline" className="border-[#664fa3] text-[#664fa3]">
|
<Badge variant="outline" className="border-[#664fa3] text-[#664fa3]">
|
||||||
{newsletter.document_type === 'google_docs' ? 'Google Docs' : newsletter.document_type.toUpperCase()}
|
{newsletter.document_type === 'upload' ? 'PDF Upload' : 'Link'}
|
||||||
</Badge>
|
</Badge>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@@ -322,14 +323,16 @@ const AdminNewsletters = () => {
|
|||||||
<Label htmlFor="document_type">Document Type *</Label>
|
<Label htmlFor="document_type">Document Type *</Label>
|
||||||
<Select
|
<Select
|
||||||
value={formData.document_type}
|
value={formData.document_type}
|
||||||
onValueChange={(value) => setFormData({ ...formData, document_type: value })}
|
onValueChange={(value) => {
|
||||||
|
setFormData({ ...formData, document_type: value, document_url: '' });
|
||||||
|
setUploadedFile(null);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue />
|
<SelectValue />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="google_docs">Google Docs</SelectItem>
|
<SelectItem value="link">Link</SelectItem>
|
||||||
<SelectItem value="pdf">PDF</SelectItem>
|
|
||||||
<SelectItem value="upload">Upload</SelectItem>
|
<SelectItem value="upload">Upload</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
@@ -350,6 +353,11 @@ const AdminNewsletters = () => {
|
|||||||
Selected: {uploadedFile.name}
|
Selected: {uploadedFile.name}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
{selectedNewsletter && !uploadedFile && (
|
||||||
|
<p className="text-sm text-[#664fa3] mt-1">
|
||||||
|
Current file will be kept if no new file is selected
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
@@ -358,12 +366,11 @@ const AdminNewsletters = () => {
|
|||||||
id="document_url"
|
id="document_url"
|
||||||
value={formData.document_url}
|
value={formData.document_url}
|
||||||
onChange={(e) => setFormData({ ...formData, document_url: e.target.value })}
|
onChange={(e) => setFormData({ ...formData, document_url: e.target.value })}
|
||||||
placeholder="https://docs.google.com/document/d/..."
|
placeholder="https://docs.google.com/document/d/... or https://example.com/file.pdf"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<p className="text-sm text-[#664fa3] mt-1">
|
<p className="text-sm text-[#664fa3] mt-1">
|
||||||
{formData.document_type === 'google_docs' && 'Paste the shareable link to your Google Doc'}
|
Paste the shareable link to your document (Google Docs, Dropbox, PDF URL, etc.)
|
||||||
{formData.document_type === 'pdf' && 'Paste the URL to your PDF file'}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user