diff --git a/src/index.ts b/src/index.ts index 845e958..e546cd3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,6 +38,14 @@ export const fhirProfileLink = getSyncLifecycle( options ); +export const scheduleManagerLink = getSyncLifecycle( + createLeftPanelLink({ + name: "schedule-manager", + title: "Schedule Manager", + }), + options +); + export const VLSuppressionPrediction = getAsyncLifecycle( () => import( diff --git a/src/root.component.tsx b/src/root.component.tsx index 5749ca8..db5d23c 100644 --- a/src/root.component.tsx +++ b/src/root.component.tsx @@ -5,6 +5,7 @@ import LeftPanel from "./components/left-panel/left-panel.component"; import styles from "./root.scss"; import Fhir from "./fhir/fhir.component"; import FacilityMetrics from "./facility-metrics/facility-metrics.component"; +import ScheduleManager from "./scheduler/scheduler.component"; const Root: React.FC = () => { const spaBasePath = window.spaBase; @@ -24,6 +25,7 @@ const Root: React.FC = () => { } /> } /> + } /> diff --git a/src/routes.json b/src/routes.json index 0e4115c..f29fb29 100644 --- a/src/routes.json +++ b/src/routes.json @@ -66,6 +66,11 @@ "name": "Health Exchange" } + }, + { + "component": "scheduleManagerLink", + "name": "scheduler-manager-link", + "slot": "health-exchange-left-panel-slot" } ] } diff --git a/src/scheduler/scheduler.component.tsx b/src/scheduler/scheduler.component.tsx new file mode 100644 index 0000000..98e54a7 --- /dev/null +++ b/src/scheduler/scheduler.component.tsx @@ -0,0 +1,82 @@ +import React, { useCallback, useState } from "react"; +import Header from "../components/header/header.component"; +import Illustration from "../facility-metrics/facility-metrics-illustration.component"; +import fhirStyles from "../fhir/fhir.scss"; +import DataList from "../components/data-table/data-table.component"; +import { + runTask, + schedulerTableHeaders, + schedulerTasks, + Task, +} from "./scheduler.resource"; +import { Button, InlineLoading } from "@carbon/react"; +import { ChooseItem } from "@carbon/react/icons"; +import { showNotification, showToast } from "@openmrs/esm-framework"; + +const ScheduleManager: React.FC = () => { + const [executingTaskId, setExecutingTaskId] = useState(null); + const isExecutingTask = (taskId: string) => executingTaskId === taskId; + const getTasks = () => { + const taskArray = []; + schedulerTasks.map((task) => { + taskArray.push({ + ...task, + actions: isExecutingTask(task.no) ? ( + + ) : ( +