From 8974a9fda82725938dc538aea4b723beebf6909f Mon Sep 17 00:00:00 2001 From: JHM69 Date: Fri, 10 May 2024 19:21:56 -0700 Subject: [PATCH 1/2] refactor: Update URLs and fix bugs in ContractorEntrys components --- .../CollectionPlanEntryEntryForm/index.js | 127 +++++++ .../ContractorEntry/AddCollectionPlanEntry.js | 140 ++++++++ .../ContractorEntrys/CollectionPlanItem.js | 100 ++++++ .../ContractorEntrys/CollectionPlanItems.js | 19 + .../ContractorEntrys/ContractorBillItem.js | 78 ++++ .../ContractorEntrys/ContractorBillItems.js | 18 + .../ContractorEntrys/MonitoringEntryItems.js | 17 + .../ContractorEntrys/MonitoringItem.js | 75 ++++ .../ContractorEntrys/TrackerItem.js | 61 ++++ .../ContractorEntrys/TrackerItems.js | 18 + .../components/ContractorTab/employee.js | 159 ++++++++ react-app/pages/contractor/[contractorId].js | 340 ++++++++++++++---- react-app/utils/url.js | 2 +- 13 files changed, 1081 insertions(+), 73 deletions(-) create mode 100644 react-app/components/CollectionPlanEntryEntryForm/index.js create mode 100644 react-app/components/ContractorEntry/AddCollectionPlanEntry.js create mode 100644 react-app/components/ContractorEntrys/CollectionPlanItem.js create mode 100644 react-app/components/ContractorEntrys/CollectionPlanItems.js create mode 100644 react-app/components/ContractorEntrys/ContractorBillItem.js create mode 100644 react-app/components/ContractorEntrys/ContractorBillItems.js create mode 100644 react-app/components/ContractorEntrys/MonitoringEntryItems.js create mode 100644 react-app/components/ContractorEntrys/MonitoringItem.js create mode 100644 react-app/components/ContractorEntrys/TrackerItem.js create mode 100644 react-app/components/ContractorEntrys/TrackerItems.js create mode 100644 react-app/components/ContractorTab/employee.js diff --git a/react-app/components/CollectionPlanEntryEntryForm/index.js b/react-app/components/CollectionPlanEntryEntryForm/index.js new file mode 100644 index 0000000..cfd4ec4 --- /dev/null +++ b/react-app/components/CollectionPlanEntryEntryForm/index.js @@ -0,0 +1,127 @@ +/* eslint-disable no-unused-expressions */ +import React, { useEffect, useState } from 'react' +import { useForm } from 'react-hook-form' +import Button from '../common/Button' +import Input from '../common/Input' + +const CollectionPlanEntryEntryForm = ({ + type, + defaultValues, + onFormSubmit, + handleClose, + contractorId, + ...props +}) => { + const { + register, + handleSubmit, + formState: { errors }, + reset, + setValue, + } = useForm() + + const [loading, setLoading] = useState(false) + + useEffect(() => { + if (defaultValues) { + setValue('contractorId', contractorId) + setValue('area', defaultValues.area) + setValue('startTime', defaultValues.startTime) + setValue('endTime', defaultValues.endTime) + setValue('laborers', defaultValues.laborers) + setValue('expectedWaste', defaultValues.expectedWaste) + setValue('vans', defaultValues.vans) + } + }, [ defaultValues ]) + + const onSubmit = handleSubmit(async (data) => { + console.log(data) + setLoading(true) + // convert timeOfArrival to ISO string + data.dateOfBirth = new Date(data.dateOfBirth).toISOString() + await onFormSubmit(data) + setLoading(false) + reset() + }) + + return ( +
+
+ + + + + + + + + + + + + + +
+ + +
+ ) +} + +export default CollectionPlanEntryEntryForm diff --git a/react-app/components/ContractorEntry/AddCollectionPlanEntry.js b/react-app/components/ContractorEntry/AddCollectionPlanEntry.js new file mode 100644 index 0000000..afc63a3 --- /dev/null +++ b/react-app/components/ContractorEntry/AddCollectionPlanEntry.js @@ -0,0 +1,140 @@ +import { Dialog, Transition } from '@headlessui/react' +import React, { Fragment, useEffect, useState } from 'react' + +import Button from '../common/Button' +import { Close } from '../common/icons/Close' + +import { getBaseUrl } from '../../utils/url' +import axios from 'axios' +import toast, { Toaster } from 'react-hot-toast' +import ContractorEntryForm from '../ContractorEntryForm' +import CollectionPlanEntryEntryForm from '../CollectionPlanEntryEntryForm' +const AddCollectionPlanEntry = ({ props, contractorId }) => { + const [isOpen, setIsOpen] = useState(false) + const handleClose = () => setIsOpen(false) + const handleOpen = () => setIsOpen(true) + const [contractor, setContractor] = useState([]) + const onFormSubmit = async (data) => { + try { + console.log(data) + const submitData = { + ...data, + contractorId, + } + toast('Adding the entry!', { + icon: '👏', + }) + const token = localStorage.getItem('token') + await axios + .post(getBaseUrl() + `/collectionPlan`, submitData, { + headers: { + Authorization: `Bearer ${token}`, + }, + }) + .then((response) => { + console.log(response) + toast.success('Collection Plan created successfully') + // toast.custom((t) => ( + //
+ //
+ //
+ //
+ // + //
+ //
+ //

+ // {response.data.landfill.name} + //

+ //

+ // Distance {response.data.bill.distance} KM .It will take{' '} + // {Number(response.data.bill.duration).toFixed(2)} min. + //

+ //
+ //
+ //
+ //
+ // + //
+ //
+ // )) + handleClose() + }) + .catch((error) => console.log(error)) + } catch (error) { + console.log(error) + } + } + + + + return ( + <> + + + + + +
+ + +
+
+ + + +

Make Collection Plan

+ +
+ + +
+
+
+
+
+
+ + ) +} + +export default AddCollectionPlanEntry diff --git a/react-app/components/ContractorEntrys/CollectionPlanItem.js b/react-app/components/ContractorEntrys/CollectionPlanItem.js new file mode 100644 index 0000000..95ed916 --- /dev/null +++ b/react-app/components/ContractorEntrys/CollectionPlanItem.js @@ -0,0 +1,100 @@ +/* eslint-disable react/prop-types */ +import React from 'react' +import { getBaseUrl } from '../../utils/url' +import axios from 'axios' + +const CollectionPlanItem = ({ + id, + contractorId, + area, + startTime, + endTime, + laborers, + expectedWaste, + vans, + completed, +}) => { + return ( +
+
+

+ {new Date(startTime).toLocaleTimeString() + + ' ' + + new Date(endTime).toLocaleTimeString()} +

+
+ +
+

Laborers: {laborers}

+
+ +
+

vans: {vans}

+
+
+

+ Expected Waste: {expectedWaste} +

+
+ +
+

+ completed: {completed ? 'YES' : 'NO'} +

+
+ + {/* Download button */} + +
+ +
+ + {/* */} + + {/* */} +
+ ) +} + +export default CollectionPlanItem diff --git a/react-app/components/ContractorEntrys/CollectionPlanItems.js b/react-app/components/ContractorEntrys/CollectionPlanItems.js new file mode 100644 index 0000000..4bb5991 --- /dev/null +++ b/react-app/components/ContractorEntrys/CollectionPlanItems.js @@ -0,0 +1,19 @@ +import React from 'react' +import CollectionPlanItem from './CollectionPlanItem' +import TrackerItem from './TrackerItem' +const CollectionPlanItems = ({ trackers }) => { + return ( + console.log({trackers}), +
+ {trackers?.length ? ( + trackers?.map((i) => ) + ) : ( +
+ No Collection Plan Items +
+ )} +
+ ) +} + +export default CollectionPlanItems diff --git a/react-app/components/ContractorEntrys/ContractorBillItem.js b/react-app/components/ContractorEntrys/ContractorBillItem.js new file mode 100644 index 0000000..3130fa3 --- /dev/null +++ b/react-app/components/ContractorEntrys/ContractorBillItem.js @@ -0,0 +1,78 @@ +/* eslint-disable react/prop-types */ +import React from 'react' +import { getBaseUrl } from '../../utils/url' + +const ContractorBillItem = ({paid, createdAt, totalAmount, fine, id}) => { + + return ( +
+ + +
+

+ { + new Date(createdAt).toLocaleTimeString() + " " + new Date(createdAt).toLocaleDateString() + } +

+
+ + +
+

+ Amount: {totalAmount} Taka +

+
+ +
+

+ Fine: {fine} Taka +

+
+ +
+

+ Paid: {paid?"YES" : "NO"} +

+
+ + {/* Download button */} + +
+ +
+ + + {/* */} + + {/* */} +
+ ) +} + +export default ContractorBillItem diff --git a/react-app/components/ContractorEntrys/ContractorBillItems.js b/react-app/components/ContractorEntrys/ContractorBillItems.js new file mode 100644 index 0000000..a6b8154 --- /dev/null +++ b/react-app/components/ContractorEntrys/ContractorBillItems.js @@ -0,0 +1,18 @@ +import React from 'react' +import ContractorBillItem from './ContractorBillItem' +const ContractorBillItems = ({ contractorBills }) => { + return ( + console.log({contractorBills}), +
+ {contractorBills?.length ? ( + contractorBills?.map((i) => ) + ) : ( +
+ Add some bills of contractor +
+ )} +
+ ) +} + +export default ContractorBillItems diff --git a/react-app/components/ContractorEntrys/MonitoringEntryItems.js b/react-app/components/ContractorEntrys/MonitoringEntryItems.js new file mode 100644 index 0000000..f34d90f --- /dev/null +++ b/react-app/components/ContractorEntrys/MonitoringEntryItems.js @@ -0,0 +1,17 @@ +import React from 'react' +import MonitoringItem from './MonitoringItem' +const MonitorItemEntries = ({ monitorEntries }) => { + return ( +
+ {monitorEntries?.length ? ( + monitorEntries?.map((i) => ) + ) : ( +
+ Add some employee entries of contractor +
+ )} +
+ ) +} + +export default MonitorItemEntries diff --git a/react-app/components/ContractorEntrys/MonitoringItem.js b/react-app/components/ContractorEntrys/MonitoringItem.js new file mode 100644 index 0000000..d98b662 --- /dev/null +++ b/react-app/components/ContractorEntrys/MonitoringItem.js @@ -0,0 +1,75 @@ +/* eslint-disable react/prop-types */ +import React from 'react' + +const MonitoringItem = ({id, lastLogin, lastLogout, name, accessLevel, diff}) => { + + return ( +
+
+

+ {name} +

+
+ {/*
+

{new Date(dateOfBirth).toISOString().slice(0, 10)}

+
+ +
+

{new Date(dateOfHire).toISOString().slice(0, 10)}

+
*/} + +
+

+ { + new Date(lastLogin).toLocaleTimeString() + } +

+
+ +
+

+ { + new Date(lastLogout).toLocaleTimeString() + } +

+
+ +
+

+ {accessLevel} +

+
+ +
+

+ Difference: {diff/60 > 1 ? `${Math.floor(diff/60)} hours` : `${diff} mins` } +

+
+ + {/* */} + + {/* */} +
+ ) +} + +export default MonitoringItem diff --git a/react-app/components/ContractorEntrys/TrackerItem.js b/react-app/components/ContractorEntrys/TrackerItem.js new file mode 100644 index 0000000..5a04663 --- /dev/null +++ b/react-app/components/ContractorEntrys/TrackerItem.js @@ -0,0 +1,61 @@ +/* eslint-disable react/prop-types */ +import React from 'react' + +const TrackerItem = ({ + id, + employeeId, + lat, + lon, + timestamp +}) => { + return ( +
+
+

Employee ID: {employeeId}

+
+ +
+

+ {new Date(timestamp).toLocaleTimeString() + + ' ' + + new Date(timestamp).toLocaleTimeString()} +

+
+ +
+

lat: {lat}

+
+ +
+

lon: {lon}

+
+ + + + {/* */} + + {/* */} +
+ ) +} + +export default TrackerItem diff --git a/react-app/components/ContractorEntrys/TrackerItems.js b/react-app/components/ContractorEntrys/TrackerItems.js new file mode 100644 index 0000000..1a8e087 --- /dev/null +++ b/react-app/components/ContractorEntrys/TrackerItems.js @@ -0,0 +1,18 @@ +import React from 'react' +import TrackerItem from './TrackerItem' +const CollectionPlanItems = ({ trackers }) => { + return ( + console.log({trackers}), +
+ {trackers?.length ? ( + trackers?.map((i) => ) + ) : ( +
+ No Collection Plan Items +
+ )} +
+ ) +} + +export default CollectionPlanItems diff --git a/react-app/components/ContractorTab/employee.js b/react-app/components/ContractorTab/employee.js new file mode 100644 index 0000000..a3aeda2 --- /dev/null +++ b/react-app/components/ContractorTab/employee.js @@ -0,0 +1,159 @@ +'use-client' + +/* eslint-disable multiline-ternary */ +/* eslint-disable react/react-in-jsx-scope */ +import { useEffect, useState } from 'react' +import axios from 'axios' +import { useRouter } from 'next/router' +// import ContractorItemsSkeleton from '../../../components/Contractors/ContractorItemsSkeleton' +// import ContractorItemsSkeleton from '../../../components/Contractors/ContractorItemsSkeleton' +// import ContractorEntryItems from '../../../components/ContractorEntrys/ContractorEntryItems' +import ContractorEntryItems from '../../components/ContractorEntrys/ContractorEntryItems' +import AddContractorEntry from '../../components/ContractorEntry/AddContractorEntry' +import { getBaseUrl } from '../../utils/url' + + + + +export default function EmployeeTab(contractorId) { + const [loading, setLoading] = useState(true) + const [loadingInfo, setLoadingInfo] = useState(true) + const [contractorEntries, setContractorEntries] = useState([]) + const [wasteEntries, setWasteEntries] = useState([]) + + const [contractor, setContractor] = useState({}) + + + const router = useRouter() + + const { type } = router.query; + + useEffect(() => { + if (contractorId === null) { + //console.log('contractorId is null') + return + } + setLoadingInfo(true) + const token = localStorage.getItem('token') + if (token) { + axios + .get(getBaseUrl() + `/contractor/${contractorId}`, { + headers: { + Authorization: `Bearer ${token}` + } + }) + .then((res) => { + setLoadingInfo(false) + setContractor(res.data) + console.log(res.data) + }) + .catch((err) => { + alert(err); + setLoadingInfo(false) + console.log(err) + }) + } + }, [contractorId]) + + useEffect(() => { + if (contractorId === null) return + setLoading(true) + const token = localStorage.getItem('token') + if (token.length > 0) { + axios + .get(getBaseUrl() + `/contractor/${contractorId}/employees`, { + headers: { + Authorization: `Bearer ${token}` + } + }) + .then((res) => { + console.log("fdfwd") + console.log(res.data) + res.data.sort((a, b) => b.id - a.id) + setContractorEntries(res.data) + setLoading(false) + }) + .catch((err) => { + console.log("fdfwd") + setLoading(false) + console.log(err) + }) + }else{ + console.log("fdfwd") + } + }, [contractorId]) + + useEffect(() => { + if (contractorId === null) return + setLoading(true) + const token = localStorage.getItem('token') + if (token.length > 0) { + axios + .get(getBaseUrl() + `/contractor/${contractorId}/add`, { + headers: { + Authorization: `Bearer ${token}` + } + }) + .then((res) => { + console.log(res.data) + res.data.sort((a, b) => b.id - a.id) + setWasteEntries(res.data) + setLoading(false) + }) + .catch((err) => { + setLoading(false) + console.log(err) + }) + } + }, [contractorId]) + + + + return ( + + <> +
+
+ +
+ +
+
+
+

+ Employee Entries{' '} +

+
+ {contractorId && } +
+
+ {loading ? ( + <>Loading... + ) : ( + + )} +
+ + {/*
+
+

+ Waste Entries +

+
+ {contractorId && } +
+
+ {loading ? ( + + ) : ( + + )} +
*/} +
+
+ + + + ) +} + \ No newline at end of file diff --git a/react-app/pages/contractor/[contractorId].js b/react-app/pages/contractor/[contractorId].js index 624b835..00d0807 100644 --- a/react-app/pages/contractor/[contractorId].js +++ b/react-app/pages/contractor/[contractorId].js @@ -3,10 +3,10 @@ import { useEffect, useState } from 'react' import axios from 'axios' import { useRouter } from 'next/router' -import { getBaseUrl } from '../../utils/url' +import { getBaseUrl } from '../../utils/url' import ContractorItemsSkeleton from '../../components/Contractors/ContractorItemsSkeleton' import ContractorEntryItems from '../../components/ContractorEntrys/ContractorEntryItems' -import Layout from '../../components/layout' +import Layout from '../../components/layout' import MapView from '../../components/common/MapView' import AddWasteEntry from '../../components/WasteEntry/AddWasteEntry' import WasteItemsSkeleton from '../../components/WasteEntrys/WasteEntryItemsSkeleton' @@ -14,16 +14,59 @@ import WasteEntryItems from '../../components/WasteEntrys/WasteEntryItems' import { NoSSR } from '../../components/common/NoSSR' import ProgressBar from '../../components/common/ProgressBar' import AddContractorEntry from '../../components/ContractorEntry/AddContractorEntry' +import MonitoringEntryItem from '../../components/ContractorEntrys/MonitoringItem' +import MonitorItemEntries from '../../components/ContractorEntrys/MonitoringEntryItems' +import ContractorBillItems from '../../components/ContractorEntrys/ContractorBillItems' +import CollectionPlanItems from '../../components/ContractorEntrys/CollectionPlanItems' +import AddCollectionPlanEntry from '../../components/ContractorEntry/AddCollectionPlanEntry' -export default function VehicleEntry () { +const Tab = ({ label, isActive, onClick }) => ( +
+ {label} +
+) + +// Navigation bar component +const NavigationBar = ({ tabs, activeTab, setActiveTab }) => ( +
+ {tabs.map((tab) => ( + setActiveTab(tab.key)} + /> + ))} +
+) + +export default function ContractorEntry() { const [loading, setLoading] = useState(true) const [loadingInfo, setLoadingInfo] = useState(true) const [contractorEntries, setContractorEntries] = useState([]) - const [wasteEntries, setWasteEntries] = useState([]) + const [monitorEntries, setMonitorEntries] = useState([]) + const [contractorBills, setContractorBills] = useState([]) + const [collectionPlans, setCollectionPlans] = useState([]) + const [trackers, setTrackers] = useState([]) + + const [activeTab, setActiveTab] = useState('employee') + const tabs = [ + { key: 'employee', label: 'Employees' }, + { key: 'loggedHours', label: 'Logged Hours' }, + { key: 'collectionPlan', label: 'Collection Plan' }, + { key: 'workforceTracking', label: 'Workforce Tracking' }, + ] const [contractor, setContractor] = useState({}) - const [contractorId, setContractorId] = useState(null) + const [contractorId, setContractorId] = useState('') const router = useRouter() @@ -32,18 +75,15 @@ export default function VehicleEntry () { }, [router.query.contractorId]) useEffect(() => { - if (contractorId === null) { - //console.log('contractorId is null') - return - } setLoadingInfo(true) + if (contractorId === '') return const token = localStorage.getItem('token') if (token) { axios .get(getBaseUrl() + `/contractor/${contractorId}`, { headers: { - Authorization: `Bearer ${token}` - } + Authorization: `Bearer ${token}`, + }, }) .then((res) => { setLoadingInfo(false) @@ -51,7 +91,6 @@ export default function VehicleEntry () { console.log(res.data) }) .catch((err) => { - alert(err); setLoadingInfo(false) console.log(err) }) @@ -66,8 +105,8 @@ export default function VehicleEntry () { axios .get(getBaseUrl() + `/contractor/${contractorId}/employees`, { headers: { - Authorization: `Bearer ${token}` - } + Authorization: `Bearer ${token}`, + }, }) .then((res) => { console.log(res.data) @@ -88,15 +127,43 @@ export default function VehicleEntry () { const token = localStorage.getItem('token') if (token.length > 0) { axios - .get(getBaseUrl() + `/contractor/${contractorId}/add`, { + .get(getBaseUrl() + `/contractorBill/${contractorId}`, { headers: { - Authorization: `Bearer ${token}` + Authorization: `Bearer ${token}`, + }, + }) + .then((res) => { + console.log('res.data,', res.data) + + if (res.data.length > 0) { + console.log('data is here ') + setContractorBills(res.data) + setLoading(false) } }) + .catch((err) => { + setLoading(false) + console.log(err) + }) + } + }, [contractorId]) + + useEffect(() => { + if (contractorId === null) return + setLoading(true) + + const token = localStorage.getItem('token') + if (token.length > 0) { + axios + .get(getBaseUrl() + `/monitor/${contractorId}`, { + headers: { + Authorization: `Bearer ${token}`, + }, + }) .then((res) => { - console.log(res.data) - res.data.sort((a, b) => b.id - a.id) - setWasteEntries(res.data) + console.log('res.data') + + setMonitorEntries(res.data) setLoading(false) }) .catch((err) => { @@ -106,30 +173,100 @@ export default function VehicleEntry () { } }, [contractorId]) + + useEffect(() => { + if (contractorId === null) return + setLoading(true) + + const token = localStorage.getItem('token') + if (token.length > 0) { + axios + .get(getBaseUrl() + `/collectionPlan/contractor/${contractorId}`, { + headers: { + Authorization: `Bearer ${token}`, + }, + }) + .then((res) => { + console.log('res.data') + + setCollectionPlans(res.data) + setLoading(false) + }) + .catch((err) => { + setLoading(false) + console.log(err) + }) + } + }, [contractorId]) + + + + + + useEffect(() => { + if (contractorId === null) return + setLoading(true) + + const token = localStorage.getItem('token') + if (token.length > 0) { + axios + .get(getBaseUrl() + `/tracker/${contractorId}`, { + headers: { + Authorization: `Bearer ${token}`, + }, + }) + .then((res) => { + console.log('trackers:: ' , res.data) + + setTrackers(res.data) + setLoading(false) + }) + .catch((err) => { + setLoading(false) + console.log(err) + }) + } + }, [contractorId]) + + + + + + return ( -
-
-
-

Contractor Info

-
- {loadingInfo ? ( -
-
-
-
- ) : ( -
-
-
-

Company: {contractor.companyName}

-

Registration Number: {contractor.registrationId}

- {/* +
+ + + + + {loadingInfo ? ( +
+
+
+
+ ) : ( +
+
+
+

+ Company: {contractor.companyName} +

+

+ Registration Number: {contractor.registrationId} +

+ {/* */} -
- {/*
+
+ {/*
*/} +
+
+ )} +
+ +
+
+
+

+ Employee Entries{' '} +

+
+ {contractorId && ( + + )} +
+
+ {loading ? ( + + ) : ( + + )} +
+
+ +
+
+
+

+ Logged Hours +

+
+ {loading ? ( + + ) : ( + + )}
- )} -
- -
-
-
-

- Employee Entries{' '} -

-
- {contractorId && } + +
+
+
+

Bills

+
+ {loading ? ( + + ) : ( + + )}
- {loading ? ( - - ) : ( - - )} -
- {/*
-
-

- Waste Entries -

-
- {contractorId && } +
+
+
+

+ Collection Plan +

+ +
+ {contractorId && ( + + )} +
+
+ + {loading ? ( + + ) : ( + + )}
- {loading ? ( - - ) : ( - - )} -
*/} -
-
+ + + + +
+
+
+

+ Tracking +

+ +
+ + {loading ? ( + + ) : ( + + )} +
+
+ + +
+ )} ) } - -VehicleEntry.getLayout = function getLayout (page) { + +ContractorEntry.getLayout = function getLayout(page) { return {page} } diff --git a/react-app/utils/url.js b/react-app/utils/url.js index 9d2da75..abc002d 100644 --- a/react-app/utils/url.js +++ b/react-app/utils/url.js @@ -4,6 +4,6 @@ const url = process.env.API; export const getBaseUrl = () => { // console.log(process.env.API); //return process.env.API || 'http://3.208.28.247:5000'; - return 'http://3.208.28.247:5000'; + return 'http://localhost:5000'; } \ No newline at end of file From 938296cff5654853283d3fbc89926d47fbd64181 Mon Sep 17 00:00:00 2001 From: JHM69 Date: Fri, 10 May 2024 19:22:12 -0700 Subject: [PATCH 2/2] fix --- react-app/components/CollectionPlanEntryEntryForm/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/react-app/components/CollectionPlanEntryEntryForm/index.js b/react-app/components/CollectionPlanEntryEntryForm/index.js index cfd4ec4..4ba5eea 100644 --- a/react-app/components/CollectionPlanEntryEntryForm/index.js +++ b/react-app/components/CollectionPlanEntryEntryForm/index.js @@ -37,8 +37,7 @@ const CollectionPlanEntryEntryForm = ({ const onSubmit = handleSubmit(async (data) => { console.log(data) setLoading(true) - // convert timeOfArrival to ISO string - data.dateOfBirth = new Date(data.dateOfBirth).toISOString() + // convert timeOfArrival to ISO string await onFormSubmit(data) setLoading(false) reset()