Merge branch 'main' of https://github.com/VAR-Virtual-Air-Rescue/var-monorepo
This commit is contained in:
@@ -33,6 +33,7 @@ import { ChartBarBigIcon, Check, Eye, PlaneIcon, Timer, X } from "lucide-react";
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { ColumnDef } from "@tanstack/react-table";
|
import { ColumnDef } from "@tanstack/react-table";
|
||||||
import { Error } from "_components/Error";
|
import { Error } from "_components/Error";
|
||||||
|
import { useSession } from "next-auth/react";
|
||||||
|
|
||||||
interface ProfileFormProps {
|
interface ProfileFormProps {
|
||||||
user: User;
|
user: User;
|
||||||
@@ -40,6 +41,7 @@ interface ProfileFormProps {
|
|||||||
|
|
||||||
export const ProfileForm: React.FC<ProfileFormProps> = ({ user }: ProfileFormProps) => {
|
export const ProfileForm: React.FC<ProfileFormProps> = ({ user }: ProfileFormProps) => {
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const session = useSession();
|
||||||
const form = useForm<UserOptionalDefaults>({
|
const form = useForm<UserOptionalDefaults>({
|
||||||
defaultValues: user,
|
defaultValues: user,
|
||||||
resolver: zodResolver(UserOptionalDefaultsSchema),
|
resolver: zodResolver(UserOptionalDefaultsSchema),
|
||||||
@@ -131,6 +133,7 @@ export const ProfileForm: React.FC<ProfileFormProps> = ({ user }: ProfileFormPro
|
|||||||
form={form}
|
form={form}
|
||||||
name="permissions"
|
name="permissions"
|
||||||
label="Permissions"
|
label="Permissions"
|
||||||
|
isDisabled={user.permissions.length > (session.data?.user?.permissions?.length ?? 0)}
|
||||||
options={Object.entries(PERMISSION).map(([key, value]) => ({
|
options={Object.entries(PERMISSION).map(([key, value]) => ({
|
||||||
label: value,
|
label: value,
|
||||||
value: key,
|
value: key,
|
||||||
|
|||||||
Reference in New Issue
Block a user