Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | 4x 112x 112x 1x 112x 176x 176x 176x 112x 67x 45x 45x | import NiceModal from "@ebay/nice-modal-react";
import TaskCard from "@features/Merchants/MerchantSidePanel/UnderwritingTasks/components/TaskCard";
import {
AccordionDetailsHeader,
LastCheckArray,
} from "@features/Merchants/MerchantSidePanel/UnderwritingTasks/components/Accordion.atom";
import {
ActionButtonsProps,
ExtendedPEPStatusType,
LastCheckArrayProps,
} from "@features/Merchants/MerchantSidePanel/UnderwritingTasks/types";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import { useCallback } from "react";
import { GIVE_OFAC_DETAILS_MODAL } from "modals/modal_names";
import GiveLatestCheckSectionSkeleton from "./skeletons/GiveLatestCheckSectionSkeleton";
import GiveOFACEmptyState from "./emptyStates/GiveOFACEmptyState";
import GiveCheckDataRowsSkeleton from "./skeletons/GiveCheckDataRowsSkeleton";
interface GiveLatestCheckSectionProps {
statusName?: ExtendedPEPStatusType;
buttons?: ActionButtonsProps[];
latestCheckInfo?: LastCheckArrayProps[];
merchantId?: number;
legalEntityId?: number;
currentCheckId?: number;
composed?: string;
isEditAllowed?: boolean;
isCheckAllowed?: boolean;
activeTab?: any;
tabCategory?: string;
onUpdateSuccess?: (data: any) => void;
isEnterprisePanel?: boolean;
isLoading?: boolean;
isCheckingNow?: boolean;
isEmpty?: boolean;
isPEP?: boolean;
selectedOwner?: any;
}
const GiveLatestCheckSection = ({
statusName,
buttons = [],
latestCheckInfo = [],
merchantId = 0,
legalEntityId = 0,
currentCheckId = 0,
composed = "",
isEditAllowed = false,
isCheckAllowed = true,
activeTab,
tabCategory = "",
onUpdateSuccess,
isEnterprisePanel = false,
isLoading = false,
isCheckingNow = false,
isEmpty = false,
isPEP = false,
selectedOwner,
}: GiveLatestCheckSectionProps) => {
const { isMobileView } = useCustomThemeV2();
const handleViewDetails = useCallback(() => {
NiceModal.show(GIVE_OFAC_DETAILS_MODAL, {
merchantId,
legalEntityId,
currentCheckId,
composed,
isEditAllowed,
activeTab,
tabCategory,
onUpdateSuccess,
isEnterprisePanel,
isPEP,
selectedOwner,
hideBackdrop: true,
initialStatus: statusName,
});
}, [
merchantId,
legalEntityId,
currentCheckId,
composed,
isEditAllowed,
activeTab,
tabCategory,
onUpdateSuccess,
isEnterprisePanel,
isPEP,
selectedOwner,
]);
const updatedButtons = buttons?.map((btn) => {
const isCheckNow = btn.label === "Check Now";
const isViewDetails = btn.label === "View Details";
return {
...btn,
...(isViewDetails && { onClick: handleViewDetails }),
disabled: isCheckingNow || (isCheckNow && !isCheckAllowed),
isLoading: isCheckingNow && isCheckNow,
tooltip:
!isCheckingNow && isCheckNow && !isCheckAllowed
? "You don't have permission to perform this action"
: undefined,
};
});
if (isLoading) {
return <GiveLatestCheckSectionSkeleton />;
}
Iif (isEmpty) {
return (
<TaskCard
title="Latest Check"
sx={{
p: 0,
display: "flex",
flexDirection: "column",
flex: 1,
minHeight: 0,
}}
>
<GiveOFACEmptyState showBorder={false} minHeight={200} />
</TaskCard>
);
}
return (
<TaskCard title="Latest Check">
<AccordionDetailsHeader
useFallbackText
isTextBelowIcon={isMobileView}
lastCheckStatusName={statusName}
buttons={updatedButtons}
/>
{isCheckingNow ? (
<GiveCheckDataRowsSkeleton />
) : (
<LastCheckArray lastNextCheckArray={latestCheckInfo} />
)}
</TaskCard>
);
};
export default GiveLatestCheckSection;
|