From 13d8e97218a79f243ce498d0a248d2769edb345a Mon Sep 17 00:00:00 2001 From: 2nthony Date: Tue, 2 Apr 2024 14:34:13 +0800 Subject: [PATCH] feat: add salary summary content --- .../components/fellowship/salary/common.js | 4 +++ .../components/fellowship/salary/summary.jsx | 34 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 packages/next-common/components/fellowship/salary/summary.jsx diff --git a/packages/next-common/components/fellowship/salary/common.js b/packages/next-common/components/fellowship/salary/common.js index f8f1303f85..109768f046 100644 --- a/packages/next-common/components/fellowship/salary/common.js +++ b/packages/next-common/components/fellowship/salary/common.js @@ -1,4 +1,6 @@ import ListLayout from "next-common/components/layout/ListLayout"; +import FellowshipSalarySummary from "./summary"; +import FellowshipSummaryActions from "../core/summary/actions"; export default function FellowshipSalaryCommon({ children, ...props }) { const title = "Fellowship Salary"; @@ -11,6 +13,8 @@ export default function FellowshipSalaryCommon({ children, ...props }) { seoInfo={seoInfo} title={title} description={seoInfo.desc} + summary={} + summaryFooter={} tabs={[ { label: "Cycles", diff --git a/packages/next-common/components/fellowship/salary/summary.jsx b/packages/next-common/components/fellowship/salary/summary.jsx new file mode 100644 index 0000000000..508de18fd7 --- /dev/null +++ b/packages/next-common/components/fellowship/salary/summary.jsx @@ -0,0 +1,34 @@ +import { has, partition } from "lodash-es"; +import Summary from "next-common/components/summary"; +import { usePageProps } from "next-common/context/page"; + +export default function FellowshipSalarySummary() { + const { fellowshipMembers, fellowshipSalaryClaimants } = usePageProps(); + + const [registeredClaimants] = partition( + fellowshipSalaryClaimants, + (claimant) => { + return ( + has(claimant?.status?.status, "registered") || + has(claimant?.status?.status, "attempted") + ); + }, + ); + + const items = [ + { + title: "Claimants", + content: fellowshipSalaryClaimants?.length || 0, + }, + { + title: "Registered", + content: registeredClaimants.length, + }, + { + title: "Not Inducted", + content: fellowshipMembers?.length - fellowshipSalaryClaimants?.length, + }, + ]; + + return ; +}