Improved the performance of the MasterCorporate
This commit is contained in:
@@ -36,8 +36,7 @@ export default function AdminDashboard({user}: Props) {
|
||||
const [selectedUser, setSelectedUser] = useState<User>();
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
|
||||
const {data: stats} = useFilterRecordsByUser<Stat[]>(user.id);
|
||||
const {users, reload} = useUsers();
|
||||
const {users, reload, isLoading} = useUsers();
|
||||
const {groups} = useGroups({});
|
||||
const {pending, done} = usePaymentStatusUsers();
|
||||
|
||||
@@ -280,6 +279,7 @@ export default function AdminDashboard({user}: Props) {
|
||||
<section className="w-full grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 place-items-center items-center justify-between">
|
||||
<IconCard
|
||||
Icon={BsPersonFill}
|
||||
isLoading={isLoading}
|
||||
label="Students"
|
||||
value={users.filter((x) => x.type === "student").length}
|
||||
onClick={() => router.push("/#students")}
|
||||
@@ -287,6 +287,7 @@ export default function AdminDashboard({user}: Props) {
|
||||
/>
|
||||
<IconCard
|
||||
Icon={BsPencilSquare}
|
||||
isLoading={isLoading}
|
||||
label="Teachers"
|
||||
value={users.filter((x) => x.type === "teacher").length}
|
||||
onClick={() => router.push("/#teachers")}
|
||||
@@ -294,6 +295,7 @@ export default function AdminDashboard({user}: Props) {
|
||||
/>
|
||||
<IconCard
|
||||
Icon={BsBank}
|
||||
isLoading={isLoading}
|
||||
label="Corporate"
|
||||
value={users.filter((x) => x.type === "corporate").length}
|
||||
onClick={() => router.push("/#corporate")}
|
||||
@@ -301,6 +303,7 @@ export default function AdminDashboard({user}: Props) {
|
||||
/>
|
||||
<IconCard
|
||||
Icon={BsBriefcaseFill}
|
||||
isLoading={isLoading}
|
||||
label="Country Managers"
|
||||
value={users.filter((x) => x.type === "agent").length}
|
||||
onClick={() => router.push("/#agents")}
|
||||
@@ -308,6 +311,7 @@ export default function AdminDashboard({user}: Props) {
|
||||
/>
|
||||
<IconCard
|
||||
Icon={BsGlobeCentralSouthAsia}
|
||||
isLoading={isLoading}
|
||||
label="Countries"
|
||||
value={[...new Set(users.filter((x) => x.demographicInformation).map((x) => x.demographicInformation?.country))].length}
|
||||
color="purple"
|
||||
@@ -315,6 +319,7 @@ export default function AdminDashboard({user}: Props) {
|
||||
<IconCard
|
||||
onClick={() => router.push("/#inactiveStudents")}
|
||||
Icon={BsPersonFill}
|
||||
isLoading={isLoading}
|
||||
label="Inactive Students"
|
||||
value={
|
||||
users.filter((x) => x.type === "student" && (x.status === "disabled" || moment().isAfter(x.subscriptionExpirationDate)))
|
||||
@@ -325,6 +330,7 @@ export default function AdminDashboard({user}: Props) {
|
||||
<IconCard
|
||||
onClick={() => router.push("/#inactiveCountryManagers")}
|
||||
Icon={BsBriefcaseFill}
|
||||
isLoading={isLoading}
|
||||
label="Inactive Country Managers"
|
||||
value={users.filter(inactiveCountryManagerFilter).length}
|
||||
color="rose"
|
||||
@@ -332,6 +338,7 @@ export default function AdminDashboard({user}: Props) {
|
||||
<IconCard
|
||||
onClick={() => router.push("/#inactiveCorporate")}
|
||||
Icon={BsBank}
|
||||
isLoading={isLoading}
|
||||
label="Inactive Corporate"
|
||||
value={
|
||||
users.filter((x) => x.type === "corporate" && (x.status === "disabled" || moment().isAfter(x.subscriptionExpirationDate)))
|
||||
@@ -342,6 +349,7 @@ export default function AdminDashboard({user}: Props) {
|
||||
<IconCard
|
||||
onClick={() => router.push("/#paymentdone")}
|
||||
Icon={BsCurrencyDollar}
|
||||
isLoading={isLoading}
|
||||
label="Payment Done"
|
||||
value={done.length}
|
||||
color="purple"
|
||||
@@ -349,6 +357,7 @@ export default function AdminDashboard({user}: Props) {
|
||||
<IconCard
|
||||
onClick={() => router.push("/#paymentpending")}
|
||||
Icon={BsCurrencyDollar}
|
||||
isLoading={isLoading}
|
||||
label="Pending Payment"
|
||||
value={pending.length}
|
||||
color="rose"
|
||||
@@ -356,12 +365,14 @@ export default function AdminDashboard({user}: Props) {
|
||||
<IconCard
|
||||
onClick={() => router.push("https://cms.encoach.com/admin")}
|
||||
Icon={BsLayoutSidebar}
|
||||
isLoading={isLoading}
|
||||
label="Content Management System (CMS)"
|
||||
color="green"
|
||||
/>
|
||||
<IconCard
|
||||
onClick={() => router.push("/#corporatestudentslevels")}
|
||||
Icon={BsPersonFill}
|
||||
isLoading={isLoading}
|
||||
label="Corporate Students Levels"
|
||||
color="purple"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user