All files / src/components/AcquirerMerchants/ViewTransaction ExpandedRow.tsx

0% Statements 0/7
0% Branches 0/2
0% Functions 0/2
0% Lines 0/7

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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
import * as React from "react";
import { palette } from "@palette";
import { TransactionData } from "./data";
// mui
import Box from "@mui/material/Box";
import Grid from "@mui/material/Grid";
import Stack from "@mui/material/Stack";
import { useTheme } from "@mui/material/styles";
// components
import { Text } from "@common/Text";
import { KeyVal } from "@common/KeyVal";
import SubExpandedRow from "./SubExpandedRow";
// assets
import { CreditCardIcon, ServerIcon } from "@assets/icons";
import { Divider } from "@mui/material";
 
type ExpandedRowProps = {
  rowData: TransactionData;
};
 
 
const backgroundGradient = {
  position: "absolute",
  background:
    "linear-gradient(104.33deg, rgba(129, 68, 154, 0) 25.61%, #81449A 54.5%, #E6B96F 82.41%)",
  borderRadius: "12px",
  top: "30px",
  height: "calc( 100% - 37px )",
  width: "calc(100% + -47px)",
};
 
const mainContent = {
  gap: "16px",
  display: "flex",
  padding: "16px 24px",
  flexDirection: "column",
  backgroundColor: "rgba(246, 250, 255, 0.8)",
  position: "relative",
  background: "rgba(246, 250, 255, 0.9)",
  border: "2px solid rgba(255, 255, 255, 0.5)",
  boxShadow: "0px 4px 16px rgba(0, 0, 0, 0.05)",
  backdropFilter: "blur(9px)",
  borderRadius: "0px 0px 8px 8px"
};
 
 
export const ExpandedRow: React.FC<ExpandedRowProps> = ({ rowData }) => {
  const theme = useTheme();
  const style = {
    "& sup": {
      fontSize: 9,
      lineHeight: "9px",
      marginLeft: "2px",
    },
  };
  return (
    <Box 
      p={theme.spacing(3, 1.5, 2)}
      position="relative"
    >
      <Box sx={backgroundGradient} />
      <Box sx={mainContent}>
      <Box display="flex" gap={3} sx={style}>
        <Box gap={1.5} display="flex" flexDirection="column">
          <Stack gap={0.5} direction="row" alignItems="center">
            <ServerIcon fill="transparent" />
            <Text
              color={palette.primary.main}
              variant="headline"
              fontWeight="medium"
            >
              Payment Details
            </Text>
          </Stack>
          {/** ============== GRID [xs={6} 2 items per row (12 column grid) | column & row spacing {2} ] ============= */}
          <Grid container spacing={2}>
          {/* Organization details  */}
          {/** ================= Organization ================= */}
          <Grid item xs={6}>
              <KeyVal
                textVariant
                keyName="Organization"
                value={rowData.OrganizationName}
              />
            </Grid>
            {/** ================= OrganizationID ================= */}
            <Grid item xs={6}>
              <KeyVal textVariant keyName="OrganizationID" value={rowData.OrganizationID} />
            </Grid>
            {/* dashed divider  */}
            <Grid item xs={12}>
              <Divider  sx={{borderStyle:'dashed'}} />
            </Grid>
            {/** ================= NAME ON CARD ================= */}
            <Grid item xs={6}>
              <KeyVal
                textVariant={true}
                keyName="Name on Card"
                value={rowData.paymentDetails.nameOnCard}
              />
            </Grid>
            {/** ================= EMAIL ================= */}
            <Grid item xs={6}>
              <KeyVal textVariant keyName="Email" value={rowData.email} />
            </Grid>
            {/** ================= MERCH ORDER ================= */}
            <Grid item xs={6}>
              <KeyVal
                textVariant
                keyName="Transaction ID"
                value={rowData.paymentDetails.merchantTaxId}
              />
            </Grid>
           
           
            {/** ================= STATUS ================= */}
            <Grid item xs={6}>
              <KeyVal
                keyName="Status"
                value={
                  <Stack gap={4} direction="row" alignItems="center">
                    <Text>
                      {rowData.status.charAt(0).toUpperCase() + rowData.status.slice(1)}
                    </Text>
                    <Text>xxxx xxxx xxxx 1111</Text>
                    <Text color={palette.primary.main}>Visa</Text>
                  </Stack>
                }
              />
            </Grid>
            {/** ================= REVENUE SOURCE ================= */}
            <Grid item xs={6}>
              <KeyVal
                textVariant={true}
                keyName="Revenue Source"
                value={
                  <Stack
                    direction="row"
                    alignItems="center"
                    justifyContent="space-between"
                  >
                    <Text>{rowData.source}</Text>
                    <Text color={palette.primary.main}>
                      {rowData.paymentDetails.revenueSource}
                    </Text>
                  </Stack>
                }
              />
            </Grid>
            {/** ================= GRID [ xs={3} 4 items per row, Grid item and also container ] ================= */}
            <Grid item xs={6} container columnSpacing={1}>
              {/** ================= TOTAL ================= */}
              <Grid item xs={3}>
                <KeyVal
                  textVariant
                  keyName="Total"
                  value={
                    <Text>
                      {rowData.paymentDetails.donation} <sup>USD</sup>
                    </Text>
                  }
                />
              </Grid>
              {/** ================= GIVEBOX FEE ================= */}
              <Grid item xs={3}>
                <KeyVal
                  textVariant
                  keyName="Givebox Fee"
                  value={
                    <Text>
                      {rowData.paymentDetails.giveboxFee} <sup>USD</sup>
                    </Text>
                  }
                />
              </Grid>
              {/** =================  VISA FEE ================= */}
              <Grid item xs={3}>
                <KeyVal
                  textVariant
                  keyName="Visa Fee"
                  value={
                    <Text>
                      *{rowData.paymentDetails.visaFee} <sup>USD</sup>
                    </Text>
                  }
                />
              </Grid>
              {/** ================= CHARGED ================= */}
              <Grid item xs={3}>
                <KeyVal
                  textVariant
                  keyName="Charged"
                  value={
                    <Text>
                      {rowData.paymentDetails.charged} <sup>USD</sup>
                    </Text>
                  }
                />
              </Grid>
              <Grid item xs={12}>
                <Text
                  color={palette.neutral[600]}
                  fontWeight="regular"
                  variant="caption"
                  sx={{ marginTop: "4px" }}
                >*Visa fee deducted from Donation</Text>
              </Grid>
            </Grid>
          </Grid>
          {/** ------------------------ TRANSACTION STATISTICS ------------------------ */}
          <Stack gap={0.5} direction="row">
            <CreditCardIcon fill="transparent" />
            <Text
              color={palette.primary.main}
              variant="headline"
              fontWeight="medium"
            >
              Purchases
            </Text>
          </Stack>
        </Box>
      </Box>
      {/** ------------------------ RECURRING PURCHASES ------------------------ */}
      {rowData.recurringPurchases && (
        <Box>
          {rowData.recurringPurchases.map((data) => (
            <SubExpandedRow data={data} key={data.id} />
          ))}
        </Box>
      )}
      </Box>
    </Box>
  );
};