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'}>Documents Owner</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>DocumentNumber</th>
                                
                                
                                
                                <th>CurrentRevision</th>
                                
                                
                                
                                <th>LifecycleStatus</th>
                                
                                
                                
                                <th>ControlLevel</th>
                                
                                
                                
                                <th>Confidentiality</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>EffectiveDate</th>
                                
                                
                                
                                <th>NextReviewDate</th>
                                
                                
                                
                                <th>Summary</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>TrainingRequired</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.documents_owner && Array.isArray(users.documents_owner) &&
                              users.documents_owner.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/documents/documents-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="document_number">
                                        { item.document_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="current_revision">
                                        { item.current_revision }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="lifecycle_status">
                                        { item.lifecycle_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="control_level">
                                        { item.control_level }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="confidentiality">
                                        { item.confidentiality }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="effective_date">
                                        { dataFormatter.dateTimeFormatter(item.effective_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="next_review_date">
                                        { dataFormatter.dateTimeFormatter(item.next_review_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="summary">
                                        { item.summary }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="training_required">
                                        { dataFormatter.booleanFormatter(item.training_required) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.documents_owner?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Documents Approver</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>Title</th>
                                
                                
                                
                                <th>DocumentNumber</th>
                                
                                
                                
                                <th>CurrentRevision</th>
                                
                                
                                
                                <th>LifecycleStatus</th>
                                
                                
                                
                                <th>ControlLevel</th>
                                
                                
                                
                                <th>Confidentiality</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>EffectiveDate</th>
                                
                                
                                
                                <th>NextReviewDate</th>
                                
                                
                                
                                <th>Summary</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>TrainingRequired</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.documents_approver && Array.isArray(users.documents_approver) &&
                              users.documents_approver.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/documents/documents-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="title">
                                        { item.title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="document_number">
                                        { item.document_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="current_revision">
                                        { item.current_revision }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="lifecycle_status">
                                        { item.lifecycle_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="control_level">
                                        { item.control_level }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="confidentiality">
                                        { item.confidentiality }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="effective_date">
                                        { dataFormatter.dateTimeFormatter(item.effective_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="next_review_date">
                                        { dataFormatter.dateTimeFormatter(item.next_review_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="summary">
                                        { item.summary }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="training_required">
                                        { dataFormatter.booleanFormatter(item.training_required) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.documents_approver?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Document_versions Author</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>Revision</th>
                                
                                
                                
                                <th>VersionStatus</th>
                                
                                
                                
                                
                                
                                <th>SubmittedAt</th>
                                
                                
                                
                                <th>ApprovedAt</th>
                                
                                
                                
                                <th>EffectiveAt</th>
                                
                                
                                
                                <th>ChangeSummary</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>HashChecksum</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.document_versions_author && Array.isArray(users.document_versions_author) &&
                              users.document_versions_author.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/document_versions/document_versions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="revision">
                                        { item.revision }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="version_status">
                                        { item.version_status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="submitted_at">
                                        { dataFormatter.dateTimeFormatter(item.submitted_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="approved_at">
                                        { dataFormatter.dateTimeFormatter(item.approved_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="effective_at">
                                        { dataFormatter.dateTimeFormatter(item.effective_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="change_summary">
                                        { item.change_summary }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="hash_checksum">
                                        { item.hash_checksum }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.document_versions_author?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Change_requests Requester</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>ChangeNumber</th>
                                
                                
                                
                                <th>ChangeType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>ReasonForChange</th>
                                
                                
                                
                                <th>ImpactAssessment</th>
                                
                                
                                
                                <th>RequiresValidation</th>
                                
                                
                                
                                <th>RequiresRegulatoryNotification</th>
                                
                                
                                
                                <th>RequestedAt</th>
                                
                                
                                
                                <th>DueAt</th>
                                
                                
                                
                                <th>ClosedAt</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.change_requests_requester && Array.isArray(users.change_requests_requester) &&
                              users.change_requests_requester.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/change_requests/change_requests-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="change_number">
                                        { item.change_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="change_type">
                                        { item.change_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="reason_for_change">
                                        { item.reason_for_change }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="impact_assessment">
                                        { item.impact_assessment }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="requires_validation">
                                        { dataFormatter.booleanFormatter(item.requires_validation) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="requires_regulatory_notification">
                                        { dataFormatter.booleanFormatter(item.requires_regulatory_notification) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="requested_at">
                                        { dataFormatter.dateTimeFormatter(item.requested_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="due_at">
                                        { dataFormatter.dateTimeFormatter(item.due_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closed_at">
                                        { dataFormatter.dateTimeFormatter(item.closed_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.change_requests_requester?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Change_requests AssignedTo</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>ChangeNumber</th>
                                
                                
                                
                                <th>ChangeType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>ReasonForChange</th>
                                
                                
                                
                                <th>ImpactAssessment</th>
                                
                                
                                
                                <th>RequiresValidation</th>
                                
                                
                                
                                <th>RequiresRegulatoryNotification</th>
                                
                                
                                
                                <th>RequestedAt</th>
                                
                                
                                
                                <th>DueAt</th>
                                
                                
                                
                                <th>ClosedAt</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.change_requests_assigned_to && Array.isArray(users.change_requests_assigned_to) &&
                              users.change_requests_assigned_to.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/change_requests/change_requests-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="change_number">
                                        { item.change_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="change_type">
                                        { item.change_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="reason_for_change">
                                        { item.reason_for_change }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="impact_assessment">
                                        { item.impact_assessment }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="requires_validation">
                                        { dataFormatter.booleanFormatter(item.requires_validation) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="requires_regulatory_notification">
                                        { dataFormatter.booleanFormatter(item.requires_regulatory_notification) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="requested_at">
                                        { dataFormatter.dateTimeFormatter(item.requested_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="due_at">
                                        { dataFormatter.dateTimeFormatter(item.due_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closed_at">
                                        { dataFormatter.dateTimeFormatter(item.closed_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.change_requests_assigned_to?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Approval_steps Assignee</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>StepOrder</th>
                                
                                
                                
                                <th>StepName</th>
                                
                                
                                
                                <th>StepType</th>
                                
                                
                                
                                
                                
                                <th>AssignmentRule</th>
                                
                                
                                
                                <th>SLADays</th>
                                
                                
                                
                                <th>Required</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.approval_steps_assignee && Array.isArray(users.approval_steps_assignee) &&
                              users.approval_steps_assignee.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/approval_steps/approval_steps-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="step_order">
                                        { item.step_order }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="step_name">
                                        { item.step_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="step_type">
                                        { item.step_type }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="assignment_rule">
                                        { item.assignment_rule }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="sla_days">
                                        { item.sla_days }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="required">
                                        { dataFormatter.booleanFormatter(item.required) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.approval_steps_assignee?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Approval_tasks Assignee</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>SubjectType</th>
                                
                                
                                
                                <th>SubjectReference</th>
                                
                                
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>AssignedAt</th>
                                
                                
                                
                                <th>CompletedAt</th>
                                
                                
                                
                                <th>DecisionComment</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.approval_tasks_assignee && Array.isArray(users.approval_tasks_assignee) &&
                              users.approval_tasks_assignee.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/approval_tasks/approval_tasks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="subject_type">
                                        { item.subject_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subject_reference">
                                        { item.subject_reference }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="assigned_at">
                                        { dataFormatter.dateTimeFormatter(item.assigned_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="completed_at">
                                        { dataFormatter.dateTimeFormatter(item.completed_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="decision_comment">
                                        { item.decision_comment }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.approval_tasks_assignee?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Esignature_events 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>SubjectType</th>
                                
                                
                                
                                <th>SubjectReference</th>
                                
                                
                                
                                <th>SignedAt</th>
                                
                                
                                
                                <th>MeaningOfSignature</th>
                                
                                
                                
                                <th>AuthenticationMethod</th>
                                
                                
                                
                                <th>IPAddress</th>
                                
                                
                                
                                <th>UserAgent</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.esignature_events_user && Array.isArray(users.esignature_events_user) &&
                              users.esignature_events_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/esignature_events/esignature_events-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="action">
                                        { item.action }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subject_type">
                                        { item.subject_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subject_reference">
                                        { item.subject_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="signed_at">
                                        { dataFormatter.dateTimeFormatter(item.signed_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="meaning_of_signature">
                                        { item.meaning_of_signature }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="authentication_method">
                                        { item.authentication_method }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ip_address">
                                        { item.ip_address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="user_agent">
                                        { item.user_agent }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.esignature_events_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Training_assignments User</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>AssignedAt</th>
                                
                                
                                
                                <th>DueAt</th>
                                
                                
                                
                                <th>CompletedAt</th>
                                
                                
                                
                                <th>Score</th>
                                
                                
                                
                                <th>TrainerNotes</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.training_assignments_user && Array.isArray(users.training_assignments_user) &&
                              users.training_assignments_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/training_assignments/training_assignments-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="assigned_at">
                                        { dataFormatter.dateTimeFormatter(item.assigned_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="due_at">
                                        { dataFormatter.dateTimeFormatter(item.due_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="completed_at">
                                        { dataFormatter.dateTimeFormatter(item.completed_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="score">
                                        { item.score }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="trainer_notes">
                                        { item.trainer_notes }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.training_assignments_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Certificates_of_analysis IssuedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>COANumber</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>IssuedAt</th>
                                
                                
                                
                                <th>ExpiresAt</th>
                                
                                
                                
                                <th>Summary</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.certificates_of_analysis_issued_by && Array.isArray(users.certificates_of_analysis_issued_by) &&
                              users.certificates_of_analysis_issued_by.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/certificates_of_analysis/certificates_of_analysis-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="coa_number">
                                        { item.coa_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="issued_at">
                                        { dataFormatter.dateTimeFormatter(item.issued_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expires_at">
                                        { dataFormatter.dateTimeFormatter(item.expires_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="summary">
                                        { item.summary }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.certificates_of_analysis_issued_by?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Risk_assessments Owner</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>RiskFileName</th>
                                
                                
                                
                                <th>RiskFileCode</th>
                                
                                
                                
                                <th>Methodology</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                <th>CreatedOn</th>
                                
                                
                                
                                <th>ReviewDueAt</th>
                                
                                
                                
                                <th>Scope</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.risk_assessments_owner && Array.isArray(users.risk_assessments_owner) &&
                              users.risk_assessments_owner.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/risk_assessments/risk_assessments-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="risk_file_name">
                                        { item.risk_file_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="risk_file_code">
                                        { item.risk_file_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="methodology">
                                        { item.methodology }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="created_on">
                                        { dataFormatter.dateTimeFormatter(item.created_on) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="review_due_at">
                                        { dataFormatter.dateTimeFormatter(item.review_due_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scope">
                                        { item.scope }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.risk_assessments_owner?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Capas Owner</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>CAPANumber</th>
                                
                                
                                
                                <th>Source</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>ProblemStatement</th>
                                
                                
                                
                                <th>RootCause</th>
                                
                                
                                
                                <th>CorrectiveActions</th>
                                
                                
                                
                                <th>PreventiveActions</th>
                                
                                
                                
                                <th>OpenedAt</th>
                                
                                
                                
                                <th>DueAt</th>
                                
                                
                                
                                <th>ClosedAt</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.capas_owner && Array.isArray(users.capas_owner) &&
                              users.capas_owner.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/capas/capas-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="capa_number">
                                        { item.capa_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="source">
                                        { item.source }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="problem_statement">
                                        { item.problem_statement }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="root_cause">
                                        { item.root_cause }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="corrective_actions">
                                        { item.corrective_actions }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="preventive_actions">
                                        { item.preventive_actions }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="opened_at">
                                        { dataFormatter.dateTimeFormatter(item.opened_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="due_at">
                                        { dataFormatter.dateTimeFormatter(item.due_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closed_at">
                                        { dataFormatter.dateTimeFormatter(item.closed_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.capas_owner?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Nonconformances Owner</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>NCNumber</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>NonconformanceType</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>Disposition</th>
                                
                                
                                
                                
                                
                                <th>DetectedAt</th>
                                
                                
                                
                                <th>ClosedAt</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.nonconformances_owner && Array.isArray(users.nonconformances_owner) &&
                              users.nonconformances_owner.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/nonconformances/nonconformances-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="nc_number">
                                        { item.nc_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="nonconformance_type">
                                        { item.nonconformance_type }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="disposition">
                                        { item.disposition }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="detected_at">
                                        { dataFormatter.dateTimeFormatter(item.detected_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closed_at">
                                        { dataFormatter.dateTimeFormatter(item.closed_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.nonconformances_owner?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Complaints Owner</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>ComplaintNumber</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                <th>ReporterName</th>
                                
                                
                                
                                <th>ReporterContact</th>
                                
                                
                                
                                <th>ComplaintDescription</th>
                                
                                
                                
                                <th>SeriousInjuryOrDeath</th>
                                
                                
                                
                                <th>Malfunction</th>
                                
                                
                                
                                <th>ReportableToAuthority</th>
                                
                                
                                
                                <th>ReceivedAt</th>
                                
                                
                                
                                <th>ClosedAt</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.complaints_owner && Array.isArray(users.complaints_owner) &&
                              users.complaints_owner.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/complaints/complaints-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="complaint_number">
                                        { item.complaint_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="reporter_name">
                                        { item.reporter_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reporter_contact">
                                        { item.reporter_contact }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="complaint_description">
                                        { item.complaint_description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="serious_injury_or_death">
                                        { dataFormatter.booleanFormatter(item.serious_injury_or_death) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="malfunction">
                                        { dataFormatter.booleanFormatter(item.malfunction) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reportable_to_authority">
                                        { dataFormatter.booleanFormatter(item.reportable_to_authority) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="received_at">
                                        { dataFormatter.dateTimeFormatter(item.received_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closed_at">
                                        { dataFormatter.dateTimeFormatter(item.closed_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.complaints_owner?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Audits LeadAuditor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>AuditNumber</th>
                                
                                
                                
                                <th>AuditType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>StartAt</th>
                                
                                
                                
                                <th>EndAt</th>
                                
                                
                                
                                <th>Scope</th>
                                
                                
                                
                                <th>Summary</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.audits_lead_auditor && Array.isArray(users.audits_lead_auditor) &&
                              users.audits_lead_auditor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/audits/audits-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="audit_number">
                                        { item.audit_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="audit_type">
                                        { item.audit_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="start_at">
                                        { dataFormatter.dateTimeFormatter(item.start_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="end_at">
                                        { dataFormatter.dateTimeFormatter(item.end_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scope">
                                        { item.scope }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="summary">
                                        { item.summary }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.audits_lead_auditor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Audit_findings Owner</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>FindingNumber</th>
                                
                                
                                
                                <th>Severity</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Description</th>
                                
                                
                                
                                <th>ObjectiveEvidence</th>
                                
                                
                                
                                
                                
                                <th>DueAt</th>
                                
                                
                                
                                <th>ClosedAt</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.audit_findings_owner && Array.isArray(users.audit_findings_owner) &&
                              users.audit_findings_owner.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/audit_findings/audit_findings-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="finding_number">
                                        { item.finding_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="severity">
                                        { item.severity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="description">
                                        { item.description }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="objective_evidence">
                                        { item.objective_evidence }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="due_at">
                                        { dataFormatter.dateTimeFormatter(item.due_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closed_at">
                                        { dataFormatter.dateTimeFormatter(item.closed_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.audit_findings_owner?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Management_reviews Chairperson</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>ReviewTitle</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>MeetingStartAt</th>
                                
                                
                                
                                <th>MeetingEndAt</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.management_reviews_chairperson && Array.isArray(users.management_reviews_chairperson) &&
                              users.management_reviews_chairperson.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/management_reviews/management_reviews-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="review_title">
                                        { item.review_title }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="meeting_start_at">
                                        { dataFormatter.dateTimeFormatter(item.meeting_start_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="meeting_end_at">
                                        { dataFormatter.dateTimeFormatter(item.meeting_end_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.management_reviews_chairperson?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Regulatory_submissions Owner</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>SubmissionName</th>
                                
                                
                                
                                <th>Jurisdiction</th>
                                
                                
                                
                                <th>SubmissionType</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>PlannedSubmissionAt</th>
                                
                                
                                
                                <th>SubmittedAt</th>
                                
                                
                                
                                <th>DecisionAt</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.regulatory_submissions_owner && Array.isArray(users.regulatory_submissions_owner) &&
                              users.regulatory_submissions_owner.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/regulatory_submissions/regulatory_submissions-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="submission_name">
                                        { item.submission_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="jurisdiction">
                                        { item.jurisdiction }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="submission_type">
                                        { item.submission_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="planned_submission_at">
                                        { dataFormatter.dateTimeFormatter(item.planned_submission_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="submitted_at">
                                        { dataFormatter.dateTimeFormatter(item.submitted_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="decision_at">
                                        { dataFormatter.dateTimeFormatter(item.decision_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.regulatory_submissions_owner?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Audit_logs Actor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>EventAt</th>
                                
                                
                                
                                
                                
                                <th>EventType</th>
                                
                                
                                
                                <th>SubjectType</th>
                                
                                
                                
                                <th>SubjectReference</th>
                                
                                
                                
                                <th>Details</th>
                                
                                
                                
                                <th>IPAddress</th>
                                
                                
                                
                                <th>UserAgent</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.audit_logs_actor && Array.isArray(users.audit_logs_actor) &&
                              users.audit_logs_actor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/audit_logs/audit_logs-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="event_at">
                                        { dataFormatter.dateTimeFormatter(item.event_at) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="event_type">
                                        { item.event_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subject_type">
                                        { item.subject_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subject_reference">
                                        { item.subject_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="details">
                                        { item.details }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ip_address">
                                        { item.ip_address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="user_agent">
                                        { item.user_agent }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.audit_logs_actor?.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;