diff --git a/frontend/components/assets/Transfer.tsx b/frontend/components/assets/Transfer.tsx new file mode 100644 index 000000000..aa068aa13 --- /dev/null +++ b/frontend/components/assets/Transfer.tsx @@ -0,0 +1,134 @@ +// "use client"; + +// import Link from "next/link"; +// import { usePathname, useRouter } from "next/navigation"; +// import { clsx } from "clsx"; +// import { +// LayoutDashboard, +// Package, +// Users, +// Building2, +// BarChart3, +// Settings, +// LogOut, +// X, +// } from "lucide-react"; +// import { useAuthStore } from "@/store/auth.store"; + +// const navItems = [ +// { href: "/dashboard", label: "Dashboard", icon: LayoutDashboard }, +// { href: "/assets", label: "Assets", icon: Package }, +// { href: "/users", label: "Users", icon: Users }, +// { href: "/departments", label: "Organisation", icon: Building2 }, +// { href: "/reports", label: "Reports", icon: BarChart3 }, +// ]; + +// interface SidebarProps { +// open?: boolean; +// onClose?: () => void; +// } + +// export function Sidebar({ open, onClose }: SidebarProps) { +// const pathname = usePathname(); +// const router = useRouter(); +// const { logout } = useAuthStore(); + +// const handleLogout = async () => { +// await logout(); +// router.push("/login"); +// }; + +// return ( +// <> +// {/* Mobile overlay */} +// {open && ( +//
+// )} + +// +// +// ); +// } diff --git a/frontend/components/assets/vote.tsx b/frontend/components/assets/vote.tsx new file mode 100644 index 000000000..761980a58 --- /dev/null +++ b/frontend/components/assets/vote.tsx @@ -0,0 +1,257 @@ +// // frontend/components/assets/create-asset-modal.tsx +// "use client"; + +// import { useForm } from "react-hook-form"; +// import { zodResolver } from "@hookform/resolvers/zod"; +// import { z } from "zod"; +// import { X } from "lucide-react"; +// import { Button } from "@/components/ui/button"; +// import { Input } from "@/components/ui/input"; +// import { useCreateAsset } from "@/lib/query/hooks/useAssets"; +// import { useDepartments } from "@/lib/query/hooks/useAsset"; +// import { useCategories } from "@/lib/query/hooks/useAssets"; +// import { AssetStatus, AssetCondition } from "@/lib/query/types/asset"; + +// const schema = z.object({ +// name: z.string().min(1, "Asset name is required"), +// categoryId: z.string().min(1, "Category is required"), +// departmentId: z.string().min(1, "Department is required"), +// serialNumber: z.string().optional(), +// manufacturer: z.string().optional(), +// model: z.string().optional(), +// location: z.string().optional(), +// condition: z.nativeEnum(AssetCondition).optional(), +// status: z.nativeEnum(AssetStatus).optional(), +// purchasePrice: z.string().optional(), +// notes: z.string().optional(), +// }); + +// type FormValues = z.infer; + +// interface Props { +// onClose: () => void; +// onSuccess?: () => void; +// } + +// export function CreateAssetModal({ onClose, onSuccess }: Props) { +// const { data: departments = [] } = useDepartments(); +// const { data: categories = [] } = useCategories(); +// const createAsset = useCreateAsset(); + +// const { +// register, +// handleSubmit, +// setError, +// formState: { errors }, +// } = useForm({ +// resolver: zodResolver(schema), +// defaultValues: { +// condition: AssetCondition.NEW, +// status: AssetStatus.ACTIVE, +// }, +// }); + +// const onSubmit = async (values: FormValues) => { +// try { +// await createAsset.mutateAsync({ +// name: values.name, +// categoryId: values.categoryId, +// departmentId: values.departmentId, +// serialNumber: values.serialNumber || undefined, +// manufacturer: values.manufacturer || undefined, +// model: values.model || undefined, +// location: values.location || undefined, +// condition: values.condition, +// status: values.status, +// purchasePrice: values.purchasePrice +// ? Number(values.purchasePrice) +// : undefined, +// notes: values.notes || undefined, +// }); +// onSuccess?.(); +// onClose(); +// } catch (err: unknown) { +// const message = +// (err as { response?: { data?: { message?: string } } })?.response?.data +// ?.message || "Failed to register asset."; +// setError("root", { message }); +// } +// }; + +// return ( +//
+// {/* Backdrop */} +//
+ +// {/* Modal */} +//
+//
+//

+// Register New Asset +//

+// +//
+ +//
+// + +//
+// {/* Category */} +//
+// +// +// {errors.categoryId && ( +//

+// {errors.categoryId.message} +//

+// )} +//
+ +// {/* Department */} +//
+// +// +// {errors.departmentId && ( +//

+// {errors.departmentId.message} +//

+// )} +//
+//
+ +//
+// +// +//
+ +//
+// +// +//
+ +//
+// {/* Condition */} +//
+// +// +//
+ +// +//
+ +//
+// +//