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'}>Nom</p>
                    <p>{tenants?.name}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

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

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

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

              

              

              

              

              
              

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

              

              

              

              

              

              

              

              

              

              

              

              
              

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

              

              

              

              

              

              

              

              

              

              

              

              
              

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

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              

              

              

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

              
              

              

              

              

              

              

              

              

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

              

              

              

              

              
              

              

              

              

              

              

              

              

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

              

              

              

              

              
              

              

              

              

              

              

              

              

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

              

              

              

              

              
              

              

              

              

              

              

              

              

              

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

              

              

              

              
              

              

              

              

              

              

              
                <FormField label='Datedesuspension'>
                    {tenants.suspended_on ? <DatePicker
                      dateFormat="yyyy-MM-dd hh:mm"
                      showTimeSelect
                      selected={tenants.suspended_on ?
                        new Date(
                          dayjs(tenants.suspended_on).format('YYYY-MM-DD hh:mm'),
                        ) : null
                      }
                      disabled
                    /> : <p>No Datedesuspension</p>}
                </FormField>
              

              

              

              

              

              

              

              
              

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

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              

              
              
                <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'}>Departments Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Nom</th>
                                
                                
                                
                                <th>Actif</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.departments_tenant && Array.isArray(tenants.departments_tenant) &&
                              tenants.departments_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/departments/departments-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.departments_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Projects Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Nom</th>
                                
                                
                                
                                <th>Actif</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.projects_tenant && Array.isArray(tenants.projects_tenant) &&
                              tenants.projects_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/projects/projects-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.projects_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Budget_lines Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Code</th>
                                
                                
                                
                                <th>Libelle</th>
                                
                                
                                
                                <th>Actif</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.budget_lines_tenant && Array.isArray(tenants.budget_lines_tenant) &&
                              tenants.budget_lines_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/budget_lines/budget_lines-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="code">
                                        { item.code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_active">
                                        { dataFormatter.booleanFormatter(item.is_active) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.budget_lines_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Workflow_rules Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>SeuilL1USD</th>
                                
                                
                                
                                <th>SeuilL2USD</th>
                                
                                
                                
                                <th>SeuilL3USD</th>
                                
                                
                                
                                <th>SeuilL4USD</th>
                                
                                
                                
                                <th>SLAapprobationheures</th>
                                
                                
                                
                                <th>SLAachatsheures</th>
                                
                                
                                
                                <th>SLAreceptionheures</th>
                                
                                
                                
                                <th>Profillimitation</th>
                                
                                
                                
                                <th>Motifrejetobligatoire</th>
                                
                                
                                
                                <th>Commentaireretourobligatoire</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.workflow_rules_tenant && Array.isArray(tenants.workflow_rules_tenant) &&
                              tenants.workflow_rules_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/workflow_rules/workflow_rules-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="l1_threshold_usd">
                                        { item.l1_threshold_usd }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="l2_threshold_usd">
                                        { item.l2_threshold_usd }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="l3_threshold_usd">
                                        { item.l3_threshold_usd }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="l4_threshold_usd">
                                        { item.l4_threshold_usd }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sla_approval_hours">
                                        { item.sla_approval_hours }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sla_procurement_hours">
                                        { item.sla_procurement_hours }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sla_reception_hours">
                                        { item.sla_reception_hours }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rate_limit_profile">
                                        { item.rate_limit_profile }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="require_reject_reason">
                                        { dataFormatter.booleanFormatter(item.require_reject_reason) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="require_return_comment">
                                        { dataFormatter.booleanFormatter(item.require_return_comment) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.workflow_rules_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Currency_rates Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Devisedebase</th>
                                
                                
                                
                                <th>Devisecotee</th>
                                
                                
                                
                                <th>Taux</th>
                                
                                
                                
                                <th>Dateeffet</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.currency_rates_tenant && Array.isArray(tenants.currency_rates_tenant) &&
                              tenants.currency_rates_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/currency_rates/currency_rates-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="base_currency">
                                        { item.base_currency }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quote_currency">
                                        { item.quote_currency }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rate">
                                        { item.rate }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="effective_at">
                                        { dataFormatter.dateTimeFormatter(item.effective_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.currency_rates_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Requisitions Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Numerorequisition</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Titre</th>
                                
                                
                                
                                
                                
                                <th>Quantite</th>
                                
                                
                                
                                <th>BudgetestimeUSD</th>
                                
                                
                                
                                <th>Devise</th>
                                
                                
                                
                                <th>Budgetestimedevise</th>
                                
                                
                                
                                <th>TauxversUSD</th>
                                
                                
                                
                                <th>Statut</th>
                                
                                
                                
                                <th>Datesoumission</th>
                                
                                
                                
                                <th>Dateapprobation</th>
                                
                                
                                
                                <th>Datecloture</th>
                                
                                
                                
                                
                                
                                <th>Motifderetour</th>
                                
                                
                                
                                <th>Motifderejet</th>
                                
                                
                                
                                <th>Transactionelevee</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.requisitions_tenant && Array.isArray(tenants.requisitions_tenant) &&
                              tenants.requisitions_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/requisitions/requisitions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="req_number">
                                        { item.req_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="estimated_budget_usd">
                                        { item.estimated_budget_usd }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="currency">
                                        { item.currency }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="estimated_budget_original">
                                        { item.estimated_budget_original }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="fx_rate_to_usd">
                                        { item.fx_rate_to_usd }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="submitted_at">
                                        { dataFormatter.dateTimeFormatter(item.submitted_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="approved_at">
                                        { dataFormatter.dateTimeFormatter(item.approved_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closed_at">
                                        { dataFormatter.dateTimeFormatter(item.closed_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="return_reason">
                                        { item.return_reason }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reject_reason">
                                        { item.reject_reason }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="is_high_value">
                                        { dataFormatter.booleanFormatter(item.is_high_value) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.requisitions_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Approval_steps Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Niveau</th>
                                
                                
                                
                                
                                
                                <th>Decision</th>
                                
                                
                                
                                <th>Commentaire</th>
                                
                                
                                
                                <th>Dateassignation</th>
                                
                                
                                
                                <th>Datedecision</th>
                                
                                
                                
                                <th>EcheanceSLA</th>
                                
                                
                                
                                <th>SLAdepasse</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.approval_steps_tenant && Array.isArray(tenants.approval_steps_tenant) &&
                              tenants.approval_steps_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/approval_steps/approval_steps-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="level">
                                        { item.level }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="decision">
                                        { item.decision }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="comment">
                                        { item.comment }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="assigned_at">
                                        { dataFormatter.dateTimeFormatter(item.assigned_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="decided_at">
                                        { dataFormatter.dateTimeFormatter(item.decided_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sla_due_at">
                                        { dataFormatter.dateTimeFormatter(item.sla_due_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sla_breached">
                                        { dataFormatter.booleanFormatter(item.sla_breached) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.approval_steps_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Procurement_cases Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Classification</th>
                                
                                
                                
                                <th>Justification</th>
                                
                                
                                
                                <th>Etapepipeline</th>
                                
                                
                                
                                
                                
                                <th>Datedemarrage</th>
                                
                                
                                
                                <th>EcheanceSLA</th>
                                
                                
                                
                                <th>Dateattribution</th>
                                
                                
                                
                                <th>Datecloture</th>
                                
                                
                                
                                <th>Overridesinglesource</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.procurement_cases_tenant && Array.isArray(tenants.procurement_cases_tenant) &&
                              tenants.procurement_cases_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/procurement_cases/procurement_cases-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="classification">
                                        { item.classification }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="classification_justification">
                                        { item.classification_justification }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="pipeline_stage">
                                        { item.pipeline_stage }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sla_due_at">
                                        { dataFormatter.dateTimeFormatter(item.sla_due_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="awarded_at">
                                        { dataFormatter.dateTimeFormatter(item.awarded_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closed_at">
                                        { dataFormatter.dateTimeFormatter(item.closed_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="admin_override_single_source">
                                        { dataFormatter.booleanFormatter(item.admin_override_single_source) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.procurement_cases_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Suppliers Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Raisonsociale</th>
                                
                                
                                
                                <th>Nomcommercial</th>
                                
                                
                                
                                <th>NumeroRCCM</th>
                                
                                
                                
                                <th>Numeroimpots</th>
                                
                                
                                
                                <th>Pays</th>
                                
                                
                                
                                <th>Adresse</th>
                                
                                
                                
                                <th>Contactprincipal</th>
                                
                                
                                
                                <th>Emailcontact</th>
                                
                                
                                
                                <th>Telephonecontact</th>
                                
                                
                                
                                <th>Banque</th>
                                
                                
                                
                                <th>Numerodecompte</th>
                                
                                
                                
                                <th>SWIFT</th>
                                
                                
                                
                                <th>Statut</th>
                                
                                
                                
                                <th>Prequalification</th>
                                
                                
                                
                                <th>Scoreperformance</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.suppliers_tenant && Array.isArray(tenants.suppliers_tenant) &&
                              tenants.suppliers_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/suppliers/suppliers-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="legal_name">
                                        { item.legal_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="commercial_name">
                                        { item.commercial_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rccm_number">
                                        { item.rccm_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tax_id">
                                        { item.tax_id }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="country">
                                        { item.country }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address">
                                        { item.address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="primary_contact_name">
                                        { item.primary_contact_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="primary_contact_email">
                                        { item.primary_contact_email }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="primary_contact_phone">
                                        { item.primary_contact_phone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="bank_name">
                                        { item.bank_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="bank_account_number">
                                        { item.bank_account_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="bank_swift">
                                        { item.bank_swift }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="prequalification_status">
                                        { item.prequalification_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="performance_score">
                                        { item.performance_score }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.suppliers_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Supplier_categories Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Categorie</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.supplier_categories_tenant && Array.isArray(tenants.supplier_categories_tenant) &&
                              tenants.supplier_categories_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/supplier_categories/supplier_categories-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.supplier_categories_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Supplier_diligence_checks Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Typedecontrole</th>
                                
                                
                                
                                <th>Statut</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>Datecontrole</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.supplier_diligence_checks_tenant && Array.isArray(tenants.supplier_diligence_checks_tenant) &&
                              tenants.supplier_diligence_checks_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/supplier_diligence_checks/supplier_diligence_checks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="check_type">
                                        { item.check_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="checked_at">
                                        { dataFormatter.dateTimeFormatter(item.checked_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.supplier_diligence_checks_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Tender_events Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Reference</th>
                                
                                
                                
                                <th>Titre</th>
                                
                                
                                
                                <th>Statut</th>
                                
                                
                                
                                <th>Datepublication</th>
                                
                                
                                
                                <th>Datelimitesoumission</th>
                                
                                
                                
                                <th>Dateouvertureplis</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.tender_events_tenant && Array.isArray(tenants.tender_events_tenant) &&
                              tenants.tender_events_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/tender_events/tender_events-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="reference">
                                        { item.reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="published_at">
                                        { dataFormatter.dateTimeFormatter(item.published_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="submission_deadline">
                                        { dataFormatter.dateTimeFormatter(item.submission_deadline) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="opened_at">
                                        { dataFormatter.dateTimeFormatter(item.opened_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.tender_events_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Supplier_offers Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Montantoffre</th>
                                
                                
                                
                                <th>Devise</th>
                                
                                
                                
                                <th>MontantUSD</th>
                                
                                
                                
                                <th>Delailivraison</th>
                                
                                
                                
                                <th>Garantie</th>
                                
                                
                                
                                
                                
                                <th>Statut</th>
                                
                                
                                
                                <th>Datereception</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.supplier_offers_tenant && Array.isArray(tenants.supplier_offers_tenant) &&
                              tenants.supplier_offers_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/supplier_offers/supplier_offers-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="amount">
                                        { item.amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="currency">
                                        { item.currency }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount_usd">
                                        { item.amount_usd }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="delivery_lead_time">
                                        { item.delivery_lead_time }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="warranty_terms">
                                        { item.warranty_terms }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="received_at">
                                        { dataFormatter.dateTimeFormatter(item.received_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.supplier_offers_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Bid_criteria Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Critere</th>
                                
                                
                                
                                <th>Ponderation</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.bid_criteria_tenant && Array.isArray(tenants.bid_criteria_tenant) &&
                              tenants.bid_criteria_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/bid_criteria/bid_criteria-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="weight">
                                        { item.weight }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.bid_criteria_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Offer_scores Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Score</th>
                                
                                
                                
                                <th>Commentaire</th>
                                
                                
                                
                                
                                
                                <th>Dateevaluation</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.offer_scores_tenant && Array.isArray(tenants.offer_scores_tenant) &&
                              tenants.offer_scores_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/offer_scores/offer_scores-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="score">
                                        { item.score }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="comment">
                                        { item.comment }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="scored_at">
                                        { dataFormatter.dateTimeFormatter(item.scored_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.offer_scores_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Awards Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>MontantattribueUSD</th>
                                
                                
                                
                                <th>Justificationattribution</th>
                                
                                
                                
                                
                                
                                <th>Dateattribution</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.awards_tenant && Array.isArray(tenants.awards_tenant) &&
                              tenants.awards_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/awards/awards-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="awarded_amount_usd">
                                        { item.awarded_amount_usd }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="award_rationale">
                                        { item.award_rationale }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="awarded_at">
                                        { dataFormatter.dateTimeFormatter(item.awarded_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.awards_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Purchase_orders Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Numerobondecommande</th>
                                
                                
                                
                                <th>TotalUSD</th>
                                
                                
                                
                                <th>Devise</th>
                                
                                
                                
                                <th>Totaldevise</th>
                                
                                
                                
                                <th>Dateemission</th>
                                
                                
                                
                                <th>Datelivraisonprevue</th>
                                
                                
                                
                                <th>Statut</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.purchase_orders_tenant && Array.isArray(tenants.purchase_orders_tenant) &&
                              tenants.purchase_orders_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/purchase_orders/purchase_orders-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="po_number">
                                        { item.po_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_amount_usd">
                                        { item.total_amount_usd }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="currency">
                                        { item.currency }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_amount_original">
                                        { item.total_amount_original }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="issued_at">
                                        { dataFormatter.dateTimeFormatter(item.issued_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expected_delivery_at">
                                        { dataFormatter.dateTimeFormatter(item.expected_delivery_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.purchase_orders_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Po_lines Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Article</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>Quantitecommandee</th>
                                
                                
                                
                                <th>Prixunitaire</th>
                                
                                
                                
                                <th>Totalligne</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.po_lines_tenant && Array.isArray(tenants.po_lines_tenant) &&
                              tenants.po_lines_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/po_lines/po_lines-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="item_name">
                                        { item.item_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity_ordered">
                                        { item.quantity_ordered }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="unit_price">
                                        { item.unit_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="line_total">
                                        { item.line_total }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.po_lines_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Goods_receipt_notes Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>NumeroGRN</th>
                                
                                
                                
                                <th>Datereception</th>
                                
                                
                                
                                
                                
                                <th>Controlequalite</th>
                                
                                
                                
                                <th>Observations</th>
                                
                                
                                
                                
                                
                                <th>Signaturerecepteur</th>
                                
                                
                                
                                <th>Statut</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.goods_receipt_notes_tenant && Array.isArray(tenants.goods_receipt_notes_tenant) &&
                              tenants.goods_receipt_notes_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/goods_receipt_notes/goods_receipt_notes-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="grn_number">
                                        { item.grn_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="received_at">
                                        { dataFormatter.dateTimeFormatter(item.received_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="quality_check">
                                        { item.quality_check }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="observations">
                                        { item.observations }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="receiver_signature">
                                        { item.receiver_signature }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.goods_receipt_notes_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Grn_lines Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Quantiterecue</th>
                                
                                
                                
                                <th>Quantiterejetee</th>
                                
                                
                                
                                <th>Remarques</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.grn_lines_tenant && Array.isArray(tenants.grn_lines_tenant) &&
                              tenants.grn_lines_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/grn_lines/grn_lines-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="quantity_received">
                                        { item.quantity_received }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity_rejected">
                                        { item.quantity_rejected }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="remarks">
                                        { item.remarks }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.grn_lines_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Service_acceptance_notes Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>NumeroSAN</th>
                                
                                
                                
                                <th>Dateacceptation</th>
                                
                                
                                
                                
                                
                                <th>Checklistlivrables</th>
                                
                                
                                
                                <th>Criteresacceptation</th>
                                
                                
                                
                                <th>Statut</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.service_acceptance_notes_tenant && Array.isArray(tenants.service_acceptance_notes_tenant) &&
                              tenants.service_acceptance_notes_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/service_acceptance_notes/service_acceptance_notes-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="san_number">
                                        { item.san_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="acceptance_date">
                                        { dataFormatter.dateTimeFormatter(item.acceptance_date) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="deliverable_checklist">
                                        { item.deliverable_checklist }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="acceptance_criteria">
                                        { item.acceptance_criteria }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.service_acceptance_notes_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Discrepancy_cases Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Type</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                
                                
                                <th>Statut</th>
                                
                                
                                
                                
                                
                                <th>Datesignalement</th>
                                
                                
                                
                                <th>Dateresolution</th>
                                
                                
                                
                                <th>Notesderesolution</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.discrepancy_cases_tenant && Array.isArray(tenants.discrepancy_cases_tenant) &&
                              tenants.discrepancy_cases_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/discrepancy_cases/discrepancy_cases-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="type">
                                        { item.type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="reported_at">
                                        { dataFormatter.dateTimeFormatter(item.reported_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="resolved_at">
                                        { dataFormatter.dateTimeFormatter(item.resolved_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="resolution_notes">
                                        { item.resolution_notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.discrepancy_cases_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Archive_items Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Typeressource</th>
                                
                                
                                
                                <th>Referenceressource</th>
                                
                                
                                
                                <th>Visibilite</th>
                                
                                
                                
                                <th>Titrearchive</th>
                                
                                
                                
                                <th>Motscles</th>
                                
                                
                                
                                <th>MontantUSD</th>
                                
                                
                                
                                <th>Statut</th>
                                
                                
                                
                                <th>Datearchivage</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.archive_items_tenant && Array.isArray(tenants.archive_items_tenant) &&
                              tenants.archive_items_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/archive_items/archive_items-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="resource_type">
                                        { item.resource_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="resource_reference">
                                        { item.resource_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="visibility_scope">
                                        { item.visibility_scope }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="keywords">
                                        { item.keywords }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount_usd">
                                        { item.amount_usd }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="archived_at">
                                        { dataFormatter.dateTimeFormatter(item.archived_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.archive_items_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Access_logs Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Action</th>
                                
                                
                                
                                <th>Typeressource</th>
                                
                                
                                
                                <th>Reference</th>
                                
                                
                                
                                <th>AdresseIP</th>
                                
                                
                                
                                <th>Useragent</th>
                                
                                
                                
                                <th>Horodatage</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.access_logs_tenant && Array.isArray(tenants.access_logs_tenant) &&
                              tenants.access_logs_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/access_logs/access_logs-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="action">
                                        { item.action }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="resource_type">
                                        { item.resource_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="resource_reference">
                                        { item.resource_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ip_address">
                                        { item.ip_address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="user_agent">
                                        { item.user_agent }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="occurred_at">
                                        { dataFormatter.dateTimeFormatter(item.occurred_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.access_logs_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>Canal</th>
                                
                                
                                
                                <th>Objet</th>
                                
                                
                                
                                
                                
                                <th>Statut</th>
                                
                                
                                
                                <th>Dateenvoi</th>
                                
                                
                                
                                <th>Datelecture</th>
                                
                                
                                
                                <th>Referenceliee</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="channel">
                                        { item.channel }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subject">
                                        { item.subject }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sent_at">
                                        { dataFormatter.dateTimeFormatter(item.sent_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="read_at">
                                        { dataFormatter.dateTimeFormatter(item.read_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="related_reference">
                                        { item.related_reference }
                                    </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'}>Audit_events Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>IDevenement</th>
                                
                                
                                
                                <th>Horodatage</th>
                                
                                
                                
                                
                                
                                <th>Typeevenement</th>
                                
                                
                                
                                <th>Typeressource</th>
                                
                                
                                
                                <th>Referenceressource</th>
                                
                                
                                
                                <th>Resume</th>
                                
                                
                                
                                <th>AdresseIP</th>
                                
                                
                                
                                <th>Hashintegrite</th>
                                
                                
                                
                                <th>Hashprecedent</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.audit_events_tenant && Array.isArray(tenants.audit_events_tenant) &&
                              tenants.audit_events_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/audit_events/audit_events-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="event_id">
                                        { item.event_id }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="occurred_at">
                                        { dataFormatter.dateTimeFormatter(item.occurred_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="event_type">
                                        { item.event_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="resource_type">
                                        { item.resource_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="resource_reference">
                                        { item.resource_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="summary">
                                        { item.summary }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ip_address">
                                        { item.ip_address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="integrity_hash">
                                        { item.integrity_hash }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="previous_hash">
                                        { item.previous_hash }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.audit_events_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Export_jobs Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Typeexport</th>
                                
                                
                                
                                <th>Statut</th>
                                
                                
                                
                                <th>Parametres</th>
                                
                                
                                
                                
                                
                                <th>Datedemande</th>
                                
                                
                                
                                <th>Datefin</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.export_jobs_tenant && Array.isArray(tenants.export_jobs_tenant) &&
                              tenants.export_jobs_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/export_jobs/export_jobs-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="type">
                                        { item.type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="parameters_json">
                                        { item.parameters_json }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="requested_at">
                                        { dataFormatter.dateTimeFormatter(item.requested_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="completed_at">
                                        { dataFormatter.dateTimeFormatter(item.completed_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.export_jobs_tenant?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Sessions Tenant</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Hashrefreshtoken</th>
                                
                                
                                
                                <th>Creele</th>
                                
                                
                                
                                <th>Expirele</th>
                                
                                
                                
                                <th>Revoquele</th>
                                
                                
                                
                                <th>AdresseIP</th>
                                
                                
                                
                                <th>Useragent</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {tenants.sessions_tenant && Array.isArray(tenants.sessions_tenant) &&
                              tenants.sessions_tenant.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/sessions/sessions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="refresh_token_hash">
                                        { item.refresh_token_hash }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="created_at_time">
                                        { dataFormatter.dateTimeFormatter(item.created_at_time) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expires_at">
                                        { dataFormatter.dateTimeFormatter(item.expires_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="revoked_at">
                                        { dataFormatter.dateTimeFormatter(item.revoked_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ip_address">
                                        { item.ip_address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="user_agent">
                                        { item.user_agent }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!tenants?.sessions_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;