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'}>Memberships Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Role</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>JoinedOn</th>
                                
                                
                                
                                <th>InvitationEmail</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.memberships_organization && Array.isArray(organizations.memberships_organization) &&
                              organizations.memberships_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/memberships/memberships-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="role">
                                        { item.role }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="joined_on">
                                        { dataFormatter.dateTimeFormatter(item.joined_on) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="invitation_email">
                                        { item.invitation_email }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.memberships_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Organization_settings Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>DefaultCurrencyCode</th>
                                
                                
                                
                                <th>DefaultLanguage</th>
                                
                                
                                
                                <th>DefaultTimezone</th>
                                
                                
                                
                                <th>InvoicePrefix</th>
                                
                                
                                
                                <th>QuotePrefix</th>
                                
                                
                                
                                <th>ReceiptPrefix</th>
                                
                                
                                
                                <th>DefaultVATRate</th>
                                
                                
                                
                                <th>PricesIncludeTax</th>
                                
                                
                                
                                <th>EnableInventory</th>
                                
                                
                                
                                <th>EnableProjects</th>
                                
                                
                                
                                <th>EnableApprovals</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.organization_settings_organization && Array.isArray(organizations.organization_settings_organization) &&
                              organizations.organization_settings_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/organization_settings/organization_settings-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="default_currency_code">
                                        { item.default_currency_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="default_language">
                                        { item.default_language }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="default_timezone">
                                        { item.default_timezone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="invoice_prefix">
                                        { item.invoice_prefix }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quote_prefix">
                                        { item.quote_prefix }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="receipt_prefix">
                                        { item.receipt_prefix }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="default_vat_rate">
                                        { item.default_vat_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="prices_include_tax">
                                        { dataFormatter.booleanFormatter(item.prices_include_tax) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="enable_inventory">
                                        { dataFormatter.booleanFormatter(item.enable_inventory) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="enable_projects">
                                        { dataFormatter.booleanFormatter(item.enable_projects) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="enable_approvals">
                                        { dataFormatter.booleanFormatter(item.enable_approvals) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.organization_settings_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Tax_codes Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>TaxCodeName</th>
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Rate</th>
                                
                                
                                
                                <th>TaxType</th>
                                
                                
                                
                                <th>IsDefault</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.tax_codes_organization && Array.isArray(organizations.tax_codes_organization) &&
                              organizations.tax_codes_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/tax_codes/tax_codes-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rate">
                                        { item.rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_type">
                                        { item.tax_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_default">
                                        { dataFormatter.booleanFormatter(item.is_default) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.tax_codes_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Contacts Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ContactType</th>
                                
                                
                                
                                <th>DisplayName</th>
                                
                                
                                
                                <th>CompanyName</th>
                                
                                
                                
                                <th>FirstName</th>
                                
                                
                                
                                <th>LastName</th>
                                
                                
                                
                                <th>Email</th>
                                
                                
                                
                                <th>Phone</th>
                                
                                
                                
                                <th>TIN</th>
                                
                                
                                
                                <th>VRN</th>
                                
                                
                                
                                <th>BillingAddressLine1</th>
                                
                                
                                
                                <th>BillingAddressLine2</th>
                                
                                
                                
                                <th>BillingCity</th>
                                
                                
                                
                                <th>BillingStateRegion</th>
                                
                                
                                
                                <th>BillingPostalCode</th>
                                
                                
                                
                                <th>BillingCountry</th>
                                
                                
                                
                                <th>ShippingAddressLine1</th>
                                
                                
                                
                                <th>ShippingAddressLine2</th>
                                
                                
                                
                                <th>ShippingCity</th>
                                
                                
                                
                                <th>ShippingStateRegion</th>
                                
                                
                                
                                <th>ShippingPostalCode</th>
                                
                                
                                
                                <th>ShippingCountry</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.contacts_organization && Array.isArray(organizations.contacts_organization) &&
                              organizations.contacts_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/contacts/contacts-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="contact_type">
                                        { item.contact_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="display_name">
                                        { item.display_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="company_name">
                                        { item.company_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="first_name">
                                        { item.first_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_name">
                                        { item.last_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="email">
                                        { item.email }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="phone">
                                        { item.phone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tin">
                                        { item.tin }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="vrn">
                                        { item.vrn }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="billing_address_line1">
                                        { item.billing_address_line1 }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="billing_address_line2">
                                        { item.billing_address_line2 }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="billing_city">
                                        { item.billing_city }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="billing_state_region">
                                        { item.billing_state_region }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="billing_postal_code">
                                        { item.billing_postal_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="billing_country">
                                        { item.billing_country }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipping_address_line1">
                                        { item.shipping_address_line1 }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipping_address_line2">
                                        { item.shipping_address_line2 }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipping_city">
                                        { item.shipping_city }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipping_state_region">
                                        { item.shipping_state_region }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipping_postal_code">
                                        { item.shipping_postal_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipping_country">
                                        { item.shipping_country }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.contacts_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Products Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ItemType</th>
                                
                                
                                
                                <th>Name</th>
                                
                                
                                
                                <th>SKU</th>
                                
                                
                                
                                <th>Barcode</th>
                                
                                
                                
                                <th>UnitName</th>
                                
                                
                                
                                <th>SalesPrice</th>
                                
                                
                                
                                <th>PurchaseCost</th>
                                
                                
                                
                                <th>IsTaxable</th>
                                
                                
                                
                                
                                
                                <th>ReorderLevel</th>
                                
                                
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.products_organization && Array.isArray(organizations.products_organization) &&
                              organizations.products_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/products/products-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="item_type">
                                        { item.item_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sku">
                                        { item.sku }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="barcode">
                                        { item.barcode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unit_name">
                                        { item.unit_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sales_price">
                                        { item.sales_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="purchase_cost">
                                        { item.purchase_cost }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_taxable">
                                        { dataFormatter.booleanFormatter(item.is_taxable) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="reorder_level">
                                        { item.reorder_level }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.products_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Warehouses Organization</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>Code</th>
                                
                                
                                
                                <th>AddressLine1</th>
                                
                                
                                
                                <th>AddressLine2</th>
                                
                                
                                
                                <th>City</th>
                                
                                
                                
                                <th>StateRegion</th>
                                
                                
                                
                                <th>Country</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.warehouses_organization && Array.isArray(organizations.warehouses_organization) &&
                              organizations.warehouses_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/warehouses/warehouses-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </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_region">
                                        { item.state_region }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="country">
                                        { item.country }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.warehouses_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Inventory_items Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>QuantityOnHand</th>
                                
                                
                                
                                <th>QuantityAvailable</th>
                                
                                
                                
                                <th>AverageCost</th>
                                
                                
                                
                                <th>LastCountedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.inventory_items_organization && Array.isArray(organizations.inventory_items_organization) &&
                              organizations.inventory_items_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/inventory_items/inventory_items-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="quantity_on_hand">
                                        { item.quantity_on_hand }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity_available">
                                        { item.quantity_available }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="average_cost">
                                        { item.average_cost }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_counted_at">
                                        { dataFormatter.dateTimeFormatter(item.last_counted_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.inventory_items_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Quotes Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>QuoteNumber</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>IssueDate</th>
                                
                                
                                
                                <th>ValidUntil</th>
                                
                                
                                
                                <th>CurrencyCode</th>
                                
                                
                                
                                <th>ExchangeRate</th>
                                
                                
                                
                                <th>SubtotalAmount</th>
                                
                                
                                
                                <th>TaxAmount</th>
                                
                                
                                
                                <th>DiscountAmount</th>
                                
                                
                                
                                <th>TotalAmount</th>
                                
                                
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.quotes_organization && Array.isArray(organizations.quotes_organization) &&
                              organizations.quotes_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/quotes/quotes-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="quote_number">
                                        { item.quote_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="issue_date">
                                        { dataFormatter.dateTimeFormatter(item.issue_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="valid_until">
                                        { dataFormatter.dateTimeFormatter(item.valid_until) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="currency_code">
                                        { item.currency_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="exchange_rate">
                                        { item.exchange_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subtotal_amount">
                                        { item.subtotal_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_amount">
                                        { item.tax_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discount_amount">
                                        { item.discount_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_amount">
                                        { item.total_amount }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.quotes_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Quote_lines organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>LineDescription</th>
                                
                                
                                
                                <th>Quantity</th>
                                
                                
                                
                                <th>UnitPrice</th>
                                
                                
                                
                                <th>DiscountRate</th>
                                
                                
                                
                                <th>LineSubtotal</th>
                                
                                
                                
                                
                                
                                <th>TaxAmount</th>
                                
                                
                                
                                <th>LineTotal</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.quote_lines_organizations && Array.isArray(organizations.quote_lines_organizations) &&
                              organizations.quote_lines_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/quote_lines/quote_lines-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="line_description">
                                        { item.line_description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unit_price">
                                        { item.unit_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discount_rate">
                                        { item.discount_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="line_subtotal">
                                        { item.line_subtotal }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="tax_amount">
                                        { item.tax_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="line_total">
                                        { item.line_total }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.quote_lines_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Invoices Organization</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>InvoiceType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>IssueDate</th>
                                
                                
                                
                                <th>DueDate</th>
                                
                                
                                
                                <th>CurrencyCode</th>
                                
                                
                                
                                <th>ExchangeRate</th>
                                
                                
                                
                                <th>SubtotalAmount</th>
                                
                                
                                
                                <th>TaxAmount</th>
                                
                                
                                
                                <th>DiscountAmount</th>
                                
                                
                                
                                <th>TotalAmount</th>
                                
                                
                                
                                <th>AmountPaid</th>
                                
                                
                                
                                <th>BalanceDue</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.invoices_organization && Array.isArray(organizations.invoices_organization) &&
                              organizations.invoices_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/invoices/invoices-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="invoice_number">
                                        { item.invoice_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="invoice_type">
                                        { item.invoice_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="issue_date">
                                        { dataFormatter.dateTimeFormatter(item.issue_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="due_date">
                                        { dataFormatter.dateTimeFormatter(item.due_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="currency_code">
                                        { item.currency_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="exchange_rate">
                                        { item.exchange_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subtotal_amount">
                                        { item.subtotal_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_amount">
                                        { item.tax_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discount_amount">
                                        { item.discount_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_amount">
                                        { item.total_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount_paid">
                                        { item.amount_paid }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="balance_due">
                                        { item.balance_due }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.invoices_organization?.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>LineDescription</th>
                                
                                
                                
                                <th>Quantity</th>
                                
                                
                                
                                <th>UnitPrice</th>
                                
                                
                                
                                <th>DiscountRate</th>
                                
                                
                                
                                <th>LineSubtotal</th>
                                
                                
                                
                                
                                
                                <th>TaxAmount</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="line_description">
                                        { item.line_description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unit_price">
                                        { item.unit_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discount_rate">
                                        { item.discount_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="line_subtotal">
                                        { item.line_subtotal }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="tax_amount">
                                        { item.tax_amount }
                                    </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 Organization</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>CurrencyCode</th>
                                
                                
                                
                                <th>ExchangeRate</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.payments_organization && Array.isArray(organizations.payments_organization) &&
                              organizations.payments_organization.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="currency_code">
                                        { item.currency_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="exchange_rate">
                                        { item.exchange_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.payments_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Receipts Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>ReceiptNumber</th>
                                
                                
                                
                                <th>ReceiptDate</th>
                                
                                
                                
                                <th>ReceiptAmount</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.receipts_organization && Array.isArray(organizations.receipts_organization) &&
                              organizations.receipts_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/receipts/receipts-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="receipt_number">
                                        { item.receipt_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="receipt_date">
                                        { dataFormatter.dateTimeFormatter(item.receipt_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="receipt_amount">
                                        { item.receipt_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.receipts_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Expenses Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>ExpenseNumber</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>ExpenseType</th>
                                
                                
                                
                                <th>ExpenseDate</th>
                                
                                
                                
                                <th>DueDate</th>
                                
                                
                                
                                <th>SubtotalAmount</th>
                                
                                
                                
                                <th>TaxAmount</th>
                                
                                
                                
                                <th>TotalAmount</th>
                                
                                
                                
                                <th>CurrencyCode</th>
                                
                                
                                
                                <th>ExchangeRate</th>
                                
                                
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.expenses_organization && Array.isArray(organizations.expenses_organization) &&
                              organizations.expenses_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/expenses/expenses-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="expense_number">
                                        { item.expense_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expense_type">
                                        { item.expense_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expense_date">
                                        { dataFormatter.dateTimeFormatter(item.expense_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="due_date">
                                        { dataFormatter.dateTimeFormatter(item.due_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subtotal_amount">
                                        { item.subtotal_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_amount">
                                        { item.tax_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_amount">
                                        { item.total_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="currency_code">
                                        { item.currency_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="exchange_rate">
                                        { item.exchange_rate }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.expenses_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Approval_requests Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>RequestType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>RequestedAt</th>
                                
                                
                                
                                <th>DecidedAt</th>
                                
                                
                                
                                <th>Subject</th>
                                
                                
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.approval_requests_organization && Array.isArray(organizations.approval_requests_organization) &&
                              organizations.approval_requests_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/approval_requests/approval_requests-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="request_type">
                                        { item.request_type }
                                    </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="subject">
                                        { item.subject }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.approval_requests_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Projects Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>ProjectName</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>StartDate</th>
                                
                                
                                
                                <th>EndDate</th>
                                
                                
                                
                                <th>BudgetAmount</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.projects_organization && Array.isArray(organizations.projects_organization) &&
                              organizations.projects_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/projects/projects-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="start_date">
                                        { dataFormatter.dateTimeFormatter(item.start_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="end_date">
                                        { dataFormatter.dateTimeFormatter(item.end_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="budget_amount">
                                        { item.budget_amount }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.projects_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Tasks Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                <th>StartAt</th>
                                
                                
                                
                                <th>DueAt</th>
                                
                                
                                
                                <th>Priority</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.tasks_organization && Array.isArray(organizations.tasks_organization) &&
                              organizations.tasks_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/tasks/tasks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="start_at">
                                        { dataFormatter.dateTimeFormatter(item.start_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="due_at">
                                        { dataFormatter.dateTimeFormatter(item.due_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="priority">
                                        { item.priority }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.tasks_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Time_entries Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>StartTime</th>
                                
                                
                                
                                <th>EndTime</th>
                                
                                
                                
                                <th>Hours</th>
                                
                                
                                
                                <th>BillableRate</th>
                                
                                
                                
                                <th>IsBillable</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.time_entries_organization && Array.isArray(organizations.time_entries_organization) &&
                              organizations.time_entries_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/time_entries/time_entries-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="start_time">
                                        { dataFormatter.dateTimeFormatter(item.start_time) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="end_time">
                                        { dataFormatter.dateTimeFormatter(item.end_time) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="hours">
                                        { item.hours }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="billable_rate">
                                        { item.billable_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_billable">
                                        { dataFormatter.booleanFormatter(item.is_billable) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.time_entries_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Efris_connections Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Environment</th>
                                
                                
                                
                                <th>DeviceNumber</th>
                                
                                
                                
                                <th>BranchCode</th>
                                
                                
                                
                                <th>BusinessNameonEFRIS</th>
                                
                                
                                
                                <th>TINonEFRIS</th>
                                
                                
                                
                                <th>ClientID</th>
                                
                                
                                
                                <th>ClientSecret</th>
                                
                                
                                
                                <th>APIBaseURL</th>
                                
                                
                                
                                <th>LastConnectedAt</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>LastErrorMessage</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.efris_connections_organization && Array.isArray(organizations.efris_connections_organization) &&
                              organizations.efris_connections_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/efris_connections/efris_connections-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="environment">
                                        { item.environment }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="device_number">
                                        { item.device_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="branch_code">
                                        { item.branch_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="business_name_on_efris">
                                        { item.business_name_on_efris }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tin_on_efris">
                                        { item.tin_on_efris }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="client_id">
                                        { item.client_id }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="client_secret">
                                        { item.client_secret }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="api_base_url">
                                        { item.api_base_url }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_connected_at">
                                        { dataFormatter.dateTimeFormatter(item.last_connected_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_error_message">
                                        { item.last_error_message }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.efris_connections_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Efris_submissions Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>DocumentType</th>
                                
                                
                                
                                <th>SubmissionStatus</th>
                                
                                
                                
                                <th>SubmittedAt</th>
                                
                                
                                
                                <th>LastAttemptAt</th>
                                
                                
                                
                                <th>AttemptCount</th>
                                
                                
                                
                                <th>RequestPayloadJSON</th>
                                
                                
                                
                                <th>ResponsePayloadJSON</th>
                                
                                
                                
                                <th>EFRISInvoiceNumber</th>
                                
                                
                                
                                <th>EFRISReceiptNumber</th>
                                
                                
                                
                                <th>VerificationCode</th>
                                
                                
                                
                                <th>QRCodeData</th>
                                
                                
                                
                                <th>ErrorCode</th>
                                
                                
                                
                                <th>ErrorMessage</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.efris_submissions_organization && Array.isArray(organizations.efris_submissions_organization) &&
                              organizations.efris_submissions_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/efris_submissions/efris_submissions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="document_type">
                                        { item.document_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="submission_status">
                                        { item.submission_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="submitted_at">
                                        { dataFormatter.dateTimeFormatter(item.submitted_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_attempt_at">
                                        { dataFormatter.dateTimeFormatter(item.last_attempt_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="attempt_count">
                                        { item.attempt_count }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="request_payload_json">
                                        { item.request_payload_json }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="response_payload_json">
                                        { item.response_payload_json }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="efris_invoice_no">
                                        { item.efris_invoice_no }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="efris_receipt_no">
                                        { item.efris_receipt_no }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="verification_code">
                                        { item.verification_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="qr_code_data">
                                        { item.qr_code_data }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="error_code">
                                        { item.error_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="error_message">
                                        { item.error_message }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.efris_submissions_organization?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Audit_events Organization</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>EventType</th>
                                
                                
                                
                                <th>EntityName</th>
                                
                                
                                
                                <th>EntityReference</th>
                                
                                
                                
                                <th>EventTime</th>
                                
                                
                                
                                <th>IPAddress</th>
                                
                                
                                
                                <th>UserAgent</th>
                                
                                
                                
                                <th>DetailsJSON</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.audit_events_organization && Array.isArray(organizations.audit_events_organization) &&
                              organizations.audit_events_organization.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/audit_events/audit_events-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="event_type">
                                        { item.event_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entity_name">
                                        { item.entity_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entity_reference">
                                        { item.entity_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="event_time">
                                        { dataFormatter.dateTimeFormatter(item.event_time) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ip_address">
                                        { item.ip_address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="user_agent">
                                        { item.user_agent }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="details_json">
                                        { item.details_json }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.audit_events_organization?.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;