Added Date export based on user timezone
This commit is contained in:
@@ -11,13 +11,12 @@ import Button from "@/components/Low/Button";
|
||||
import Link from "next/link";
|
||||
import axios from "axios";
|
||||
import {ErrorMessage} from "@/constants/errors";
|
||||
import {RadioGroup} from "@headlessui/react";
|
||||
import clsx from "clsx";
|
||||
import {CorporateUser, EmploymentStatus, EMPLOYMENT_STATUS, Gender, User} from "@/interfaces/user";
|
||||
import CountrySelect from "@/components/Low/CountrySelect";
|
||||
import {shouldRedirectHome} from "@/utils/navigation.disabled";
|
||||
import moment from "moment";
|
||||
import {BsCamera, BsCameraFill} from "react-icons/bs";
|
||||
import {BsCamera} from "react-icons/bs";
|
||||
import {USER_TYPE_LABELS} from "@/resources/user";
|
||||
import useGroups from "@/hooks/useGroups";
|
||||
import useUsers from "@/hooks/useUsers";
|
||||
@@ -25,7 +24,7 @@ import {convertBase64} from "@/utils";
|
||||
import {Divider} from "primereact/divider";
|
||||
import GenderInput from "@/components/High/GenderInput";
|
||||
import EmploymentStatusInput from "@/components/High/EmploymentStatusInput";
|
||||
|
||||
import TimezoneSelect from "@/components/Low/TImezoneSelect";
|
||||
export const getServerSideProps = withIronSessionSsr(({req, res}) => {
|
||||
const user = req.session.user;
|
||||
|
||||
@@ -83,7 +82,7 @@ function UserProfile({user, mutateUser}: Props) {
|
||||
const [commercialRegistration, setCommercialRegistration] = useState<string | undefined>(
|
||||
user.type === "agent" ? user.agentInformation?.commercialRegistration : undefined,
|
||||
);
|
||||
|
||||
const [timezone, setTimezone] = useState<string>(user.demographicInformation?.timezone || 'UTC');
|
||||
const {groups} = useGroups();
|
||||
const {users} = useUsers();
|
||||
|
||||
@@ -146,6 +145,7 @@ function UserProfile({user, mutateUser}: Props) {
|
||||
position: user?.type === "corporate" ? position : undefined,
|
||||
gender,
|
||||
passport_id,
|
||||
timezone,
|
||||
},
|
||||
...(user.type === "corporate" ? {corporateInformation} : {}),
|
||||
});
|
||||
@@ -247,6 +247,13 @@ function UserProfile({user, mutateUser}: Props) {
|
||||
</div>
|
||||
);
|
||||
|
||||
const TimezoneInput = () => (
|
||||
<div className="flex flex-col gap-3 w-1/2">
|
||||
<label className="font-normal text-base text-mti-gray-dim">Timezone</label>
|
||||
<TimezoneSelect value={timezone} onChange={setTimezone} />
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<Layout user={user}>
|
||||
<section className="w-full flex flex-col gap-4 md:gap-8 px-4 py-8">
|
||||
@@ -304,6 +311,9 @@ function UserProfile({user, mutateUser}: Props) {
|
||||
<CountryInput />
|
||||
<PhoneInput />
|
||||
</DoubleColumnRow>
|
||||
<DoubleColumnRow>
|
||||
<TimezoneInput />
|
||||
</DoubleColumnRow>
|
||||
|
||||
<Divider />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user