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/businesses/businessesSlice'
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";


const BusinessesView = () => {
    const router = useRouter()
    const dispatch = useAppDispatch()
    const { businesses } = useAppSelector((state) => state.businesses)
    

    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 businesses')}</title>
          </Head>
          <SectionMain>
            <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title={removeLastCharacter('View businesses')} main>
                <BaseButton
                  color='info'
                  label='Edit'
                  href={`/businesses/businesses-edit/?id=${id}`}
                />
            </SectionTitleLineWithButton>
            <CardBox>
            

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>LegalName</p>
                    <p>{businesses?.legal_name}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>TradeName</p>
                    <p>{businesses?.trade_name}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>NationalID</p>
                    <p>{businesses?.national_id}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>EconomicCode</p>
                    <p>{businesses?.economic_code}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>RegistrationNumber</p>
                    <p>{businesses?.registration_number}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Phone</p>
                    <p>{businesses?.phone}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              
                <FormField label='Multi Text' hasTextareaHeight>
                  <textarea className={'w-full'} disabled value={businesses?.address} />
                </FormField>
              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              
                <FormField label='IsActive'>
                    <SwitchField
                      field={{name: 'is_active', value: businesses?.is_active}}
                      form={{setFieldValue: () => null}}
                      disabled
                    />
                </FormField>
              

              

              

              

              
              

                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Branches Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>BranchCode</th>
                                
                                
                                
                                <th>BranchName</th>
                                
                                
                                
                                <th>Phone</th>
                                
                                
                                
                                <th>Address</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.branches_business && Array.isArray(businesses.branches_business) &&
                              businesses.branches_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/branches/branches-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="phone">
                                        { item.phone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address">
                                        { item.address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.branches_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Fiscal_years Business</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>StartDate</th>
                                
                                
                                
                                <th>EndDate</th>
                                
                                
                                
                                <th>IsClosed</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.fiscal_years_business && Array.isArray(businesses.fiscal_years_business) &&
                              businesses.fiscal_years_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/fiscal_years/fiscal_years-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </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="is_closed">
                                        { dataFormatter.booleanFormatter(item.is_closed) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.fiscal_years_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>User_role_assignments Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.user_role_assignments_business && Array.isArray(businesses.user_role_assignments_business) &&
                              businesses.user_role_assignments_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/user_role_assignments/user_role_assignments-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.user_role_assignments_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Role_permissions Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>FormKey</th>
                                
                                
                                
                                <th>FieldKey</th>
                                
                                
                                
                                <th>Action</th>
                                
                                
                                
                                <th>IsAllowed</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.role_permissions_business && Array.isArray(businesses.role_permissions_business) &&
                              businesses.role_permissions_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/role_permissions/role_permissions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="form_key">
                                        { item.form_key }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="field_key">
                                        { item.field_key }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="action">
                                        { item.action }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_allowed">
                                        { dataFormatter.booleanFormatter(item.is_allowed) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.role_permissions_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>App_settings Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>AccountingCodingMode</th>
                                
                                
                                
                                <th>AnalyticLevelsCount</th>
                                
                                
                                
                                <th>EnableBranching</th>
                                
                                
                                
                                <th>EnableMultiCurrency</th>
                                
                                
                                
                                <th>EnableDocumentWorkflow</th>
                                
                                
                                
                                <th>EnableNetworkDongle</th>
                                
                                
                                
                                <th>DefaultCurrencyCode</th>
                                
                                
                                
                                <th>NumberingProfileCode</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.app_settings_business && Array.isArray(businesses.app_settings_business) &&
                              businesses.app_settings_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/app_settings/app_settings-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="accounting_coding_mode">
                                        { item.accounting_coding_mode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="analytic_levels_count">
                                        { item.analytic_levels_count }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="enable_branching">
                                        { dataFormatter.booleanFormatter(item.enable_branching) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="enable_multi_currency">
                                        { dataFormatter.booleanFormatter(item.enable_multi_currency) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="enable_document_workflow">
                                        { dataFormatter.booleanFormatter(item.enable_document_workflow) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="enable_network_dongle">
                                        { dataFormatter.booleanFormatter(item.enable_network_dongle) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="default_currency_code">
                                        { item.default_currency_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="numbering_profile_code">
                                        { item.numbering_profile_code }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.app_settings_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Currencies Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>CurrencyCode</th>
                                
                                
                                
                                <th>CurrencyName</th>
                                
                                
                                
                                <th>Symbol</th>
                                
                                
                                
                                <th>MinorUnit</th>
                                
                                
                                
                                <th>IsBaseCurrency</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.currencies_business && Array.isArray(businesses.currencies_business) &&
                              businesses.currencies_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/currencies/currencies-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="symbol">
                                        { item.symbol }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="minor_unit">
                                        { item.minor_unit }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_base">
                                        { dataFormatter.booleanFormatter(item.is_base) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.currencies_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Currency_rates Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>RateDate</th>
                                
                                
                                
                                <th>Rate</th>
                                
                                
                                
                                <th>Source</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.currency_rates_business && Array.isArray(businesses.currency_rates_business) &&
                              businesses.currency_rates_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/currency_rates/currency_rates-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="rate_date">
                                        { dataFormatter.dateTimeFormatter(item.rate_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rate">
                                        { item.rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="source">
                                        { item.source }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.currency_rates_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Numbering_profiles Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ProfileCode</th>
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>Prefix</th>
                                
                                
                                
                                <th>NextNumber</th>
                                
                                
                                
                                <th>Padding</th>
                                
                                
                                
                                <th>ResetPolicy</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.numbering_profiles_business && Array.isArray(businesses.numbering_profiles_business) &&
                              businesses.numbering_profiles_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/numbering_profiles/numbering_profiles-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="prefix">
                                        { item.prefix }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="next_number">
                                        { item.next_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="padding">
                                        { item.padding }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reset_policy">
                                        { item.reset_policy }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.numbering_profiles_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Widgets Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>WidgetKey</th>
                                
                                
                                
                                <th>WidgetTitle</th>
                                
                                
                                
                                <th>Placement</th>
                                
                                
                                
                                <th>IsEnabled</th>
                                
                                
                                
                                <th>SortOrder</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.widgets_business && Array.isArray(businesses.widgets_business) &&
                              businesses.widgets_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/widgets/widgets-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="key">
                                        { item.key }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="placement">
                                        { item.placement }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_enabled">
                                        { dataFormatter.booleanFormatter(item.is_enabled) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sort_order">
                                        { item.sort_order }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.widgets_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Counterparties Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Type</th>
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Name</th>
                                
                                
                                
                                <th>NationalID</th>
                                
                                
                                
                                <th>EconomicCode</th>
                                
                                
                                
                                <th>Phone</th>
                                
                                
                                
                                <th>Address</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.counterparties_business && Array.isArray(businesses.counterparties_business) &&
                              businesses.counterparties_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/counterparties/counterparties-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="type">
                                        { item.type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="national_id">
                                        { item.national_id }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="economic_code">
                                        { item.economic_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="phone">
                                        { item.phone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address">
                                        { item.address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.counterparties_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Cost_centers Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Name</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.cost_centers_business && Array.isArray(businesses.cost_centers_business) &&
                              businesses.cost_centers_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/cost_centers/cost_centers-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.cost_centers_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Projects Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Name</th>
                                
                                
                                
                                <th>StartDate</th>
                                
                                
                                
                                <th>EndDate</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.projects_business && Array.isArray(businesses.projects_business) &&
                              businesses.projects_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/projects/projects-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </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="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.projects_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Contracts Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>ContractNumber</th>
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>StartDate</th>
                                
                                
                                
                                <th>EndDate</th>
                                
                                
                                
                                <th>Amount</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.contracts_business && Array.isArray(businesses.contracts_business) &&
                              businesses.contracts_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/contracts/contracts-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="contract_number">
                                        { item.contract_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </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="amount">
                                        { item.amount }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.contracts_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Cash_boxes Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Name</th>
                                
                                
                                
                                
                                
                                <th>OpeningBalance</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.cash_boxes_business && Array.isArray(businesses.cash_boxes_business) &&
                              businesses.cash_boxes_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/cash_boxes/cash_boxes-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="opening_balance">
                                        { item.opening_balance }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.cash_boxes_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Banks Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>BankName</th>
                                
                                
                                
                                <th>SWIFT</th>
                                
                                
                                
                                <th>Website</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.banks_business && Array.isArray(businesses.banks_business) &&
                              businesses.banks_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/banks/banks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="swift">
                                        { item.swift }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="website">
                                        { item.website }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.banks_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Bank_accounts Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>AccountTitle</th>
                                
                                
                                
                                <th>AccountNumber</th>
                                
                                
                                
                                <th>IBAN</th>
                                
                                
                                
                                <th>CardNumber</th>
                                
                                
                                
                                
                                
                                <th>OpeningBalance</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.bank_accounts_business && Array.isArray(businesses.bank_accounts_business) &&
                              businesses.bank_accounts_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/bank_accounts/bank_accounts-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="account_title">
                                        { item.account_title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="account_number">
                                        { item.account_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="iban">
                                        { item.iban }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="card_number">
                                        { item.card_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="opening_balance">
                                        { item.opening_balance }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.bank_accounts_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Letters_of_credit Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>LCNumber</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>IssueDate</th>
                                
                                
                                
                                <th>ExpiryDate</th>
                                
                                
                                
                                <th>Amount</th>
                                
                                
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.letters_of_credit_business && Array.isArray(businesses.letters_of_credit_business) &&
                              businesses.letters_of_credit_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/letters_of_credit/letters_of_credit-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="lc_number">
                                        { item.lc_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="issue_date">
                                        { dataFormatter.dateTimeFormatter(item.issue_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expiry_date">
                                        { dataFormatter.dateTimeFormatter(item.expiry_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount">
                                        { item.amount }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.letters_of_credit_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Pos_terminals Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>TerminalNumber</th>
                                
                                
                                
                                <th>MerchantNumber</th>
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.pos_terminals_business && Array.isArray(businesses.pos_terminals_business) &&
                              businesses.pos_terminals_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/pos_terminals/pos_terminals-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="terminal_number">
                                        { item.terminal_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="merchant_number">
                                        { item.merchant_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.pos_terminals_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Sales_item_groups Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Name</th>
                                
                                
                                
                                <th>ParentCode</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.sales_item_groups_business && Array.isArray(businesses.sales_item_groups_business) &&
                              businesses.sales_item_groups_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/sales_item_groups/sales_item_groups-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="parent_code">
                                        { item.parent_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.sales_item_groups_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Warehouse_item_groups Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Name</th>
                                
                                
                                
                                <th>ParentCode</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.warehouse_item_groups_business && Array.isArray(businesses.warehouse_item_groups_business) &&
                              businesses.warehouse_item_groups_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/warehouse_item_groups/warehouse_item_groups-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="parent_code">
                                        { item.parent_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.warehouse_item_groups_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Customer_groups Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Name</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.customer_groups_business && Array.isArray(businesses.customer_groups_business) &&
                              businesses.customer_groups_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/customer_groups/customer_groups-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.customer_groups_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Analytic_dimensions Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Level</th>
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Name</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.analytic_dimensions_business && Array.isArray(businesses.analytic_dimensions_business) &&
                              businesses.analytic_dimensions_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/analytic_dimensions/analytic_dimensions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="level">
                                        { item.level }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.analytic_dimensions_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Accounts Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>CodingMode</th>
                                
                                
                                
                                <th>AccountCode</th>
                                
                                
                                
                                <th>AccountName</th>
                                
                                
                                
                                <th>Level</th>
                                
                                
                                
                                <th>Nature</th>
                                
                                
                                
                                <th>IsLeaf</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                                
                                <th>ParentCode</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.accounts_business && Array.isArray(businesses.accounts_business) &&
                              businesses.accounts_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/accounts/accounts-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="coding_mode">
                                        { item.coding_mode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="level">
                                        { item.level }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="nature">
                                        { item.nature }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_leaf">
                                        { dataFormatter.booleanFormatter(item.is_leaf) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="parent_code">
                                        { item.parent_code }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.accounts_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Journal_voucher_types Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Name</th>
                                
                                
                                
                                
                                
                                <th>RequiresApproval</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.journal_voucher_types_business && Array.isArray(businesses.journal_voucher_types_business) &&
                              businesses.journal_voucher_types_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/journal_voucher_types/journal_voucher_types-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="requires_approval">
                                        { dataFormatter.booleanFormatter(item.requires_approval) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.journal_voucher_types_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Journal_vouchers Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>VoucherNumber</th>
                                
                                
                                
                                <th>VoucherDate</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>TotalDebit</th>
                                
                                
                                
                                <th>TotalCredit</th>
                                
                                
                                
                                <th>IsBalanced</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.journal_vouchers_business && Array.isArray(businesses.journal_vouchers_business) &&
                              businesses.journal_vouchers_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/journal_vouchers/journal_vouchers-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="voucher_number">
                                        { item.voucher_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="voucher_date">
                                        { dataFormatter.dateTimeFormatter(item.voucher_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_debit">
                                        { item.total_debit }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_credit">
                                        { item.total_credit }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_balanced">
                                        { dataFormatter.booleanFormatter(item.is_balanced) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.journal_vouchers_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Approval_workflows Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>WorkflowName</th>
                                
                                
                                
                                <th>AppliesTo</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.approval_workflows_business && Array.isArray(businesses.approval_workflows_business) &&
                              businesses.approval_workflows_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/approval_workflows/approval_workflows-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="applies_to">
                                        { item.applies_to }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.approval_workflows_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Year_end_operations Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>OperationType</th>
                                
                                
                                
                                <th>OperationDate</th>
                                
                                
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.year_end_operations_business && Array.isArray(businesses.year_end_operations_business) &&
                              businesses.year_end_operations_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/year_end_operations/year_end_operations-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="operation_type">
                                        { item.operation_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="operation_date">
                                        { dataFormatter.dateTimeFormatter(item.operation_date) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.year_end_operations_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Report_definitions Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ReportCode</th>
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>Engine</th>
                                
                                
                                
                                <th>Path/Name</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.report_definitions_business && Array.isArray(businesses.report_definitions_business) &&
                              businesses.report_definitions_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/report_definitions/report_definitions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="engine">
                                        { item.engine }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="path_or_name">
                                        { item.path_or_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.report_definitions_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Chat_conversations Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Type</th>
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>IsArchived</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.chat_conversations_business && Array.isArray(businesses.chat_conversations_business) &&
                              businesses.chat_conversations_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/chat_conversations/chat_conversations-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="type">
                                        { item.type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_archived">
                                        { dataFormatter.booleanFormatter(item.is_archived) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.chat_conversations_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Form_alarms Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>FormKey</th>
                                
                                
                                
                                <th>Action</th>
                                
                                
                                
                                <th>Severity</th>
                                
                                
                                
                                <th>MessageTemplate</th>
                                
                                
                                
                                <th>IsEnabled</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.form_alarms_business && Array.isArray(businesses.form_alarms_business) &&
                              businesses.form_alarms_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/form_alarms/form_alarms-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="form_key">
                                        { item.form_key }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="action">
                                        { item.action }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="severity">
                                        { item.severity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="message_template">
                                        { item.message_template }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_enabled">
                                        { dataFormatter.booleanFormatter(item.is_enabled) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.form_alarms_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Data_export_jobs Business</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>ExportType</th>
                                
                                
                                
                                <th>SourceConnectionName</th>
                                
                                
                                
                                <th>TargetConnectionName</th>
                                
                                
                                
                                <th>RequestedAt</th>
                                
                                
                                
                                <th>CompletedAt</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                <th>ErrorMessage</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {businesses.data_export_jobs_business && Array.isArray(businesses.data_export_jobs_business) &&
                              businesses.data_export_jobs_business.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/data_export_jobs/data_export_jobs-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="export_type">
                                        { item.export_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="source_connection_name">
                                        { item.source_connection_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="target_connection_name">
                                        { item.target_connection_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="requested_at">
                                        { dataFormatter.dateTimeFormatter(item.requested_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="completed_at">
                                        { dataFormatter.dateTimeFormatter(item.completed_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="error_message">
                                        { item.error_message }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!businesses?.data_export_jobs_business?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                

                <BaseDivider />

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

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

export default BusinessesView;