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/tenants/tenantsSlice'
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 TenantsView = () => {
    const router = useRouter()
    const dispatch = useAppDispatch()
    const { tenants } = useAppSelector((state) => state.tenants)
    
    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 tenants')}</title>
          </Head>
          <SectionMain>
            <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title={removeLastCharacter('View tenants')} main>
                <BaseButton
                  color='info'
                  label='Edit'
                  href={`/tenants/tenants-edit/?id=${id}`}
                />
            </SectionTitleLineWithButton>
            <CardBox>
            

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>TenantName</p>
                    <p>{tenants?.tenant_name}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

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

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Domain</p>
                    <p>{tenants?.domain}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Industry</p>
                    <p>{tenants?.industry}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>DefaultCurrency</p>
                    <p>{tenants?.default_currency}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Timezone</p>
                    <p>{tenants?.timezone}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

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

              

              

              

              
              

              

              

              

              

              

              

              

              

              

              

              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>LogoImages</p>
                    {tenants?.logo_images?.length
                      ? (
                        <ImageField
                          name={'logo_images'}
                          image={tenants?.logo_images}
                          className='w-20 h-20'
                        />
                      ) : <p>No LogoImages</p>
                    }
                </div>
              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>SupportEmail</p>
                    <p>{tenants?.support_email}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>SupportPhone</p>
                    <p>{tenants?.support_phone}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

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

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              

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

              

              

              
              

                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Products Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ProductName</th>
                                
                                
                                
                                <th>SKU</th>
                                
                                
                                
                                <th>Barcode</th>
                                
                                
                                
                                <th>ProductStatus</th>
                                
                                
                                
                                <th>Brand</th>
                                
                                
                                
                                <th>Category</th>
                                
                                
                                
                                <th>Unit</th>
                                
                                
                                
                                <th>Weight(grams)</th>
                                
                                
                                
                                <th>Length(cm)</th>
                                
                                
                                
                                <th>Width(cm)</th>
                                
                                
                                
                                <th>Height(cm)</th>
                                
                                
                                
                                <th>CostPrice</th>
                                
                                
                                
                                <th>RetailPrice</th>
                                
                                
                                
                                <th>ResellerPrice</th>
                                
                                
                                
                                <th>AgentPrice</th>
                                
                                
                                
                                <th>DistributorPrice</th>
                                
                                
                                
                                <th>LowStockThreshold</th>
                                
                                
                                
                                
                                
                                <th>ShortDescription</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.products_tenant && Array.isArray(tenants.products_tenant) &&
                              tenants.products_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/products/products-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="product_name">
                                        { item.product_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sku">
                                        { item.sku }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="barcode">
                                        { item.barcode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="product_status">
                                        { item.product_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="brand">
                                        { item.brand }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="category">
                                        { item.category }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unit">
                                        { item.unit }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="weight_grams">
                                        { item.weight_grams }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="length_cm">
                                        { item.length_cm }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="width_cm">
                                        { item.width_cm }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="height_cm">
                                        { item.height_cm }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="cost_price">
                                        { item.cost_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="retail_price">
                                        { item.retail_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reseller_price">
                                        { item.reseller_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="agent_price">
                                        { item.agent_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="distributor_price">
                                        { item.distributor_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="low_stock_threshold">
                                        { item.low_stock_threshold }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="short_description">
                                        { item.short_description }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.products_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Warehouses Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>WarehouseName</th>
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>ContactName</th>
                                
                                
                                
                                <th>ContactPhone</th>
                                
                                
                                
                                <th>Address</th>
                                
                                
                                
                                <th>IsDefault</th>
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.warehouses_tenant && Array.isArray(tenants.warehouses_tenant) &&
                              tenants.warehouses_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/warehouses/warehouses-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="warehouse_name">
                                        { item.warehouse_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="contact_name">
                                        { item.contact_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="contact_phone">
                                        { item.contact_phone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address">
                                        { item.address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_default">
                                        { dataFormatter.booleanFormatter(item.is_default) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.warehouses_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Inventory_items Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>OnHandQty</th>
                                
                                
                                
                                <th>ReservedQty</th>
                                
                                
                                
                                <th>AvailableQty</th>
                                
                                
                                
                                <th>LastCountedAt</th>
                                
                                
                                
                                <th>Note</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.inventory_items_tenant && Array.isArray(tenants.inventory_items_tenant) &&
                              tenants.inventory_items_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/inventory_items/inventory_items-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="on_hand_qty">
                                        { item.on_hand_qty }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reserved_qty">
                                        { item.reserved_qty }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="available_qty">
                                        { item.available_qty }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_counted_at">
                                        { dataFormatter.dateTimeFormatter(item.last_counted_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="note">
                                        { item.note }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.inventory_items_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Inventory_movements Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>MovementType</th>
                                
                                
                                
                                <th>Quantity</th>
                                
                                
                                
                                <th>UnitCost</th>
                                
                                
                                
                                <th>ReferenceType</th>
                                
                                
                                
                                <th>ReferenceNumber</th>
                                
                                
                                
                                
                                
                                <th>MovedAt</th>
                                
                                
                                
                                <th>Note</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.inventory_movements_tenant && Array.isArray(tenants.inventory_movements_tenant) &&
                              tenants.inventory_movements_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/inventory_movements/inventory_movements-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="movement_type">
                                        { item.movement_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unit_cost">
                                        { item.unit_cost }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reference_type">
                                        { item.reference_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reference_number">
                                        { item.reference_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="moved_at">
                                        { dataFormatter.dateTimeFormatter(item.moved_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="note">
                                        { item.note }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.inventory_movements_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Customers Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>CustomerName</th>
                                
                                
                                
                                <th>Email</th>
                                
                                
                                
                                <th>PhoneNumber</th>
                                
                                
                                
                                <th>Address</th>
                                
                                
                                
                                <th>City</th>
                                
                                
                                
                                <th>Province</th>
                                
                                
                                
                                <th>PostalCode</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.customers_tenant && Array.isArray(tenants.customers_tenant) &&
                              tenants.customers_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/customers/customers-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="customer_name">
                                        { item.customer_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="email">
                                        { item.email }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="phone_number">
                                        { item.phone_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address">
                                        { item.address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="city">
                                        { item.city }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="province">
                                        { item.province }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="postal_code">
                                        { item.postal_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.customers_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Orders Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>OrderNumber</th>
                                
                                
                                
                                <th>OrderChannel</th>
                                
                                
                                
                                <th>OrderStatus</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>SubtotalAmount</th>
                                
                                
                                
                                <th>DiscountAmount</th>
                                
                                
                                
                                <th>ShippingAmount</th>
                                
                                
                                
                                <th>TaxAmount</th>
                                
                                
                                
                                <th>TotalAmount</th>
                                
                                
                                
                                <th>PaymentStatus</th>
                                
                                
                                
                                <th>FulfillmentStatus</th>
                                
                                
                                
                                <th>ShippingCourier</th>
                                
                                
                                
                                <th>ShippingService</th>
                                
                                
                                
                                <th>TrackingNumber</th>
                                
                                
                                
                                <th>OrderedAt</th>
                                
                                
                                
                                <th>PaidAt</th>
                                
                                
                                
                                <th>ShippedAt</th>
                                
                                
                                
                                <th>DeliveredAt</th>
                                
                                
                                
                                <th>ShippingAddress</th>
                                
                                
                                
                                <th>CustomerNote</th>
                                
                                
                                
                                <th>InternalNote</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.orders_tenant && Array.isArray(tenants.orders_tenant) &&
                              tenants.orders_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/orders/orders-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="order_number">
                                        { item.order_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="order_channel">
                                        { item.order_channel }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="order_status">
                                        { item.order_status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="subtotal_amount">
                                        { item.subtotal_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discount_amount">
                                        { item.discount_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipping_amount">
                                        { item.shipping_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_amount">
                                        { item.tax_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_amount">
                                        { item.total_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="payment_status">
                                        { item.payment_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="fulfillment_status">
                                        { item.fulfillment_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipping_courier">
                                        { item.shipping_courier }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipping_service">
                                        { item.shipping_service }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tracking_number">
                                        { item.tracking_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ordered_at">
                                        { dataFormatter.dateTimeFormatter(item.ordered_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="paid_at">
                                        { dataFormatter.dateTimeFormatter(item.paid_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipped_at">
                                        { dataFormatter.dateTimeFormatter(item.shipped_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="delivered_at">
                                        { dataFormatter.dateTimeFormatter(item.delivered_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipping_address">
                                        { item.shipping_address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="customer_note">
                                        { item.customer_note }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="internal_note">
                                        { item.internal_note }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.orders_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Invoices Tenant</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>InvoiceStatus</th>
                                
                                
                                
                                <th>IssuedAt</th>
                                
                                
                                
                                <th>DueAt</th>
                                
                                
                                
                                <th>AmountDue</th>
                                
                                
                                
                                <th>AmountPaid</th>
                                
                                
                                
                                
                                
                                <th>BillingName</th>
                                
                                
                                
                                <th>BillingAddress</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.invoices_tenant && Array.isArray(tenants.invoices_tenant) &&
                              tenants.invoices_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/invoices/invoices-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="invoice_number">
                                        { item.invoice_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="invoice_status">
                                        { item.invoice_status }
                                    </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="amount_due">
                                        { item.amount_due }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount_paid">
                                        { item.amount_paid }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="billing_name">
                                        { item.billing_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="billing_address">
                                        { item.billing_address }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.invoices_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Payments Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>PaymentReference</th>
                                
                                
                                
                                <th>PaymentMethod</th>
                                
                                
                                
                                <th>PaymentStatus</th>
                                
                                
                                
                                <th>Amount</th>
                                
                                
                                
                                <th>PaidAt</th>
                                
                                
                                
                                <th>PayerName</th>
                                
                                
                                
                                <th>Note</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.payments_tenant && Array.isArray(tenants.payments_tenant) &&
                              tenants.payments_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/payments/payments-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="payment_reference">
                                        { item.payment_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="payment_method">
                                        { item.payment_method }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="payment_status">
                                        { item.payment_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount">
                                        { item.amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="paid_at">
                                        { dataFormatter.dateTimeFormatter(item.paid_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="payer_name">
                                        { item.payer_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="note">
                                        { item.note }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.payments_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Commission_plans Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>PlanName</th>
                                
                                
                                
                                <th>PlanStatus</th>
                                
                                
                                
                                <th>CalculationBase</th>
                                
                                
                                
                                <th>CommissionType</th>
                                
                                
                                
                                <th>DefaultRate</th>
                                
                                
                                
                                <th>DefaultAmount</th>
                                
                                
                                
                                <th>IncludeShipping</th>
                                
                                
                                
                                <th>IncludeTax</th>
                                
                                
                                
                                <th>EffectiveFrom</th>
                                
                                
                                
                                <th>EffectiveTo</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.commission_plans_tenant && Array.isArray(tenants.commission_plans_tenant) &&
                              tenants.commission_plans_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/commission_plans/commission_plans-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="plan_name">
                                        { item.plan_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="plan_status">
                                        { item.plan_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="calculation_base">
                                        { item.calculation_base }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="commission_type">
                                        { item.commission_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="default_rate">
                                        { item.default_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="default_amount">
                                        { item.default_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="include_shipping">
                                        { dataFormatter.booleanFormatter(item.include_shipping) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="include_tax">
                                        { dataFormatter.booleanFormatter(item.include_tax) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="effective_from">
                                        { dataFormatter.dateTimeFormatter(item.effective_from) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="effective_to">
                                        { dataFormatter.dateTimeFormatter(item.effective_to) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.commission_plans_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Commissions Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>CommissionCode</th>
                                
                                
                                
                                <th>CommissionStatus</th>
                                
                                
                                
                                <th>CommissionType</th>
                                
                                
                                
                                <th>BaseAmount</th>
                                
                                
                                
                                <th>CommissionAmount</th>
                                
                                
                                
                                <th>EarnedAt</th>
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                                
                                <th>PaidAt</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.commissions_tenant && Array.isArray(tenants.commissions_tenant) &&
                              tenants.commissions_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/commissions/commissions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="commission_code">
                                        { item.commission_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="commission_status">
                                        { item.commission_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="commission_type">
                                        { item.commission_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="base_amount">
                                        { item.base_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="commission_amount">
                                        { item.commission_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="earned_at">
                                        { dataFormatter.dateTimeFormatter(item.earned_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="approved_at">
                                        { dataFormatter.dateTimeFormatter(item.approved_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="paid_at">
                                        { dataFormatter.dateTimeFormatter(item.paid_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.commissions_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Payouts Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>PayoutReference</th>
                                
                                
                                
                                
                                
                                <th>PayoutMethod</th>
                                
                                
                                
                                <th>PayoutStatus</th>
                                
                                
                                
                                <th>GrossAmount</th>
                                
                                
                                
                                <th>FeeAmount</th>
                                
                                
                                
                                <th>NetAmount</th>
                                
                                
                                
                                <th>ScheduledAt</th>
                                
                                
                                
                                <th>ProcessedAt</th>
                                
                                
                                
                                <th>PaidAt</th>
                                
                                
                                
                                
                                
                                <th>Note</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.payouts_tenant && Array.isArray(tenants.payouts_tenant) &&
                              tenants.payouts_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/payouts/payouts-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="payout_reference">
                                        { item.payout_reference }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="payout_method">
                                        { item.payout_method }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="payout_status">
                                        { item.payout_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="gross_amount">
                                        { item.gross_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="fee_amount">
                                        { item.fee_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="net_amount">
                                        { item.net_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scheduled_at">
                                        { dataFormatter.dateTimeFormatter(item.scheduled_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="processed_at">
                                        { dataFormatter.dateTimeFormatter(item.processed_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="paid_at">
                                        { dataFormatter.dateTimeFormatter(item.paid_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="note">
                                        { item.note }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.payouts_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Bonus_programs Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ProgramName</th>
                                
                                
                                
                                <th>ProgramStatus</th>
                                
                                
                                
                                <th>TargetMetric</th>
                                
                                
                                
                                <th>TargetValue</th>
                                
                                
                                
                                <th>RewardType</th>
                                
                                
                                
                                <th>RewardRate</th>
                                
                                
                                
                                <th>RewardAmount</th>
                                
                                
                                
                                <th>GiftDescription</th>
                                
                                
                                
                                <th>StartsAt</th>
                                
                                
                                
                                <th>EndsAt</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.bonus_programs_tenant && Array.isArray(tenants.bonus_programs_tenant) &&
                              tenants.bonus_programs_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/bonus_programs/bonus_programs-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="program_name">
                                        { item.program_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="program_status">
                                        { item.program_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="target_metric">
                                        { item.target_metric }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="target_value">
                                        { item.target_value }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reward_type">
                                        { item.reward_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reward_rate">
                                        { item.reward_rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reward_amount">
                                        { item.reward_amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="gift_description">
                                        { item.gift_description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="starts_at">
                                        { dataFormatter.dateTimeFormatter(item.starts_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ends_at">
                                        { dataFormatter.dateTimeFormatter(item.ends_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.bonus_programs_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Referral_links Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>LinkName</th>
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>DestinationURL</th>
                                
                                
                                
                                <th>LinkType</th>
                                
                                
                                
                                
                                
                                <th>IsActive</th>
                                
                                
                                
                                <th>StartsAt</th>
                                
                                
                                
                                <th>EndsAt</th>
                                
                                
                                
                                <th>ClickCount</th>
                                
                                
                                
                                <th>ConversionCount</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.referral_links_tenant && Array.isArray(tenants.referral_links_tenant) &&
                              tenants.referral_links_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/referral_links/referral_links-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="link_name">
                                        { item.link_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="destination_url">
                                        { item.destination_url }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="link_type">
                                        { item.link_type }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="starts_at">
                                        { dataFormatter.dateTimeFormatter(item.starts_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ends_at">
                                        { dataFormatter.dateTimeFormatter(item.ends_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="click_count">
                                        { item.click_count }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="conversion_count">
                                        { item.conversion_count }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.referral_links_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Reseller_stores Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>StoreName</th>
                                
                                
                                
                                <th>Slug</th>
                                
                                
                                
                                <th>StoreStatus</th>
                                
                                
                                
                                
                                
                                <th>Tagline</th>
                                
                                
                                
                                
                                
                                <th>WhatsAppNumber</th>
                                
                                
                                
                                <th>InstagramHandle</th>
                                
                                
                                
                                <th>TikTokHandle</th>
                                
                                
                                
                                <th>CustomDomain</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.reseller_stores_tenant && Array.isArray(tenants.reseller_stores_tenant) &&
                              tenants.reseller_stores_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/reseller_stores/reseller_stores-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="store_name">
                                        { item.store_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="slug">
                                        { item.slug }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="store_status">
                                        { item.store_status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="tagline">
                                        { item.tagline }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="whatsapp_number">
                                        { item.whatsapp_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="instagram_handle">
                                        { item.instagram_handle }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tiktok_handle">
                                        { item.tiktok_handle }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="custom_domain">
                                        { item.custom_domain }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.reseller_stores_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Notifications Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>NotificationType</th>
                                
                                
                                
                                <th>Channel</th>
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>Message</th>
                                
                                
                                
                                <th>ActionURL</th>
                                
                                
                                
                                <th>IsRead</th>
                                
                                
                                
                                <th>SentAt</th>
                                
                                
                                
                                <th>ReadAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.notifications_tenant && Array.isArray(tenants.notifications_tenant) &&
                              tenants.notifications_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/notifications/notifications-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="notification_type">
                                        { item.notification_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="channel">
                                        { item.channel }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title_text">
                                        { item.title_text }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="message_text">
                                        { item.message_text }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="action_url">
                                        { item.action_url }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_read">
                                        { dataFormatter.booleanFormatter(item.is_read) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sent_at">
                                        { dataFormatter.dateTimeFormatter(item.sent_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="read_at">
                                        { dataFormatter.dateTimeFormatter(item.read_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.notifications_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Ai_insights Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>InsightType</th>
                                
                                
                                
                                <th>Severity</th>
                                
                                
                                
                                <th>InsightTitle</th>
                                
                                
                                
                                <th>InsightSummary</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>GeneratedAt</th>
                                
                                
                                
                                <th>ValidUntil</th>
                                
                                
                                
                                <th>IsAcknowledged</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.ai_insights_tenant && Array.isArray(tenants.ai_insights_tenant) &&
                              tenants.ai_insights_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/ai_insights/ai_insights-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="insight_type">
                                        { item.insight_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="severity">
                                        { item.severity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="insight_title">
                                        { item.insight_title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="insight_summary">
                                        { item.insight_summary }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="generated_at">
                                        { dataFormatter.dateTimeFormatter(item.generated_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="valid_until">
                                        { dataFormatter.dateTimeFormatter(item.valid_until) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_acknowledged">
                                        { dataFormatter.booleanFormatter(item.is_acknowledged) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.ai_insights_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Sales_targets Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>TargetName</th>
                                
                                
                                
                                <th>TargetScope</th>
                                
                                
                                
                                
                                
                                <th>Metric</th>
                                
                                
                                
                                <th>TargetValue</th>
                                
                                
                                
                                <th>AchievedValue</th>
                                
                                
                                
                                <th>PeriodStart</th>
                                
                                
                                
                                <th>PeriodEnd</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.sales_targets_tenant && Array.isArray(tenants.sales_targets_tenant) &&
                              tenants.sales_targets_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/sales_targets/sales_targets-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="target_name">
                                        { item.target_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="target_scope">
                                        { item.target_scope }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="metric">
                                        { item.metric }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="target_value">
                                        { item.target_value }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="achieved_value">
                                        { item.achieved_value }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="period_start">
                                        { dataFormatter.dateTimeFormatter(item.period_start) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="period_end">
                                        { dataFormatter.dateTimeFormatter(item.period_end) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.sales_targets_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                

                <BaseDivider />

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

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

export default TenantsView;