feat: add care execution workspace
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import CarePage from "../../care/page";
|
||||
|
||||
export default function ScopedCarePage(): React.ReactElement {
|
||||
export default async function ScopedCarePage(): Promise<React.ReactElement> {
|
||||
return CarePage();
|
||||
}
|
||||
|
||||
@@ -1,15 +1,26 @@
|
||||
import { ClipboardCheck } from "lucide-react";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { ModulePage } from "@/modules/shared/components/ModulePage";
|
||||
import { getCurrentAuthContext } from "@/modules/core/server/auth";
|
||||
import { hasPermission } from "@/modules/core/server/permissions";
|
||||
import { listCareExecutionData } from "@/modules/care/server/operations";
|
||||
import { CareWorkspaceClient } from "@/modules/care/components/CareWorkspaceClient";
|
||||
import { getWorkspaceHref } from "@/modules/shared/lib/workspace-routing";
|
||||
|
||||
export default function CarePage(): React.ReactElement {
|
||||
return (
|
||||
<ModulePage
|
||||
title="护理服务"
|
||||
eyebrow="护理计划、任务与巡检"
|
||||
description="待接入护理等级、护理计划、任务派发、执行记录和逾期状态数据源。"
|
||||
icon={ClipboardCheck}
|
||||
phase="待接入"
|
||||
/>
|
||||
);
|
||||
export default async function CarePage(): Promise<React.ReactElement> {
|
||||
const context = await getCurrentAuthContext();
|
||||
if (!context) {
|
||||
redirect("/login");
|
||||
}
|
||||
|
||||
if (!hasPermission(context.permissions, "care:read")) {
|
||||
redirect(getWorkspaceHref(context.organization?.slug, "/dashboard"));
|
||||
}
|
||||
|
||||
const organizationId = context.organization?.id;
|
||||
if (!organizationId) {
|
||||
redirect(getWorkspaceHref(context.organization?.slug, "/dashboard"));
|
||||
}
|
||||
|
||||
const data = await listCareExecutionData(organizationId);
|
||||
return <CareWorkspaceClient canManage={hasPermission(context.permissions, "care:manage")} initialData={data} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user