diff --git a/index.html b/index.html index 20dce0f..7cef13f 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@ const craftedMsg = "Crafted with ❤️ by WDI Team for a better web."; - --> + + + + diff --git a/package-lock.json b/package-lock.json index e22faa2..8da2698 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,17 +14,21 @@ "@emotion/styled": "^11.11.5", "@hookform/resolvers": "^3.3.4", "@reduxjs/toolkit": "^2.2.3", + "apexcharts": "^3.52.0", "axios": "^1.7.2", "bootstrap": "5.3.3", + "chart.js": "^4.4.3", "dotenv": "^16.4.5", "framer-motion": "^11.1.5", "js-cookie": "^3.0.5", "react": "^18.2.0", + "react-apexcharts": "^1.4.1", "react-beautiful-dnd": "^13.1.1", + "react-chartjs-2": "^5.2.0", "react-dom": "^18.2.0", "react-hook-form": "^7.51.3", "react-icons": "^5.1.0", - "react-quill": "^2.0.0", + "react-quill": "^0.0.2", "react-redux": "^9.1.1", "react-router-dom": "^6.22.3", "redux-persist": "^6.0.0", @@ -1964,6 +1968,11 @@ "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "dev": true }, + "node_modules/@kurkle/color": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz", + "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==" + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2498,14 +2507,6 @@ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" }, - "node_modules/@types/quill": { - "version": "1.3.10", - "resolved": "https://registry.npmjs.org/@types/quill/-/quill-1.3.10.tgz", - "integrity": "sha512-IhW3fPW+bkt9MLNlycw8u8fWb7oO7W5URC9MfZYHBlA24rex9rs23D5DETChu1zvgVdc5ka64ICjJOgQMr6Shw==", - "dependencies": { - "parchment": "^1.1.2" - } - }, "node_modules/@types/react": { "version": "18.2.79", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.79.tgz", @@ -2566,6 +2567,11 @@ "vite": "^4 || ^5" } }, + "node_modules/@yr/monotone-cubic-spline": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@yr/monotone-cubic-spline/-/monotone-cubic-spline-1.0.3.tgz", + "integrity": "sha512-FQXkOta0XBSUPHndIKON2Y9JeQz5ZeMqLYZVVK93FliNBFm7LNMIZmY6FrMEB9XPcDbE2bekMbZD6kzDkxwYjA==" + }, "node_modules/@zag-js/dom-query": { "version": "0.16.0", "resolved": "https://registry.npmjs.org/@zag-js/dom-query/-/dom-query-0.16.0.tgz", @@ -2653,6 +2659,20 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/apexcharts": { + "version": "3.52.0", + "resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.52.0.tgz", + "integrity": "sha512-7dg0ADKs8AA89iYMZMe2sFDG0XK5PfqllKV9N+i3hKHm3vEtdhwz8AlXGm+/b0nJ6jKiaXsqci5LfVxNhtB+dA==", + "dependencies": { + "@yr/monotone-cubic-spline": "^1.0.3", + "svg.draggable.js": "^2.2.2", + "svg.easing.js": "^2.0.0", + "svg.filter.js": "^2.0.2", + "svg.pathmorphing.js": "^0.1.3", + "svg.resize.js": "^1.4.3", + "svg.select.js": "^3.0.1" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -2891,6 +2911,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dev": true, "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -2941,12 +2962,15 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", + "node_modules/chart.js": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.3.tgz", + "integrity": "sha512-qK1gkGSRYcJzqrrzdR6a+I0vQ4/R+SoODXyAjscQ/4mzuNzySaMCd+hyVxitSY1+L2fjPD1Gbn+ibNqRmwQeLw==", + "dependencies": { + "@kurkle/color": "^0.3.0" + }, "engines": { - "node": ">=0.8" + "pnpm": ">=8" } }, "node_modules/codepage": { @@ -3141,25 +3165,6 @@ } } }, - "node_modules/deep-equal": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.2.tgz", - "integrity": "sha512-5tdhKF6DbU7iIzrIOa1AOUt39ZRm13cmL1cGEh//aqR8x9+tNfbywRf0n5FD/18OKMdo7DNEtrX2t22ZAkI+eg==", - "dependencies": { - "is-arguments": "^1.1.1", - "is-date-object": "^1.0.5", - "is-regex": "^1.1.4", - "object-is": "^1.1.5", - "object-keys": "^1.1.1", - "regexp.prototype.flags": "^1.5.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -3170,6 +3175,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -3186,6 +3192,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, "dependencies": { "define-data-property": "^1.0.1", "has-property-descriptors": "^1.0.0", @@ -3306,6 +3313,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, "dependencies": { "get-intrinsic": "^1.2.4" }, @@ -3317,6 +3325,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, "engines": { "node": ">= 0.4" } @@ -3671,15 +3680,10 @@ "node": ">=0.10.0" } }, - "node_modules/eventemitter3": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-2.0.3.tgz", - "integrity": "sha512-jLN68Dx5kyFHaePoXWPsCGW5qdyZQtLYHkxkg02/Mz6g0kYpDx4FyP6XfArhQdlOC4b8Mv+EMxPo/8La7Tzghg==" - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + "node_modules/eventemitter2": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", + "integrity": "sha512-K7J4xq5xAD5jHsGM5ReWXRTFa3JRGofHiMcVgQ8PRwgWxzjHpMWCIzsmyf60+mh8KLsqYPcjUMa0AC4hd6lPyQ==" }, "node_modules/fast-deep-equal": { "version": "3.1.3", @@ -3688,9 +3692,9 @@ "dev": true }, "node_modules/fast-diff": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.1.2.tgz", - "integrity": "sha512-KaJUt+M9t1qaIteSvjc6P3RbMdXsNhK61GRftR6SNxqmhthcd9MGIi4T+o0jD8LUSpSnSKXE20nLtJ3fOHxQig==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.0.1.tgz", + "integrity": "sha512-anEzYJ8VOA5iAMjDOVMTVMrUOXveDTMMk5x0E4p0nJ3VPoIOolF51AqYyE+UD0QIyggUwqppqH7XVA9lF3fdaQ==" }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", @@ -3913,6 +3917,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3921,6 +3926,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dev": true, "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", @@ -4026,6 +4032,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, "dependencies": { "get-intrinsic": "^1.1.3" }, @@ -4061,6 +4068,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, "dependencies": { "es-define-property": "^1.0.0" }, @@ -4072,6 +4080,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -4083,6 +4092,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -4094,6 +4104,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, "dependencies": { "has-symbols": "^1.0.3" }, @@ -4204,21 +4215,6 @@ "loose-envify": "^1.0.0" } }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-array-buffer": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", @@ -4325,6 +4321,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -4435,6 +4432,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -4694,9 +4692,13 @@ } }, "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "integrity": "sha512-Kak1hi6/hYHGVPmdyiZijoQyz5x2iGVzs6w9GYB/HiXEtylY7tIoYEROMjvM1d9nXJqPOrG2MNPMn01bJ+S0Rw==", + "engines": [ + "node", + "rhino" + ] }, "node_modules/lodash.merge": { "version": "4.6.2", @@ -4803,25 +4805,11 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object-is": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", - "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, "engines": { "node": ">= 0.4" } @@ -4966,11 +4954,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parchment": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/parchment/-/parchment-1.1.4.tgz", - "integrity": "sha512-J5FBQt/pM2inLzg4hEWmzQx/8h8D0CiDxaG3vyp9rKrQRSDgBlhjdP5jQGgosEajXPSQouXGHOmVdgo7QmJuOg==" - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -5139,27 +5122,14 @@ } ] }, - "node_modules/quill": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/quill/-/quill-1.3.7.tgz", - "integrity": "sha512-hG/DVzh/TiknWtE6QmWAF/pxoZKYxfe3J/d/+ShUWkDvvkZQVTPeVmUJVu1uE6DDooC4fWTiCLh84ul89oNz5g==", + "node_modules/quilljs": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/quilljs/-/quilljs-0.18.1.tgz", + "integrity": "sha512-VKaO7GNehgnH4LlFPx5ZAl+KFDoRVtboY0I6UUbYXUsPHP8kR80Tg/CFEYqrqrpCOGQr4OQ5Tjm813gV1DUyQw==", "dependencies": { - "clone": "^2.1.1", - "deep-equal": "^1.0.1", - "eventemitter3": "^2.0.3", - "extend": "^3.0.2", - "parchment": "^1.1.4", - "quill-delta": "^3.6.2" - } - }, - "node_modules/quill-delta": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/quill-delta/-/quill-delta-3.6.3.tgz", - "integrity": "sha512-wdIGBlcX13tCHOXGMVnnTVFtGRLoP0imqxM696fIPwIf5ODIYUHIvHbZcyvGlZFiFhK5XzDC2lpjbxRhnM05Tg==", - "dependencies": { - "deep-equal": "^1.0.1", - "extend": "^3.0.2", - "fast-diff": "1.1.2" + "eventemitter2": "~0.4.13", + "lodash": "~2.4.1", + "rich-text": "~1.0.2" }, "engines": { "node": ">=0.10" @@ -5181,6 +5151,18 @@ "node": ">=0.10.0" } }, + "node_modules/react-apexcharts": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/react-apexcharts/-/react-apexcharts-1.4.1.tgz", + "integrity": "sha512-G14nVaD64Bnbgy8tYxkjuXEUp/7h30Q0U33xc3AwtGFijJB9nHqOt1a6eG0WBn055RgRg+NwqbKGtqPxy15d0Q==", + "dependencies": { + "prop-types": "^15.8.1" + }, + "peerDependencies": { + "apexcharts": "^3.41.0", + "react": ">=0.13" + } + }, "node_modules/react-beautiful-dnd": { "version": "13.1.1", "resolved": "https://registry.npmjs.org/react-beautiful-dnd/-/react-beautiful-dnd-13.1.1.tgz", @@ -5236,6 +5218,15 @@ "@babel/runtime": "^7.9.2" } }, + "node_modules/react-chartjs-2": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/react-chartjs-2/-/react-chartjs-2-5.2.0.tgz", + "integrity": "sha512-98iN5aguJyVSxp5U3CblRLH67J8gkfyGNbiK3c+l1QI/G4irHMPQw44aEPmjVag+YKTyQ260NcF82GTQ3bdscA==", + "peerDependencies": { + "chart.js": "^4.1.1", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-clientside-effect": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/react-clientside-effect/-/react-clientside-effect-1.2.6.tgz", @@ -5315,17 +5306,17 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "node_modules/react-quill": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/react-quill/-/react-quill-2.0.0.tgz", - "integrity": "sha512-4qQtv1FtCfLgoD3PXAur5RyxuUbPXQGOHgTlFie3jtxp43mXDtzCKaOgQ3mLyZfi1PUlyjycfivKelFhy13QUg==", + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/react-quill/-/react-quill-0.0.2.tgz", + "integrity": "sha512-PeiHXZ63Sumh41OdovBQExXJH7B4UsJpyCW8CtRvXrNBa2RJXdciaJvTeb0x6pYQfqkoCYPT5EbUvEr0Z1tohg==", "dependencies": { - "@types/quill": "^1.3.10", - "lodash": "^4.17.4", - "quill": "^1.3.7" + "quilljs": "^0.18.1" + }, + "engines": { + "node": ">= 0.8.x" }, "peerDependencies": { - "react": "^16 || ^17 || ^18", - "react-dom": "^16 || ^17 || ^18" + "react": ">=0.11.0" } }, "node_modules/react-redux": { @@ -5515,6 +5506,7 @@ "version": "1.5.2", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", "integrity": "sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==", + "dev": true, "dependencies": { "call-bind": "^1.0.6", "define-properties": "^1.2.1", @@ -5567,6 +5559,17 @@ "node": ">=0.10.0" } }, + "node_modules/rich-text": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/rich-text/-/rich-text-1.0.3.tgz", + "integrity": "sha512-L+Mi0fBH4/TBGH68XZqUXdUr5Ze+ViYkrKuwEvCpeyB1Blbp4CLO4LyYleutTNybujCMQfcmivaNrE3YLrEUgg==", + "dependencies": { + "fast-diff": "~1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -5696,6 +5699,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", @@ -5712,6 +5716,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", @@ -5916,6 +5921,89 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/svg.draggable.js": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/svg.draggable.js/-/svg.draggable.js-2.2.2.tgz", + "integrity": "sha512-JzNHBc2fLQMzYCZ90KZHN2ohXL0BQJGQimK1kGk6AvSeibuKcIdDX9Kr0dT9+UJ5O8nYA0RB839Lhvk4CY4MZw==", + "dependencies": { + "svg.js": "^2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/svg.easing.js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/svg.easing.js/-/svg.easing.js-2.0.0.tgz", + "integrity": "sha512-//ctPdJMGy22YoYGV+3HEfHbm6/69LJUTAqI2/5qBvaNHZ9uUFVC82B0Pl299HzgH13rKrBgi4+XyXXyVWWthA==", + "dependencies": { + "svg.js": ">=2.3.x" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/svg.filter.js": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/svg.filter.js/-/svg.filter.js-2.0.2.tgz", + "integrity": "sha512-xkGBwU+dKBzqg5PtilaTb0EYPqPfJ9Q6saVldX+5vCRy31P6TlRCP3U9NxH3HEufkKkpNgdTLBJnmhDHeTqAkw==", + "dependencies": { + "svg.js": "^2.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/svg.js": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/svg.js/-/svg.js-2.7.1.tgz", + "integrity": "sha512-ycbxpizEQktk3FYvn/8BH+6/EuWXg7ZpQREJvgacqn46gIddG24tNNe4Son6omdXCnSOaApnpZw6MPCBA1dODA==" + }, + "node_modules/svg.pathmorphing.js": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/svg.pathmorphing.js/-/svg.pathmorphing.js-0.1.3.tgz", + "integrity": "sha512-49HWI9X4XQR/JG1qXkSDV8xViuTLIWm/B/7YuQELV5KMOPtXjiwH4XPJvr/ghEDibmLQ9Oc22dpWpG0vUDDNww==", + "dependencies": { + "svg.js": "^2.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/svg.resize.js": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/svg.resize.js/-/svg.resize.js-1.4.3.tgz", + "integrity": "sha512-9k5sXJuPKp+mVzXNvxz7U0uC9oVMQrrf7cFsETznzUDDm0x8+77dtZkWdMfRlmbkEEYvUn9btKuZ3n41oNA+uw==", + "dependencies": { + "svg.js": "^2.6.5", + "svg.select.js": "^2.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/svg.resize.js/node_modules/svg.select.js": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/svg.select.js/-/svg.select.js-2.1.2.tgz", + "integrity": "sha512-tH6ABEyJsAOVAhwcCjF8mw4crjXSI1aa7j2VQR8ZuJ37H2MBUbyeqYr5nEO7sSN3cy9AR9DUwNg0t/962HlDbQ==", + "dependencies": { + "svg.js": "^2.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/svg.select.js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/svg.select.js/-/svg.select.js-3.0.1.tgz", + "integrity": "sha512-h5IS/hKkuVCbKSieR9uQCj9w+zLHoPh+ce19bBYyqF53g6mnPB8sAtIbe1s9dh2S2fCmYX2xel1Ln3PJBbK4kw==", + "dependencies": { + "svg.js": "^2.6.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", diff --git a/package.json b/package.json index 11ee664..1cab514 100644 --- a/package.json +++ b/package.json @@ -16,17 +16,21 @@ "@emotion/styled": "^11.11.5", "@hookform/resolvers": "^3.3.4", "@reduxjs/toolkit": "^2.2.3", + "apexcharts": "^3.52.0", "axios": "^1.7.2", "bootstrap": "5.3.3", + "chart.js": "^4.4.3", "dotenv": "^16.4.5", "framer-motion": "^11.1.5", "js-cookie": "^3.0.5", "react": "^18.2.0", + "react-apexcharts": "^1.4.1", "react-beautiful-dnd": "^13.1.1", + "react-chartjs-2": "^5.2.0", "react-dom": "^18.2.0", "react-hook-form": "^7.51.3", "react-icons": "^5.1.0", - "react-quill": "^2.0.0", + "react-quill": "^0.0.2", "react-redux": "^9.1.1", "react-router-dom": "^6.22.3", "redux-persist": "^6.0.0", diff --git a/src/App.css b/src/App.css index 13b4daa..5668f26 100644 --- a/src/App.css +++ b/src/App.css @@ -336,3 +336,151 @@ font-size: 22px !important; } } + + + + + +/* ========= [ switch BTN ============ */ + + + +/* From Uiverse.io by Nawsome */ +.switch { + display: block; + background-color: black; + width: 85px; + height: 115px; + box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0 1px 2px black, inset 0 2px 2px -2px white, inset 0 0 2px 15px #47434c, inset 0 0 2px 22px black; + border-radius: 5px; + padding: 20px; + perspective: 700px; +} + +.switch input { + display: none; +} + +.switch input:checked + .button { + transform: translateZ(20px) rotateX(25deg); + box-shadow: 0 -10px 20px #ff1818; +} + +.switch input:checked + .button .light { + animation: flicker 0.2s infinite 0.3s; +} + +.switch input:checked + .button .shine { + opacity: 1; +} + +.switch input:checked + .button .shadow { + opacity: 0; +} + +.switch .button { + display: block; + transition: all 0.3s cubic-bezier(1, 0, 1, 1); + transform-origin: center center -20px; + transform: translateZ(20px) rotateX(-25deg); + transform-style: preserve-3d; + background-color: #9b0621; + height: 100%; + position: relative; + cursor: pointer; + background: linear-gradient(#980000 0%, #6f0000 30%, #6f0000 70%, #980000 100%); + background-repeat: no-repeat; +} + +.switch .button::before { + content: ""; + background: linear-gradient(rgba(255, 255, 255, 0.8) 10%, rgba(255, 255, 255, 0.3) 30%, #650000 75%, #320000) 50% 50%/97% 97%, #b10000; + background-repeat: no-repeat; + width: 100%; + height: 50px; + transform-origin: top; + transform: rotateX(-90deg); + position: absolute; + top: 0; +} + +.switch .button::after { + content: ""; + background-image: linear-gradient(#650000, #320000); + width: 100%; + height: 58px; + transform-origin: top; + transform: translateY(50px) rotateX(-90deg); + position: absolute; + bottom: 0; + box-shadow: 0 50px 8px 0px black, 0 80px 20px 0px rgba(0, 0, 0, 0.5); +} + +.switch .light { + opacity: 0; + animation: light-off 1s; + position: absolute; + width: 100%; + height: 100%; + background-image: radial-gradient(#ffc97e, #ff1818 40%, transparent 70%); +} + +.switch .dots { + position: absolute; + width: 100%; + height: 100%; + background-image: radial-gradient(transparent 30%, rgba(101, 0, 0, 0.7) 70%); + background-size: 10px 10px; +} + +.switch .characters { + position: absolute; + width: 100%; + height: 100%; + background: linear-gradient(white, white) 50% 20%/5% 20%, radial-gradient(circle, transparent 50%, white 52%, white 70%, transparent 72%) 50% 80%/33% 25%; + background-repeat: no-repeat; +} + +.switch .shine { + transition: all 0.3s cubic-bezier(1, 0, 1, 1); + opacity: 0.3; + position: absolute; + width: 100%; + height: 100%; + background: linear-gradient(white, transparent 3%) 50% 50%/97% 97%, linear-gradient(rgba(255, 255, 255, 0.5), transparent 50%, transparent 80%, rgba(255, 255, 255, 0.5)) 50% 50%/97% 97%; + background-repeat: no-repeat; +} + +.switch .shadow { + transition: all 0.3s cubic-bezier(1, 0, 1, 1); + opacity: 1; + position: absolute; + width: 100%; + height: 100%; + background: linear-gradient(transparent 70%, rgba(0, 0, 0, 0.8)); + background-repeat: no-repeat; +} + +@keyframes flicker { + 0% { + opacity: 1; + } + + 80% { + opacity: 0.8; + } + + 100% { + opacity: 1; + } +} + +@keyframes light-off { + 0% { + opacity: 1; + } + + 80% { + opacity: 0; + } +} \ No newline at end of file diff --git a/src/App.jsx b/src/App.jsx index 4efe6e0..e163d62 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -37,12 +37,16 @@ const App = () => { }; }, []); - const PrivateRoute = ({ children }) => { - if (!isAuthenticate && isAuthenticatedInCookie !== "true") { - return ; - } - return children; - }; + // const token = localStorage.getItem('accessToken') + // console.log(token); + + + // const PrivateRoute = ({ children }) => { + // if (!isAuthenticate && isAuthenticatedInCookie !== "true") { + // return ; + // } + // return children; + // }; return ( @@ -52,7 +56,8 @@ const App = () => { path="/*" element={ // isOnline ? ( - isAuthenticate || isAuthenticatedInCookie === "true" ? ( + // isAuthenticate || isAuthenticatedInCookie === "true" ? ( + localStorage.getItem('accessToken') && localStorage.getItem('refreshToken') ? ( ) : ( diff --git a/src/Components/CurrencyInput.jsx b/src/Components/CurrencyInput.jsx new file mode 100644 index 0000000..c6fb280 --- /dev/null +++ b/src/Components/CurrencyInput.jsx @@ -0,0 +1,41 @@ +import React, { forwardRef } from 'react'; +import { Input } from "@chakra-ui/react"; + +export const formatCurrency = (value) => { + if (!value) return ''; + const [integer, decimal] = value?.split('.'); + const formattedInteger = integer?.replace(/\B(?=(\d{3})+(?!\d))/g, ','); + return decimal ? `${formattedInteger}.${decimal}` : formattedInteger; +}; + +const CurrencyInput = forwardRef(({ value, onChange, ...props }, ref) => { + + + + const handleChange = (event) => { + let { value } = event?.target; + + // Remove non-numeric characters except decimal point + value = value?.replace(/[^0-9.]/g, ''); + + // Ensure only one decimal point + const parts = value?.split('.'); + if (parts.length > 2) { + value = parts[0] + '.' + parts?.slice(1)?.join(''); + } + + onChange(value); // Pass the raw value to parent or use it directly + }; + + return ( + + ); +}); + +export default CurrencyInput; diff --git a/src/Components/DataTable/DataTable.jsx b/src/Components/DataTable/DataTable.jsx index facf526..94be903 100644 --- a/src/Components/DataTable/DataTable.jsx +++ b/src/Components/DataTable/DataTable.jsx @@ -50,7 +50,7 @@ const DataTable = ({ const [removed] = reorderedItems.splice(result.source.index, 1); reorderedItems.splice(result.destination.index, 0, removed); setData(reorderedItems) - console.log("New Order:", reorderedItems.map((item, index) => ({ index, item }))); + // console.log("New Order:", reorderedItems.map((item, index) => ({ index, item }))); }; return ( diff --git a/src/Components/DataTable/NormalTable.jsx b/src/Components/DataTable/NormalTable.jsx index 883df72..0ae24b8 100644 --- a/src/Components/DataTable/NormalTable.jsx +++ b/src/Components/DataTable/NormalTable.jsx @@ -12,6 +12,7 @@ import { Tfoot, } from "@chakra-ui/react"; import EmptySearchList from "../EmptySearchList"; +import { TABLE_PAGINATION } from "../../Constants/Paginations"; const DataTable = ({ data, @@ -20,6 +21,9 @@ const DataTable = ({ emptyMessage, centered, }) => { + + console.log(data); + const columnWidth = data && data[0] ? `${(100 / Object.keys(data[0]).length).toFixed(2)}%` @@ -35,7 +39,6 @@ const DataTable = ({ {tableHeadRow.map((heading, index) => ( {isLoading ? : heading} {/* {heading} */} @@ -53,7 +62,7 @@ const DataTable = ({ {isLoading - ? Array.from({ length: 12 }).map((_, index) => ( + ? Array.from({ length: TABLE_PAGINATION?.size }).map((_, index) => ( {tableHeadRow.map((_, i) => ( { + + // Customize colors and series titles here + const [options] = useState({ + chart: { + width: 600, + type: 'donut', + }, + plotOptions: { + pie: { + startAngle: -90, + endAngle: 270, + donut: { + size: '45%' // Adjust the donut size here (percentage of chart size) + } + } + }, + labels:data?.labels, + dataLabels: { + enabled: false + }, + fill: { + type: 'gradient', + }, + colors: data?.backgroundColor, + legend: { + show: false, + position: 'right', + labels: { + colors: ['#000'], // Customize the color of the legend labels + useSeriesColors: true + } + }, + responsive: [{ + breakpoint: 480, + options: { + chart: { + width: 500 + }, + legend: { + position: 'center' + } + } + }] + }); + + return ( + + ); +}; + +export default ApexChart; diff --git a/src/Components/Doughnut/ApexLine.jsx b/src/Components/Doughnut/ApexLine.jsx new file mode 100644 index 0000000..8e27e25 --- /dev/null +++ b/src/Components/Doughnut/ApexLine.jsx @@ -0,0 +1,66 @@ +import React, { useState } from 'react'; +import ReactApexChart from 'react-apexcharts'; + +function ApexLine() { + const [chartOptions, setChartOptions] = useState({ + series: [{ + name: 'Rate', + data: [45, 23, 70, 65, 5, 34, 32], + gradientToColors: ['#004017'], + }], + options: { + chart: { + height: 350, + type: 'line', + toolbar: { + show: false // Hide the action icons + } + }, + stroke: { + width: 5, + curve: 'smooth', + colors: ['#598369'], // Customize the line color here + }, + markers: { + size: 6, // Size of markers + colors: ['#004118'], // Marker (dot) color + strokeColor: '#fff', // Stroke color of the marker + strokeWidth: 2 + }, + xaxis: { + type: 'category', // Change from 'datetime' to 'category' + categories: ['BH', 'KW', 'OM', 'QA', 'SA', 'UAE', 'IND'], + tickAmount: 7 + }, + title: { + text: 'Exchange Rate Currency', // Adjust the title if needed + align: 'left', + style: { + fontSize: '15px', + color: '#000', + fontWeight: 400 + } + }, + fill: { + type: 'gradient', + gradient: { + shade: 'dark', + gradientToColors: ['#004017'], + shadeIntensity: 4, + type: 'horizontal', + opacityFrom: 1, + opacityTo: 1, + stops: [0, 100] // Gradient stops + }, + } + } + }); + + return ( +
+ +
+ ); +} + +export default ApexLine; diff --git a/src/Components/Doughnut/DonutChart.jsx b/src/Components/Doughnut/DonutChart.jsx new file mode 100644 index 0000000..57a9e74 --- /dev/null +++ b/src/Components/Doughnut/DonutChart.jsx @@ -0,0 +1,39 @@ +// DonutChart.jsx +import React from 'react'; +import { Doughnut } from 'react-chartjs-2'; +import { Chart as ChartJS, Title, Tooltip, Legend, ArcElement } from 'chart.js'; + +ChartJS.register(Title, Tooltip, Legend, ArcElement); + +const DonutChart = ({ data, width = 300, height = 250 }) => { + const chartData = { + labels: data.labels, + datasets: [ + { + label: 'My Dataset', + data: data.values, + backgroundColor: [ '#3182ce', '#004118', '#D69E2E', '#E53E3E' ], + borderColor: ['#FFF'], + borderWidth: 2, + }, + ], + }; + + const options = { + responsive: true, + plugins: { + legend: { + display: false, // Hide the legend + }, + tooltip: { + callbacks: { + label: (tooltipItem) => `${tooltipItem.label}: ${tooltipItem.raw}`, + }, + }, + }, + }; + + return ; +}; + +export default DonutChart; diff --git a/src/Components/Doughnut/LineChart.jsx b/src/Components/Doughnut/LineChart.jsx new file mode 100644 index 0000000..db31867 --- /dev/null +++ b/src/Components/Doughnut/LineChart.jsx @@ -0,0 +1,80 @@ +// 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 +// 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; + } + } + } + }, + animation: { + tension: { + duration: 2000, + easing: 'linear', + from: 1, + to: 0, + loop: true + } + } +}; + + +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: 'rectRounded', + pointRadius: 10, + pointHoverRadius: 15 + } + ] + }; + + + + return ( + + ); +}; + +export default LineChart; diff --git a/src/Components/DummyComponent.jsx b/src/Components/DummyComponent.jsx new file mode 100644 index 0000000..56f9d5a --- /dev/null +++ b/src/Components/DummyComponent.jsx @@ -0,0 +1,41 @@ +import { Box, Input } from "@chakra-ui/react"; +import React, { useRef, useState } from "react"; +import audioClick from "../assets/click-151673.mp3"; + +const DummyComponent = () => { + // Define the state for the checkbox + const [isSwitchOn, setIsSwitchOn] = useState(false); + + const audio = useRef(); + + // Function to toggle the switch + const handleToggle = () => { + setIsSwitchOn(!isSwitchOn); + if(audio.current){ + audio.current.play(); + } + }; + + return ( + + + + + ); +}; + +export default DummyComponent; diff --git a/src/Components/FormField.jsx b/src/Components/FormField.jsx index 76ef002..32f53b2 100644 --- a/src/Components/FormField.jsx +++ b/src/Components/FormField.jsx @@ -27,10 +27,11 @@ import { Controller } from "react-hook-form"; import { TiWarning } from "react-icons/ti"; import { motion } from "framer-motion"; import { AddIcon, CloseIcon } from "@chakra-ui/icons"; +import CurrencyInput from "./CurrencyInput"; const today = new Date().toISOString().split("T")[0]; -const formatDate = (dateString) => { +export const formatDatee = (dateString) => { const date = new Date(dateString); const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, "0"); // Months are zero-based @@ -41,7 +42,7 @@ const formatDate = (dateString) => { const defaultDate = "8/2/2024"; // Format the default date as YYYY-MM-DD -const formattedDate = formatDate(defaultDate); +const formattedDate = formatDatee(defaultDate); const FormField = ({ label, @@ -67,12 +68,13 @@ const FormField = ({ handleInputChange, align, maxLength, + dateValue, ...props }) => ( @@ -460,7 +462,51 @@ const FormField = ({ ); - } else { + } else if(type === 'date'){ + return ( + + ); + + }else if(type === 'number'){ + return ( + + );} else{ return ( )} {helperText && ( - {helperText} + {helperText} )} {type === "file" && ( diff --git a/src/Components/FormInputMain.jsx b/src/Components/FormInputMain.jsx index ba824b8..15cdd42 100644 --- a/src/Components/FormInputMain.jsx +++ b/src/Components/FormInputMain.jsx @@ -59,7 +59,8 @@ const FormInputMain = ({ value, handleInputChange, align, - maxLength + maxLength, + dateValue }, key ) => ( @@ -83,10 +84,11 @@ const FormInputMain = ({ handleImageChange={handleImageChange} removeImage={removeImage} width={width} - value={type === "date" ? null :value} + value={value} handleInputChange={handleInputChange} align={align} maxLength={maxLength} + dateValue={dateValue} /> ) )} diff --git a/src/Components/FormInputView.jsx b/src/Components/FormInputView.jsx index 6b83d86..ff0c467 100644 --- a/src/Components/FormInputView.jsx +++ b/src/Components/FormInputView.jsx @@ -30,16 +30,16 @@ const FormInputView = ({
{Object?.entries(groupedFields, groupedFieldsTwo).map( ([section, fields], index) => ( - + {section} {/* */} - + {fields.map( ({ value, label, id, width, btn, arabic, type, align }, key) => type === "table" ? ( - +
{value?.map((item, index) => ( @@ -121,7 +121,7 @@ const FormInputView = ({
) : ( - + {label} diff --git a/src/Components/HeaderMain.jsx b/src/Components/HeaderMain.jsx index 471f91c..e10cac6 100644 --- a/src/Components/HeaderMain.jsx +++ b/src/Components/HeaderMain.jsx @@ -1,8 +1,9 @@ -import { AddIcon } from "@chakra-ui/icons"; +import { AddIcon, ArrowBackIcon } from "@chakra-ui/icons"; import { Avatar, Box, Button, + HStack, Popover, PopoverArrow, PopoverBody, @@ -14,13 +15,14 @@ import { useColorMode, } from "@chakra-ui/react"; import React, { useContext } from "react"; -import { Link } from "react-router-dom"; +import { Link, useNavigate } from "react-router-dom"; import { IoMdDownload } from "react-icons/io"; import * as XLSX from "xlsx"; import profile from "../assets/proavatar.webp"; import GlobalStateContext from "../Contexts/GlobalStateContext"; import { MdOutlineDarkMode, MdOutlineLightMode } from "react-icons/md"; import logoMini from "../assets/propic.png" +import { BsBack } from "react-icons/bs"; const HeaderMain = ({ link, @@ -30,6 +32,7 @@ const HeaderMain = ({ logOutHandler, slideDirecttion, }) => { + const navigate = useNavigate() const { colorMode, toggleColorMode } = useContext(GlobalStateContext); @@ -38,7 +41,12 @@ const HeaderMain = ({ className={` pt-2 pb-2 fw-400 border-bottom d-flex ${ slideDirecttion ? "flex-row-reverse ps-2" : "" } justify-content-between align-items-center`} + // boxShadow={"0 0px 8px rgba(0, 0, 0, 0.2)"} + + zIndex={999} > + + {/* navigate(-1)} /> */} */} {title} + diff --git a/src/Components/Loaders/FullscreenLoaders.css b/src/Components/Loaders/FullscreenLoaders.css new file mode 100644 index 0000000..e5c1769 --- /dev/null +++ b/src/Components/Loaders/FullscreenLoaders.css @@ -0,0 +1,105 @@ +/* From Uiverse.io by abrahamcalsin */ +.dot-spinner { + --uib-size: 2.8rem; + --uib-speed: .9s; + --uib-color: #004717; + position: relative; + display: flex; + align-items: center; + justify-content: flex-start; + height: var(--uib-size); + width: var(--uib-size); + } + + .dot-spinner__dot { + position: absolute; + top: 0; + left: 0; + display: flex; + align-items: center; + justify-content: flex-start; + height: 100%; + width: 100%; + } + + .dot-spinner__dot::before { + content: ''; + height: 20%; + width: 20%; + border-radius: 50%; + background-color: var(--uib-color); + transform: scale(0); + opacity: 0.5; + animation: pulse0112 calc(var(--uib-speed) * 1.111) ease-in-out infinite; + box-shadow: 0 0 20px rgba(18, 31, 53, 0.3); + } + + .dot-spinner__dot:nth-child(2) { + transform: rotate(45deg); + } + + .dot-spinner__dot:nth-child(2)::before { + animation-delay: calc(var(--uib-speed) * -0.875); + } + + .dot-spinner__dot:nth-child(3) { + transform: rotate(90deg); + } + + .dot-spinner__dot:nth-child(3)::before { + animation-delay: calc(var(--uib-speed) * -0.75); + } + + .dot-spinner__dot:nth-child(4) { + transform: rotate(135deg); + } + + .dot-spinner__dot:nth-child(4)::before { + animation-delay: calc(var(--uib-speed) * -0.625); + } + + .dot-spinner__dot:nth-child(5) { + transform: rotate(180deg); + } + + .dot-spinner__dot:nth-child(5)::before { + animation-delay: calc(var(--uib-speed) * -0.5); + } + + .dot-spinner__dot:nth-child(6) { + transform: rotate(225deg); + } + + .dot-spinner__dot:nth-child(6)::before { + animation-delay: calc(var(--uib-speed) * -0.375); + } + + .dot-spinner__dot:nth-child(7) { + transform: rotate(270deg); + } + + .dot-spinner__dot:nth-child(7)::before { + animation-delay: calc(var(--uib-speed) * -0.25); + } + + .dot-spinner__dot:nth-child(8) { + transform: rotate(315deg); + } + + .dot-spinner__dot:nth-child(8)::before { + animation-delay: calc(var(--uib-speed) * -0.125); + } + + @keyframes pulse0112 { + 0%, + 100% { + transform: scale(0); + opacity: 0.5; + } + + 50% { + transform: scale(1); + opacity: 1; + } + } + \ No newline at end of file diff --git a/src/Components/Loaders/FullscreenLoaders.jsx b/src/Components/Loaders/FullscreenLoaders.jsx index 3e5e613..a821ce3 100644 --- a/src/Components/Loaders/FullscreenLoaders.jsx +++ b/src/Components/Loaders/FullscreenLoaders.jsx @@ -1,7 +1,8 @@ import { Box, Spinner, Text } from "@chakra-ui/react"; import React from "react"; +import './FullscreenLoaders.css' -const FullscreenLoaders = () => { +const FullscreenLoaders = ({height}) => { return ( { flexDirection={'column'} alignItems={"center"} w={"100%"} - h={"100vh"} + h={height ? height: "100vh"} gap={4} - > - Loading... + >
+
+
+
+
+
+
+
+
+
+ {/* Loading... */}
); }; diff --git a/src/Components/Loaders/Loader01.jsx b/src/Components/Loaders/Loader01.jsx index 89f04bc..d730e32 100644 --- a/src/Components/Loaders/Loader01.jsx +++ b/src/Components/Loaders/Loader01.jsx @@ -1,12 +1,18 @@ import React from "react"; +import './FullscreenLoaders.css' const Loader01 = () => { return ( -
-
-
-
-
+ +
+
+
+
+
+
+
+
+
); }; diff --git a/src/Components/MobileView.jsx b/src/Components/MobileView.jsx new file mode 100644 index 0000000..d0a4262 --- /dev/null +++ b/src/Components/MobileView.jsx @@ -0,0 +1,228 @@ +import { + Box, + Button, + Heading, + HStack, + Image, + Modal, + ModalContent, + ModalFooter, + ModalHeader, + ModalOverlay, + Progress, + Stack, + Text, +} from "@chakra-ui/react"; +import React from "react"; +import Mobile from "../assets/mobileWing.png"; +import mobileBanner from "../assets/welcome.avif"; +import { GrDownload } from "react-icons/gr"; +import { LuClock } from "react-icons/lu"; + +const MobileView = ({ isOpen, onClose, finalRef }) => { + return ( + + + + + + + + + + + + + Stock + Closing Date Aug 23 2024 + + + + + + Guinevere Gates + + + BHD 46,258 + + + + 0.0% funded + + + fugit eligendi dolore dolore et + + + + + + Sponsor name: + + + Scott Simon + + + + + Estimated return: + + + A provident veniam + + + + + Hoiding period: + + + Eius eiusmod exericit + + + + + Minimum investment: + + + BHD 1 + + + + + + Key Merits + + + + Sit sunt consequunt Dolores minim suscip + + + + + Investment Documents + + + + + Merrill Rocha + + + + + 0.03 mb + + + + + + + Videos + + + + + + + + + + + + + + ); +}; + +export default MobileView; diff --git a/src/Components/SwitchButton.jsx b/src/Components/SwitchButton.jsx index 3cd1788..28b46b9 100644 --- a/src/Components/SwitchButton.jsx +++ b/src/Components/SwitchButton.jsx @@ -1,9 +1,18 @@ -import { Box, Text } from '@chakra-ui/react'; -import React from 'react'; +import { Box, Text } from "@chakra-ui/react"; +import React, { useRef } from "react"; +import audioClick from "../assets/click-151673.mp3"; const SwitchButton = ({ isSwitchOn, setIsSwitchOn }) => { + + // const [isSwitchOn, setIsSwitchOn] = useState(false); + + const audio = useRef(); + const switch_onChange_handle = () => { setIsSwitchOn(!isSwitchOn); + if (audio.current) { + audio.current.play(); + } }; return ( @@ -15,7 +24,7 @@ const SwitchButton = ({ isSwitchOn, setIsSwitchOn }) => { alignItems="center" // justifyContent={isSwitchOn ? "flex-end" : "flex-start"} width="90px" - height="24px" + height="25px" borderRadius="20px" backgroundColor={isSwitchOn ? "#004118" : "#ef0000"} onClick={switch_onChange_handle} @@ -24,16 +33,28 @@ const SwitchButton = ({ isSwitchOn, setIsSwitchOn }) => { fontWeight="100" transition="background-color 0.2s" _before={{ + // content: '""', + // position: "absolute", + // width: "20px", + // height: "20px", + // borderRadius: "50%", + // backgroundColor: "#FFF", + // boxShadow: "0 2px 4px rgba(0, 0, 0, 0.2)", + // transform: isSwitchOn ? "translateX(65px)" : "translateX(0)", + // transition: "transform 0.2s", + // left:'2px' + content: '""', position: "absolute", - width: "20px", - height: "20px", + height: "25px", + width: "25px", + left: "0px", + background: + "conic-gradient(rgb(104, 104, 104), white, rgb(104, 104, 104), white, rgb(104, 104, 104))", borderRadius: "50%", - backgroundColor: "#FFF", - boxShadow: "0 2px 4px rgba(0, 0, 0, 0.2)", + transitionDuration: ".3s", + boxShadow: " 5px 2px 7px rgba(8, 8, 8, 0.308)", transform: isSwitchOn ? "translateX(65px)" : "translateX(0)", - transition: "transform 0.2s", - left:'2px' }} > { left={isSwitchOn ? "10px" : "auto"} right={isSwitchOn ? "auto" : "10px"} > - {isSwitchOn ? 'Active' : 'InActive'} + {isSwitchOn ? "Active" : "InActive"} +
{ - + */} + {getCountdownTimer(localStorage.getItem('accessTokenExp'))} - )}
{ error, } = useGetBankQuery({ page: 1, size: 10 }); - console.log(bankDetails?.data); useEffect(() => { // Simulate loading @@ -115,8 +114,7 @@ const BankDetails = () => { return nameMatches; }); - - console.log(bankDetails); + const extractedArray = filteredData?.map((item) => ({ id: item?.id, diff --git a/src/Pages/Admin/Contact.jsx b/src/Pages/Admin/Contact.jsx index e2fe28c..e0d2fa0 100644 --- a/src/Pages/Admin/Contact.jsx +++ b/src/Pages/Admin/Contact.jsx @@ -10,6 +10,7 @@ import { Textarea, Button, Text, + useToast, } from "@chakra-ui/react"; import { useForm, Controller } from "react-hook-form"; import { yupResolver } from "@hookform/resolvers/yup"; @@ -19,8 +20,9 @@ import { v4 as uuidv4 } from "uuid"; import GlobalStateContext from "../../Contexts/GlobalStateContext"; import { OPACITY_ON_LOAD } from "../../Layout/animations"; import FormInputMain from "../../Components/FormInputMain"; -import { useGetContactQuery } from "../../Services/contact.service"; +import { useGetContactQuery, useUpdateContactMutation } from "../../Services/contact.service"; import FullscreenLoaders from "../../Components/Loaders/FullscreenLoaders"; +import ToastBox from "../../Components/ToastBox"; export const addSponser = yup.object().shape({ phoneNumber: yup.string().required("Phone Number is required"), @@ -37,8 +39,10 @@ export function debounce(func, delay) { } const Contact = () => { + const toast = useToast() const navigate = useNavigate(); const [form, setForm] = useState({}); + const [ isLoading, setIsLoading ] = useState(false) // const { sponser, setSponser } = useContext(GlobalStateContext); const { @@ -50,22 +54,21 @@ const Contact = () => { resolver: yupResolver(addSponser), }); - console.log(errors); const { data: contact, isLoading: contactLoading, error, - } = useGetContactQuery({ page: 1, size: 10 }); + } = useGetContactQuery(); + const [ updateContact ] = useUpdateContactMutation() - console.log(contact?.data); useEffect(() => { if (contact) { reset({ - phoneNumber: contact.phoneNumber, - emailAddress: contact.emailAddress, - websiteUrl: contact.websiteUrl, + phoneNumber: contact?.data[0]?.phoneNumber, + emailAddress: contact?.data[0]?.emailAddress, + websiteUrl: contact?.data[0]?.websiteUrl, }); } }, [contact, reset]); @@ -82,7 +85,7 @@ const Contact = () => { type: "text", isRequired: true, section: "Add Details", - defaultValue: contact?.phoneNumber || "", + // value: contact?.phoneNumber || "", }, { label: "E-mail ID", @@ -91,7 +94,7 @@ const Contact = () => { type: "text", isRequired: true, section: "Add Details", - defaultValue: contact?.emailAddress || "", + // value: contact?.emailAddress || "", }, { label: "Website URL", @@ -100,7 +103,7 @@ const Contact = () => { type: "text", isRequired: true, section: "Add Details", - defaultValue: contact?.websiteUrl || "", + // value: contact?.websiteUrl || "", }, ]; @@ -113,11 +116,25 @@ const Contact = () => { return groups; }, {}); - const onSubmit = (data) => { - if (!Object.keys(errors).length) { - setForm(data); - setAlert(true); + const onSubmit = async (data) => { + setIsLoading(true) + try { + const res = await updateContact(data) + if (res?.data?.statusCode === 200) { + toast({ + render: () => , + }); + setIsLoading(false) + } + + } catch (error) { + console.log(error); + + setIsLoading(false) + + } + }; return ( @@ -127,6 +144,7 @@ const Contact = () => { control={control} errors={errors} onSubmit={handleSubmit(onSubmit)} + btnLoading={isLoading} /> ); diff --git a/src/Pages/Dashbaord.jsx b/src/Pages/Dashbaord.jsx new file mode 100644 index 0000000..1ed8b29 --- /dev/null +++ b/src/Pages/Dashbaord.jsx @@ -0,0 +1,162 @@ +import { Box, HStack, Icon, position, Text, VStack } from '@chakra-ui/react' +import React from 'react' +import { HiOutlineChartSquareBar } from 'react-icons/hi' +import { RiMoneyDollarBoxLine } from 'react-icons/ri' +import { TbTransactionDollar } from 'react-icons/tb' +import { VscSymbolClass } from 'react-icons/vsc' +import { TABLE_PAGINATION } from '../Constants/Paginations' +import FullscreenLoaders from '../Components/Loaders/FullscreenLoaders' +import { useGetIOprepopulateDataQuery, useGetIOsQuery } from '../Services/io.service' +import { useGetInvestorsQuery } from '../Services/investor.details.service' +import DonutChart from '../Components/Doughnut/DonutChart' +import { GoDotFill } from "react-icons/go"; +import { useNavigate } from 'react-router-dom' +import LineChart from '../Components/Doughnut/LineChart' +import { PiChartLineUpDuotone } from 'react-icons/pi' +import ApexChart from '../Components/Doughnut/ApexDonut' +import ApexLine from '../Components/Doughnut/ApexLine' +import ReactApexChart from 'react-apexcharts' +import { BsGraphUpArrow } from "react-icons/bs"; + + +const Dashbaord = () => { + const navigate = useNavigate() + const { data, isLoading: isIoPreLoading } = useGetIOprepopulateDataQuery(); + 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 }); + const sortArrayByStatus = () => { + const sortedArrays = { + open: [], + closed: [], + processing: [], + draft: [] + }; + + IO?.data?.rows.forEach(item => { + const status = item.ioStatus?.statusAdmin; + if (status === 'Open') { + sortedArrays.open.push(item); + } else if (status === 'Closed') { + sortedArrays.closed.push(item); + } else if (status === 'Processing') { + sortedArrays.processing.push(item); + } else if (status === 'Draft') { + sortedArrays.draft.push(item); + } + }); + return sortedArrays; + }; + const statusData = sortArrayByStatus() + const chartData = { + labels: ['Draft', 'Open', 'Processing', 'Closed',], + backgroundColor: ['#3182ce', '#004118', '#D69E2E', '#E53E3E'], + values: [statusData?.draft?.length, statusData?.open?.length, statusData?.processing?.length, statusData?.closed?.length] + }; + + + + const series1= [{ + data: [25, 66, 41, 89, 63, 25, 44, 12, 36, 9, 54] + }] + const options1= { + chart: { + type: 'line', + position:"absolute", + right:0, + width: 100, + height: 35, + sparkline: { + enabled: true + } + }, + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + } + } + + + + + + + + + return ( + isIoPreLoading || isIoLoading || isInvestorLoading ? : + + + navigate("/investor-details")} boxShadow={'lg'} color={"#004118"} p={4} rounded={'xl'} w={'25%'} display={'flex'} bg={'#f5f8f6'} flexDirection={'column'} alignItems={'start'} > + + Total Investors + {investorDetails?.data?.totalItems} + + {/* */} + + navigate("/view-io")} boxShadow={'lg'} bg={'#f5f8f6'} color={"#004118"} p={3} rounded={'xl'} w={'25%'} display={'flex'} flexDirection={'column'} alignItems={'start'} > + + Total IO + {IO?.data?.totalItems} + + + navigate("/sponser")} boxShadow={'lg'} bg={'#f5f8f6'} 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={'#f5f8f6'} color={"#004118"} p={3} rounded={'xl'} w={'25%'} display={'flex'} flexDirection={'column'} alignItems={'start'} > + + Total Investment Type + {data?.data?.investmentType?.length} + + + + + + + {/* Exchange rate currency */} + {/* */} + + + + + + + + + IO Status + + {/* */} + {/* */} + + + {/* */} + + {chartData?.labels?.map((item, index) => {item})} + + + + + + + + + ) +} + +export default Dashbaord \ No newline at end of file diff --git a/src/Pages/Deposit/DepositRequest/DepositRequest.jsx b/src/Pages/Deposit/DepositRequest/DepositRequest.jsx index fff3b23..c5f6f22 100644 --- a/src/Pages/Deposit/DepositRequest/DepositRequest.jsx +++ b/src/Pages/Deposit/DepositRequest/DepositRequest.jsx @@ -32,6 +32,11 @@ import DataTable from "../../../Components/DataTable/DataTable"; import DepositRequestApprove from "./DepositRequestApprove"; import DepositRequestReject from "./DepositRequestReject"; import NormalTable from "../../../Components/DataTable/NormalTable"; +import { useGetDepositRequestQuery } from "../../../Services/deposit.request.service"; +import { current } from "@reduxjs/toolkit"; +import { TABLE_PAGINATION } from "../../../Constants/Paginations"; +import { removeTrailingZeros } from "../../../Constants/Constants"; +import { formatCurrency } from "../../../Components/CurrencyInput"; const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter @@ -43,7 +48,7 @@ const DepositRequest = () => { const [searchTerm, setSearchTerm] = useState(""); const [isLoading, setIsLoading] = useState(true); const [deleteAlert, setDeleteAlert] = useState(false); - const [actionId, setActionId] = useState(false); + const [actionId, setActionId] = useState(""); const [mouseEntered, setMouseEntered] = useState(false); const [mouseEnteredId, setMouseEnteredId] = useState(""); const { @@ -57,26 +62,27 @@ const DepositRequest = () => { onClose: onRejectClose, } = useDisclosure(); - useEffect(() => { - // Simulate loading - const timer = setTimeout(() => { - setIsLoading(false); - }, 1500); + const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size); + const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page); + + const { + data, + isLoading: depositRequestLoading, + error, + } = useGetDepositRequestQuery({ page: currentPage, size: pageSize }); + - // Cleanup the timer on component unmount - return () => clearTimeout(timer); - }, []); // ====================================================[Table Setup]================================================================ const tableHeadRow = [ // "Sr.no", - "Deposit Date", "Client ID", "First Name", "Last Name", "Country", "Phone Number", "Amount in Investor currency", + "Deposit Date", "Action", ]; @@ -94,9 +100,9 @@ const DepositRequest = () => { }, 300); // ====================================================[Table Filter]================================================================ - const filteredData = depositRequest.filter((item) => { + const filteredData = data?.data?.rows.filter((item) => { // Filter by name (case insensitive) - const name = item.clientId; + const name = [item.firstName, item.lastName, item.countryName].filter(Boolean).join(' '); const searchLower = searchTerm.toLowerCase(); const nameMatches = name.toLowerCase().includes(searchLower); @@ -112,130 +118,141 @@ const DepositRequest = () => { return nameMatches; }); - const [extractedArray, setExtractedArray] = useState( - filteredData?.map((item, index) => ({ - // id: item?.id, - "Sr.no": ( - - {index + 1} + console.log(data?.data?.rows); + + + const extractedArray = filteredData?.map((item, index) => ({ + // id: item?.id, + "Sr.no": ( + + {index + 1} + + ), + "Client ID": ( + + {item?.clientReference_id} + + ), + "First Name": ( + + + {item?.firstName} - ), - "Deposit Date": ( - - {item.date} + + ), + "Last Name": ( + + + {item?.lastName} - ), - "Client ID": ( - - {item.clientId} + + ), + Country: ( + + + {item?.countryName} - ), - "First Name": ( - - - {item.firstName} - - - ), - "Last Name": ( - - - {item.lastName} - - - ), - Country: ( - - - {item.country} - - - ), - "Phone Number": ( - - - {item.phoneNumber} - - - ), - "Amount in Investor currency": ( - - - {item.amountcurrency} - - - ), - Action: ( - - + ), + "Phone Number": ( + + + {item?.mobileNumber} + + + ), + "Amount in Investor currency": ( + + + {formatCurrency(removeTrailingZeros(item?.investorAmount))} {item?.currencyCode} + + + ), + "Deposit Date": ( + + {formatDate(item?.createdAt)} + + ), + Action: ( + + + + + + + + + ), + })); const handleDelete = () => { const IOtype = investmentType.filter( @@ -274,17 +291,23 @@ const DepositRequest = () => { /> - + - { isLoading={isLoading} /> + - ); }; diff --git a/src/Pages/Deposit/DepositRequest/DepositRequestApprove.jsx b/src/Pages/Deposit/DepositRequest/DepositRequestApprove.jsx index 5aff06e..24637f6 100644 --- a/src/Pages/Deposit/DepositRequest/DepositRequestApprove.jsx +++ b/src/Pages/Deposit/DepositRequest/DepositRequestApprove.jsx @@ -1,128 +1,225 @@ import { - Box, - Button, - FormControl, - FormLabel, - Input, - Modal, - ModalBody, - ModalCloseButton, - ModalContent, - ModalFooter, - ModalHeader, - ModalOverlay, - Text, - useDisclosure, - } from "@chakra-ui/react"; - import React from "react"; - import * as yup from "yup"; - import { yupResolver } from "@hookform/resolvers/yup"; - import { useForm } from "react-hook-form"; - - export const conformModalSchema = yup.object().shape({ - fees: yup.string().required("File name is required"), - totalAmount: yup.string().required("File name is required"), + Box, + Button, + FormControl, + FormLabel, + Input, + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalFooter, + ModalHeader, + ModalOverlay, + Text, + Textarea, + useDisclosure, + useToast, +} from "@chakra-ui/react"; +import React, { useEffect, useState } from "react"; +import * as yup from "yup"; +import { yupResolver } from "@hookform/resolvers/yup"; +import { useForm } from "react-hook-form"; +import { useGetDepositRequestByIdQuery, useUpdateDepositRequestMutation } from "../../../Services/deposit.request.service"; +import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders"; +import ToastBox from "../../../Components/ToastBox"; + +const FILE_TYPES = ["image/jpeg", "image/png", "image/gif"]; + +export const conformModalSchema = yup.object().shape({ + investorAmount: yup.string().required("Investor amount is required"), + comment: yup.string().notRequired(), + supporting_FileName: yup.mixed().required("File is required"), + // .test("fileType", "Unsupported File Format", (value) => { + // return value && FILE_TYPES.includes(value.type); + // }), +}); + +const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestData }) => { + const toast = useToast() + const [file, setFile] = useState(); + const [isBtnLoading , setIsBtnLoading] = useState(false) + + const fileredData = requestData?.find((item)=> item?.id === id) + console.log(fileredData); + + + + const [ updateDepositRequest ] = useUpdateDepositRequestMutation() + + const { + register, + reset, + handleSubmit, + formState: { errors }, + } = useForm({ + resolver: yupResolver(conformModalSchema), }); + + useEffect(() => { + reset({ + investorAmount:fileredData?.investorAmount + }) - const DepositRequestApprove = ({ isOpen, onClose, firstField }) => { - const { - register, - handleSubmit, - formState: { errors }, - } = useForm({ - resolver: yupResolver(conformModalSchema), - }); + + }, [requestData, id]) - const onSubmit = (data) => { - setFile(data.document[0]); - - const newDocument = { - ...data, - document: data.document[0].name, // Store the document name - status: true, - id: uuidv4(), - createdAt: new Date().toISOString(), - Type: getFileIcon(file.type), - }; - - setCreate((prevCreate) => [...prevCreate, newDocument]); - onClose(); - }; - - const handleFileChange = (event) => { - const selectedFile = event.target.files[0]; - setFile(selectedFile); - }; - - return ( - - - - Confirm - + const onSubmit = async(data) => { + setIsBtnLoading(true) + const formData = new FormData(); + + formData.append("investorAmount", data.investorAmount); + formData.append("comment", data.comment); + const file = data.supporting_FileName["0"]; + formData.append("supporting_FileName", file); + + + try { + const res = await updateDepositRequest({ id ,data: formData}) + + + if (res?.error) { + toast({ + render: () => ( + + ), + }); + setIsBtnLoading(false) + }else if(res?.data?.statusCode === 200) { + toast({ + render: () => ( + + ), + }); + setIsBtnLoading(false) + } + + } catch (error) { + + } + + heandleOnClose(); + }; + + const handleFileChange = (event) => { + const selectedFile = event.target.files[0]; + setFile(selectedFile); + }; + + const { data, isLoading } = + (id, { + skip: !id, + }); + + useEffect(() => { + if (data) { + reset({ + investorAmount: data?.data?.investorAmount, + }); + } + }, [data, reset]); + + const heandleOnClose = () =>{ + reset() + onClose() + } + + return ( + + + + + Confirm + + {isLoading ? ( + + ) : ( - - Deposit Amount + + Deposit Amount (SAR) - - - Fees - - {errors.fees && ( + {errors.investorAmount && ( - {errors.fees.message} + {errors.investorAmount.message} + + )} + + + Upload Supporting + + {errors.supporting_FileName && ( + + {errors.supporting_FileName.message} )} - Total Amount - Comments +