import React, { ReactElement, useEffect } from 'react';
import Head from 'next/head'
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import dayjs from "dayjs";
import {useAppDispatch, useAppSelector} from "../../stores/hooks";
import {useRouter} from "next/router";
import { fetch } from '../../stores/organizations/organizationsSlice'
import {saveFile} from "../../helpers/fileSaver";
import dataFormatter from '../../helpers/dataFormatter';
import ImageField from "../../components/ImageField";
import LayoutAuthenticated from "../../layouts/Authenticated";
import {getPageTitle} from "../../config";
import SectionTitleLineWithButton from "../../components/SectionTitleLineWithButton";
import SectionMain from "../../components/SectionMain";
import CardBox from "../../components/CardBox";
import BaseButton from "../../components/BaseButton";
import BaseDivider from "../../components/BaseDivider";
import {mdiChartTimelineVariant} from "@mdi/js";
import {SwitchField} from "../../components/SwitchField";
import FormField from "../../components/FormField";

import {hasPermission} from "../../helpers/userPermissions";


const OrganizationsView = () => {
    const router = useRouter()
    const dispatch = useAppDispatch()
    const { organizations } = useAppSelector((state) => state.organizations)
    
    const { currentUser } = useAppSelector((state) => state.auth);
    

    const { id } = router.query;
    
    function removeLastCharacter(str) {
      console.log(str,`str`)
      return str.slice(0, -1);
    }

    useEffect(() => {
        dispatch(fetch({ id }));
    }, [dispatch, id]);


    return (
      <>
          <Head>
              <title>{getPageTitle('View organizations')}</title>
          </Head>
          <SectionMain>
            <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title={removeLastCharacter('View organizations')} main>
                <BaseButton
                  color='info'
                  label='Edit'
                  href={`/organizations/organizations-edit/?id=${id}`}
                />
            </SectionTitleLineWithButton>
            <CardBox>
            

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Name</p>
                    <p>{organizations?.name}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

                
                <>
                    <p className={'block font-bold mb-2'}>Users Organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>First Name</th>
                                
                                
                                
                                <th>Last Name</th>
                                
                                
                                
                                <th>Phone Number</th>
                                
                                
                                
                                <th>E-Mail</th>
                                
                                
                                
                                <th>Disabled</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.users_organizations && Array.isArray(organizations.users_organizations) &&
                              organizations.users_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/users/users-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="firstName">
                                        { item.firstName }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="lastName">
                                        { item.lastName }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="phoneNumber">
                                        { item.phoneNumber }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="email">
                                        { item.email }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="disabled">
                                        { dataFormatter.booleanFormatter(item.disabled) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.users_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Workspaces organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>WorkspaceName</th>
                                
                                
                                
                                <th>Slug</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>WorkspaceType</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>ThemePreset</th>
                                
                                
                                
                                <th>IsArchived</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.workspaces_organizations && Array.isArray(organizations.workspaces_organizations) &&
                              organizations.workspaces_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/workspaces/workspaces-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="slug">
                                        { item.slug }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="workspace_type">
                                        { item.workspace_type }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="theme_preset">
                                        { item.theme_preset }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_archived">
                                        { dataFormatter.booleanFormatter(item.is_archived) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.workspaces_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Workspace_memberships organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Role</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>JoinedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.workspace_memberships_organizations && Array.isArray(organizations.workspace_memberships_organizations) &&
                              organizations.workspace_memberships_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/workspace_memberships/workspace_memberships-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="role">
                                        { item.role }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="joined_at">
                                        { dataFormatter.dateTimeFormatter(item.joined_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.workspace_memberships_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Subjects organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>SubjectName</th>
                                
                                
                                
                                <th>ColorHex</th>
                                
                                
                                
                                
                                
                                <th>IsArchived</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.subjects_organizations && Array.isArray(organizations.subjects_organizations) &&
                              organizations.subjects_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/subjects/subjects-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="color_hex">
                                        { item.color_hex }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="is_archived">
                                        { dataFormatter.booleanFormatter(item.is_archived) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.subjects_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Topics organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>TopicName</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>IsArchived</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.topics_organizations && Array.isArray(organizations.topics_organizations) &&
                              organizations.topics_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/topics/topics-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_archived">
                                        { dataFormatter.booleanFormatter(item.is_archived) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.topics_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Pages organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>IconEmoji</th>
                                
                                
                                
                                
                                
                                <th>Visibility</th>
                                
                                
                                
                                <th>IsPinned</th>
                                
                                
                                
                                <th>IsArchived</th>
                                
                                
                                
                                <th>LastEditedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.pages_organizations && Array.isArray(organizations.pages_organizations) &&
                              organizations.pages_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/pages/pages-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="icon_emoji">
                                        { item.icon_emoji }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="visibility">
                                        { item.visibility }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_pinned">
                                        { dataFormatter.booleanFormatter(item.is_pinned) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_archived">
                                        { dataFormatter.booleanFormatter(item.is_archived) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_edited_at">
                                        { dataFormatter.dateTimeFormatter(item.last_edited_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.pages_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Blocks organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>BlockType</th>
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                
                                
                                <th>CodeLanguage</th>
                                
                                
                                
                                <th>LinkURL</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>SortOrder</th>
                                
                                
                                
                                <th>IsCollapsed</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.blocks_organizations && Array.isArray(organizations.blocks_organizations) &&
                              organizations.blocks_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/blocks/blocks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="block_type">
                                        { item.block_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="code_language">
                                        { item.code_language }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="link_url">
                                        { item.link_url }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="sort_order">
                                        { item.sort_order }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_collapsed">
                                        { dataFormatter.booleanFormatter(item.is_collapsed) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.blocks_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Databases organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>DatabaseName</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>DatabaseKind</th>
                                
                                
                                
                                <th>DefaultView</th>
                                
                                
                                
                                <th>IsArchived</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.databases_organizations && Array.isArray(organizations.databases_organizations) &&
                              organizations.databases_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/databases/databases-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="database_kind">
                                        { item.database_kind }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="default_view">
                                        { item.default_view }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_archived">
                                        { dataFormatter.booleanFormatter(item.is_archived) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.databases_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Database_entries organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                
                                
                                <th>ContentType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>StudiedAt</th>
                                
                                
                                
                                <th>NextReviewAt</th>
                                
                                
                                
                                <th>EstimatedRetention</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.database_entries_organizations && Array.isArray(organizations.database_entries_organizations) &&
                              organizations.database_entries_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/database_entries/database_entries-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="content_type">
                                        { item.content_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="studied_at">
                                        { dataFormatter.dateTimeFormatter(item.studied_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="next_review_at">
                                        { dataFormatter.dateTimeFormatter(item.next_review_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="estimated_retention">
                                        { item.estimated_retention }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.database_entries_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Sources organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>SourceType</th>
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>SourceURL</th>
                                
                                
                                
                                
                                
                                <th>IngestionStatus</th>
                                
                                
                                
                                <th>ErrorMessage</th>
                                
                                
                                
                                <th>IngestedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.sources_organizations && Array.isArray(organizations.sources_organizations) &&
                              organizations.sources_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/sources/sources-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="source_type">
                                        { item.source_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="source_url">
                                        { item.source_url }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="ingestion_status">
                                        { item.ingestion_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="error_message">
                                        { item.error_message }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ingested_at">
                                        { dataFormatter.dateTimeFormatter(item.ingested_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.sources_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Source_chunks organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ChunkIndex</th>
                                
                                
                                
                                <th>ChunkText</th>
                                
                                
                                
                                <th>TokenCountEstimate</th>
                                
                                
                                
                                <th>EmbeddingProvider</th>
                                
                                
                                
                                <th>EmbeddingModel</th>
                                
                                
                                
                                <th>ChunkKind</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.source_chunks_organizations && Array.isArray(organizations.source_chunks_organizations) &&
                              organizations.source_chunks_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/source_chunks/source_chunks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="chunk_index">
                                        { item.chunk_index }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="chunk_text">
                                        { item.chunk_text }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="token_count_estimate">
                                        { item.token_count_estimate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="embedding_provider">
                                        { item.embedding_provider }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="embedding_model">
                                        { item.embedding_model }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="chunk_kind">
                                        { item.chunk_kind }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.source_chunks_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Ai_jobs organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>JobType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Provider</th>
                                
                                
                                
                                <th>Model</th>
                                
                                
                                
                                <th>CostEstimate</th>
                                
                                
                                
                                <th>ErrorDetails</th>
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>FinishedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.ai_jobs_organizations && Array.isArray(organizations.ai_jobs_organizations) &&
                              organizations.ai_jobs_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/ai_jobs/ai_jobs-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="job_type">
                                        { item.job_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="provider">
                                        { item.provider }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="model">
                                        { item.model }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="cost_estimate">
                                        { item.cost_estimate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="error_details">
                                        { item.error_details }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="finished_at">
                                        { dataFormatter.dateTimeFormatter(item.finished_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.ai_jobs_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Concept_maps organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>MapDataJSON</th>
                                
                                
                                
                                <th>Format</th>
                                
                                
                                
                                <th>GeneratedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.concept_maps_organizations && Array.isArray(organizations.concept_maps_organizations) &&
                              organizations.concept_maps_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/concept_maps/concept_maps-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="map_data_json">
                                        { item.map_data_json }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="format">
                                        { item.format }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="generated_at">
                                        { dataFormatter.dateTimeFormatter(item.generated_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.concept_maps_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Study_guides organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                
                                
                                <th>DifficultyLevel</th>
                                
                                
                                
                                <th>GeneratedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.study_guides_organizations && Array.isArray(organizations.study_guides_organizations) &&
                              organizations.study_guides_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/study_guides/study_guides-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="difficulty_level">
                                        { item.difficulty_level }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="generated_at">
                                        { dataFormatter.dateTimeFormatter(item.generated_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.study_guides_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Flashcard_decks organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>DeckName</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>DeckVisibility</th>
                                
                                
                                
                                <th>GenerationMode</th>
                                
                                
                                
                                <th>IsArchived</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.flashcard_decks_organizations && Array.isArray(organizations.flashcard_decks_organizations) &&
                              organizations.flashcard_decks_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/flashcard_decks/flashcard_decks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="deck_visibility">
                                        { item.deck_visibility }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="generation_mode">
                                        { item.generation_mode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_archived">
                                        { dataFormatter.booleanFormatter(item.is_archived) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.flashcard_decks_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Flashcards organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Hint</th>
                                
                                
                                
                                <th>CardType</th>
                                
                                
                                
                                
                                
                                <th>SortOrder</th>
                                
                                
                                
                                <th>IsSuspended</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.flashcards_organizations && Array.isArray(organizations.flashcards_organizations) &&
                              organizations.flashcards_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/flashcards/flashcards-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="hint">
                                        { item.hint }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="card_type">
                                        { item.card_type }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="sort_order">
                                        { item.sort_order }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_suspended">
                                        { dataFormatter.booleanFormatter(item.is_suspended) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.flashcards_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Spaced_repetition_states organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Algorithm</th>
                                
                                
                                
                                <th>Repetitions</th>
                                
                                
                                
                                <th>Lapses</th>
                                
                                
                                
                                <th>EaseFactor</th>
                                
                                
                                
                                <th>IntervalDays</th>
                                
                                
                                
                                <th>Stability</th>
                                
                                
                                
                                <th>Difficulty</th>
                                
                                
                                
                                <th>DueAt</th>
                                
                                
                                
                                <th>LastReviewedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.spaced_repetition_states_organizations && Array.isArray(organizations.spaced_repetition_states_organizations) &&
                              organizations.spaced_repetition_states_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/spaced_repetition_states/spaced_repetition_states-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="algorithm">
                                        { item.algorithm }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="repetitions">
                                        { item.repetitions }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="lapses">
                                        { item.lapses }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ease_factor">
                                        { item.ease_factor }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="interval_days">
                                        { item.interval_days }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="stability">
                                        { item.stability }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="difficulty">
                                        { item.difficulty }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="due_at">
                                        { dataFormatter.dateTimeFormatter(item.due_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_reviewed_at">
                                        { dataFormatter.dateTimeFormatter(item.last_reviewed_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.spaced_repetition_states_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Study_sessions organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Mode</th>
                                
                                
                                
                                <th>SessionType</th>
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>EndedAt</th>
                                
                                
                                
                                <th>DurationSeconds</th>
                                
                                
                                
                                <th>DistractionBlockEnabled</th>
                                
                                
                                
                                <th>MusicMode</th>
                                
                                
                                
                                <th>FocusScore</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.study_sessions_organizations && Array.isArray(organizations.study_sessions_organizations) &&
                              organizations.study_sessions_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/study_sessions/study_sessions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="mode">
                                        { item.mode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="session_type">
                                        { item.session_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ended_at">
                                        { dataFormatter.dateTimeFormatter(item.ended_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="duration_seconds">
                                        { item.duration_seconds }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="distraction_block_enabled">
                                        { dataFormatter.booleanFormatter(item.distraction_block_enabled) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="music_mode">
                                        { item.music_mode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="focus_score">
                                        { item.focus_score }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.study_sessions_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Review_events organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Rating</th>
                                
                                
                                
                                <th>ResponseTimeMs</th>
                                
                                
                                
                                <th>IsCorrect</th>
                                
                                
                                
                                <th>ReviewedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.review_events_organizations && Array.isArray(organizations.review_events_organizations) &&
                              organizations.review_events_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/review_events/review_events-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="rating">
                                        { item.rating }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="response_time_ms">
                                        { item.response_time_ms }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_correct">
                                        { dataFormatter.booleanFormatter(item.is_correct) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reviewed_at">
                                        { dataFormatter.dateTimeFormatter(item.reviewed_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.review_events_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Quizzes organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>QuizType</th>
                                
                                
                                
                                <th>DifficultyLevel</th>
                                
                                
                                
                                <th>TimeLimitMinutes</th>
                                
                                
                                
                                <th>IsPublished</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.quizzes_organizations && Array.isArray(organizations.quizzes_organizations) &&
                              organizations.quizzes_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/quizzes/quizzes-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quiz_type">
                                        { item.quiz_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="difficulty_level">
                                        { item.difficulty_level }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="time_limit_minutes">
                                        { item.time_limit_minutes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_published">
                                        { dataFormatter.booleanFormatter(item.is_published) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.quizzes_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Quiz_questions organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>QuestionType</th>
                                
                                
                                
                                
                                
                                <th>ChoicesJSON</th>
                                
                                
                                
                                <th>CorrectAnswer</th>
                                
                                
                                
                                
                                
                                <th>Points</th>
                                
                                
                                
                                <th>SortOrder</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.quiz_questions_organizations && Array.isArray(organizations.quiz_questions_organizations) &&
                              organizations.quiz_questions_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/quiz_questions/quiz_questions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="question_type">
                                        { item.question_type }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="choices_json">
                                        { item.choices_json }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="correct_answer">
                                        { item.correct_answer }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="points">
                                        { item.points }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sort_order">
                                        { item.sort_order }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.quiz_questions_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Quiz_attempts organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>SubmittedAt</th>
                                
                                
                                
                                <th>ScorePercent</th>
                                
                                
                                
                                <th>CorrectCount</th>
                                
                                
                                
                                <th>TotalCount</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.quiz_attempts_organizations && Array.isArray(organizations.quiz_attempts_organizations) &&
                              organizations.quiz_attempts_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/quiz_attempts/quiz_attempts-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="submitted_at">
                                        { dataFormatter.dateTimeFormatter(item.submitted_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="score_percent">
                                        { item.score_percent }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="correct_count">
                                        { item.correct_count }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_count">
                                        { item.total_count }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.quiz_attempts_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Tutor_conversations organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>TutorMode</th>
                                
                                
                                
                                <th>IsArchived</th>
                                
                                
                                
                                <th>LastMessageAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.tutor_conversations_organizations && Array.isArray(organizations.tutor_conversations_organizations) &&
                              organizations.tutor_conversations_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/tutor_conversations/tutor_conversations-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tutor_mode">
                                        { item.tutor_mode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_archived">
                                        { dataFormatter.booleanFormatter(item.is_archived) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_message_at">
                                        { dataFormatter.dateTimeFormatter(item.last_message_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.tutor_conversations_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Tutor_messages organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Sender</th>
                                
                                
                                
                                
                                
                                <th>CitationsJSON</th>
                                
                                
                                
                                <th>SentAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.tutor_messages_organizations && Array.isArray(organizations.tutor_messages_organizations) &&
                              organizations.tutor_messages_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/tutor_messages/tutor_messages-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="sender">
                                        { item.sender }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="citations_json">
                                        { item.citations_json }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sent_at">
                                        { dataFormatter.dateTimeFormatter(item.sent_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.tutor_messages_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Study_plans organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>Goal</th>
                                
                                
                                
                                <th>StartDate</th>
                                
                                
                                
                                <th>EndDate</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>TargetHoursPerWeek</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.study_plans_organizations && Array.isArray(organizations.study_plans_organizations) &&
                              organizations.study_plans_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/study_plans/study_plans-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="goal">
                                        { item.goal }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="start_date">
                                        { dataFormatter.dateTimeFormatter(item.start_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="end_date">
                                        { dataFormatter.dateTimeFormatter(item.end_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="target_hours_per_week">
                                        { item.target_hours_per_week }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.study_plans_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Study_plan_items organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>ItemType</th>
                                
                                
                                
                                <th>ScheduledStartAt</th>
                                
                                
                                
                                <th>ScheduledEndAt</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>EstimatedMinutes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.study_plan_items_organizations && Array.isArray(organizations.study_plan_items_organizations) &&
                              organizations.study_plan_items_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/study_plan_items/study_plan_items-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="item_type">
                                        { item.item_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scheduled_start_at">
                                        { dataFormatter.dateTimeFormatter(item.scheduled_start_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scheduled_end_at">
                                        { dataFormatter.dateTimeFormatter(item.scheduled_end_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="estimated_minutes">
                                        { item.estimated_minutes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.study_plan_items_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Dashboard_snapshots organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>SnapshotAt</th>
                                
                                
                                
                                <th>StudyHoursLast7d</th>
                                
                                
                                
                                <th>StudyHoursLast30d</th>
                                
                                
                                
                                <th>RetentionEstimate</th>
                                
                                
                                
                                <th>TestPerformanceAvg</th>
                                
                                
                                
                                <th>CardsDueCount</th>
                                
                                
                                
                                <th>StreakDays</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.dashboard_snapshots_organizations && Array.isArray(organizations.dashboard_snapshots_organizations) &&
                              organizations.dashboard_snapshots_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/dashboard_snapshots/dashboard_snapshots-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="snapshot_at">
                                        { dataFormatter.dateTimeFormatter(item.snapshot_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="study_hours_last_7d">
                                        { item.study_hours_last_7d }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="study_hours_last_30d">
                                        { item.study_hours_last_30d }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="retention_estimate">
                                        { item.retention_estimate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="test_performance_avg">
                                        { item.test_performance_avg }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="cards_due_count">
                                        { item.cards_due_count }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="streak_days">
                                        { item.streak_days }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.dashboard_snapshots_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                

                <BaseDivider />

                <BaseButton
                    color='info'
                    label='Back'
                    onClick={() => router.push('/organizations/organizations-list')}
                />
              </CardBox>
          </SectionMain>
      </>
    );
};

OrganizationsView.getLayout = function getLayout(page: ReactElement) {
    return (
      <LayoutAuthenticated
        
        permission={'READ_ORGANIZATIONS'}
        
      >
          {page}
      </LayoutAuthenticated>
    )
}

export default OrganizationsView;