continued the kita-planer
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
import { useState, useTransition } from "react";
|
||||
import { Plus, X, Shield, Trash2 } from "lucide-react";
|
||||
import { ParentDuty, ParentDutyAssignment, User } from "@prisma/client";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -15,13 +14,30 @@ import {
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
|
||||
import { createDuty, assignDuty, removeDutyAssignment, deleteDuty } from "./duty-actions";
|
||||
|
||||
type DutyWithAssignments = ParentDuty & {
|
||||
assignments: ParentDutyAssignment[];
|
||||
type DutyWithAssignments = {
|
||||
id: string;
|
||||
name: string;
|
||||
assignments: {
|
||||
id: string;
|
||||
}[];
|
||||
};
|
||||
|
||||
type DutyUser = {
|
||||
id: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
};
|
||||
|
||||
type UserDutyAssignment = {
|
||||
id: string;
|
||||
dutyId: string;
|
||||
duty: {
|
||||
name: string;
|
||||
};
|
||||
};
|
||||
|
||||
export function DutyManager({
|
||||
@@ -29,9 +45,9 @@ export function DutyManager({
|
||||
allDuties,
|
||||
userAssignments,
|
||||
}: {
|
||||
user: User;
|
||||
user: DutyUser;
|
||||
allDuties: DutyWithAssignments[];
|
||||
userAssignments: (ParentDutyAssignment & { duty: ParentDuty })[];
|
||||
userAssignments: UserDutyAssignment[];
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [isPending, startTransition] = useTransition();
|
||||
|
||||
Reference in New Issue
Block a user