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";

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


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

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

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


    return (
      <>
          <Head>
              <title>{getPageTitle('View 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>
                </>
              

              

              
              

              

              

              

              

              

              

              

              

              

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

              

              

              
              

                
                
                
                
                
                
                
                
                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Cash_drawer_sessions OpenedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>OpenedAt</th>
                                
                                
                                
                                <th>ClosedAt</th>
                                
                                
                                
                                <th>OpeningFloat</th>
                                
                                
                                
                                <th>ClosingCashCounted</th>
                                
                                
                                
                                <th>ExpectedCash</th>
                                
                                
                                
                                <th>CashDifference</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.cash_drawer_sessions_opened_by_user && Array.isArray(users.cash_drawer_sessions_opened_by_user) &&
                              users.cash_drawer_sessions_opened_by_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/cash_drawer_sessions/cash_drawer_sessions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="opened_at">
                                        { dataFormatter.dateTimeFormatter(item.opened_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closed_at">
                                        { dataFormatter.dateTimeFormatter(item.closed_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="opening_float">
                                        { item.opening_float }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closing_cash_counted">
                                        { item.closing_cash_counted }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expected_cash">
                                        { item.expected_cash }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="cash_difference">
                                        { item.cash_difference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.cash_drawer_sessions_opened_by_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Cash_drawer_sessions ClosedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>OpenedAt</th>
                                
                                
                                
                                <th>ClosedAt</th>
                                
                                
                                
                                <th>OpeningFloat</th>
                                
                                
                                
                                <th>ClosingCashCounted</th>
                                
                                
                                
                                <th>ExpectedCash</th>
                                
                                
                                
                                <th>CashDifference</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.cash_drawer_sessions_closed_by_user && Array.isArray(users.cash_drawer_sessions_closed_by_user) &&
                              users.cash_drawer_sessions_closed_by_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/cash_drawer_sessions/cash_drawer_sessions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="opened_at">
                                        { dataFormatter.dateTimeFormatter(item.opened_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closed_at">
                                        { dataFormatter.dateTimeFormatter(item.closed_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="opening_float">
                                        { item.opening_float }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="closing_cash_counted">
                                        { item.closing_cash_counted }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expected_cash">
                                        { item.expected_cash }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="cash_difference">
                                        { item.cash_difference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.cash_drawer_sessions_closed_by_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Sales Cashier</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>ReceiptNumber</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>SoldAt</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Subtotal</th>
                                
                                
                                
                                <th>DiscountTotal</th>
                                
                                
                                
                                <th>VATTotal</th>
                                
                                
                                
                                <th>GrandTotal</th>
                                
                                
                                
                                <th>AmountPaid</th>
                                
                                
                                
                                <th>ChangeGiven</th>
                                
                                
                                
                                <th>ReceiptDelivery</th>
                                
                                
                                
                                <th>CustomerEmail</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.sales_cashier && Array.isArray(users.sales_cashier) &&
                              users.sales_cashier.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/sales/sales-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="receipt_number">
                                        { item.receipt_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="sold_at">
                                        { dataFormatter.dateTimeFormatter(item.sold_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subtotal">
                                        { item.subtotal }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discount_total">
                                        { item.discount_total }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="vat_total">
                                        { item.vat_total }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="grand_total">
                                        { item.grand_total }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="amount_paid">
                                        { item.amount_paid }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="change_given">
                                        { item.change_given }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="receipt_delivery">
                                        { item.receipt_delivery }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="customer_email">
                                        { item.customer_email }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.sales_cashier?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Returns ProcessedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>ReturnNumber</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>ReturnedAt</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Reason</th>
                                
                                
                                
                                <th>RefundTotal</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.returns_processed_by_user && Array.isArray(users.returns_processed_by_user) &&
                              users.returns_processed_by_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/returns/returns-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="return_number">
                                        { item.return_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="returned_at">
                                        { dataFormatter.dateTimeFormatter(item.returned_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reason">
                                        { item.reason }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="refund_total">
                                        { item.refund_total }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.returns_processed_by_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Purchase_orders CreatedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>PONumber</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>OrderedAt</th>
                                
                                
                                
                                <th>ExpectedAt</th>
                                
                                
                                
                                <th>ReceivedAt</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Subtotal</th>
                                
                                
                                
                                <th>VATTotal</th>
                                
                                
                                
                                <th>GrandTotal</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.purchase_orders_created_by_user && Array.isArray(users.purchase_orders_created_by_user) &&
                              users.purchase_orders_created_by_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/purchase_orders/purchase_orders-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="po_number">
                                        { item.po_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="ordered_at">
                                        { dataFormatter.dateTimeFormatter(item.ordered_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expected_at">
                                        { dataFormatter.dateTimeFormatter(item.expected_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="received_at">
                                        { dataFormatter.dateTimeFormatter(item.received_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subtotal">
                                        { item.subtotal }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="vat_total">
                                        { item.vat_total }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="grand_total">
                                        { item.grand_total }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.purchase_orders_created_by_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Stock_movements PerformedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                <th>MovedAt</th>
                                
                                
                                
                                <th>MovementType</th>
                                
                                
                                
                                <th>Quantity</th>
                                
                                
                                
                                <th>ReferenceCode</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.stock_movements_performed_by_user && Array.isArray(users.stock_movements_performed_by_user) &&
                              users.stock_movements_performed_by_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/stock_movements/stock_movements-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="moved_at">
                                        { dataFormatter.dateTimeFormatter(item.moved_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="movement_type">
                                        { item.movement_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="quantity">
                                        { item.quantity }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reference_code">
                                        { item.reference_code }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.stock_movements_performed_by_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Stock_transfers RequestedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>TransferNumber</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>RequestedAt</th>
                                
                                
                                
                                <th>ShippedAt</th>
                                
                                
                                
                                <th>ReceivedAt</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.stock_transfers_requested_by_user && Array.isArray(users.stock_transfers_requested_by_user) &&
                              users.stock_transfers_requested_by_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/stock_transfers/stock_transfers-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="transfer_number">
                                        { item.transfer_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="requested_at">
                                        { dataFormatter.dateTimeFormatter(item.requested_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipped_at">
                                        { dataFormatter.dateTimeFormatter(item.shipped_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="received_at">
                                        { dataFormatter.dateTimeFormatter(item.received_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.stock_transfers_requested_by_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Stock_transfers ApprovedBy</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>TransferNumber</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>RequestedAt</th>
                                
                                
                                
                                <th>ShippedAt</th>
                                
                                
                                
                                <th>ReceivedAt</th>
                                
                                
                                
                                <th>Status</th>
                                
                                
                                
                                <th>Notes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {users.stock_transfers_approved_by_user && Array.isArray(users.stock_transfers_approved_by_user) &&
                              users.stock_transfers_approved_by_user.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/stock_transfers/stock_transfers-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="transfer_number">
                                        { item.transfer_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="requested_at">
                                        { dataFormatter.dateTimeFormatter(item.requested_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="shipped_at">
                                        { dataFormatter.dateTimeFormatter(item.shipped_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="received_at">
                                        { dataFormatter.dateTimeFormatter(item.received_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!users?.stock_transfers_approved_by_user?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                

                <BaseDivider />

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

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

export default UsersView;