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

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


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

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

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


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

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

              

              

              

              

              

              

              

              

              

              

              

              
              

                
                <>
                    <p className={'block font-bold mb-2'}>Users Organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>First Name</th>
                                
                                
                                
                                <th>Last Name</th>
                                
                                
                                
                                <th>Phone Number</th>
                                
                                
                                
                                <th>E-Mail</th>
                                
                                
                                
                                <th>Disabled</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.users_organizations && Array.isArray(organizations.users_organizations) &&
                              organizations.users_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/users/users-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="firstName">
                                        { item.firstName }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="lastName">
                                        { item.lastName }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="phoneNumber">
                                        { item.phoneNumber }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="email">
                                        { item.email }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="disabled">
                                        { dataFormatter.booleanFormatter(item.disabled) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.users_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Hotels organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>HotelName</th>
                                
                                
                                
                                <th>LegalName</th>
                                
                                
                                
                                <th>AddressLine1</th>
                                
                                
                                
                                <th>AddressLine2</th>
                                
                                
                                
                                <th>City</th>
                                
                                
                                
                                <th>StateorRegion</th>
                                
                                
                                
                                <th>PostalCode</th>
                                
                                
                                
                                <th>Country</th>
                                
                                
                                
                                <th>Phone</th>
                                
                                
                                
                                <th>Email</th>
                                
                                
                                
                                <th>Website</th>
                                
                                
                                
                                <th>Timezone</th>
                                
                                
                                
                                <th>Currency</th>
                                
                                
                                
                                <th>DefaultTaxRate</th>
                                
                                
                                
                                <th>Active</th>
                                
                                
                                
                                <th>StripeCustomerReference</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.hotels_organizations && Array.isArray(organizations.hotels_organizations) &&
                              organizations.hotels_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/hotels/hotels-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="legal_name">
                                        { item.legal_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address_line1">
                                        { item.address_line1 }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address_line2">
                                        { item.address_line2 }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="city">
                                        { item.city }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="state_region">
                                        { item.state_region }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="postal_code">
                                        { item.postal_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="country">
                                        { item.country }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="phone">
                                        { item.phone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="email">
                                        { item.email }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="website">
                                        { item.website }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="timezone">
                                        { item.timezone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="currency">
                                        { item.currency }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="default_tax_rate">
                                        { item.default_tax_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="active">
                                        { dataFormatter.booleanFormatter(item.active) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="stripe_customer_reference">
                                        { item.stripe_customer_reference }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.hotels_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Departments organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>DepartmentName</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>Active</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.departments_organizations && Array.isArray(organizations.departments_organizations) &&
                              organizations.departments_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/departments/departments-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="active">
                                        { dataFormatter.booleanFormatter(item.active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.departments_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Staff_profiles organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>JobTitle</th>
                                
                                
                                
                                <th>EmployeeCode</th>
                                
                                
                                
                                <th>HireDate</th>
                                
                                
                                
                                <th>CanLogin</th>
                                
                                
                                
                                <th>Active</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.staff_profiles_organizations && Array.isArray(organizations.staff_profiles_organizations) &&
                              organizations.staff_profiles_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/staff_profiles/staff_profiles-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="job_title">
                                        { item.job_title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="employee_code">
                                        { item.employee_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="hire_date">
                                        { dataFormatter.dateTimeFormatter(item.hire_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="can_login">
                                        { dataFormatter.booleanFormatter(item.can_login) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="active">
                                        { dataFormatter.booleanFormatter(item.active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.staff_profiles_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Shifts organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>StartAt</th>
                                
                                
                                
                                <th>EndAt</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.shifts_organizations && Array.isArray(organizations.shifts_organizations) &&
                              organizations.shifts_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/shifts/shifts-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="start_at">
                                        { dataFormatter.dateTimeFormatter(item.start_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="end_at">
                                        { dataFormatter.dateTimeFormatter(item.end_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.shifts_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Room_types organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>RoomTypeName</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>CapacityAdults</th>
                                
                                
                                
                                <th>CapacityChildren</th>
                                
                                
                                
                                <th>BaseRate</th>
                                
                                
                                
                                
                                
                                <th>Active</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.room_types_organizations && Array.isArray(organizations.room_types_organizations) &&
                              organizations.room_types_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/room_types/room_types-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="capacity_adults">
                                        { item.capacity_adults }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="capacity_children">
                                        { item.capacity_children }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="base_rate">
                                        { item.base_rate }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="active">
                                        { dataFormatter.booleanFormatter(item.active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.room_types_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Rooms organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>RoomNumber</th>
                                
                                
                                
                                <th>Floor</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                                
                                <th>Active</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.rooms_organizations && Array.isArray(organizations.rooms_organizations) &&
                              organizations.rooms_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/rooms/rooms-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="room_number">
                                        { item.room_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="floor">
                                        { item.floor }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="active">
                                        { dataFormatter.booleanFormatter(item.active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.rooms_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Guests organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>FirstName</th>
                                
                                
                                
                                <th>LastName</th>
                                
                                
                                
                                <th>Email</th>
                                
                                
                                
                                <th>Phone</th>
                                
                                
                                
                                <th>Nationality</th>
                                
                                
                                
                                <th>AddressLine1</th>
                                
                                
                                
                                <th>AddressLine2</th>
                                
                                
                                
                                <th>City</th>
                                
                                
                                
                                <th>StateorRegion</th>
                                
                                
                                
                                <th>PostalCode</th>
                                
                                
                                
                                <th>Country</th>
                                
                                
                                
                                <th>Preferences</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                                
                                <th>LoyaltyPoints</th>
                                
                                
                                
                                <th>MarketingOptIn</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.guests_organizations && Array.isArray(organizations.guests_organizations) &&
                              organizations.guests_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/guests/guests-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="first_name">
                                        { item.first_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_name">
                                        { item.last_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="email">
                                        { item.email }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="phone">
                                        { item.phone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="nationality">
                                        { item.nationality }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address_line1">
                                        { item.address_line1 }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address_line2">
                                        { item.address_line2 }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="city">
                                        { item.city }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="state_region">
                                        { item.state_region }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="postal_code">
                                        { item.postal_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="country">
                                        { item.country }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="preferences">
                                        { item.preferences }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="loyalty_points">
                                        { item.loyalty_points }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="marketing_opt_in">
                                        { dataFormatter.booleanFormatter(item.marketing_opt_in) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.guests_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Guest_documents organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>DocumentType</th>
                                
                                
                                
                                <th>DocumentNumber</th>
                                
                                
                                
                                <th>IssuedAt</th>
                                
                                
                                
                                <th>ExpiresAt</th>
                                
                                
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.guest_documents_organizations && Array.isArray(organizations.guest_documents_organizations) &&
                              organizations.guest_documents_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/guest_documents/guest_documents-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="document_type">
                                        { item.document_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="document_number">
                                        { item.document_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="issued_at">
                                        { dataFormatter.dateTimeFormatter(item.issued_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expires_at">
                                        { dataFormatter.dateTimeFormatter(item.expires_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.guest_documents_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Rate_plans organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>RatePlanName</th>
                                
                                
                                
                                <th>PlanType</th>
                                
                                
                                
                                <th>Refundable</th>
                                
                                
                                
                                <th>MinimumNights</th>
                                
                                
                                
                                <th>MaximumNights</th>
                                
                                
                                
                                <th>DepositPercent</th>
                                
                                
                                
                                <th>CancellationPolicy</th>
                                
                                
                                
                                <th>Active</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.rate_plans_organizations && Array.isArray(organizations.rate_plans_organizations) &&
                              organizations.rate_plans_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/rate_plans/rate_plans-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="plan_type">
                                        { item.plan_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="refundable">
                                        { dataFormatter.booleanFormatter(item.refundable) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="min_nights">
                                        { item.min_nights }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="max_nights">
                                        { item.max_nights }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="deposit_percent">
                                        { item.deposit_percent }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="cancellation_policy">
                                        { item.cancellation_policy }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="active">
                                        { dataFormatter.booleanFormatter(item.active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.rate_plans_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Seasonal_rates organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>StartDate</th>
                                
                                
                                
                                <th>EndDate</th>
                                
                                
                                
                                <th>NightlyRate</th>
                                
                                
                                
                                <th>PricingMode</th>
                                
                                
                                
                                <th>DeltaAmount</th>
                                
                                
                                
                                <th>Active</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.seasonal_rates_organizations && Array.isArray(organizations.seasonal_rates_organizations) &&
                              organizations.seasonal_rates_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/seasonal_rates/seasonal_rates-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <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="nightly_rate">
                                        { item.nightly_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="pricing_mode">
                                        { item.pricing_mode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="delta_amount">
                                        { item.delta_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="active">
                                        { dataFormatter.booleanFormatter(item.active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.seasonal_rates_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Dynamic_pricing_rules organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>RuleName</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>RuleType</th>
                                
                                
                                
                                <th>AdjustmentPercent</th>
                                
                                
                                
                                <th>AdjustmentAmount</th>
                                
                                
                                
                                <th>MinimumOccupancyPercent</th>
                                
                                
                                
                                <th>MaximumOccupancyPercent</th>
                                
                                
                                
                                <th>MinimumDaysBeforeArrival</th>
                                
                                
                                
                                <th>MaximumDaysBeforeArrival</th>
                                
                                
                                
                                <th>AppliesDaysOfWeek</th>
                                
                                
                                
                                <th>Active</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.dynamic_pricing_rules_organizations && Array.isArray(organizations.dynamic_pricing_rules_organizations) &&
                              organizations.dynamic_pricing_rules_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/dynamic_pricing_rules/dynamic_pricing_rules-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="rule_type">
                                        { item.rule_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="adjustment_percent">
                                        { item.adjustment_percent }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="adjustment_amount">
                                        { item.adjustment_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="min_occupancy_percent">
                                        { item.min_occupancy_percent }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="max_occupancy_percent">
                                        { item.max_occupancy_percent }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="min_days_before">
                                        { item.min_days_before }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="max_days_before">
                                        { item.max_days_before }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="applies_days_of_week">
                                        { item.applies_days_of_week }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="active">
                                        { dataFormatter.booleanFormatter(item.active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.dynamic_pricing_rules_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Sales_channels organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ChannelType</th>
                                
                                
                                
                                <th>ChannelName</th>
                                
                                
                                
                                <th>ExternalReference</th>
                                
                                
                                
                                <th>Active</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.sales_channels_organizations && Array.isArray(organizations.sales_channels_organizations) &&
                              organizations.sales_channels_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/sales_channels/sales_channels-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="channel_type">
                                        { item.channel_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="external_reference">
                                        { item.external_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="active">
                                        { dataFormatter.booleanFormatter(item.active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.sales_channels_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Ota_connections organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Provider</th>
                                
                                
                                
                                <th>AccountIdentifier</th>
                                
                                
                                
                                <th>APIKeyReference</th>
                                
                                
                                
                                <th>InventorySyncEnabled</th>
                                
                                
                                
                                <th>RateSyncEnabled</th>
                                
                                
                                
                                <th>LastSyncAt</th>
                                
                                
                                
                                <th>SyncStatus</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.ota_connections_organizations && Array.isArray(organizations.ota_connections_organizations) &&
                              organizations.ota_connections_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/ota_connections/ota_connections-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="provider">
                                        { item.provider }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="account_identifier">
                                        { item.account_identifier }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="api_key_reference">
                                        { item.api_key_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="inventory_sync_enabled">
                                        { dataFormatter.booleanFormatter(item.inventory_sync_enabled) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rate_sync_enabled">
                                        { dataFormatter.booleanFormatter(item.rate_sync_enabled) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_sync_at">
                                        { dataFormatter.dateTimeFormatter(item.last_sync_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sync_status">
                                        { item.sync_status }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.ota_connections_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Reservations organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ReservationNumber</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>CheckIn</th>
                                
                                
                                
                                <th>CheckOut</th>
                                
                                
                                
                                <th>Adults</th>
                                
                                
                                
                                <th>Children</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>TotalAmount</th>
                                
                                
                                
                                <th>TaxAmount</th>
                                
                                
                                
                                <th>DepositAmount</th>
                                
                                
                                
                                <th>SpecialRequests</th>
                                
                                
                                
                                <th>InternalNotes</th>
                                
                                
                                
                                <th>CancelledAt</th>
                                
                                
                                
                                <th>CancellationReason</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.reservations_organizations && Array.isArray(organizations.reservations_organizations) &&
                              organizations.reservations_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/reservations/reservations-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="reservation_number">
                                        { item.reservation_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="check_in_at">
                                        { dataFormatter.dateTimeFormatter(item.check_in_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="check_out_at">
                                        { dataFormatter.dateTimeFormatter(item.check_out_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="adults">
                                        { item.adults }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="children">
                                        { item.children }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_amount">
                                        { item.total_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_amount">
                                        { item.tax_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="deposit_amount">
                                        { item.deposit_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="special_requests">
                                        { item.special_requests }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="internal_notes">
                                        { item.internal_notes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="cancelled_at">
                                        { dataFormatter.dateTimeFormatter(item.cancelled_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="cancellation_reason">
                                        { item.cancellation_reason }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.reservations_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Reservation_guests organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>GuestRole</th>
                                
                                
                                
                                <th>IsPrimary</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.reservation_guests_organizations && Array.isArray(organizations.reservation_guests_organizations) &&
                              organizations.reservation_guests_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/reservation_guests/reservation_guests-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="guest_role">
                                        { item.guest_role }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_primary">
                                        { dataFormatter.booleanFormatter(item.is_primary) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.reservation_guests_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Stay_folios organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>FolioNumber</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>BalanceDue</th>
                                
                                
                                
                                <th>TotalCharges</th>
                                
                                
                                
                                <th>TotalPayments</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.stay_folios_organizations && Array.isArray(organizations.stay_folios_organizations) &&
                              organizations.stay_folios_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/stay_folios/stay_folios-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="folio_number">
                                        { item.folio_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="balance_due">
                                        { item.balance_due }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_charges">
                                        { item.total_charges }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_payments">
                                        { item.total_payments }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.stay_folios_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Folio_items organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>ItemType</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>PostedAt</th>
                                
                                
                                
                                <th>Quantity</th>
                                
                                
                                
                                <th>UnitPrice</th>
                                
                                
                                
                                <th>Amount</th>
                                
                                
                                
                                <th>Taxable</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.folio_items_organizations && Array.isArray(organizations.folio_items_organizations) &&
                              organizations.folio_items_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/folio_items/folio_items-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="item_type">
                                        { item.item_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="posted_at">
                                        { dataFormatter.dateTimeFormatter(item.posted_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unit_price">
                                        { item.unit_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount">
                                        { item.amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="taxable">
                                        { dataFormatter.booleanFormatter(item.taxable) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.folio_items_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Payments organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>PaymentMethod</th>
                                
                                
                                
                                <th>Amount</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>PaidAt</th>
                                
                                
                                
                                <th>StripePaymentIntentReference</th>
                                
                                
                                
                                <th>StripeChargeReference</th>
                                
                                
                                
                                <th>ReceiptNumber</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.payments_organizations && Array.isArray(organizations.payments_organizations) &&
                              organizations.payments_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/payments/payments-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="method">
                                        { item.method }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount">
                                        { item.amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="paid_at">
                                        { dataFormatter.dateTimeFormatter(item.paid_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="stripe_payment_intent_reference">
                                        { item.stripe_payment_intent_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="stripe_charge_reference">
                                        { item.stripe_charge_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="receipt_number">
                                        { item.receipt_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.payments_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Refunds organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>RefundAmount</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>RefundedAt</th>
                                
                                
                                
                                <th>StripeRefundReference</th>
                                
                                
                                
                                <th>Reason</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.refunds_organizations && Array.isArray(organizations.refunds_organizations) &&
                              organizations.refunds_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/refunds/refunds-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="amount">
                                        { item.amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="refunded_at">
                                        { dataFormatter.dateTimeFormatter(item.refunded_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="stripe_refund_reference">
                                        { item.stripe_refund_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reason">
                                        { item.reason }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.refunds_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Invoices organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>InvoiceNumber</th>
                                
                                
                                
                                <th>IssuedAt</th>
                                
                                
                                
                                <th>DueAt</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>SubtotalAmount</th>
                                
                                
                                
                                <th>TaxAmount</th>
                                
                                
                                
                                <th>TotalAmount</th>
                                
                                
                                
                                
                                
                                <th>BillingName</th>
                                
                                
                                
                                <th>BillingAddress</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.invoices_organizations && Array.isArray(organizations.invoices_organizations) &&
                              organizations.invoices_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/invoices/invoices-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="invoice_number">
                                        { item.invoice_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="issued_at">
                                        { dataFormatter.dateTimeFormatter(item.issued_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="due_at">
                                        { dataFormatter.dateTimeFormatter(item.due_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subtotal_amount">
                                        { item.subtotal_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_amount">
                                        { item.tax_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_amount">
                                        { item.total_amount }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="billing_name">
                                        { item.billing_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="billing_address">
                                        { item.billing_address }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.invoices_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Housekeeping_tasks organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>ScheduledFor</th>
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>CompletedAt</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>TaskType</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.housekeeping_tasks_organizations && Array.isArray(organizations.housekeeping_tasks_organizations) &&
                              organizations.housekeeping_tasks_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/housekeeping_tasks/housekeeping_tasks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="scheduled_for">
                                        { dataFormatter.dateTimeFormatter(item.scheduled_for) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="completed_at">
                                        { dataFormatter.dateTimeFormatter(item.completed_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="task_type">
                                        { item.task_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.housekeeping_tasks_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Maintenance_tickets organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Category</th>
                                
                                
                                
                                <th>Priority</th>
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>OpenedAt</th>
                                
                                
                                
                                <th>ClosedAt</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.maintenance_tickets_organizations && Array.isArray(organizations.maintenance_tickets_organizations) &&
                              organizations.maintenance_tickets_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/maintenance_tickets/maintenance_tickets-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="category">
                                        { item.category }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="priority">
                                        { item.priority }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="opened_at">
                                        { dataFormatter.dateTimeFormatter(item.opened_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closed_at">
                                        { dataFormatter.dateTimeFormatter(item.closed_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.maintenance_tickets_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Notifications organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Channel</th>
                                
                                
                                
                                <th>TemplateType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>ScheduledAt</th>
                                
                                
                                
                                <th>SentAt</th>
                                
                                
                                
                                <th>ToAddress</th>
                                
                                
                                
                                <th>Subject</th>
                                
                                
                                
                                
                                
                                <th>ProviderMessageReference</th>
                                
                                
                                
                                <th>ErrorMessage</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.notifications_organizations && Array.isArray(organizations.notifications_organizations) &&
                              organizations.notifications_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/notifications/notifications-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="channel">
                                        { item.channel }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="template_type">
                                        { item.template_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scheduled_at">
                                        { dataFormatter.dateTimeFormatter(item.scheduled_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sent_at">
                                        { dataFormatter.dateTimeFormatter(item.sent_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="to_address">
                                        { item.to_address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subject">
                                        { item.subject }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="provider_message_reference">
                                        { item.provider_message_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="error_message">
                                        { item.error_message }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.notifications_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Booking_widgets organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>WidgetName</th>
                                
                                
                                
                                <th>PublicKey</th>
                                
                                
                                
                                <th>AllowedDomains</th>
                                
                                
                                
                                <th>Active</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.booking_widgets_organizations && Array.isArray(organizations.booking_widgets_organizations) &&
                              organizations.booking_widgets_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/booking_widgets/booking_widgets-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="public_key">
                                        { item.public_key }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="allowed_domains">
                                        { item.allowed_domains }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="active">
                                        { dataFormatter.booleanFormatter(item.active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.booking_widgets_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Subscriptions organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Plan</th>
                                
                                
                                
                                <th>BillingCycle</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>TrialEndsAt</th>
                                
                                
                                
                                <th>CurrentPeriodStartAt</th>
                                
                                
                                
                                <th>CurrentPeriodEndAt</th>
                                
                                
                                
                                <th>IncludedRoomsLimit</th>
                                
                                
                                
                                <th>IncludedUsersLimit</th>
                                
                                
                                
                                <th>StripeSubscriptionReference</th>
                                
                                
                                
                                <th>StripePriceReference</th>
                                
                                
                                
                                <th>AutoRenew</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.subscriptions_organizations && Array.isArray(organizations.subscriptions_organizations) &&
                              organizations.subscriptions_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/subscriptions/subscriptions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="plan">
                                        { item.plan }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="billing_cycle">
                                        { item.billing_cycle }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="trial_ends_at">
                                        { dataFormatter.dateTimeFormatter(item.trial_ends_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="current_period_start_at">
                                        { dataFormatter.dateTimeFormatter(item.current_period_start_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="current_period_end_at">
                                        { dataFormatter.dateTimeFormatter(item.current_period_end_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="included_rooms_limit">
                                        { item.included_rooms_limit }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="included_users_limit">
                                        { item.included_users_limit }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="stripe_subscription_reference">
                                        { item.stripe_subscription_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="stripe_price_reference">
                                        { item.stripe_price_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="auto_renew">
                                        { dataFormatter.booleanFormatter(item.auto_renew) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.subscriptions_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Audit_logs organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Action</th>
                                
                                
                                
                                <th>EntityName</th>
                                
                                
                                
                                <th>RecordReference</th>
                                
                                
                                
                                <th>OccurredAt</th>
                                
                                
                                
                                <th>IPAddress</th>
                                
                                
                                
                                <th>UserAgent</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.audit_logs_organizations && Array.isArray(organizations.audit_logs_organizations) &&
                              organizations.audit_logs_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/audit_logs/audit_logs-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="action">
                                        { item.action }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entity_name">
                                        { item.entity_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="record_reference">
                                        { item.record_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="occurred_at">
                                        { dataFormatter.dateTimeFormatter(item.occurred_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ip_address">
                                        { item.ip_address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="user_agent">
                                        { item.user_agent }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.audit_logs_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Daily_snapshots organizations</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>SnapshotAt</th>
                                
                                
                                
                                <th>RoomsAvailable</th>
                                
                                
                                
                                <th>RoomsOccupied</th>
                                
                                
                                
                                <th>RoomsDirty</th>
                                
                                
                                
                                <th>RoomsOutOfService</th>
                                
                                
                                
                                <th>OccupancyRatePercent</th>
                                
                                
                                
                                <th>RevenueToday</th>
                                
                                
                                
                                <th>RevenueMonthToDate</th>
                                
                                
                                
                                <th>ADR</th>
                                
                                
                                
                                <th>RevPAR</th>
                                
                                
                                
                                <th>ArrivalsToday</th>
                                
                                
                                
                                <th>DeparturesToday</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {organizations.daily_snapshots_organizations && Array.isArray(organizations.daily_snapshots_organizations) &&
                              organizations.daily_snapshots_organizations.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/daily_snapshots/daily_snapshots-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="snapshot_at">
                                        { dataFormatter.dateTimeFormatter(item.snapshot_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rooms_available">
                                        { item.rooms_available }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rooms_occupied">
                                        { item.rooms_occupied }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rooms_dirty">
                                        { item.rooms_dirty }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rooms_out_of_service">
                                        { item.rooms_out_of_service }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="occupancy_rate_percent">
                                        { item.occupancy_rate_percent }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="revenue_today">
                                        { item.revenue_today }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="revenue_month_to_date">
                                        { item.revenue_month_to_date }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="adr">
                                        { item.adr }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="revpar">
                                        { item.revpar }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="arrivals_today">
                                        { item.arrivals_today }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="departures_today">
                                        { item.departures_today }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!organizations?.daily_snapshots_organizations?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                

                <BaseDivider />

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

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

export default OrganizationsView;