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/users/usersSlice'
import {saveFile} from "../../helpers/fileSaver";
import dataFormatter from '../../helpers/dataFormatter';
import ImageField from "../../components/ImageField";
import LayoutAuthenticated from "../../layouts/Authenticated";
import {getPageTitle} from "../../config";
import SectionTitleLineWithButton from "../../components/SectionTitleLineWithButton";
import SectionMain from "../../components/SectionMain";
import CardBox from "../../components/CardBox";
import BaseButton from "../../components/BaseButton";
import BaseDivider from "../../components/BaseDivider";
import {mdiChartTimelineVariant} from "@mdi/js";
import {SwitchField} from "../../components/SwitchField";
import FormField from "../../components/FormField";


const UsersView = () => {
    const router = useRouter()
    const dispatch = useAppDispatch()
    const { users } = useAppSelector((state) => state.users)
    

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

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

              

              

              

              

              

              

              

              

              

              

              

              
              

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

              

              

              

              

              

              

              

              

              

              

              

              
              

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

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>E-Mail</p>
                    <p>{users?.email}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

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

              

              

              

              
              

              

              

              

              

              

              

              

              

              

              

              

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

              
              

              

              

              

              

              

              

              

              

              

              
              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>App Role</p>
                    
                    
                    
                    
                        <p>{users?.app_role?.name ?? 'No data'}</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                </div>
                 
              

              

              

              
              

              

              

              

              

              

              

              

              

              

              

              
                <>
                    <p className={'block font-bold mb-2'}>Custom Permissions</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                    <th>Name</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.custom_permissions && Array.isArray(users.custom_permissions) &&
                              users.custom_permissions.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/permissions/permissions-view/?id=${item.id}`)}>
                                  
                                    
                                    
                                  
                                    
                                    <td data-label="name">
                                        { item.name }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.custom_permissions?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
              

              

              
              

                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>System_parameters LastUpdatedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>Key</th>
                                
                                
                                
                                <th>Value</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>LastUpdatedAt</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.system_parameters_lastUpdatedByUser && Array.isArray(users.system_parameters_lastUpdatedByUser) &&
                              users.system_parameters_lastUpdatedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/system_parameters/system_parameters-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="key">
                                        { item.key }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="value">
                                        { item.value }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="lastUpdatedAt">
                                        { dataFormatter.dateTimeFormatter(item.lastUpdatedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.system_parameters_lastUpdatedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Fiscal_periods ClosedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>Year</th>
                                
                                
                                
                                <th>Month</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>OpenedAt</th>
                                
                                
                                
                                <th>ClosedAt</th>
                                
                                
                                
                                
                                
                                <th>LockedAt</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.fiscal_periods_closedByUser && Array.isArray(users.fiscal_periods_closedByUser) &&
                              users.fiscal_periods_closedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/fiscal_periods/fiscal_periods-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="year">
                                        { item.year }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="month">
                                        { item.month }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="openedAt">
                                        { dataFormatter.dateTimeFormatter(item.openedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closedAt">
                                        { dataFormatter.dateTimeFormatter(item.closedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="lockedAt">
                                        { dataFormatter.dateTimeFormatter(item.lockedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.fiscal_periods_closedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Fiscal_periods LockedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>Year</th>
                                
                                
                                
                                <th>Month</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>OpenedAt</th>
                                
                                
                                
                                <th>ClosedAt</th>
                                
                                
                                
                                
                                
                                <th>LockedAt</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.fiscal_periods_lockedByUser && Array.isArray(users.fiscal_periods_lockedByUser) &&
                              users.fiscal_periods_lockedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/fiscal_periods/fiscal_periods-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="year">
                                        { item.year }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="month">
                                        { item.month }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="openedAt">
                                        { dataFormatter.dateTimeFormatter(item.openedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closedAt">
                                        { dataFormatter.dateTimeFormatter(item.closedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="lockedAt">
                                        { dataFormatter.dateTimeFormatter(item.lockedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.fiscal_periods_lockedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Employee_documents UploadedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>DocumentType</th>
                                
                                
                                
                                <th>FileName</th>
                                
                                
                                
                                
                                
                                <th>UploadedAt</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.employee_documents_uploadedByUser && Array.isArray(users.employee_documents_uploadedByUser) &&
                              users.employee_documents_uploadedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/employee_documents/employee_documents-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="documentType">
                                        { item.documentType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="fileName">
                                        { item.fileName }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="uploadedAt">
                                        { dataFormatter.dateTimeFormatter(item.uploadedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.employee_documents_uploadedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Time_records ModifiedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>WorkDate</th>
                                
                                
                                
                                <th>ScheduledTimeIn</th>
                                
                                
                                
                                <th>ScheduledTimeOut</th>
                                
                                
                                
                                <th>ActualTimeIn</th>
                                
                                
                                
                                <th>ActualTimeOut</th>
                                
                                
                                
                                <th>TardinessMinutes</th>
                                
                                
                                
                                <th>UndertimeMinutes</th>
                                
                                
                                
                                <th>OvertimeMinutes</th>
                                
                                
                                
                                <th>NightDiffHours</th>
                                
                                
                                
                                <th>WorkType</th>
                                
                                
                                
                                <th>IsAbsent</th>
                                
                                
                                
                                <th>IsHalfDay</th>
                                
                                
                                
                                <th>HalfDayType</th>
                                
                                
                                
                                <th>Source</th>
                                
                                
                                
                                
                                
                                <th>ModificationReason</th>
                                
                                
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.time_records_modifiedByUser && Array.isArray(users.time_records_modifiedByUser) &&
                              users.time_records_modifiedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/time_records/time_records-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="workDate">
                                        { dataFormatter.dateTimeFormatter(item.workDate) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scheduledTimeIn">
                                        { item.scheduledTimeIn }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scheduledTimeOut">
                                        { item.scheduledTimeOut }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="actualTimeIn">
                                        { dataFormatter.dateTimeFormatter(item.actualTimeIn) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="actualTimeOut">
                                        { dataFormatter.dateTimeFormatter(item.actualTimeOut) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tardinessMinutes">
                                        { item.tardinessMinutes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="undertimeMinutes">
                                        { item.undertimeMinutes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="overtimeMinutes">
                                        { item.overtimeMinutes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="nightDiffHours">
                                        { item.nightDiffHours }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="workType">
                                        { item.workType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="isAbsent">
                                        { dataFormatter.booleanFormatter(item.isAbsent) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="isHalfDay">
                                        { dataFormatter.booleanFormatter(item.isHalfDay) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="halfDayType">
                                        { item.halfDayType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="source">
                                        { item.source }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="modificationReason">
                                        { item.modificationReason }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="approvedAt">
                                        { dataFormatter.dateTimeFormatter(item.approvedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.time_records_modifiedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Time_records ApprovedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>WorkDate</th>
                                
                                
                                
                                <th>ScheduledTimeIn</th>
                                
                                
                                
                                <th>ScheduledTimeOut</th>
                                
                                
                                
                                <th>ActualTimeIn</th>
                                
                                
                                
                                <th>ActualTimeOut</th>
                                
                                
                                
                                <th>TardinessMinutes</th>
                                
                                
                                
                                <th>UndertimeMinutes</th>
                                
                                
                                
                                <th>OvertimeMinutes</th>
                                
                                
                                
                                <th>NightDiffHours</th>
                                
                                
                                
                                <th>WorkType</th>
                                
                                
                                
                                <th>IsAbsent</th>
                                
                                
                                
                                <th>IsHalfDay</th>
                                
                                
                                
                                <th>HalfDayType</th>
                                
                                
                                
                                <th>Source</th>
                                
                                
                                
                                
                                
                                <th>ModificationReason</th>
                                
                                
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.time_records_approvedByUser && Array.isArray(users.time_records_approvedByUser) &&
                              users.time_records_approvedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/time_records/time_records-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="workDate">
                                        { dataFormatter.dateTimeFormatter(item.workDate) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scheduledTimeIn">
                                        { item.scheduledTimeIn }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scheduledTimeOut">
                                        { item.scheduledTimeOut }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="actualTimeIn">
                                        { dataFormatter.dateTimeFormatter(item.actualTimeIn) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="actualTimeOut">
                                        { dataFormatter.dateTimeFormatter(item.actualTimeOut) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tardinessMinutes">
                                        { item.tardinessMinutes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="undertimeMinutes">
                                        { item.undertimeMinutes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="overtimeMinutes">
                                        { item.overtimeMinutes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="nightDiffHours">
                                        { item.nightDiffHours }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="workType">
                                        { item.workType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="isAbsent">
                                        { dataFormatter.booleanFormatter(item.isAbsent) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="isHalfDay">
                                        { dataFormatter.booleanFormatter(item.isHalfDay) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="halfDayType">
                                        { item.halfDayType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="source">
                                        { item.source }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="modificationReason">
                                        { item.modificationReason }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="approvedAt">
                                        { dataFormatter.dateTimeFormatter(item.approvedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.time_records_approvedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Biometric_imports ImportedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>ImportDate</th>
                                
                                
                                
                                <th>DeviceCode</th>
                                
                                
                                
                                <th>FileName</th>
                                
                                
                                
                                <th>TotalRecords</th>
                                
                                
                                
                                <th>SuccessCount</th>
                                
                                
                                
                                <th>ErrorCount</th>
                                
                                
                                
                                <th>ErrorDetailsJSON</th>
                                
                                
                                
                                
                                
                                <th>PeriodFrom</th>
                                
                                
                                
                                <th>PeriodTo</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.biometric_imports_importedByUser && Array.isArray(users.biometric_imports_importedByUser) &&
                              users.biometric_imports_importedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/biometric_imports/biometric_imports-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="importDate">
                                        { dataFormatter.dateTimeFormatter(item.importDate) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="deviceCode">
                                        { item.deviceCode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="fileName">
                                        { item.fileName }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="totalRecords">
                                        { item.totalRecords }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="successCount">
                                        { item.successCount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="errorCount">
                                        { item.errorCount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="errorDetailsJson">
                                        { item.errorDetailsJson }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="periodFrom">
                                        { dataFormatter.dateTimeFormatter(item.periodFrom) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="periodTo">
                                        { dataFormatter.dateTimeFormatter(item.periodTo) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.biometric_imports_importedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Leave_applications ApprovedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>DateFrom</th>
                                
                                
                                
                                <th>DateTo</th>
                                
                                
                                
                                <th>TotalDays</th>
                                
                                
                                
                                <th>Reason</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>ManagerNote</th>
                                
                                
                                
                                <th>HRNote</th>
                                
                                
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.leave_applications_approvedByUser && Array.isArray(users.leave_applications_approvedByUser) &&
                              users.leave_applications_approvedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/leave_applications/leave_applications-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="dateFrom">
                                        { dataFormatter.dateTimeFormatter(item.dateFrom) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="dateTo">
                                        { dataFormatter.dateTimeFormatter(item.dateTo) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="totalDays">
                                        { item.totalDays }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reason">
                                        { item.reason }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="managerNote">
                                        { item.managerNote }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="hrNote">
                                        { item.hrNote }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="approvedAt">
                                        { dataFormatter.dateTimeFormatter(item.approvedAt) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.leave_applications_approvedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Payroll_runs ApprovedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>PeriodFrom</th>
                                
                                
                                
                                <th>PeriodTo</th>
                                
                                
                                
                                <th>PayrollType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>LockedAt</th>
                                
                                
                                
                                <th>ComputedAt</th>
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                                
                                <th>PostedAt</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>Notes</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.payroll_runs_approvedByUser && Array.isArray(users.payroll_runs_approvedByUser) &&
                              users.payroll_runs_approvedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/payroll_runs/payroll_runs-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="periodFrom">
                                        { dataFormatter.dateTimeFormatter(item.periodFrom) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="periodTo">
                                        { dataFormatter.dateTimeFormatter(item.periodTo) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="payrollType">
                                        { item.payrollType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="lockedAt">
                                        { dataFormatter.dateTimeFormatter(item.lockedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="computedAt">
                                        { dataFormatter.dateTimeFormatter(item.computedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="approvedAt">
                                        { dataFormatter.dateTimeFormatter(item.approvedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="postedAt">
                                        { dataFormatter.dateTimeFormatter(item.postedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.payroll_runs_approvedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Payroll_runs PostedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>PeriodFrom</th>
                                
                                
                                
                                <th>PeriodTo</th>
                                
                                
                                
                                <th>PayrollType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>LockedAt</th>
                                
                                
                                
                                <th>ComputedAt</th>
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                                
                                <th>PostedAt</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>Notes</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.payroll_runs_postedByUser && Array.isArray(users.payroll_runs_postedByUser) &&
                              users.payroll_runs_postedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/payroll_runs/payroll_runs-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="periodFrom">
                                        { dataFormatter.dateTimeFormatter(item.periodFrom) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="periodTo">
                                        { dataFormatter.dateTimeFormatter(item.periodTo) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="payrollType">
                                        { item.payrollType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="lockedAt">
                                        { dataFormatter.dateTimeFormatter(item.lockedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="computedAt">
                                        { dataFormatter.dateTimeFormatter(item.computedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="approvedAt">
                                        { dataFormatter.dateTimeFormatter(item.approvedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="postedAt">
                                        { dataFormatter.dateTimeFormatter(item.postedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.payroll_runs_postedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Bank_files GeneratedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>BankCode</th>
                                
                                
                                
                                <th>FileFormat</th>
                                
                                
                                
                                
                                
                                <th>TotalAmount</th>
                                
                                
                                
                                <th>RecordCount</th>
                                
                                
                                
                                
                                
                                <th>GeneratedAt</th>
                                
                                
                                
                                <th>SubmittedAt</th>
                                
                                
                                
                                <th>FileHash</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.bank_files_generatedByUser && Array.isArray(users.bank_files_generatedByUser) &&
                              users.bank_files_generatedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/bank_files/bank_files-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="bankCode">
                                        { item.bankCode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="fileFormat">
                                        { item.fileFormat }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="totalAmount">
                                        { item.totalAmount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="recordCount">
                                        { item.recordCount }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="generatedAt">
                                        { dataFormatter.dateTimeFormatter(item.generatedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="submittedAt">
                                        { dataFormatter.dateTimeFormatter(item.submittedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="fileHash">
                                        { item.fileHash }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.bank_files_generatedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Journal_entries PostedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>EntryNumber</th>
                                
                                
                                
                                <th>EntryDate</th>
                                
                                
                                
                                <th>JournalType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>Reference</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>PostedAt</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.journal_entries_postedByUser && Array.isArray(users.journal_entries_postedByUser) &&
                              users.journal_entries_postedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/journal_entries/journal_entries-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="entryNumber">
                                        { item.entryNumber }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entryDate">
                                        { dataFormatter.dateTimeFormatter(item.entryDate) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="journalType">
                                        { item.journalType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reference">
                                        { item.reference }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="postedAt">
                                        { dataFormatter.dateTimeFormatter(item.postedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.journal_entries_postedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Ap_payments CreatedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>PaymentDate</th>
                                
                                
                                
                                <th>PaymentMode</th>
                                
                                
                                
                                <th>CheckNumber</th>
                                
                                
                                
                                <th>BankName</th>
                                
                                
                                
                                <th>TotalAmount</th>
                                
                                
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.ap_payments_createdByUser && Array.isArray(users.ap_payments_createdByUser) &&
                              users.ap_payments_createdByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/ap_payments/ap_payments-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="paymentDate">
                                        { dataFormatter.dateTimeFormatter(item.paymentDate) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="paymentMode">
                                        { item.paymentMode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="checkNumber">
                                        { item.checkNumber }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="bankName">
                                        { item.bankName }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="totalAmount">
                                        { item.totalAmount }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.ap_payments_createdByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Ap_payments ApprovedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>PaymentDate</th>
                                
                                
                                
                                <th>PaymentMode</th>
                                
                                
                                
                                <th>CheckNumber</th>
                                
                                
                                
                                <th>BankName</th>
                                
                                
                                
                                <th>TotalAmount</th>
                                
                                
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.ap_payments_approvedByUser && Array.isArray(users.ap_payments_approvedByUser) &&
                              users.ap_payments_approvedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/ap_payments/ap_payments-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="paymentDate">
                                        { dataFormatter.dateTimeFormatter(item.paymentDate) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="paymentMode">
                                        { item.paymentMode }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="checkNumber">
                                        { item.checkNumber }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="bankName">
                                        { item.bankName }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="totalAmount">
                                        { item.totalAmount }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.ap_payments_approvedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Job_requisitions ApprovedByManager</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>RequestingDepartment</th>
                                
                                
                                
                                <th>PositionTitle</th>
                                
                                
                                
                                <th>NumberOfVacancies</th>
                                
                                
                                
                                <th>Justification</th>
                                
                                
                                
                                <th>RequiredSkills</th>
                                
                                
                                
                                <th>SalaryRangeFrom</th>
                                
                                
                                
                                <th>SalaryRangeTo</th>
                                
                                
                                
                                <th>TargetStartDate</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.job_requisitions_approvedByManagerUser && Array.isArray(users.job_requisitions_approvedByManagerUser) &&
                              users.job_requisitions_approvedByManagerUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/job_requisitions/job_requisitions-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="requestingDept">
                                        { item.requestingDept }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="positionTitle">
                                        { item.positionTitle }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="numberOfVacancies">
                                        { item.numberOfVacancies }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="justification">
                                        { item.justification }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="requiredSkills">
                                        { item.requiredSkills }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="salaryRangeFrom">
                                        { item.salaryRangeFrom }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="salaryRangeTo">
                                        { item.salaryRangeTo }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="targetStartDate">
                                        { dataFormatter.dateTimeFormatter(item.targetStartDate) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.job_requisitions_approvedByManagerUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Job_requisitions ApprovedByHR</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>RequestingDepartment</th>
                                
                                
                                
                                <th>PositionTitle</th>
                                
                                
                                
                                <th>NumberOfVacancies</th>
                                
                                
                                
                                <th>Justification</th>
                                
                                
                                
                                <th>RequiredSkills</th>
                                
                                
                                
                                <th>SalaryRangeFrom</th>
                                
                                
                                
                                <th>SalaryRangeTo</th>
                                
                                
                                
                                <th>TargetStartDate</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.job_requisitions_approvedByHrUser && Array.isArray(users.job_requisitions_approvedByHrUser) &&
                              users.job_requisitions_approvedByHrUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/job_requisitions/job_requisitions-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="requestingDept">
                                        { item.requestingDept }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="positionTitle">
                                        { item.positionTitle }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="numberOfVacancies">
                                        { item.numberOfVacancies }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="justification">
                                        { item.justification }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="requiredSkills">
                                        { item.requiredSkills }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="salaryRangeFrom">
                                        { item.salaryRangeFrom }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="salaryRangeTo">
                                        { item.salaryRangeTo }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="targetStartDate">
                                        { dataFormatter.dateTimeFormatter(item.targetStartDate) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.job_requisitions_approvedByHrUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Approval_requests RequestedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>RequestType</th>
                                
                                
                                
                                <th>EntityId</th>
                                
                                
                                
                                <th>EntityType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                <th>RequestedAt</th>
                                
                                
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                                
                                
                                
                                <th>RejectedAt</th>
                                
                                
                                
                                <th>RejectionReason</th>
                                
                                
                                
                                <th>Amount</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.approval_requests_requestedByUser && Array.isArray(users.approval_requests_requestedByUser) &&
                              users.approval_requests_requestedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/approval_requests/approval_requests-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="requestType">
                                        { item.requestType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entityId">
                                        { item.entityId }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entityType">
                                        { item.entityType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="requestedAt">
                                        { dataFormatter.dateTimeFormatter(item.requestedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="approvedAt">
                                        { dataFormatter.dateTimeFormatter(item.approvedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="rejectedAt">
                                        { dataFormatter.dateTimeFormatter(item.rejectedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rejectionReason">
                                        { item.rejectionReason }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount">
                                        { item.amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.approval_requests_requestedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Approval_requests ApprovedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>RequestType</th>
                                
                                
                                
                                <th>EntityId</th>
                                
                                
                                
                                <th>EntityType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                <th>RequestedAt</th>
                                
                                
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                                
                                
                                
                                <th>RejectedAt</th>
                                
                                
                                
                                <th>RejectionReason</th>
                                
                                
                                
                                <th>Amount</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.approval_requests_approvedByUser && Array.isArray(users.approval_requests_approvedByUser) &&
                              users.approval_requests_approvedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/approval_requests/approval_requests-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="requestType">
                                        { item.requestType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entityId">
                                        { item.entityId }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entityType">
                                        { item.entityType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="requestedAt">
                                        { dataFormatter.dateTimeFormatter(item.requestedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="approvedAt">
                                        { dataFormatter.dateTimeFormatter(item.approvedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="rejectedAt">
                                        { dataFormatter.dateTimeFormatter(item.rejectedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rejectionReason">
                                        { item.rejectionReason }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount">
                                        { item.amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.approval_requests_approvedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Approval_requests RejectedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>RequestType</th>
                                
                                
                                
                                <th>EntityId</th>
                                
                                
                                
                                <th>EntityType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                <th>RequestedAt</th>
                                
                                
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                                
                                
                                
                                <th>RejectedAt</th>
                                
                                
                                
                                <th>RejectionReason</th>
                                
                                
                                
                                <th>Amount</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.approval_requests_rejectedByUser && Array.isArray(users.approval_requests_rejectedByUser) &&
                              users.approval_requests_rejectedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/approval_requests/approval_requests-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="requestType">
                                        { item.requestType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entityId">
                                        { item.entityId }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entityType">
                                        { item.entityType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="requestedAt">
                                        { dataFormatter.dateTimeFormatter(item.requestedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="approvedAt">
                                        { dataFormatter.dateTimeFormatter(item.approvedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="rejectedAt">
                                        { dataFormatter.dateTimeFormatter(item.rejectedAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="rejectionReason">
                                        { item.rejectionReason }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount">
                                        { item.amount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.approval_requests_rejectedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Notifications User</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Type</th>
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>Message</th>
                                
                                
                                
                                <th>Link</th>
                                
                                
                                
                                <th>IsRead</th>
                                
                                
                                
                                <th>ReadAt</th>
                                
                                
                                
                                <th>SentAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.notifications_user && Array.isArray(users.notifications_user) &&
                              users.notifications_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/notifications/notifications-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="type">
                                        { item.type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="message">
                                        { item.message }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="link">
                                        { item.link }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="isRead">
                                        { dataFormatter.booleanFormatter(item.isRead) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="readAt">
                                        { dataFormatter.dateTimeFormatter(item.readAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sentAt">
                                        { dataFormatter.dateTimeFormatter(item.sentAt) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.notifications_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Export_requests RequestedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ExportType</th>
                                
                                
                                
                                <th>FiltersJSON</th>
                                
                                
                                
                                <th>RecordCount</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                                
                                
                                
                                <th>ExpiresAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.export_requests_requestedByUser && Array.isArray(users.export_requests_requestedByUser) &&
                              users.export_requests_requestedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/export_requests/export_requests-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="exportType">
                                        { item.exportType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="filtersJson">
                                        { item.filtersJson }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="recordCount">
                                        { item.recordCount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="approvedAt">
                                        { dataFormatter.dateTimeFormatter(item.approvedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="expiresAt">
                                        { dataFormatter.dateTimeFormatter(item.expiresAt) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.export_requests_requestedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Export_requests ApprovedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>ExportType</th>
                                
                                
                                
                                <th>FiltersJSON</th>
                                
                                
                                
                                <th>RecordCount</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                                
                                
                                
                                <th>ExpiresAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.export_requests_approvedByUser && Array.isArray(users.export_requests_approvedByUser) &&
                              users.export_requests_approvedByUser.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/export_requests/export_requests-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="exportType">
                                        { item.exportType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="filtersJson">
                                        { item.filtersJson }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="recordCount">
                                        { item.recordCount }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="approvedAt">
                                        { dataFormatter.dateTimeFormatter(item.approvedAt) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="expiresAt">
                                        { dataFormatter.dateTimeFormatter(item.expiresAt) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.export_requests_approvedByUser?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Password_histories User</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>PasswordHash</th>
                                
                                
                                
                                <th>RecordedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.password_histories_user && Array.isArray(users.password_histories_user) &&
                              users.password_histories_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/password_histories/password_histories-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="passwordHash">
                                        { item.passwordHash }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="recordedAt">
                                        { dataFormatter.dateTimeFormatter(item.recordedAt) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.password_histories_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Refresh_tokens User</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>TokenHash</th>
                                
                                
                                
                                <th>ExpiresAt</th>
                                
                                
                                
                                <th>IsRevoked</th>
                                
                                
                                
                                <th>IPAddress</th>
                                
                                
                                
                                <th>UserAgent</th>
                                
                                
                                
                                <th>IssuedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.refresh_tokens_user && Array.isArray(users.refresh_tokens_user) &&
                              users.refresh_tokens_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/refresh_tokens/refresh_tokens-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="tokenHash">
                                        { item.tokenHash }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expiresAt">
                                        { dataFormatter.dateTimeFormatter(item.expiresAt) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="isRevoked">
                                        { dataFormatter.booleanFormatter(item.isRevoked) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ipAddress">
                                        { item.ipAddress }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="userAgent">
                                        { item.userAgent }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="issuedAt">
                                        { dataFormatter.dateTimeFormatter(item.issuedAt) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.refresh_tokens_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Audit_logs User</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>Module</th>
                                
                                
                                
                                <th>EntityId</th>
                                
                                
                                
                                <th>EntityType</th>
                                
                                
                                
                                <th>OldValueJSON</th>
                                
                                
                                
                                <th>NewValueJSON</th>
                                
                                
                                
                                <th>IPAddress</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>EventAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.audit_logs_user && Array.isArray(users.audit_logs_user) &&
                              users.audit_logs_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/audit_logs/audit_logs-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="action">
                                        { item.action }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="module">
                                        { item.module }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entityId">
                                        { item.entityId }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="entityType">
                                        { item.entityType }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="oldValueJson">
                                        { item.oldValueJson }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="newValueJson">
                                        { item.newValueJson }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ipAddress">
                                        { item.ipAddress }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="eventAt">
                                        { dataFormatter.dateTimeFormatter(item.eventAt) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.audit_logs_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                

                <BaseDivider />

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

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

export default UsersView;