diff --git a/hosting/src/app/[site]/content/[type]/page.tsx b/hosting/src/app/[site]/content/[type]/page.tsx deleted file mode 100644 index e1689a20..00000000 --- a/hosting/src/app/[site]/content/[type]/page.tsx +++ /dev/null @@ -1,47 +0,0 @@ -"use client"; -import React from "react"; -import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb"; -import {Table, TableRowActions, TableRowLabel} from "@/components/Table"; -import DefaultLayout from "@/components/Layouts/DefaultLayout"; -import {useTanamDocuments} from "@/hooks/useTanamDocuments"; -import Alerts from "@/components/common/Alerts"; - -import {useTanamDocumentType} from "@/hooks/useTanamDocumentTypes"; -import Loader from "../../../../components/common/Loader"; - -export default function ContentOverviewPage() { - const {data: documents, error: docsError} = useTanamDocuments(); - const {data: documentType} = useTanamDocumentType(); - return ( - - {documentType ? : } - - {docsError ? ( - - ) : ( - [ -
-
{document.id}
-
, -

- {document.createdAt.toDate().toUTCString()} -

, - , - console.log("View", document)} - onDelete={() => console.log("Delete", document)} - onDownload={() => console.log("Download", document)} - />, - ])} - /> - )} - - ); -} diff --git a/hosting/src/app/[site]/document-type/[documentTypeId]/page.tsx b/hosting/src/app/[site]/document-type/[documentTypeId]/page.tsx new file mode 100644 index 00000000..e8df35f7 --- /dev/null +++ b/hosting/src/app/[site]/document-type/[documentTypeId]/page.tsx @@ -0,0 +1,59 @@ +"use client"; +import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb"; +import DefaultLayout from "@/components/Layouts/DefaultLayout"; +import {Table, TableRowActions, TableRowLabel} from "@/components/Table"; +import Loader from "@/components/common/Loader"; +import Notification from "@/components/common/Notification"; +import {useTanamDocumentType} from "@/hooks/useTanamDocumentTypes"; +import {useTanamDocuments} from "@/hooks/useTanamDocuments"; +import {useTanamSite} from "@/hooks/useTanamSite"; +import {useRouter} from "next/navigation"; +import {Suspense} from "react"; + +export default function DocumentTypeDocumentsPage() { + const {data: documents, error: docsError} = useTanamDocuments(); + const {data: tanamSite} = useTanamSite(); + const {data: documentType} = useTanamDocumentType(); + const router = useRouter(); + + const handleView = (documentId: string) => { + router.push(`/${tanamSite?.id}/document/${documentId}`); + }; + + return ( + + }> + {documentType ? : } + + + {docsError ? ( + + ) : ( + }> +
[ +
+
{document.id}
+
, +

+ {document.createdAt.toDate().toUTCString()} +

, + , + handleView(document.id)} + onDelete={() => console.log("Delete", document)} + onDownload={() => console.log("Download", document)} + />, + ])} + /> + + )} + + ); +} diff --git a/hosting/src/app/[site]/document/[documentId]/page.tsx b/hosting/src/app/[site]/document/[documentId]/page.tsx new file mode 100644 index 00000000..2d7f7b98 --- /dev/null +++ b/hosting/src/app/[site]/document/[documentId]/page.tsx @@ -0,0 +1,96 @@ +"use client"; +import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb"; +import ContentCard from "@/components/Containers/ContentCard"; +import { + Checkbox, + DatePicker, + Dropdown, + FileUpload, + FormGroup, + Input, + RadioButton, + Switcher, + TextArea, +} from "@/components/Form"; +import DefaultLayout from "@/components/Layouts/DefaultLayout"; +import Loader from "@/components/common/Loader"; +import Notification from "@/components/common/Notification"; +import {useTanamDocumentType} from "@/hooks/useTanamDocumentTypes"; +import {useTanamDocument} from "@/hooks/useTanamDocuments"; +import {TanamDocumentField} from "@/models/TanamDocumentField"; +import {Timestamp} from "firebase/firestore"; +import {Suspense} from "react"; + +const DocumentDetailsPage = () => { + const {data: document, error: docError} = useTanamDocument(); + const {data: documentType, error: typeError} = useTanamDocumentType(document?.documentType); + const viewMode = true; + + const renderFormElement = (field: TanamDocumentField, value: any) => { + switch (field.type) { + case "input-text": + return ( + + + + ); + case "textbox-rich": + return ( + +