From ac352182996d796514bbbbe8b8dfb26a10b58f69 Mon Sep 17 00:00:00 2001 From: yaschalew Date: Fri, 29 May 2026 16:50:55 +0300 Subject: [PATCH 1/2] add docs settings to admin page --- apps/edr-freight-web/backoffice/package.json | 2 +- apps/edr-freight-web/backoffice/src/App.tsx | 16 +- .../src/components/ui/Breadcrumbs.tsx | 56 +++ .../backoffice/src/components/ui/button.tsx | 58 +++ .../backoffice/src/components/ui/dialog.tsx | 141 ++++++ .../backoffice/src/components/ui/input.tsx | 22 + .../backoffice/src/components/ui/label.tsx | 22 + .../backoffice/src/components/ui/textarea.tsx | 21 + .../backoffice/src/constants/FILE_SETTINGS.ts | 4 + .../src/constants/TANSTACK_QUEY_KEY.ts | 20 + .../backoffice/src/constants/URLS.ts | 89 ++++ .../backoffice/src/hooks/hooks/useBookings.ts | 16 + .../src/hooks/hooks/useConsignments.ts | 16 + .../src/hooks/hooks/useCustomers.ts | 50 ++ .../backoffice/src/hooks/hooks/useTracking.ts | 10 + .../src/hooks/useDropdownSettings.ts | 126 +++++ .../src/hooks/useFileUploadSettings.ts | 126 +++++ .../backoffice/src/lib/currentCustomer.ts | 45 ++ .../backoffice/src/lib/utils.ts | 6 + apps/edr-freight-web/backoffice/src/main.tsx | 6 + .../DeleteFileUploadSettingDialog.tsx | 65 +++ .../documents/EditFileUploadSettingDialog.tsx | 231 +++++++++ .../documents/FileUploadSettingsPage.tsx | 458 +++++++++++++++++ .../ManageFileUploadFieldsDialog.tsx | 416 ++++++++++++++++ .../DeleteDropdownSettingDialog.tsx | 77 +++ .../DropdownSettingsPage.tsx | 468 ++++++++++++++++++ .../EditDropdownSettingDialog.tsx | 336 +++++++++++++ .../ManageDropdownOptionsDialog.tsx | 339 +++++++++++++ .../src/services/dropdownSettings.service.ts | 97 ++++ .../services/fileUploadSettings.service.ts | 137 +++++ .../backoffice/src/types/apiResponse.ts | 5 + .../backoffice/src/types/dropdownSettings.ts | 12 + .../src/types/fileUploadSettings.ts | 39 ++ .../backoffice/src/utils/endpoint.ts | 119 +++++ pnpm-lock.yaml | 5 +- 35 files changed, 3653 insertions(+), 3 deletions(-) create mode 100644 apps/edr-freight-web/backoffice/src/components/ui/Breadcrumbs.tsx create mode 100644 apps/edr-freight-web/backoffice/src/components/ui/button.tsx create mode 100644 apps/edr-freight-web/backoffice/src/components/ui/dialog.tsx create mode 100644 apps/edr-freight-web/backoffice/src/components/ui/input.tsx create mode 100644 apps/edr-freight-web/backoffice/src/components/ui/label.tsx create mode 100644 apps/edr-freight-web/backoffice/src/components/ui/textarea.tsx create mode 100644 apps/edr-freight-web/backoffice/src/constants/FILE_SETTINGS.ts create mode 100644 apps/edr-freight-web/backoffice/src/constants/TANSTACK_QUEY_KEY.ts create mode 100644 apps/edr-freight-web/backoffice/src/constants/URLS.ts create mode 100644 apps/edr-freight-web/backoffice/src/hooks/hooks/useBookings.ts create mode 100644 apps/edr-freight-web/backoffice/src/hooks/hooks/useConsignments.ts create mode 100644 apps/edr-freight-web/backoffice/src/hooks/hooks/useCustomers.ts create mode 100644 apps/edr-freight-web/backoffice/src/hooks/hooks/useTracking.ts create mode 100644 apps/edr-freight-web/backoffice/src/hooks/useDropdownSettings.ts create mode 100644 apps/edr-freight-web/backoffice/src/hooks/useFileUploadSettings.ts create mode 100644 apps/edr-freight-web/backoffice/src/lib/currentCustomer.ts create mode 100644 apps/edr-freight-web/backoffice/src/lib/utils.ts create mode 100644 apps/edr-freight-web/backoffice/src/pages/documents/DeleteFileUploadSettingDialog.tsx create mode 100644 apps/edr-freight-web/backoffice/src/pages/documents/EditFileUploadSettingDialog.tsx create mode 100644 apps/edr-freight-web/backoffice/src/pages/documents/FileUploadSettingsPage.tsx create mode 100644 apps/edr-freight-web/backoffice/src/pages/documents/ManageFileUploadFieldsDialog.tsx create mode 100644 apps/edr-freight-web/backoffice/src/pages/dropdown_settings/DeleteDropdownSettingDialog.tsx create mode 100644 apps/edr-freight-web/backoffice/src/pages/dropdown_settings/DropdownSettingsPage.tsx create mode 100644 apps/edr-freight-web/backoffice/src/pages/dropdown_settings/EditDropdownSettingDialog.tsx create mode 100644 apps/edr-freight-web/backoffice/src/pages/dropdown_settings/ManageDropdownOptionsDialog.tsx create mode 100644 apps/edr-freight-web/backoffice/src/services/dropdownSettings.service.ts create mode 100644 apps/edr-freight-web/backoffice/src/services/fileUploadSettings.service.ts create mode 100644 apps/edr-freight-web/backoffice/src/types/apiResponse.ts create mode 100644 apps/edr-freight-web/backoffice/src/types/dropdownSettings.ts create mode 100644 apps/edr-freight-web/backoffice/src/types/fileUploadSettings.ts create mode 100644 apps/edr-freight-web/backoffice/src/utils/endpoint.ts diff --git a/apps/edr-freight-web/backoffice/package.json b/apps/edr-freight-web/backoffice/package.json index 7ae00f78b..817d46032 100644 --- a/apps/edr-freight-web/backoffice/package.json +++ b/apps/edr-freight-web/backoffice/package.json @@ -14,7 +14,7 @@ "dependencies": { "@edr/types": "workspace:*", "@edr/ui-common": "workspace:*", - "@tanstack/react-query": "^5.59.0", + "@tanstack/react-query": "^5.100.11", "@tria-plc/iamui-common": "1.1.1", "axios": "^1.7.7", "class-variance-authority": "^0.7.1", diff --git a/apps/edr-freight-web/backoffice/src/App.tsx b/apps/edr-freight-web/backoffice/src/App.tsx index 7947060ef..579603ed6 100644 --- a/apps/edr-freight-web/backoffice/src/App.tsx +++ b/apps/edr-freight-web/backoffice/src/App.tsx @@ -1,6 +1,6 @@ import { Navigate, Outlet, Route, Routes, useLocation, useNavigate } from "react-router-dom"; import { DashboardLayout, type SidebarItem } from "@edr/ui-common"; -import { LayoutDashboard, Network } from "lucide-react"; +import { LayoutDashboard, Network, Paperclip, Settings } from "lucide-react"; import { useAuth } from "./auth/useAuth"; import LoginPage from "./pages/auth/LoginPage"; @@ -10,6 +10,8 @@ import PermissionsPage from "./pages/dashboard/user-management/PermissionsPage"; import RolesPage from "./pages/dashboard/user-management/RolesPage"; import UserManagementPage from "./pages/dashboard/user-management/UserManagementPage"; import LoadingScreen from "./components/LoadingScreen"; +import FileUploadSettingsPage from "./pages/documents/FileUploadSettingsPage"; +import DropdownSettingsPage from "./pages/dropdown_settings/DropdownSettingsPage"; const sidebarItems: SidebarItem[] = [ { @@ -36,6 +38,16 @@ const sidebarItems: SidebarItem[] = [ }, ], }, + { + label: "File Settings", + href: "/dashboard/file-settings", + icon: , + }, + { + label: "Dropdown Settings", + href: "/dashboard/dropdown-settings", + icon: , + } ]; const DashboardShell = () => { @@ -84,6 +96,8 @@ const App = () => { }> } /> } /> + } /> + } /> } /> } /> } /> diff --git a/apps/edr-freight-web/backoffice/src/components/ui/Breadcrumbs.tsx b/apps/edr-freight-web/backoffice/src/components/ui/Breadcrumbs.tsx new file mode 100644 index 000000000..2d756b096 --- /dev/null +++ b/apps/edr-freight-web/backoffice/src/components/ui/Breadcrumbs.tsx @@ -0,0 +1,56 @@ +import { Fragment } from "react"; +import { Link } from "react-router-dom"; +import { ChevronRight, Home } from "lucide-react"; + +export interface BreadcrumbItem { + label: string; + href?: string; +} + +export interface BreadcrumbsProps { + items: BreadcrumbItem[]; +} + +export default function Breadcrumbs({ items }: BreadcrumbsProps) { + return ( + + ); +} diff --git a/apps/edr-freight-web/backoffice/src/components/ui/button.tsx b/apps/edr-freight-web/backoffice/src/components/ui/button.tsx new file mode 100644 index 000000000..1d9f2e228 --- /dev/null +++ b/apps/edr-freight-web/backoffice/src/components/ui/button.tsx @@ -0,0 +1,58 @@ +import * as React from "react"; +import { cva, type VariantProps } from "class-variance-authority"; +import { Slot } from "radix-ui"; + +import { cn } from "@/lib/utils"; + +const buttonVariants = cva( + "inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + { + variants: { + variant: { + default: "bg-primary text-primary-foreground hover:bg-primary/90", + destructive: + "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40", + outline: + "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50", + secondary: + "bg-secondary text-secondary-foreground hover:bg-secondary/80", + ghost: + "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", + link: "text-primary underline-offset-4 hover:underline", + }, + size: { + default: "h-9 px-4 py-2 has-[>svg]:px-3", + sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5", + lg: "h-10 rounded-md px-6 has-[>svg]:px-4", + icon: "size-9", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, + }, +); + +function Button({ + className, + variant = "default", + size = "default", + asChild = false, + ...props +}: React.ComponentProps<"button"> & + VariantProps & { + asChild?: boolean; + }) { + const Comp = asChild ? Slot.Root : "button"; + + return ( + + ); +} + +export { Button, buttonVariants }; diff --git a/apps/edr-freight-web/backoffice/src/components/ui/dialog.tsx b/apps/edr-freight-web/backoffice/src/components/ui/dialog.tsx new file mode 100644 index 000000000..5bf59ed79 --- /dev/null +++ b/apps/edr-freight-web/backoffice/src/components/ui/dialog.tsx @@ -0,0 +1,141 @@ +import * as React from "react"; +import { Dialog as DialogPrimitive } from "radix-ui"; +import { XIcon } from "lucide-react"; + +import { cn } from "@/lib/utils"; + +function Dialog({ + ...props +}: React.ComponentProps) { + return ; +} + +function DialogTrigger({ + ...props +}: React.ComponentProps) { + return ; +} + +function DialogPortal({ + ...props +}: React.ComponentProps) { + return ; +} + +function DialogClose({ + ...props +}: React.ComponentProps) { + return ; +} + +function DialogOverlay({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function DialogContent({ + className, + children, + showCloseButton = true, + ...props +}: React.ComponentProps & { + showCloseButton?: boolean; +}) { + return ( + + + + {children} + {showCloseButton && ( + + + Close + + )} + + + ); +} + +function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ); +} + +function DialogFooter({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ); +} + +function DialogTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function DialogDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +export { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogOverlay, + DialogPortal, + DialogTitle, + DialogTrigger, +}; diff --git a/apps/edr-freight-web/backoffice/src/components/ui/input.tsx b/apps/edr-freight-web/backoffice/src/components/ui/input.tsx new file mode 100644 index 000000000..9980c9f59 --- /dev/null +++ b/apps/edr-freight-web/backoffice/src/components/ui/input.tsx @@ -0,0 +1,22 @@ +import * as React from "react"; + +import { cn } from "@/lib/utils"; + +function Input({ className, type, ...props }: React.ComponentProps<"input">) { + return ( + + ); +} + +export { Input }; diff --git a/apps/edr-freight-web/backoffice/src/components/ui/label.tsx b/apps/edr-freight-web/backoffice/src/components/ui/label.tsx new file mode 100644 index 000000000..61818eba8 --- /dev/null +++ b/apps/edr-freight-web/backoffice/src/components/ui/label.tsx @@ -0,0 +1,22 @@ +import * as React from "react"; +import { Label as LabelPrimitive } from "radix-ui"; + +import { cn } from "@/lib/utils"; + +function Label({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +export { Label }; diff --git a/apps/edr-freight-web/backoffice/src/components/ui/textarea.tsx b/apps/edr-freight-web/backoffice/src/components/ui/textarea.tsx new file mode 100644 index 000000000..10fd9d657 --- /dev/null +++ b/apps/edr-freight-web/backoffice/src/components/ui/textarea.tsx @@ -0,0 +1,21 @@ +import * as React from "react"; + +import { cn } from "@/lib/utils"; + +function Textarea({ className, ...props }: React.ComponentProps<"textarea">) { + return ( +