Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

style: center disabled message

Brad Barbin92589c6f1eec
diff --git a/apps/erp/app/components/AuditLog/AuditLogDrawer.tsx b/apps/erp/app/components/AuditLog/AuditLogDrawer.tsx
index 3d6ee19f00..f6da96a99d 100644
--- a/apps/erp/app/components/AuditLog/AuditLogDrawer.tsx
+++ b/apps/erp/app/components/AuditLog/AuditLogDrawer.tsx
@@ -24,7 +24,7 @@ import {
} from "react-icons/lu";
import { Link, useFetcher } from "react-router";
import { EmployeeAvatar, Empty } from "~/components";
-import { useRouteData } from "~/hooks";
+import { usePermissions, useRouteData } from "~/hooks";
import AuditLogUpgradeOverlay from "~/modules/settings/ui/AuditLog/AuditLogUpgradeOverlay";
import { path } from "~/utils/path";
@@ -80,6 +80,7 @@ const AuditLogDrawer = memo(
path.to.authenticatedRoot
);
const auditLogEnabled = rootRouteData?.auditLogEnabled ?? false;
+ const { can } = usePermissions();
// Load audit log data when drawer opens or entity changes
useEffect(() => {
@@ -125,7 +126,7 @@ const AuditLogDrawer = memo(
const drawerBody = planRestricted ? (
<AuditLogUpgradeOverlay />
) : !auditLogEnabled ? (
- <div className="flex flex-col items-center justify-center flex-1 min-h-[50vh] text-center gap-4 px-4 w-full">
+ <div className="flex flex-col items-center justify-start flex-1 w-full pt-[15dvh] text-center gap-4 px-4 h-full">
<div className="rounded-full bg-muted p-3">
<LuHistory className="size-6 text-muted-foreground" />
</div>
@@ -138,9 +139,15 @@ const AuditLogDrawer = memo(
data.
</p>
</div>
- <Button variant="secondary" leftIcon={<LuSettings />} asChild>
- <Link to={path.to.auditLog}>Go to Settings</Link>
- </Button>
+ {can("update", "settings") ? (
+ <Button variant="secondary" leftIcon={<LuSettings />} asChild>
+ <Link to={path.to.auditLog}>Enable in Settings</Link>
+ </Button>
+ ) : (
+ <span className="text-sm text-muted-foreground">
+ Please contact your administrator to enable audit logging.
+ </span>
+ )}
</div>
) : isLoading ? (
<VStack spacing={3}>