@ammarkhalidfarooq/dashboard-package 0.6.63 → 0.6.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +293 -362
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +293 -362
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1329,6 +1329,287 @@ var MetricCard$1 = function MetricCard(_ref) {
|
|
|
1329
1329
|
});
|
|
1330
1330
|
};
|
|
1331
1331
|
|
|
1332
|
+
var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
1333
|
+
var sx = _ref.sx,
|
|
1334
|
+
donationTypeData = _ref.donationTypeData,
|
|
1335
|
+
_ref$exportMode = _ref.exportMode,
|
|
1336
|
+
exportMode = _ref$exportMode === void 0 ? false : _ref$exportMode,
|
|
1337
|
+
_ref$subtitle = _ref.subtitle,
|
|
1338
|
+
subtitle = _ref$subtitle === void 0 ? "Donation type" : _ref$subtitle,
|
|
1339
|
+
chartHeight = _ref.chartHeight;
|
|
1340
|
+
var recurringColor = "rgb(99, 99, 230)";
|
|
1341
|
+
var oneTimeColor = "#10B981";
|
|
1342
|
+
var colors = [recurringColor, oneTimeColor, "#06B6D4", "#F59E0B", "#EF4444"];
|
|
1343
|
+
var categories = [];
|
|
1344
|
+
var series = [];
|
|
1345
|
+
var summaries = [];
|
|
1346
|
+
var title = "Donation Type";
|
|
1347
|
+
var isDistributed = false;
|
|
1348
|
+
if (donationTypeData && donationTypeData.data && Array.isArray(donationTypeData.data)) {
|
|
1349
|
+
// Time series recurring vs one-time format
|
|
1350
|
+
categories = donationTypeData.data.map(function (item) {
|
|
1351
|
+
return item.label || "";
|
|
1352
|
+
});
|
|
1353
|
+
series = [{
|
|
1354
|
+
name: "Recurring",
|
|
1355
|
+
data: donationTypeData.data.map(function (item) {
|
|
1356
|
+
return item.recurring || 0;
|
|
1357
|
+
})
|
|
1358
|
+
}, {
|
|
1359
|
+
name: "One-time",
|
|
1360
|
+
data: donationTypeData.data.map(function (item) {
|
|
1361
|
+
return item.oneTime || 0;
|
|
1362
|
+
})
|
|
1363
|
+
}];
|
|
1364
|
+
summaries = [{
|
|
1365
|
+
label: "Recurring",
|
|
1366
|
+
total: donationTypeData.totalRecurringDonations || 0,
|
|
1367
|
+
color: recurringColor
|
|
1368
|
+
}, {
|
|
1369
|
+
label: "One-time",
|
|
1370
|
+
total: donationTypeData.totalOneTimeDonations || 0,
|
|
1371
|
+
color: oneTimeColor
|
|
1372
|
+
}];
|
|
1373
|
+
title = "Recurring vs One-time";
|
|
1374
|
+
isDistributed = false;
|
|
1375
|
+
} else if (Array.isArray(donationTypeData) && donationTypeData.length > 0 && donationTypeData[0].totalAmount !== undefined) {
|
|
1376
|
+
// New array format
|
|
1377
|
+
categories = donationTypeData.map(function (item) {
|
|
1378
|
+
return item.type || "";
|
|
1379
|
+
});
|
|
1380
|
+
series = [{
|
|
1381
|
+
name: "Amount",
|
|
1382
|
+
data: donationTypeData.map(function (item) {
|
|
1383
|
+
return item.totalAmount || 0;
|
|
1384
|
+
})
|
|
1385
|
+
}];
|
|
1386
|
+
summaries = donationTypeData.map(function (item, index) {
|
|
1387
|
+
return {
|
|
1388
|
+
label: item.type || "",
|
|
1389
|
+
total: item.totalAmount || 0,
|
|
1390
|
+
color: colors[index % colors.length]
|
|
1391
|
+
};
|
|
1392
|
+
});
|
|
1393
|
+
isDistributed = true;
|
|
1394
|
+
if (donationTypeData.length === 2) {
|
|
1395
|
+
title = "".concat(donationTypeData[0].type, " vs ").concat(donationTypeData[1].type);
|
|
1396
|
+
}
|
|
1397
|
+
} else {
|
|
1398
|
+
var _dataObj$summary, _dataObj$summary2, _dataObj$summary3, _dataObj$summary4;
|
|
1399
|
+
// Object format, empty array, or missing data
|
|
1400
|
+
var dataObj = donationTypeData && _typeof(donationTypeData) === "object" && !Array.isArray(donationTypeData) ? donationTypeData : {};
|
|
1401
|
+
categories = dataObj.categories || [];
|
|
1402
|
+
var rawSeries = dataObj.series || [];
|
|
1403
|
+
if (rawSeries.length && categories.length) {
|
|
1404
|
+
series = rawSeries;
|
|
1405
|
+
} else {
|
|
1406
|
+
series = [{
|
|
1407
|
+
name: "Recurring",
|
|
1408
|
+
data: []
|
|
1409
|
+
}, {
|
|
1410
|
+
name: "One-time",
|
|
1411
|
+
data: []
|
|
1412
|
+
}];
|
|
1413
|
+
}
|
|
1414
|
+
summaries = [{
|
|
1415
|
+
label: (dataObj === null || dataObj === void 0 || (_dataObj$summary = dataObj.summary) === null || _dataObj$summary === void 0 || (_dataObj$summary = _dataObj$summary.recurring) === null || _dataObj$summary === void 0 ? void 0 : _dataObj$summary.label) || "Recurring",
|
|
1416
|
+
total: (dataObj === null || dataObj === void 0 || (_dataObj$summary2 = dataObj.summary) === null || _dataObj$summary2 === void 0 || (_dataObj$summary2 = _dataObj$summary2.recurring) === null || _dataObj$summary2 === void 0 ? void 0 : _dataObj$summary2.total) || 0,
|
|
1417
|
+
color: recurringColor
|
|
1418
|
+
}, {
|
|
1419
|
+
label: (dataObj === null || dataObj === void 0 || (_dataObj$summary3 = dataObj.summary) === null || _dataObj$summary3 === void 0 || (_dataObj$summary3 = _dataObj$summary3.oneTime) === null || _dataObj$summary3 === void 0 ? void 0 : _dataObj$summary3.label) || "One-time",
|
|
1420
|
+
total: (dataObj === null || dataObj === void 0 || (_dataObj$summary4 = dataObj.summary) === null || _dataObj$summary4 === void 0 || (_dataObj$summary4 = _dataObj$summary4.oneTime) === null || _dataObj$summary4 === void 0 ? void 0 : _dataObj$summary4.total) || 0,
|
|
1421
|
+
color: oneTimeColor
|
|
1422
|
+
}];
|
|
1423
|
+
title = "Recurring vs one-time";
|
|
1424
|
+
isDistributed = false;
|
|
1425
|
+
}
|
|
1426
|
+
var resolvedChartHeight = chartHeight !== null && chartHeight !== void 0 ? chartHeight : exportMode ? 110 : 170;
|
|
1427
|
+
var chartOptions = {
|
|
1428
|
+
chart: {
|
|
1429
|
+
type: "bar",
|
|
1430
|
+
toolbar: {
|
|
1431
|
+
show: false
|
|
1432
|
+
},
|
|
1433
|
+
zoom: {
|
|
1434
|
+
enabled: false
|
|
1435
|
+
},
|
|
1436
|
+
fontFamily: "Inter, sans-serif"
|
|
1437
|
+
},
|
|
1438
|
+
plotOptions: {
|
|
1439
|
+
bar: {
|
|
1440
|
+
horizontal: false,
|
|
1441
|
+
columnWidth: exportMode ? "68%" : "75%",
|
|
1442
|
+
borderRadius: exportMode ? 3 : 4,
|
|
1443
|
+
distributed: isDistributed,
|
|
1444
|
+
dataLabels: {
|
|
1445
|
+
position: "top"
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
dataLabels: {
|
|
1450
|
+
enabled: true,
|
|
1451
|
+
formatter: function formatter(val) {
|
|
1452
|
+
return "$".concat(formatNumber(val));
|
|
1453
|
+
},
|
|
1454
|
+
offsetY: exportMode ? -16 : -20,
|
|
1455
|
+
style: {
|
|
1456
|
+
fontSize: exportMode ? "7px" : "9px",
|
|
1457
|
+
fontWeight: 600,
|
|
1458
|
+
colors: ["#000"]
|
|
1459
|
+
}
|
|
1460
|
+
},
|
|
1461
|
+
stroke: {
|
|
1462
|
+
show: true,
|
|
1463
|
+
width: 2,
|
|
1464
|
+
colors: ["transparent"]
|
|
1465
|
+
},
|
|
1466
|
+
xaxis: {
|
|
1467
|
+
categories: categories,
|
|
1468
|
+
axisBorder: {
|
|
1469
|
+
show: false
|
|
1470
|
+
},
|
|
1471
|
+
axisTicks: {
|
|
1472
|
+
show: false
|
|
1473
|
+
},
|
|
1474
|
+
labels: {
|
|
1475
|
+
style: {
|
|
1476
|
+
colors: "rgba(0, 0, 0, 0.4)",
|
|
1477
|
+
fontSize: exportMode ? "8px" : "11px"
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
},
|
|
1481
|
+
yaxis: {
|
|
1482
|
+
min: 0,
|
|
1483
|
+
tickAmount: exportMode ? 3 : 4,
|
|
1484
|
+
labels: {
|
|
1485
|
+
formatter: function formatter(val) {
|
|
1486
|
+
return "$".concat(formatNumber(val));
|
|
1487
|
+
},
|
|
1488
|
+
style: {
|
|
1489
|
+
colors: "rgba(0, 0, 0, 0.4)",
|
|
1490
|
+
fontSize: exportMode ? "8px" : "10px"
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
},
|
|
1494
|
+
fill: {
|
|
1495
|
+
opacity: 1
|
|
1496
|
+
},
|
|
1497
|
+
colors: colors,
|
|
1498
|
+
grid: {
|
|
1499
|
+
borderColor: "#f1f1f1",
|
|
1500
|
+
strokeDashArray: 4,
|
|
1501
|
+
padding: {
|
|
1502
|
+
left: 0,
|
|
1503
|
+
right: 0
|
|
1504
|
+
},
|
|
1505
|
+
yaxis: {
|
|
1506
|
+
lines: {
|
|
1507
|
+
show: true
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
},
|
|
1511
|
+
legend: {
|
|
1512
|
+
show: false
|
|
1513
|
+
},
|
|
1514
|
+
tooltip: {
|
|
1515
|
+
y: {
|
|
1516
|
+
formatter: function formatter(val) {
|
|
1517
|
+
return "$".concat(formatNumber(val));
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
};
|
|
1522
|
+
return /*#__PURE__*/jsxRuntime.jsxs(material.Card, {
|
|
1523
|
+
sx: _objectSpread2({
|
|
1524
|
+
bgcolor: "#fff",
|
|
1525
|
+
borderRadius: exportMode ? 2 : 4,
|
|
1526
|
+
border: exportMode ? "1px solid #DDE3EA" : "1px solid #f0f0f0",
|
|
1527
|
+
boxShadow: exportMode ? "0 1px 0 rgba(15,23,42,0.03)" : "0 4px 24px rgba(0,0,0,0.06)",
|
|
1528
|
+
p: exportMode ? 1.5 : 3,
|
|
1529
|
+
height: exportMode ? "100%" : "auto",
|
|
1530
|
+
boxSizing: "border-box"
|
|
1531
|
+
}, sx),
|
|
1532
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
1533
|
+
sx: {
|
|
1534
|
+
display: "flex",
|
|
1535
|
+
flexDirection: "column"
|
|
1536
|
+
},
|
|
1537
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
1538
|
+
sx: {
|
|
1539
|
+
textAlign: "left"
|
|
1540
|
+
},
|
|
1541
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1542
|
+
sx: {
|
|
1543
|
+
fontWeight: 700,
|
|
1544
|
+
fontSize: exportMode ? "12px" : "18px",
|
|
1545
|
+
color: "#000",
|
|
1546
|
+
lineHeight: 1.15
|
|
1547
|
+
},
|
|
1548
|
+
children: title
|
|
1549
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1550
|
+
sx: {
|
|
1551
|
+
fontSize: exportMode ? "9.5px" : "13px",
|
|
1552
|
+
color: exportMode ? "#94A3B8" : "rgba(0, 0, 0, 0.4)",
|
|
1553
|
+
lineHeight: 1.15
|
|
1554
|
+
},
|
|
1555
|
+
children: subtitle
|
|
1556
|
+
})]
|
|
1557
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
1558
|
+
sx: {
|
|
1559
|
+
display: "flex",
|
|
1560
|
+
gap: exportMode ? 1 : 1.5,
|
|
1561
|
+
mt: exportMode ? 0.75 : 0.5,
|
|
1562
|
+
flexWrap: "wrap"
|
|
1563
|
+
},
|
|
1564
|
+
children: summaries.map(function (item, index) {
|
|
1565
|
+
return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
1566
|
+
sx: {
|
|
1567
|
+
display: "flex",
|
|
1568
|
+
alignItems: "center",
|
|
1569
|
+
gap: 0.5
|
|
1570
|
+
},
|
|
1571
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
1572
|
+
sx: {
|
|
1573
|
+
width: exportMode ? 6 : 8,
|
|
1574
|
+
height: exportMode ? 6 : 8,
|
|
1575
|
+
bgcolor: item.color,
|
|
1576
|
+
borderRadius: "50%"
|
|
1577
|
+
}
|
|
1578
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1579
|
+
sx: {
|
|
1580
|
+
fontSize: exportMode ? "9.5px" : "13px",
|
|
1581
|
+
color: exportMode ? "#374151" : "rgba(0, 0, 0, 0.5)",
|
|
1582
|
+
fontWeight: 500
|
|
1583
|
+
},
|
|
1584
|
+
children: item.label
|
|
1585
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
|
|
1586
|
+
sx: {
|
|
1587
|
+
fontSize: exportMode ? "9.5px" : "13px",
|
|
1588
|
+
fontWeight: exportMode ? 700 : 600,
|
|
1589
|
+
color: "#000"
|
|
1590
|
+
},
|
|
1591
|
+
children: ["$", formatNumber(item.total || 0)]
|
|
1592
|
+
})]
|
|
1593
|
+
}, item.label || index);
|
|
1594
|
+
})
|
|
1595
|
+
})]
|
|
1596
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
1597
|
+
sx: {
|
|
1598
|
+
height: resolvedChartHeight,
|
|
1599
|
+
width: exportMode ? "calc(100% + 24px)" : "calc(100% + 48px)",
|
|
1600
|
+
ml: exportMode ? -1.5 : -3,
|
|
1601
|
+
mr: exportMode ? -1.5 : -3
|
|
1602
|
+
},
|
|
1603
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ReactApexChart, {
|
|
1604
|
+
options: chartOptions,
|
|
1605
|
+
series: series,
|
|
1606
|
+
type: "bar",
|
|
1607
|
+
height: "100%"
|
|
1608
|
+
})
|
|
1609
|
+
})]
|
|
1610
|
+
});
|
|
1611
|
+
};
|
|
1612
|
+
|
|
1332
1613
|
var PURPLE = "#6363E6";
|
|
1333
1614
|
var REPORT_COLORS = {
|
|
1334
1615
|
purple: PURPLE};
|
|
@@ -2360,9 +2641,6 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2360
2641
|
retPct = donorMix.retPct,
|
|
2361
2642
|
mixAvgGift = donorMix.avgGift,
|
|
2362
2643
|
donorMixPrev = donorMix.donorMixPrev;
|
|
2363
|
-
var _report$donationTypeT = report.donationTypeTotals,
|
|
2364
|
-
recurringTotal = _report$donationTypeT.recurringTotal,
|
|
2365
|
-
oneTimeTotal = _report$donationTypeT.oneTimeTotal;
|
|
2366
2644
|
var geoList = report.donorGeographyList;
|
|
2367
2645
|
var trafficItems = function (_apiData$trafficSourc) {
|
|
2368
2646
|
var items = Array.isArray(apiData === null || apiData === void 0 || (_apiData$trafficSourc = apiData.trafficSourceData) === null || _apiData$trafficSourc === void 0 ? void 0 : _apiData$trafficSourc.data) ? apiData.trafficSourceData.data : [];
|
|
@@ -2781,103 +3059,18 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref11, ref) {
|
|
|
2781
3059
|
})
|
|
2782
3060
|
})]
|
|
2783
3061
|
})]
|
|
2784
|
-
})
|
|
2785
|
-
})]
|
|
2786
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2787
|
-
style: {
|
|
2788
|
-
display: "grid",
|
|
2789
|
-
gridTemplateColumns: "repeat(4, 1fr)",
|
|
2790
|
-
gap: 8
|
|
2791
|
-
},
|
|
2792
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
2793
|
-
|
|
2794
|
-
subtitle: "Donation type \xB7 weekly",
|
|
2795
|
-
|
|
2796
|
-
var tot = recurringTotal + oneTimeTotal || 1;
|
|
2797
|
-
var rPct = recurringTotal / tot * 100;
|
|
2798
|
-
var oPct = oneTimeTotal / tot * 100;
|
|
2799
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2800
|
-
style: {
|
|
2801
|
-
display: "flex",
|
|
2802
|
-
flexDirection: "column",
|
|
2803
|
-
gap: 9,
|
|
2804
|
-
marginTop: 4
|
|
2805
|
-
},
|
|
2806
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2807
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2808
|
-
style: {
|
|
2809
|
-
display: "flex",
|
|
2810
|
-
justifyContent: "space-between",
|
|
2811
|
-
marginBottom: 3
|
|
2812
|
-
},
|
|
2813
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2814
|
-
style: {
|
|
2815
|
-
fontSize: 9.5,
|
|
2816
|
-
color: "#374151"
|
|
2817
|
-
},
|
|
2818
|
-
children: "Recurring"
|
|
2819
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2820
|
-
style: {
|
|
2821
|
-
fontSize: 9.5,
|
|
2822
|
-
fontWeight: 700,
|
|
2823
|
-
color: "#111827"
|
|
2824
|
-
},
|
|
2825
|
-
children: d$(recurringTotal)
|
|
2826
|
-
})]
|
|
2827
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2828
|
-
style: {
|
|
2829
|
-
height: 9,
|
|
2830
|
-
background: "#EEF2FF",
|
|
2831
|
-
borderRadius: 3
|
|
2832
|
-
},
|
|
2833
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2834
|
-
style: {
|
|
2835
|
-
width: "".concat(rPct, "%"),
|
|
2836
|
-
height: "100%",
|
|
2837
|
-
background: C.indigo,
|
|
2838
|
-
borderRadius: 3
|
|
2839
|
-
}
|
|
2840
|
-
})
|
|
2841
|
-
})]
|
|
2842
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2843
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2844
|
-
style: {
|
|
2845
|
-
display: "flex",
|
|
2846
|
-
justifyContent: "space-between",
|
|
2847
|
-
marginBottom: 3
|
|
2848
|
-
},
|
|
2849
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2850
|
-
style: {
|
|
2851
|
-
fontSize: 9.5,
|
|
2852
|
-
color: "#374151"
|
|
2853
|
-
},
|
|
2854
|
-
children: "One-time"
|
|
2855
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2856
|
-
style: {
|
|
2857
|
-
fontSize: 9.5,
|
|
2858
|
-
fontWeight: 700,
|
|
2859
|
-
color: "#111827"
|
|
2860
|
-
},
|
|
2861
|
-
children: d$(oneTimeTotal)
|
|
2862
|
-
})]
|
|
2863
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2864
|
-
style: {
|
|
2865
|
-
height: 9,
|
|
2866
|
-
background: "#EEF2FF",
|
|
2867
|
-
borderRadius: 3
|
|
2868
|
-
},
|
|
2869
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2870
|
-
style: {
|
|
2871
|
-
width: "".concat(oPct, "%"),
|
|
2872
|
-
height: "100%",
|
|
2873
|
-
background: "#C7D2FE",
|
|
2874
|
-
borderRadius: 3
|
|
2875
|
-
}
|
|
2876
|
-
})
|
|
2877
|
-
})]
|
|
2878
|
-
})]
|
|
2879
|
-
});
|
|
2880
|
-
}()
|
|
3062
|
+
})
|
|
3063
|
+
})]
|
|
3064
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3065
|
+
style: {
|
|
3066
|
+
display: "grid",
|
|
3067
|
+
gridTemplateColumns: "repeat(4, 1fr)",
|
|
3068
|
+
gap: 8
|
|
3069
|
+
},
|
|
3070
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
|
|
3071
|
+
exportMode: true,
|
|
3072
|
+
subtitle: "Donation type \xB7 weekly",
|
|
3073
|
+
donationTypeData: report.donationTypeData
|
|
2881
3074
|
}), /*#__PURE__*/jsxRuntime.jsx(Panel, {
|
|
2882
3075
|
title: "Donor geography",
|
|
2883
3076
|
subtitle: "Top countries \xB7 ".concat(formatNumber(totalDonors), " total"),
|
|
@@ -4782,268 +4975,6 @@ var MetricDonutCard = function MetricDonutCard(_ref2) {
|
|
|
4782
4975
|
});
|
|
4783
4976
|
};
|
|
4784
4977
|
|
|
4785
|
-
var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
|
|
4786
|
-
var sx = _ref.sx,
|
|
4787
|
-
donationTypeData = _ref.donationTypeData;
|
|
4788
|
-
var recurringColor = "rgb(99, 99, 230)";
|
|
4789
|
-
var oneTimeColor = "#10B981";
|
|
4790
|
-
var colors = [recurringColor, oneTimeColor, "#06B6D4", "#F59E0B", "#EF4444"];
|
|
4791
|
-
var categories = [];
|
|
4792
|
-
var series = [];
|
|
4793
|
-
var summaries = [];
|
|
4794
|
-
var title = "Donation Type";
|
|
4795
|
-
var isDistributed = false;
|
|
4796
|
-
if (donationTypeData && donationTypeData.data && Array.isArray(donationTypeData.data)) {
|
|
4797
|
-
// Time series recurring vs one-time format
|
|
4798
|
-
categories = donationTypeData.data.map(function (item) {
|
|
4799
|
-
return item.label || "";
|
|
4800
|
-
});
|
|
4801
|
-
series = [{
|
|
4802
|
-
name: "Recurring",
|
|
4803
|
-
data: donationTypeData.data.map(function (item) {
|
|
4804
|
-
return item.recurring || 0;
|
|
4805
|
-
})
|
|
4806
|
-
}, {
|
|
4807
|
-
name: "One-time",
|
|
4808
|
-
data: donationTypeData.data.map(function (item) {
|
|
4809
|
-
return item.oneTime || 0;
|
|
4810
|
-
})
|
|
4811
|
-
}];
|
|
4812
|
-
summaries = [{
|
|
4813
|
-
label: "Recurring",
|
|
4814
|
-
total: donationTypeData.totalRecurringDonations || 0,
|
|
4815
|
-
color: recurringColor
|
|
4816
|
-
}, {
|
|
4817
|
-
label: "One-time",
|
|
4818
|
-
total: donationTypeData.totalOneTimeDonations || 0,
|
|
4819
|
-
color: oneTimeColor
|
|
4820
|
-
}];
|
|
4821
|
-
title = "Recurring vs One-time";
|
|
4822
|
-
isDistributed = false;
|
|
4823
|
-
} else if (Array.isArray(donationTypeData) && donationTypeData.length > 0 && donationTypeData[0].totalAmount !== undefined) {
|
|
4824
|
-
// New array format
|
|
4825
|
-
categories = donationTypeData.map(function (item) {
|
|
4826
|
-
return item.type || "";
|
|
4827
|
-
});
|
|
4828
|
-
series = [{
|
|
4829
|
-
name: "Amount",
|
|
4830
|
-
data: donationTypeData.map(function (item) {
|
|
4831
|
-
return item.totalAmount || 0;
|
|
4832
|
-
})
|
|
4833
|
-
}];
|
|
4834
|
-
summaries = donationTypeData.map(function (item, index) {
|
|
4835
|
-
return {
|
|
4836
|
-
label: item.type || "",
|
|
4837
|
-
total: item.totalAmount || 0,
|
|
4838
|
-
color: colors[index % colors.length]
|
|
4839
|
-
};
|
|
4840
|
-
});
|
|
4841
|
-
isDistributed = true;
|
|
4842
|
-
if (donationTypeData.length === 2) {
|
|
4843
|
-
title = "".concat(donationTypeData[0].type, " vs ").concat(donationTypeData[1].type);
|
|
4844
|
-
}
|
|
4845
|
-
} else {
|
|
4846
|
-
var _dataObj$summary, _dataObj$summary2, _dataObj$summary3, _dataObj$summary4;
|
|
4847
|
-
// Object format or simple series array
|
|
4848
|
-
var dataObj = donationTypeData || {};
|
|
4849
|
-
categories = dataObj.categories || [];
|
|
4850
|
-
series = Array.isArray(donationTypeData) ? donationTypeData : dataObj.series || [];
|
|
4851
|
-
summaries = [{
|
|
4852
|
-
label: (dataObj === null || dataObj === void 0 || (_dataObj$summary = dataObj.summary) === null || _dataObj$summary === void 0 || (_dataObj$summary = _dataObj$summary.recurring) === null || _dataObj$summary === void 0 ? void 0 : _dataObj$summary.label) || "Recurring",
|
|
4853
|
-
total: (dataObj === null || dataObj === void 0 || (_dataObj$summary2 = dataObj.summary) === null || _dataObj$summary2 === void 0 || (_dataObj$summary2 = _dataObj$summary2.recurring) === null || _dataObj$summary2 === void 0 ? void 0 : _dataObj$summary2.total) || 0,
|
|
4854
|
-
color: recurringColor
|
|
4855
|
-
}, {
|
|
4856
|
-
label: (dataObj === null || dataObj === void 0 || (_dataObj$summary3 = dataObj.summary) === null || _dataObj$summary3 === void 0 || (_dataObj$summary3 = _dataObj$summary3.oneTime) === null || _dataObj$summary3 === void 0 ? void 0 : _dataObj$summary3.label) || "One-time",
|
|
4857
|
-
total: (dataObj === null || dataObj === void 0 || (_dataObj$summary4 = dataObj.summary) === null || _dataObj$summary4 === void 0 || (_dataObj$summary4 = _dataObj$summary4.oneTime) === null || _dataObj$summary4 === void 0 ? void 0 : _dataObj$summary4.total) || 0,
|
|
4858
|
-
color: oneTimeColor
|
|
4859
|
-
}];
|
|
4860
|
-
title = "Recurring vs one-time";
|
|
4861
|
-
isDistributed = false;
|
|
4862
|
-
}
|
|
4863
|
-
var chartOptions = {
|
|
4864
|
-
chart: {
|
|
4865
|
-
type: "bar",
|
|
4866
|
-
toolbar: {
|
|
4867
|
-
show: false
|
|
4868
|
-
},
|
|
4869
|
-
zoom: {
|
|
4870
|
-
enabled: false
|
|
4871
|
-
},
|
|
4872
|
-
fontFamily: "Inter, sans-serif"
|
|
4873
|
-
},
|
|
4874
|
-
plotOptions: {
|
|
4875
|
-
bar: {
|
|
4876
|
-
horizontal: false,
|
|
4877
|
-
columnWidth: "75%",
|
|
4878
|
-
borderRadius: 4,
|
|
4879
|
-
distributed: isDistributed,
|
|
4880
|
-
dataLabels: {
|
|
4881
|
-
position: "top"
|
|
4882
|
-
}
|
|
4883
|
-
}
|
|
4884
|
-
},
|
|
4885
|
-
dataLabels: {
|
|
4886
|
-
enabled: true,
|
|
4887
|
-
formatter: function formatter(val) {
|
|
4888
|
-
return "$".concat(formatNumber(val));
|
|
4889
|
-
},
|
|
4890
|
-
offsetY: -20,
|
|
4891
|
-
style: {
|
|
4892
|
-
fontSize: "9px",
|
|
4893
|
-
fontWeight: 600,
|
|
4894
|
-
colors: ["#000"]
|
|
4895
|
-
}
|
|
4896
|
-
},
|
|
4897
|
-
stroke: {
|
|
4898
|
-
show: true,
|
|
4899
|
-
width: 2,
|
|
4900
|
-
colors: ["transparent"]
|
|
4901
|
-
},
|
|
4902
|
-
xaxis: {
|
|
4903
|
-
categories: categories,
|
|
4904
|
-
axisBorder: {
|
|
4905
|
-
show: false
|
|
4906
|
-
},
|
|
4907
|
-
axisTicks: {
|
|
4908
|
-
show: false
|
|
4909
|
-
},
|
|
4910
|
-
labels: {
|
|
4911
|
-
style: {
|
|
4912
|
-
colors: "rgba(0, 0, 0, 0.4)",
|
|
4913
|
-
fontSize: "11px"
|
|
4914
|
-
}
|
|
4915
|
-
}
|
|
4916
|
-
},
|
|
4917
|
-
yaxis: {
|
|
4918
|
-
min: 0,
|
|
4919
|
-
tickAmount: 4,
|
|
4920
|
-
labels: {
|
|
4921
|
-
formatter: function formatter(val) {
|
|
4922
|
-
return "$".concat(formatNumber(val));
|
|
4923
|
-
},
|
|
4924
|
-
style: {
|
|
4925
|
-
colors: "rgba(0, 0, 0, 0.4)",
|
|
4926
|
-
fontSize: "10px"
|
|
4927
|
-
}
|
|
4928
|
-
}
|
|
4929
|
-
},
|
|
4930
|
-
fill: {
|
|
4931
|
-
opacity: 1
|
|
4932
|
-
},
|
|
4933
|
-
colors: colors,
|
|
4934
|
-
grid: {
|
|
4935
|
-
borderColor: "#f1f1f1",
|
|
4936
|
-
strokeDashArray: 4,
|
|
4937
|
-
padding: {
|
|
4938
|
-
left: 0,
|
|
4939
|
-
right: 0
|
|
4940
|
-
},
|
|
4941
|
-
yaxis: {
|
|
4942
|
-
lines: {
|
|
4943
|
-
show: true
|
|
4944
|
-
}
|
|
4945
|
-
}
|
|
4946
|
-
},
|
|
4947
|
-
legend: {
|
|
4948
|
-
show: false
|
|
4949
|
-
},
|
|
4950
|
-
tooltip: {
|
|
4951
|
-
y: {
|
|
4952
|
-
formatter: function formatter(val) {
|
|
4953
|
-
return "$".concat(formatNumber(val));
|
|
4954
|
-
}
|
|
4955
|
-
}
|
|
4956
|
-
}
|
|
4957
|
-
};
|
|
4958
|
-
return /*#__PURE__*/jsxRuntime.jsxs(material.Card, {
|
|
4959
|
-
sx: _objectSpread2({
|
|
4960
|
-
bgcolor: "#fff",
|
|
4961
|
-
borderRadius: 4,
|
|
4962
|
-
border: "1px solid #f0f0f0",
|
|
4963
|
-
boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
|
|
4964
|
-
p: 3
|
|
4965
|
-
}, sx),
|
|
4966
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
4967
|
-
sx: {
|
|
4968
|
-
display: "flex",
|
|
4969
|
-
flexDirection: "column"
|
|
4970
|
-
},
|
|
4971
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
4972
|
-
sx: {
|
|
4973
|
-
textAlign: "left"
|
|
4974
|
-
},
|
|
4975
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
4976
|
-
sx: {
|
|
4977
|
-
fontWeight: 700,
|
|
4978
|
-
fontSize: "18px",
|
|
4979
|
-
color: "#000",
|
|
4980
|
-
lineHeight: 1.15
|
|
4981
|
-
},
|
|
4982
|
-
children: title
|
|
4983
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
4984
|
-
sx: {
|
|
4985
|
-
fontSize: "13px",
|
|
4986
|
-
color: "rgba(0, 0, 0, 0.4)",
|
|
4987
|
-
lineHeight: 1.15
|
|
4988
|
-
},
|
|
4989
|
-
children: "Donation type"
|
|
4990
|
-
})]
|
|
4991
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
4992
|
-
sx: {
|
|
4993
|
-
display: "flex",
|
|
4994
|
-
gap: 1.5,
|
|
4995
|
-
mt: 0.5,
|
|
4996
|
-
flexWrap: "wrap"
|
|
4997
|
-
},
|
|
4998
|
-
children: summaries.map(function (item, index) {
|
|
4999
|
-
return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
5000
|
-
sx: {
|
|
5001
|
-
display: "flex",
|
|
5002
|
-
alignItems: "center",
|
|
5003
|
-
gap: 0.5
|
|
5004
|
-
},
|
|
5005
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
5006
|
-
sx: {
|
|
5007
|
-
width: 8,
|
|
5008
|
-
height: 8,
|
|
5009
|
-
bgcolor: item.color,
|
|
5010
|
-
borderRadius: "50%"
|
|
5011
|
-
}
|
|
5012
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
5013
|
-
sx: {
|
|
5014
|
-
fontSize: "13px",
|
|
5015
|
-
color: "rgba(0, 0, 0, 0.5)",
|
|
5016
|
-
fontWeight: 500
|
|
5017
|
-
},
|
|
5018
|
-
children: item.label
|
|
5019
|
-
}), /*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
|
|
5020
|
-
sx: {
|
|
5021
|
-
fontSize: "13px",
|
|
5022
|
-
fontWeight: 600,
|
|
5023
|
-
color: "#000"
|
|
5024
|
-
},
|
|
5025
|
-
children: ["$", formatNumber(item.total || 0)]
|
|
5026
|
-
})]
|
|
5027
|
-
}, item.label || index);
|
|
5028
|
-
})
|
|
5029
|
-
})]
|
|
5030
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
5031
|
-
sx: {
|
|
5032
|
-
height: 170,
|
|
5033
|
-
width: "calc(100% + 48px)",
|
|
5034
|
-
ml: -3,
|
|
5035
|
-
mr: -3
|
|
5036
|
-
},
|
|
5037
|
-
children: /*#__PURE__*/jsxRuntime.jsx(ReactApexChart, {
|
|
5038
|
-
options: chartOptions,
|
|
5039
|
-
series: series,
|
|
5040
|
-
type: "bar",
|
|
5041
|
-
height: "100%"
|
|
5042
|
-
})
|
|
5043
|
-
})]
|
|
5044
|
-
});
|
|
5045
|
-
};
|
|
5046
|
-
|
|
5047
4978
|
var CardWrapper = function CardWrapper(_ref) {
|
|
5048
4979
|
var title = _ref.title,
|
|
5049
4980
|
subtitle = _ref.subtitle,
|