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/organizations/organizationsSlice'; 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 OrganizationsView = () => { const router = useRouter(); const dispatch = useAppDispatch(); const { organizations } = useAppSelector((state) => state.organizations); 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 ( <>
Name
{organizations?.name}
Logo url
{organizations?.logo_url}
Primary color
{organizations?.primary_color}
Secondary color
{organizations?.secondary_color}
Users Organizations
| First Name | Last Name | Phone Number | Disabled | |
|---|---|---|---|---|
| {item.firstName} | {item.lastName} | {item.phoneNumber} | {item.email} | {dataFormatter.booleanFormatter(item.disabled)} |
Actions organizations
| DueDate | Status |
|---|---|
| {dataFormatter.dateTimeFormatter(item.due_date)} | {item.status} |
Branches organizations
| Name | Location |
|---|---|
| {item.name} | {item.location} |
Checklists organizations
| Title |
|---|
| {item.title} |
Events organizations
| EventType | EventDate | Status | RiskLevel |
|---|---|---|---|
| {item.event_type} | {dataFormatter.dateTimeFormatter(item.event_date)} | {item.status} | {item.risk_level} |
Inspections organizations
| CompletionDate | Score |
|---|---|
| {dataFormatter.dateTimeFormatter( item.completion_date, )} | {item.score} |