import { faCreditCard, faXmark } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { EmptyState, IconButton, Table, TableContainer, TableSkeleton, TBody, Td, Th, THead, Tr } from "@app/components/v2"; import { useOrganization } from "@app/context"; import { useDeleteOrgPmtMethod, useGetOrgPmtMethods } from "@app/hooks/api"; export const PmtMethodsTable = () => { const { currentOrg } = useOrganization(); const { data, isLoading } = useGetOrgPmtMethods(currentOrg?._id ?? ""); const deleteOrgPmtMethod = useDeleteOrgPmtMethod(); const handleDeletePmtMethodBtnClick = async (pmtMethodId: string) => { if (!currentOrg?._id) return; await deleteOrgPmtMethod.mutateAsync({ organizationId: currentOrg._id, pmtMethodId }); } return ( {!isLoading && data && data?.length > 0 && data.map(({ _id, brand, exp_month, exp_year, funding, last4 }) => ( ))} {isLoading && } {!isLoading && data && data?.length === 0 && ( )}
Brand Type Last 4 Digits Expiration
{brand.charAt(0).toUpperCase() + brand.slice(1)} {funding.charAt(0).toUpperCase() + funding.slice(1)} {last4} {`${exp_month}/${exp_year}`} { await handleDeletePmtMethodBtnClick(_id); }} size="lg" colorSchema="danger" variant="plain" ariaLabel="update" >
); }