feat(documents): implement document upload functionality for companies
- Added DocumentItem component to display uploaded documents in CompanyDetailsPage. - Introduced useUploadCompanyDocuments hook for handling document uploads. - Updated CreateCompany form to include document upload capabilities and validation for file types and sizes. - Enhanced API services to support batch document uploads and retrieval of document information. - Improved response handling in the file service for better error management and user feedback.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
import Loading from "@/components/loading";
|
||||
import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb";
|
||||
import DocumentItem from "@/components/forms/companies/documents/DocumentItem";
|
||||
import { ShowcaseSection } from "@/components/Layouts/showcase-section";
|
||||
import Status from "@/components/ui/Status";
|
||||
import { useCompanyDetails } from "@/hooks/queries";
|
||||
@@ -72,6 +73,9 @@ const CompanyDetailsPage = ({ params }: IProps) => {
|
||||
if (isLoading) return <Loading />;
|
||||
const company = data.data;
|
||||
const website = company.website?.trim();
|
||||
const documentFileIds: string[] = Array.isArray(company.document_file_ids)
|
||||
? company.document_file_ids
|
||||
: [];
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -215,6 +219,17 @@ const CompanyDetailsPage = ({ params }: IProps) => {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{documentFileIds.length > 0 && (
|
||||
<div>
|
||||
<SectionHeading>Documents</SectionHeading>
|
||||
<div className="grid gap-3 sm:grid-cols-2">
|
||||
{documentFileIds.map((fileId) => (
|
||||
<DocumentItem key={fileId} fileId={fileId} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</ShowcaseSection>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user