diff --git a/src/Components/Doughnut/DonutChart.jsx b/src/Components/Doughnut/DonutChart.jsx index 3f4b80f..1ffa8b9 100644 --- a/src/Components/Doughnut/DonutChart.jsx +++ b/src/Components/Doughnut/DonutChart.jsx @@ -12,7 +12,7 @@ const DonutChart = ({ data, width = 300, height = 250 }) => { { label: 'My Dataset', data: data.values, - backgroundColor: [ '#3182ce', '#38A169', '#D69E2E', '#E53E3E' ], + backgroundColor: [ '#3182ce', '#004118', '#D69E2E', '#E53E3E' ], borderColor: ['#FFF'], borderWidth: 1, }, diff --git a/src/Components/Doughnut/LineChart.jsx b/src/Components/Doughnut/LineChart.jsx new file mode 100644 index 0000000..50987d5 --- /dev/null +++ b/src/Components/Doughnut/LineChart.jsx @@ -0,0 +1,70 @@ +// LineChart.jsx +import React from 'react'; +import { Line } from 'react-chartjs-2'; +import { Chart as ChartJS, Title, Tooltip, Legend, LineElement, PointElement, LinearScale, CategoryScale } from 'chart.js'; + +// Register the necessary components +ChartJS.register( Title, Tooltip, Legend, LineElement, PointElement, LinearScale, CategoryScale ); + +// Sample options for the chart +const options = { + responsive: true, + plugins: { + legend: { + position: 'top', + }, + tooltip: { + callbacks: { + label: function (context) { + let label = context.dataset.label || ''; + if (label) { + label += ': '; + } + if (context.parsed.y !== null) { + label += `${context.parsed.y}`; + } + return label; + } + } + } + } +}; + +const Utils = { + numbers: ({ count, min, max }) => Array.from({ length: count }, () => Math.floor(Math.random() * (max - min + 1)) + min), + CHART_COLORS: { + red: 'rgba(255, 99, 132, 1)', + darkGreen: 'rgba(0, 65, 24, 1)' // Added color related to #004118 + }, + transparentize: (color, opacity) => { + // Use regex to replace the alpha value + return color.replace(/(rgba\(\d+, \d+, \d+, )\d+(\))/, `$1${opacity}$2`); + } +}; + + +const LineChart = ({ width = 300, height = 250 }) => { + const data = { + labels: ['Bahrain', 'Kuwait', 'Oman', 'Qatar', 'Saudi Arabia', 'UAE', 'India'], + datasets: [ + { + label: 'Exchange rate', + data: [45.9087, 23.8798, 99.9809, 65.8987, 65.8987, 34.9898, 32.8987], + borderColor: Utils.CHART_COLORS.darkGreen, + backgroundColor: Utils.transparentize(Utils.CHART_COLORS.darkGreen, 0.5), + pointStyle: 'circle', + pointRadius: 10, + pointHoverRadius: 15 + } + ] + }; + + console.log(data); + + + return ( + + ); +}; + +export default LineChart; diff --git a/src/Layout/DefaultLayout.jsx b/src/Layout/DefaultLayout.jsx index 23c1927..3bebca4 100644 --- a/src/Layout/DefaultLayout.jsx +++ b/src/Layout/DefaultLayout.jsx @@ -387,7 +387,7 @@ const DashboardLayout = ({ isOnline }) => { // onMouseOver={() => setIsDrawerOpen(true)} // onMouseLeave={() => setIsDrawerOpen(false)} style={{ - width: isDrawerOpen || openDrawerClick ? 232 : 74, + width: isDrawerOpen || openDrawerClick ? 255 : 74, transition: "width 0.3s ease-in-out", // Smooth transition for width change // overflow: "hidden", backgroundColor: "#0041180A", @@ -631,7 +631,7 @@ const DashboardLayout = ({ isOnline }) => {
{ const navigate = useNavigate() - const {data: sponsors,error,isLoading: isSponserLoading,} = useGetSponserMasterQuery({ page: TABLE_PAGINATION?.page, size: TABLE_PAGINATION?.size }); const { data, isLoading: isIoPreLoading } = useGetIOprepopulateDataQuery(); - const { data:IO, isLoading: isIoLoading } = useGetIOsQuery({ page: TABLE_PAGINATION?.page, size: TABLE_PAGINATION?.size }); + const { data: IO, isLoading: isIoLoading } = useGetIOsQuery({ page: TABLE_PAGINATION?.page, size: TABLE_PAGINATION?.size }); const { data: investorDetails, isInvestorLoading } = useGetInvestorsQuery({ page: TABLE_PAGINATION?.page, size: TABLE_PAGINATION?.size }); - - console.log(IO?.data?.rows); - - - const sortArrayByStatus = () => { const sortedArrays = { open: [], @@ -33,12 +26,9 @@ const Dashbaord = () => { processing: [], draft: [] }; - + IO?.data?.rows.forEach(item => { const status = item.ioStatus?.statusAdmin; - console.log(status); - - if (status === 'Open') { sortedArrays.open.push(item); } else if (status === 'Closed') { @@ -49,87 +39,63 @@ const Dashbaord = () => { sortedArrays.draft.push(item); } }); - return sortedArrays; }; - const statusData = sortArrayByStatus() - console.log(statusData); - - - - - - - - - - - const chartData = { - labels: [ 'Draft' ,'Open', 'Processing', 'Closed', ], - backgroundColor: [ '#3182ce', '#38A169', '#D69E2E', '#E53E3E' ], - values: [statusData?.draft?.length ,statusData?.open?.length, statusData?.processing?.length, statusData?.closed?.length] + labels: ['Draft', 'Open', 'Processing', 'Closed',], + backgroundColor: ['#3182ce', '#004118', '#D69E2E', '#E53E3E'], + values: [statusData?.draft?.length, statusData?.open?.length, statusData?.processing?.length, statusData?.closed?.length] }; - - + return ( - isSponserLoading || isIoPreLoading || isIoLoading || isInvestorLoading ? : - + isIoPreLoading || isIoLoading || isInvestorLoading ? : + - - - navigate("/investor-details")} boxShadow={'lg'} color={"#fff"} p={4} rounded={'xl'} w={'25%'} display={'flex'} bg={'#004118'} flexDirection={'column'} alignItems={'start'} > - + navigate("/investor-details")} boxShadow={'lg'} color={"#fff"} p={4} rounded={'xl'} w={'25%'} display={'flex'} bg={'#004118'} flexDirection={'column'} alignItems={'start'} > + Total Investors {investorDetails?.data?.totalItems} + - - - navigate("/view-io")} boxShadow={'lg'} bg={'#fff'} color={"#004118"} p={3} rounded={'xl'} w={'25%'} display={'flex'} flexDirection={'column'} alignItems={'start'} > - + navigate("/view-io")} boxShadow={'lg'} bg={'#fff'} color={"#004118"} p={3} rounded={'xl'} w={'25%'} display={'flex'} flexDirection={'column'} alignItems={'start'} > + Total IO {IO?.data?.totalItems} + - - - - navigate("/sponser")} boxShadow={'lg'} bg={'#fff'} color={"#004118"} p={3} rounded={'xl'} w={'25%'} display={'flex'} flexDirection={'column'} alignItems={'start'} > - + navigate("/sponser")} boxShadow={'lg'} bg={'#fff'} color={"#004118"} p={3} rounded={'xl'} w={'25%'} display={'flex'} flexDirection={'column'} alignItems={'start'} > + Total sponors {data?.data?.sponsor?.length} + - - - - navigate("/investment-type")} boxShadow={'lg'} bg={'#fff'} color={"#004118"} p={3} rounded={'xl'} w={'25%'} display={'flex'} flexDirection={'column'} alignItems={'start'} > - + navigate("/investment-type")} boxShadow={'lg'} bg={'#fff'} color={"#004118"} p={3} rounded={'xl'} w={'25%'} display={'flex'} flexDirection={'column'} alignItems={'start'} > + Total Investment Type {data?.data?.investmentType?.length} + - - - - - - - - - - IO Status - - + + + + Exchange rate currency + + + + + IO Status + + + + + {chartData?.labels?.map((item, index) => {item})} + - - { - chartData?.labels?.map((item, index)=> {item}) - } - - - ) + ) } export default Dashbaord \ No newline at end of file