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'}>Companies organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>CompanyName</th>
                                
                                
                                
                                <th>LegalName</th>
                                
                                
                                
                                <th>TaxNumber</th>
                                
                                
                                
                                <th>Website</th>
                                
                                
                                
                                <th>Phone</th>
                                
                                
                                
                                <th>Email</th>
                                
                                
                                
                                <th>AddressLine1</th>
                                
                                
                                
                                <th>AddressLine2</th>
                                
                                
                                
                                <th>City</th>
                                
                                
                                
                                <th>State/Province</th>
                                
                                
                                
                                <th>PostalCode</th>
                                
                                
                                
                                <th>Country</th>
                                
                                
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.companies_organizations && Array.isArray(organizations.companies_organizations) &&
                              organizations.companies_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/companies/companies-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="company_name">
                                        { item.company_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="legal_name">
                                        { item.legal_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_number">
                                        { item.tax_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="website">
                                        { item.website }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="phone">
                                        { item.phone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="email">
                                        { item.email }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address_line1">
                                        { item.address_line1 }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address_line2">
                                        { item.address_line2 }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="city">
                                        { item.city }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="state">
                                        { item.state }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="postal_code">
                                        { item.postal_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="country">
                                        { item.country }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.companies_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>User_role_assignments organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>EffectiveFrom</th>
                                
                                
                                
                                <th>EffectiveTo</th>
                                
                                
                                
                                <th>IsPrimary</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.user_role_assignments_organizations && Array.isArray(organizations.user_role_assignments_organizations) &&
                              organizations.user_role_assignments_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/user_role_assignments/user_role_assignments-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="effective_from">
                                        { dataFormatter.dateTimeFormatter(item.effective_from) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="effective_to">
                                        { dataFormatter.dateTimeFormatter(item.effective_to) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_primary">
                                        { dataFormatter.booleanFormatter(item.is_primary) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.user_role_assignments_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Role_permission_mappings organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>IsAllowed</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.role_permission_mappings_organizations && Array.isArray(organizations.role_permission_mappings_organizations) &&
                              organizations.role_permission_mappings_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/role_permission_mappings/role_permission_mappings-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="is_allowed">
                                        { dataFormatter.booleanFormatter(item.is_allowed) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.role_permission_mappings_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Vendors organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>VendorName</th>
                                
                                
                                
                                <th>VendorCode</th>
                                
                                
                                
                                <th>ContactName</th>
                                
                                
                                
                                <th>Email</th>
                                
                                
                                
                                <th>Phone</th>
                                
                                
                                
                                <th>Address</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>PaymentTerms</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.vendors_organizations && Array.isArray(organizations.vendors_organizations) &&
                              organizations.vendors_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/vendors/vendors-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="vendor_name">
                                        { item.vendor_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="vendor_code">
                                        { item.vendor_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="contact_name">
                                        { item.contact_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="email">
                                        { item.email }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="phone">
                                        { item.phone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address">
                                        { item.address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="payment_terms">
                                        { item.payment_terms }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.vendors_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Warehouses organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>WarehouseName</th>
                                
                                
                                
                                <th>WarehouseCode</th>
                                
                                
                                
                                <th>Address</th>
                                
                                
                                
                                <th>IsDefault</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.warehouses_organizations && Array.isArray(organizations.warehouses_organizations) &&
                              organizations.warehouses_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/warehouses/warehouses-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="warehouse_name">
                                        { item.warehouse_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="warehouse_code">
                                        { item.warehouse_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address">
                                        { item.address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_default">
                                        { dataFormatter.booleanFormatter(item.is_default) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.warehouses_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Product_categories organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>CategoryName</th>
                                
                                
                                
                                <th>CategoryCode</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.product_categories_organizations && Array.isArray(organizations.product_categories_organizations) &&
                              organizations.product_categories_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/product_categories/product_categories-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="category_name">
                                        { item.category_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="category_code">
                                        { item.category_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.product_categories_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Products organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>ProductName</th>
                                
                                
                                
                                <th>SKU</th>
                                
                                
                                
                                <th>Barcode</th>
                                
                                
                                
                                <th>ProductType</th>
                                
                                
                                
                                <th>UnitofMeasure</th>
                                
                                
                                
                                <th>StandardCost</th>
                                
                                
                                
                                <th>PurchasePrice</th>
                                
                                
                                
                                <th>SalesPrice</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.products_organizations && Array.isArray(organizations.products_organizations) &&
                              organizations.products_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/products/products-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="product_name">
                                        { item.product_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sku">
                                        { item.sku }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="barcode">
                                        { item.barcode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="product_type">
                                        { item.product_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="uom">
                                        { item.uom }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="standard_cost">
                                        { item.standard_cost }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="purchase_price">
                                        { item.purchase_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sales_price">
                                        { item.sales_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.products_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Purchase_requisitions organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>RequisitionNumber</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>RequestedDate</th>
                                
                                
                                
                                <th>NeededBy</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Reason</th>
                                
                                
                                
                                <th>EstimatedTotal</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.purchase_requisitions_organizations && Array.isArray(organizations.purchase_requisitions_organizations) &&
                              organizations.purchase_requisitions_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/purchase_requisitions/purchase_requisitions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="requisition_number">
                                        { item.requisition_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="requested_date">
                                        { dataFormatter.dateTimeFormatter(item.requested_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="needed_by">
                                        { dataFormatter.dateTimeFormatter(item.needed_by) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reason">
                                        { item.reason }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="estimated_total">
                                        { item.estimated_total }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.purchase_requisitions_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Purchase_requisition_lines organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>Quantity</th>
                                
                                
                                
                                <th>UnitPriceEstimate</th>
                                
                                
                                
                                <th>LineTotalEstimate</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.purchase_requisition_lines_organizations && Array.isArray(organizations.purchase_requisition_lines_organizations) &&
                              organizations.purchase_requisition_lines_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/purchase_requisition_lines/purchase_requisition_lines-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unit_price_estimate">
                                        { item.unit_price_estimate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="line_total_estimate">
                                        { item.line_total_estimate }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.purchase_requisition_lines_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Purchase_orders organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>PONumber</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>OrderDate</th>
                                
                                
                                
                                <th>ExpectedDeliveryDate</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Currency</th>
                                
                                
                                
                                <th>Subtotal</th>
                                
                                
                                
                                <th>TaxTotal</th>
                                
                                
                                
                                <th>DiscountTotal</th>
                                
                                
                                
                                <th>GrandTotal</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.purchase_orders_organizations && Array.isArray(organizations.purchase_orders_organizations) &&
                              organizations.purchase_orders_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/purchase_orders/purchase_orders-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="po_number">
                                        { item.po_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="order_date">
                                        { dataFormatter.dateTimeFormatter(item.order_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expected_delivery_date">
                                        { dataFormatter.dateTimeFormatter(item.expected_delivery_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="currency">
                                        { item.currency }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subtotal">
                                        { item.subtotal }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_total">
                                        { item.tax_total }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discount_total">
                                        { item.discount_total }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="grand_total">
                                        { item.grand_total }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.purchase_orders_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Purchase_order_lines organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>Quantity</th>
                                
                                
                                
                                <th>UnitPrice</th>
                                
                                
                                
                                <th>TaxRate</th>
                                
                                
                                
                                <th>DiscountRate</th>
                                
                                
                                
                                <th>LineTotal</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.purchase_order_lines_organizations && Array.isArray(organizations.purchase_order_lines_organizations) &&
                              organizations.purchase_order_lines_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/purchase_order_lines/purchase_order_lines-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unit_price">
                                        { item.unit_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_rate">
                                        { item.tax_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discount_rate">
                                        { item.discount_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="line_total">
                                        { item.line_total }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.purchase_order_lines_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Goods_receipts organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>GRNNumber</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>ReceiptDate</th>
                                
                                
                                
                                <th>PostedDate</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Remarks</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.goods_receipts_organizations && Array.isArray(organizations.goods_receipts_organizations) &&
                              organizations.goods_receipts_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/goods_receipts/goods_receipts-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="grn_number">
                                        { item.grn_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="receipt_date">
                                        { dataFormatter.dateTimeFormatter(item.receipt_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="posted_date">
                                        { dataFormatter.dateTimeFormatter(item.posted_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="remarks">
                                        { item.remarks }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.goods_receipts_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Goods_receipt_lines organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>QuantityReceived</th>
                                
                                
                                
                                <th>QuantityAccepted</th>
                                
                                
                                
                                <th>QuantityRejected</th>
                                
                                
                                
                                <th>QualityNotes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.goods_receipt_lines_organizations && Array.isArray(organizations.goods_receipt_lines_organizations) &&
                              organizations.goods_receipt_lines_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/goods_receipt_lines/goods_receipt_lines-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="quantity_received">
                                        { item.quantity_received }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity_accepted">
                                        { item.quantity_accepted }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity_rejected">
                                        { item.quantity_rejected }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quality_notes">
                                        { item.quality_notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.goods_receipt_lines_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Vendor_invoices organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>InvoiceNumber</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>InvoiceDate</th>
                                
                                
                                
                                <th>DueDate</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Currency</th>
                                
                                
                                
                                <th>Subtotal</th>
                                
                                
                                
                                <th>TaxTotal</th>
                                
                                
                                
                                <th>GrandTotal</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.vendor_invoices_organizations && Array.isArray(organizations.vendor_invoices_organizations) &&
                              organizations.vendor_invoices_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/vendor_invoices/vendor_invoices-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="invoice_number">
                                        { item.invoice_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="invoice_date">
                                        { dataFormatter.dateTimeFormatter(item.invoice_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="due_date">
                                        { dataFormatter.dateTimeFormatter(item.due_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="currency">
                                        { item.currency }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subtotal">
                                        { item.subtotal }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_total">
                                        { item.tax_total }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="grand_total">
                                        { item.grand_total }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.vendor_invoices_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Invoice_lines organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>Quantity</th>
                                
                                
                                
                                <th>UnitPrice</th>
                                
                                
                                
                                <th>TaxRate</th>
                                
                                
                                
                                <th>LineTotal</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.invoice_lines_organizations && Array.isArray(organizations.invoice_lines_organizations) &&
                              organizations.invoice_lines_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/invoice_lines/invoice_lines-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unit_price">
                                        { item.unit_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_rate">
                                        { item.tax_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="line_total">
                                        { item.line_total }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.invoice_lines_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Payments organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>PaymentReference</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>PaymentDate</th>
                                
                                
                                
                                <th>Amount</th>
                                
                                
                                
                                <th>Method</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.payments_organizations && Array.isArray(organizations.payments_organizations) &&
                              organizations.payments_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/payments/payments-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="payment_reference">
                                        { item.payment_reference }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="payment_date">
                                        { dataFormatter.dateTimeFormatter(item.payment_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount">
                                        { item.amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="method">
                                        { item.method }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.payments_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Departments organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>DepartmentName</th>
                                
                                
                                
                                <th>DepartmentCode</th>
                                
                                
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.departments_organizations && Array.isArray(organizations.departments_organizations) &&
                              organizations.departments_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/departments/departments-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="department_name">
                                        { item.department_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="department_code">
                                        { item.department_code }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.departments_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Document_types organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>TypeName</th>
                                
                                
                                
                                <th>TypeCode</th>
                                
                                
                                
                                <th>Module</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.document_types_organizations && Array.isArray(organizations.document_types_organizations) &&
                              organizations.document_types_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/document_types/document_types-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="type_name">
                                        { item.type_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="type_code">
                                        { item.type_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="module">
                                        { item.module }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.document_types_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Documents organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>DocumentNumber</th>
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Priority</th>
                                
                                
                                
                                
                                
                                <th>DocumentDate</th>
                                
                                
                                
                                <th>ReviewDueDate</th>
                                
                                
                                
                                <th>Summary</th>
                                
                                
                                
                                
                                
                                <th>Tags</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.documents_organizations && Array.isArray(organizations.documents_organizations) &&
                              organizations.documents_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/documents/documents-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="document_number">
                                        { item.document_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="priority">
                                        { item.priority }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="document_date">
                                        { dataFormatter.dateTimeFormatter(item.document_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="review_due_date">
                                        { dataFormatter.dateTimeFormatter(item.review_due_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="summary">
                                        { item.summary }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="tags">
                                        { item.tags }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.documents_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Document_links 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>SourceReference</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.document_links_organizations && Array.isArray(organizations.document_links_organizations) &&
                              organizations.document_links_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/document_links/document_links-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="source_type">
                                        { item.source_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="source_reference">
                                        { item.source_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.document_links_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Approval_workflows organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>WorkflowName</th>
                                
                                
                                
                                <th>AppliesTo</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.approval_workflows_organizations && Array.isArray(organizations.approval_workflows_organizations) &&
                              organizations.approval_workflows_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/approval_workflows/approval_workflows-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="workflow_name">
                                        { item.workflow_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="applies_to">
                                        { item.applies_to }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.approval_workflows_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Approval_steps organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>StepOrder</th>
                                
                                
                                
                                <th>StepName</th>
                                
                                
                                
                                
                                
                                <th>MinAmount</th>
                                
                                
                                
                                <th>MaxAmount</th>
                                
                                
                                
                                <th>IsRequired</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.approval_steps_organizations && Array.isArray(organizations.approval_steps_organizations) &&
                              organizations.approval_steps_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/approval_steps/approval_steps-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="step_order">
                                        { item.step_order }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="step_name">
                                        { item.step_name }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="min_amount">
                                        { item.min_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="max_amount">
                                        { item.max_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_required">
                                        { dataFormatter.booleanFormatter(item.is_required) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.approval_steps_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Approvals organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>EntityType</th>
                                
                                
                                
                                <th>EntityReference</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>RequestedAt</th>
                                
                                
                                
                                <th>DecidedAt</th>
                                
                                
                                
                                <th>DecisionNotes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.approvals_organizations && Array.isArray(organizations.approvals_organizations) &&
                              organizations.approvals_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/approvals/approvals-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="entity_type">
                                        { item.entity_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entity_reference">
                                        { item.entity_reference }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="requested_at">
                                        { dataFormatter.dateTimeFormatter(item.requested_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="decided_at">
                                        { dataFormatter.dateTimeFormatter(item.decided_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="decision_notes">
                                        { item.decision_notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.approvals_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Activity_logs organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>EntityType</th>
                                
                                
                                
                                <th>EntityReference</th>
                                
                                
                                
                                <th>Action</th>
                                
                                
                                
                                <th>EventTime</th>
                                
                                
                                
                                <th>Message</th>
                                
                                
                                
                                <th>IPAddress</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.activity_logs_organizations && Array.isArray(organizations.activity_logs_organizations) &&
                              organizations.activity_logs_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/activity_logs/activity_logs-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="entity_type">
                                        { item.entity_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entity_reference">
                                        { item.entity_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="action">
                                        { item.action }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="event_time">
                                        { dataFormatter.dateTimeFormatter(item.event_time) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="message">
                                        { item.message }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ip_address">
                                        { item.ip_address }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.activity_logs_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Ui_announcements organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Headline</th>
                                
                                
                                
                                
                                
                                <th>Audience</th>
                                
                                
                                
                                <th>PublishFrom</th>
                                
                                
                                
                                <th>PublishTo</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.ui_announcements_organizations && Array.isArray(organizations.ui_announcements_organizations) &&
                              organizations.ui_announcements_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/ui_announcements/ui_announcements-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="headline">
                                        { item.headline }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="audience">
                                        { item.audience }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="publish_from">
                                        { dataFormatter.dateTimeFormatter(item.publish_from) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="publish_to">
                                        { dataFormatter.dateTimeFormatter(item.publish_to) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.ui_announcements_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;