ionav updated
This commit is contained in:
116
package-lock.json
generated
116
package-lock.json
generated
@@ -14,6 +14,7 @@
|
||||
"@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",
|
||||
@@ -21,6 +22,7 @@
|
||||
"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",
|
||||
@@ -2565,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",
|
||||
@@ -2652,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",
|
||||
@@ -5130,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",
|
||||
@@ -5888,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",
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"@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",
|
||||
@@ -23,6 +24,7 @@
|
||||
"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",
|
||||
|
||||
39
src/Components/CurrencyInput.jsx
Normal file
39
src/Components/CurrencyInput.jsx
Normal file
@@ -0,0 +1,39 @@
|
||||
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 (
|
||||
<Input
|
||||
{...props}
|
||||
ref={ref} // Forward ref here
|
||||
type="text"
|
||||
value={formatCurrency(value)}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
export default CurrencyInput;
|
||||
@@ -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 (
|
||||
|
||||
@@ -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)}%`
|
||||
@@ -42,7 +46,7 @@ const DataTable = ({
|
||||
}
|
||||
key={index}
|
||||
p={3}
|
||||
width="120px" // Adjust width as needed
|
||||
width="20px" // Adjust width as needed
|
||||
color={"#004118"}
|
||||
whiteSpace="normal" // Allow text to wrap
|
||||
wordBreak="normal" // Ensure long words break properly
|
||||
@@ -56,7 +60,7 @@ const DataTable = ({
|
||||
</Thead>
|
||||
<Tbody className="web-text-small">
|
||||
{isLoading
|
||||
? Array.from({ length: 12 }).map((_, index) => (
|
||||
? Array.from({ length: TABLE_PAGINATION?.size }).map((_, index) => (
|
||||
<Tr key={index}>
|
||||
{tableHeadRow.map((_, i) => (
|
||||
<Td
|
||||
|
||||
55
src/Components/Doughnut/ApexDonut.jsx
Normal file
55
src/Components/Doughnut/ApexDonut.jsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import React, { useState } from 'react';
|
||||
import ApexCharts from 'react-apexcharts';
|
||||
|
||||
const ApexChart = ({ data }) => {
|
||||
|
||||
// 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, // Customize your colors here
|
||||
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 (
|
||||
<ApexCharts options={options} series={data?.values} type="donut" width={350} />
|
||||
);
|
||||
};
|
||||
|
||||
export default ApexChart;
|
||||
62
src/Components/Doughnut/ApexLine.jsx
Normal file
62
src/Components/Doughnut/ApexLine.jsx
Normal file
@@ -0,0 +1,62 @@
|
||||
import React from 'react';
|
||||
import ReactApexChart from 'react-apexcharts';
|
||||
|
||||
const ApexLine = () => {
|
||||
const [series] = React.useState([{
|
||||
name: 'Rate',
|
||||
data: [45, 23, 70, 65, 5, 34, 32]
|
||||
}]);
|
||||
|
||||
const 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: ['#FF0000'], // Marker (dot) color
|
||||
strokeColor: '#000000', // 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 (
|
||||
<ReactApexChart options={options} series={series} type="line" height={350} width={700} />
|
||||
);
|
||||
};
|
||||
|
||||
export default ApexLine;
|
||||
@@ -14,7 +14,7 @@ const DonutChart = ({ data, width = 300, height = 250 }) => {
|
||||
data: data.values,
|
||||
backgroundColor: [ '#3182ce', '#004118', '#D69E2E', '#E53E3E' ],
|
||||
borderColor: ['#FFF'],
|
||||
borderWidth: 1,
|
||||
borderWidth: 2,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -70,7 +70,6 @@ const LineChart = ({ width = 300, height = 250 }) => {
|
||||
]
|
||||
};
|
||||
|
||||
console.log(data);
|
||||
|
||||
|
||||
return (
|
||||
|
||||
@@ -12,9 +12,7 @@ const DummyComponent = () => {
|
||||
const handleToggle = () => {
|
||||
setIsSwitchOn(!isSwitchOn);
|
||||
if(audio.current){
|
||||
console.log("hit");
|
||||
audio.current.play();
|
||||
console.log( audio.current);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ 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];
|
||||
|
||||
@@ -474,7 +475,7 @@ const FormField = ({
|
||||
{...field}
|
||||
{...props}
|
||||
placeholder={placeHolder ? placeHolder : label}
|
||||
textAlign={arabic || type === "number" ? "right" : align ? align : "left"}
|
||||
textAlign={arabic ? "right" : align ? align : "left"}
|
||||
_placeholder={{ fontSize: "sm" }}
|
||||
min={type === "date" ? today : undefined}
|
||||
maxLength={maxLength}
|
||||
@@ -485,7 +486,27 @@ const FormField = ({
|
||||
/>
|
||||
);
|
||||
|
||||
} else{
|
||||
}else if(type === 'number'){
|
||||
return (
|
||||
<CurrencyInput
|
||||
position={'relative'}
|
||||
bg={"#F5F8F6"}
|
||||
focusBorderColor="forestGreen.300"
|
||||
size={"sm"}
|
||||
fontSize={"sm"}
|
||||
rounded={"sm"}
|
||||
{...field}
|
||||
{...props}
|
||||
placeholder={placeHolder ? placeHolder : label}
|
||||
textAlign={"right"}
|
||||
_placeholder={{ fontSize: "sm" }}
|
||||
maxLength={maxLength}
|
||||
// defaultValue={type === "date" && "2023-07-26" : undefined}
|
||||
// defaultValue={value}
|
||||
// value={dateValue}
|
||||
|
||||
/>
|
||||
);} else{
|
||||
return (
|
||||
<Input
|
||||
bg={"#F5F8F6"}
|
||||
|
||||
@@ -30,16 +30,16 @@ const FormInputView = ({
|
||||
<form>
|
||||
{Object?.entries(groupedFields, groupedFieldsTwo).map(
|
||||
([section, fields], index) => (
|
||||
<Box key={section}>
|
||||
<Box key={index}>
|
||||
<Heading as="h6" size="xs" mt={index === 0 ? 3 : 4}>
|
||||
{section}
|
||||
</Heading>
|
||||
{/* <Box display={"flex"} gap={0}> */}
|
||||
<Box width={"100%"} display={"flex"} flexWrap={"wrap"} gap={4}>
|
||||
<Box key={index} width={"100%"} display={"flex"} flexWrap={"wrap"} gap={4}>
|
||||
{fields.map(
|
||||
({ value, label, id, width, btn, arabic, type, align }, key) =>
|
||||
type === "table" ? (
|
||||
<Table w={"100%"} variant="simple">
|
||||
<Table key={id} w={"100%"} variant="simple">
|
||||
<Thead>
|
||||
<Tr>
|
||||
{value?.map((item, index) => (
|
||||
@@ -121,7 +121,7 @@ const FormInputView = ({
|
||||
</Tbody>
|
||||
</Table>
|
||||
) : (
|
||||
<Box w={!width ? "49%" : width}>
|
||||
<Box key={id} w={!width ? "49%" : width}>
|
||||
<FormLabel key={id} color={"gray.500"} fontSize={"xs"}>
|
||||
{label}
|
||||
</FormLabel>
|
||||
|
||||
@@ -35,7 +35,7 @@ const HeaderMain = ({
|
||||
|
||||
return (
|
||||
<Box
|
||||
className={` pt-3 pb-2 fw-400 border-bottom d-flex ${
|
||||
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)"}
|
||||
|
||||
@@ -1,6 +1,49 @@
|
||||
|
||||
import dns from "node:dns"
|
||||
|
||||
|
||||
export function getCountdownTimer(utcDateString) {
|
||||
// Parse the UTC datetime string into a Date object
|
||||
const targetDate = new Date(utcDateString);
|
||||
const now = new Date();
|
||||
|
||||
// Calculate the difference in milliseconds
|
||||
const difference = targetDate - now;
|
||||
|
||||
if (difference <= 0) {
|
||||
return 'The time has passed or is now!';
|
||||
}
|
||||
|
||||
// Convert the difference from milliseconds to a more readable format
|
||||
const seconds = Math.floor(difference / 1000);
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const days = Math.floor(hours / 24);
|
||||
|
||||
const remainingDays = days;
|
||||
const remainingHours = hours % 24;
|
||||
const remainingMinutes = minutes % 60;
|
||||
const remainingSeconds = seconds % 60;
|
||||
|
||||
return `${remainingDays === 0 ? "": remainingDays+"d"} ${remainingHours === 0 ? "": remainingHours+"h"} ${remainingMinutes}m `;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function startCountdown(utcDateString) {
|
||||
// Function to update the countdown
|
||||
const updateCountdown = () => {
|
||||
const countdown = getCountdownTimer(utcDateString);
|
||||
console.log(countdown);
|
||||
};
|
||||
|
||||
// Update countdown immediately
|
||||
updateCountdown();
|
||||
|
||||
// Set up interval to update countdown every minute (60000 milliseconds)
|
||||
setInterval(updateCountdown, 60000);
|
||||
}
|
||||
|
||||
export const getFileNameFromPath = (filePath) => {
|
||||
const parts = filePath?.split("/");
|
||||
return parts?.[parts?.length - 1];
|
||||
|
||||
@@ -46,7 +46,6 @@ const GlobalStateProvider = ({ children }) => {
|
||||
const [slideFromRight, setSlideFormRight] = useState(false);
|
||||
const { colorMode, toggleColorMode } = useColorMode();
|
||||
const [sponser, setSponser] = useState([]);
|
||||
const [ioStatus, setIoStatus] = useState([]);
|
||||
|
||||
const [investors, setInvestors] = useState([
|
||||
{
|
||||
@@ -1450,7 +1449,6 @@ const GlobalStateProvider = ({ children }) => {
|
||||
},
|
||||
]);
|
||||
|
||||
const [IODetails, setIODetails] = useState({});
|
||||
|
||||
const [depositRequest, setDepositRequest] = useState([
|
||||
{
|
||||
@@ -1724,6 +1722,17 @@ const GlobalStateProvider = ({ children }) => {
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ==============[ prod state ]===============================
|
||||
const [IODetails, setIODetails] = useState(null);
|
||||
const [ IOStatus, setIoStatus ] = useState(null)
|
||||
|
||||
return (
|
||||
<GlobalStateContext.Provider
|
||||
value={{
|
||||
@@ -1795,8 +1804,12 @@ const GlobalStateProvider = ({ children }) => {
|
||||
setAcademicDocuments,
|
||||
iOArtifactsTwo,
|
||||
setIOArtifactsTwo,
|
||||
ioStatus,
|
||||
setIoStatus,
|
||||
|
||||
|
||||
|
||||
|
||||
IOStatus,
|
||||
setIoStatus
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -72,6 +72,7 @@ import shield from "../assets/shield.png";
|
||||
import SplashScreen from "../Pages/SplashScreen";
|
||||
import CutomBreadcrumb from "../Components/CutomBreadcrumb";
|
||||
import CustomBreadcrumb from "../Components/CutomBreadcrumb";
|
||||
import { getCountdownTimer } from "../Constants/Constants";
|
||||
|
||||
const DashboardLayout = ({ isOnline }) => {
|
||||
const navigate = useNavigate();
|
||||
@@ -121,6 +122,9 @@ const DashboardLayout = ({ isOnline }) => {
|
||||
// dispach(loginUser(false));
|
||||
setIsAuthenticate(false);
|
||||
Cookies.remove("isAuthenticated");
|
||||
localStorage.removeItem('refreshToken')
|
||||
localStorage.removeItem('accessToken')
|
||||
localStorage.removeItem('refreshTokenExp')
|
||||
navigate("/login");
|
||||
};
|
||||
|
||||
@@ -598,7 +602,7 @@ const DashboardLayout = ({ isOnline }) => {
|
||||
</Accordion>
|
||||
</Box>
|
||||
|
||||
<Button
|
||||
{/* <Button
|
||||
colorScheme={"forestGreen"}
|
||||
rounded={"lg"}
|
||||
// onMouseOver={() => setIsDrawerOpen(true)}
|
||||
@@ -618,13 +622,9 @@ const DashboardLayout = ({ isOnline }) => {
|
||||
) : (
|
||||
<ArrowRightIcon className="web-text-small " />
|
||||
)}
|
||||
</Button>
|
||||
</Button> */}
|
||||
<Text textAlign={'center'} fontWeight={500} fontSize={'xs'} color={"gray.600"}>{getCountdownTimer(localStorage.getItem('accessTokenExp'))}</Text>
|
||||
|
||||
<Box
|
||||
id="google_translate_element"
|
||||
display="block"
|
||||
className="bg-danger"
|
||||
/>
|
||||
</aside>
|
||||
)}
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ const BankDetails = () => {
|
||||
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,
|
||||
|
||||
@@ -120,7 +120,6 @@ const Contact = () => {
|
||||
setIsLoading(true)
|
||||
try {
|
||||
const res = await updateContact(data)
|
||||
console.log(res?.data?.statusCode);
|
||||
if (res?.data?.statusCode === 200) {
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.data?.message} />,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Box, HStack, Icon, Text } from '@chakra-ui/react'
|
||||
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'
|
||||
@@ -13,6 +13,9 @@ 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'
|
||||
|
||||
const Dashbaord = () => {
|
||||
const navigate = useNavigate()
|
||||
@@ -48,15 +51,61 @@ const Dashbaord = () => {
|
||||
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 ? <FullscreenLoaders /> :
|
||||
<Box height={'100vh'} bg={'#fff'} roundedTop={0} mt={0}>
|
||||
<Box display={'flex'} gap={6} w={'100%'} pt={3} pb={3} p={3} >
|
||||
<Box position={'relative'} border={"#fff solid 1px"} cursor={'pointer'} onClick={() => navigate("/investor-details")} boxShadow={'lg'} color={"#fff"} p={4} rounded={'xl'} w={'25%'} display={'flex'} bg={'#004118'} flexDirection={'column'} alignItems={'start'} >
|
||||
<Box position={'relative'} cursor={'pointer'} onClick={() => navigate("/investor-details")} boxShadow={'lg'} color={"#fff"} p={4} rounded={'xl'} w={'25%'} display={'flex'} bg={'#004118'} flexDirection={'column'} alignItems={'start'} >
|
||||
<Icon bg={'#fff'} rounded={9} p={2} color={"#004118"} as={TbTransactionDollar} mb={6} boxSize={12} />
|
||||
<Text as={'span'} fontSize={'xs'}>Total Investors</Text>
|
||||
<Text as={'span'} fontSize={'36px'} fontWeight={700}>{investorDetails?.data?.totalItems}</Text>
|
||||
<Icon position={'absolute'} right={6} bottom={6} boxSize={12} as={PiChartLineUpDuotone} />
|
||||
|
||||
|
||||
{/* <ReactApexChart position={'absolute'} right={6} bottom={6} options={options1} series={series1} type="line" height={35} width={100} /> */}
|
||||
</Box>
|
||||
<Box position={'relative'} cursor={'pointer'} onClick={() => navigate("/view-io")} boxShadow={'lg'} bg={'#fff'} color={"#004118"} p={3} rounded={'xl'} w={'25%'} display={'flex'} flexDirection={'column'} alignItems={'start'} >
|
||||
<Icon bg={'#004118'} rounded={9} p={2} color={"#fff"} as={HiOutlineChartSquareBar} mb={6} boxSize={12} />
|
||||
@@ -77,22 +126,34 @@ const Dashbaord = () => {
|
||||
<Icon position={'absolute'} right={6} bottom={6} boxSize={12} as={PiChartLineUpDuotone} />
|
||||
</Box>
|
||||
</Box>
|
||||
<Box display={'flex'} pe={4} minH={450}>
|
||||
<Box w={'77%'} p={4} pe={6} pt={1} >
|
||||
<Box position={'relative'} boxShadow={'lg'} display={'flex'} justifyContent={'center'} rounded={'xl'} p={5}>
|
||||
<Text position={'absolute'} top={3} left={6} as={'span'} fontSize={'sm'}>Exchange rate currency</Text>
|
||||
<LineChart />
|
||||
<Box h={'45%'} display={'flex'} pe={4} >
|
||||
<Box w={'60%'} h={'100%'} p={4} pe={6} pt={1} >
|
||||
<Box position={'relative'} h={'100%'} boxShadow={'lg'} display={'flex'} justifyContent={'center'} rounded={'xl'} p={5} ps={0} pe={0}>
|
||||
<Text position={'absolute'} top={3} left={6} as={'span'} fontSize={'sm'}>Exchange rate currency</Text>
|
||||
<LineChart />
|
||||
{/* <ApexLine/> */}
|
||||
</Box>
|
||||
</Box>
|
||||
<Box boxShadow={'lg'} bg={'#fff'} rounded={'xl'} w={'23%'} display={'flex'} justifyContent={'space-between'} flexDirection={'column'} h={"fit-content"} mt={1} p={4}>
|
||||
|
||||
|
||||
|
||||
|
||||
<Box boxShadow={'lg'} bg={'#fff'} rounded={'xl'} w={'50%'} display={'flex'} justifyContent={'space-between'} flexDirection={'column'} h={"95%"} mt={1} p={4}>
|
||||
<Text as={'span'} fontSize={'sm'}>IO Status</Text>
|
||||
<Box display={'flex'} alignItems={'center'} h={420} >
|
||||
<DonutChart data={chartData} />
|
||||
<Box display={'flex'} w={'100%'} h={'100%'} alignItems={'center'} justifyContent={'space-around'} >
|
||||
{/* <Box display={'flex'} w={'70%'} alignItems={'center'} h={325} p={6}> */}
|
||||
{/* <DonutChart data={chartData} /> */}
|
||||
|
||||
<ApexChart data={chartData} />
|
||||
{/* </Box> */}
|
||||
<VStack alignItems={'start'} justifyContent={'center'} flexWrap={'wrap'}>
|
||||
{chartData?.labels?.map((item, index) => <Text key={index} as={'span'} display={'flex'} gap={0.5} alignItems={'center'} fontSize={'sm'} fontWeight={600}><GoDotFill color={chartData?.backgroundColor[index]} fontSize={30} />{item}</Text>)}
|
||||
</VStack>
|
||||
</Box>
|
||||
<HStack flexWrap={'wrap'} mt={3}>
|
||||
{chartData?.labels?.map((item, index) => <Text as={'span'} display={'flex'} gap={0.5} alignItems={'center'} fontSize={'xs'} fontWeight={600}><GoDotFill color={chartData?.backgroundColor[index]} fontSize={21} />{item}</Text>)}
|
||||
</HStack>
|
||||
</Box>
|
||||
|
||||
|
||||
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
|
||||
@@ -69,7 +69,6 @@ const DepositRequest = () => {
|
||||
error,
|
||||
} = useGetDepositRequestQuery({ page: currentPage, size: pageSize });
|
||||
|
||||
console.log(data?.data?.rows);
|
||||
|
||||
useEffect(() => {
|
||||
// Simulate loading
|
||||
|
||||
@@ -63,7 +63,7 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id }) => {
|
||||
|
||||
try {
|
||||
const res = await updateDepositRequest({ id ,data: formData})
|
||||
console.log(res);
|
||||
|
||||
|
||||
if (res?.error) {
|
||||
toast({
|
||||
@@ -86,13 +86,11 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id }) => {
|
||||
}
|
||||
|
||||
heandleOnClose();
|
||||
console.log(data);
|
||||
};
|
||||
|
||||
const handleFileChange = (event) => {
|
||||
const selectedFile = event.target.files[0];
|
||||
setFile(selectedFile);
|
||||
console.log(file);
|
||||
};
|
||||
|
||||
const { data, isLoading } =
|
||||
|
||||
@@ -48,7 +48,6 @@ const DepositRequestReject = ({ isOpen, onClose, firstField ,id}) => {
|
||||
setIsBtnLoading(true)
|
||||
try {
|
||||
const res = await depositReject({ id ,data})
|
||||
console.log(res?.data?.statusCode);
|
||||
|
||||
if (res?.error) {
|
||||
toast({
|
||||
|
||||
@@ -63,7 +63,6 @@ const DepositHistory = () => {
|
||||
isLoading: depositHistoryLoading,
|
||||
} = useGetDepositHistoryQuery({ page: currentPage, size: pageSize });
|
||||
|
||||
console.log(data?.data?.rows);
|
||||
|
||||
useEffect(() => {
|
||||
// Simulate loading
|
||||
|
||||
@@ -1,243 +1,248 @@
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Drawer,
|
||||
DrawerBody,
|
||||
DrawerCloseButton,
|
||||
DrawerContent,
|
||||
DrawerFooter,
|
||||
DrawerHeader,
|
||||
DrawerOverlay,
|
||||
FormControl,
|
||||
FormErrorMessage,
|
||||
FormLabel,
|
||||
Input,
|
||||
Stack,
|
||||
Textarea,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import * as yup from "yup";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useForm, Controller } from "react-hook-form";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import CustomAlertDialog from "../../../Components/CustomAlertDialog";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { useCreateVideoArtifactsMutation, useUpdateVideoArtifactsMutation } from "../../../Services/io.service";
|
||||
import { useParams } from "react-router-dom";
|
||||
import ToastBox from "../../../Components/ToastBox";
|
||||
|
||||
const investmentVideoSchema = yup.object().shape({
|
||||
transactionDate: yup.string().required("Artifact name is required"),
|
||||
ioTransType_xid: yup.number().required("Artifact name is required"),
|
||||
transactionAmount: yup.number().required("Artifact name is required"),
|
||||
comments: yup.string().notRequired(),
|
||||
Box,
|
||||
Button,
|
||||
Drawer,
|
||||
DrawerBody,
|
||||
DrawerCloseButton,
|
||||
DrawerContent,
|
||||
DrawerFooter,
|
||||
DrawerHeader,
|
||||
DrawerOverlay,
|
||||
FormControl,
|
||||
FormErrorMessage,
|
||||
FormLabel,
|
||||
Input,
|
||||
Select,
|
||||
Stack,
|
||||
Textarea,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import * as yup from "yup";
|
||||
import React, { useState, useEffect, useContext } from "react";
|
||||
import { useForm, Controller } from "react-hook-form";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import CustomAlertDialog from "../../../Components/CustomAlertDialog";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { useCreateIoCashMutation, useCreateVideoArtifactsMutation, useUpdateVideoArtifactsMutation } from "../../../Services/io.service";
|
||||
import { useParams } from "react-router-dom";
|
||||
import ToastBox from "../../../Components/ToastBox";
|
||||
import GlobalStateContext from "../../../Contexts/GlobalStateContext";
|
||||
import CurrencyInput from "../../../Components/CurrencyInput";
|
||||
|
||||
const cashDetails = yup.object().shape({
|
||||
transactionDate: yup.string().required("Artifact name is required"),
|
||||
ioTransType_xid: yup.number().required("Artifact name is required"),
|
||||
transactionAmount: yup.number().required("Artifact name is required"),
|
||||
comments: yup.string().notRequired(),
|
||||
});
|
||||
|
||||
const AddCashDetails = ({ isOpen, onClose, firstField, actionId, setActionId, data }) => {
|
||||
const params = useParams()
|
||||
const id = params?.id
|
||||
const [file, setFile] = useState("");
|
||||
const [fileName, setFileName] = useState("");
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [alert, setAlert] = useState(false);
|
||||
const toast = useToast();
|
||||
|
||||
|
||||
|
||||
// ======================[ Cotext Api ]
|
||||
const { IODetails } = useContext(GlobalStateContext);
|
||||
const found = data?.find((item) => item?.id === actionId);
|
||||
|
||||
|
||||
const [createArtifactsVideo] = useCreateVideoArtifactsMutation()
|
||||
const [updateVideoArtifacts] = useUpdateVideoArtifactsMutation()
|
||||
// const {
|
||||
// data
|
||||
// } = useGetArtifactsQuery(id)
|
||||
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
watch,
|
||||
reset,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
resolver: yupResolver(cashDetails),
|
||||
});
|
||||
|
||||
const AddCashDetails = ({ isOpen, onClose, firstField, actionId, setActionId, data}) => {
|
||||
const params = useParams()
|
||||
const id = params?.id
|
||||
const [file, setFile] = useState("");
|
||||
const [fileName, setFileName] = useState("");
|
||||
const [ isLoading, setIsLoading] = useState(false)
|
||||
const [alert, setAlert] = useState(false);
|
||||
const toast = useToast();
|
||||
|
||||
|
||||
const found = data?.find((item) => item?.id === actionId);
|
||||
console.log(found);
|
||||
|
||||
const [ createArtifactsVideo ] = useCreateVideoArtifactsMutation()
|
||||
const [ updateVideoArtifacts ] = useUpdateVideoArtifactsMutation()
|
||||
// const {
|
||||
// data
|
||||
// } = useGetArtifactsQuery(id)
|
||||
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
watch,
|
||||
reset,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
resolver: yupResolver(investmentVideoSchema),
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
console.log(data);
|
||||
|
||||
// setIsLoading(true)
|
||||
|
||||
|
||||
|
||||
// try {
|
||||
|
||||
|
||||
// if (found) {
|
||||
// const res = await updateVideoArtifacts({data, id: found?.id})
|
||||
// if (res?.data?.statusCode === 200) {
|
||||
// toast({
|
||||
// render: () => <ToastBox message={res?.data?.message} />,
|
||||
// });
|
||||
// setAlert(false);
|
||||
// setIsLoading(false)
|
||||
// handleClose();
|
||||
// }
|
||||
// } else {
|
||||
|
||||
// const res = await createArtifactsVideo({data, id})
|
||||
// if (res?.data?.statusCode === 200) {
|
||||
// toast({
|
||||
// render: () => <ToastBox message={res?.data?.message} />,
|
||||
// });
|
||||
// setAlert(false);
|
||||
// setIsLoading(false)
|
||||
// handleClose();
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// } catch (error) {
|
||||
// console.log(error);
|
||||
|
||||
// }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
const handleConfirm = () => {
|
||||
handleSubmit(onSubmit)();
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
handleSubmit(onSubmit)();
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
onClose()
|
||||
reset()
|
||||
|
||||
|
||||
const [createIoCash] = useCreateIoCashMutation()
|
||||
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
|
||||
setIsLoading(true)
|
||||
|
||||
try {
|
||||
|
||||
const res = await createIoCash({ data, id })
|
||||
if (res?.data?.statusCode === 200) {
|
||||
setIsLoading(false);
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.data?.message} />,
|
||||
});
|
||||
handleClose()
|
||||
}else if(res?.error?.status === 400){
|
||||
setIsLoading(false);
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.error?.data?.message } status={"error"} />,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Drawer
|
||||
size={"md"}
|
||||
isOpen={isOpen}
|
||||
placement="right"
|
||||
initialFocusRef={firstField}
|
||||
onClose={handleClose}
|
||||
>
|
||||
<DrawerOverlay />
|
||||
<DrawerContent>
|
||||
<DrawerCloseButton />
|
||||
<DrawerHeader fontSize={"sm"}>IO Cash Details</DrawerHeader>
|
||||
|
||||
<DrawerBody>
|
||||
<Stack spacing={4}>
|
||||
<FormControl isInvalid={errors.transactionDate}>
|
||||
<FormLabel fontSize={"sm"}>Date Selection</FormLabel>
|
||||
<Controller
|
||||
name="transactionDate"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input {...field} fontSize={"sm"} type="date" size={"sm"} />
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.transactionDate?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
<FormControl isInvalid={errors.ioTransType_xid}>
|
||||
<FormLabel fontSize={"sm"}>Cash transaction</FormLabel>
|
||||
<Controller
|
||||
name="ioTransType_xid"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input {...field} textAlign={'end'} fontSize={"sm"} type="number" size={"sm"} />
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.ioTransType_xid?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
|
||||
<FormControl isInvalid={errors.transactionAmount}>
|
||||
<FormLabel fontSize={"sm"}>Transaction Amount</FormLabel>
|
||||
<Controller
|
||||
name="transactionAmount"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input {...field} textAlign={'right'} fontSize={"sm"} type="number" size={"sm"} />
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.transactionAmount?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
<FormControl isInvalid={errors.comments}>
|
||||
<FormLabel fontSize={"sm"}>Comments</FormLabel>
|
||||
<Controller
|
||||
name="comments"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Textarea {...field} textAlign={'right'} fontSize={"sm"} type="text" size={"sm"} />
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.comments?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
</Stack>
|
||||
</DrawerBody>
|
||||
|
||||
<DrawerFooter>
|
||||
<Button
|
||||
variant="outline"
|
||||
colorScheme={"forestGreen"}
|
||||
rounded={"sm"}
|
||||
size={"sm"}
|
||||
mr={3}
|
||||
onClick={handleClose}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
colorScheme={"forestGreen"}
|
||||
rounded={"sm"}
|
||||
size={"sm"}
|
||||
|
||||
onClick={() => setAlert(true)}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</DrawerFooter>
|
||||
</DrawerContent>
|
||||
</Drawer>
|
||||
|
||||
|
||||
<CustomAlertDialog
|
||||
isOpen={alert}
|
||||
onClose={() => setAlert(false)}
|
||||
alertHandler={handleSave}
|
||||
message={"Are you sure you want to add cash details?"}
|
||||
isLoading={isLoading}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default AddCashDetails;
|
||||
|
||||
|
||||
|
||||
|
||||
const handleConfirm = () => {
|
||||
handleSubmit(onSubmit)();
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
handleSubmit(onSubmit)();
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
setAlert(false)
|
||||
onClose()
|
||||
reset()
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Drawer
|
||||
size={"md"}
|
||||
isOpen={isOpen}
|
||||
placement="right"
|
||||
initialFocusRef={firstField}
|
||||
onClose={handleClose}
|
||||
>
|
||||
<DrawerOverlay />
|
||||
<DrawerContent>
|
||||
<DrawerCloseButton />
|
||||
<DrawerHeader fontSize={"sm"}>IO Cash Details</DrawerHeader>
|
||||
|
||||
<DrawerBody>
|
||||
<Stack spacing={4}>
|
||||
<FormControl isInvalid={errors.transactionDate} isRequired>
|
||||
<FormLabel fontSize={"sm"}>Date Selection</FormLabel>
|
||||
<Controller
|
||||
name="transactionDate"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input {...field} fontSize={"sm"} type="date" size={"sm"} />
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.transactionDate?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
<FormControl isInvalid={errors.ioTransType_xid} isRequired>
|
||||
<FormLabel fontSize={"sm"}>Cash transaction</FormLabel>
|
||||
<Controller
|
||||
name="ioTransType_xid"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Select
|
||||
{...field}
|
||||
placeholder="Select an option"
|
||||
fontSize={"sm"}
|
||||
size={"sm"}
|
||||
>
|
||||
{IODetails?.ioCashTransaction?.map(({ id, transactionName }) => (
|
||||
<option key={id} value={id}>
|
||||
{transactionName}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.ioTransType_xid?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
|
||||
<FormControl isInvalid={errors.transactionAmount} isRequired>
|
||||
<FormLabel fontSize={"sm"}>Transaction Amount</FormLabel>
|
||||
<Controller
|
||||
name="transactionAmount"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<CurrencyInput {...field} textAlign={'right'} fontSize={"sm"} type="number" size={"sm"} />
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.transactionAmount?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
<FormControl isInvalid={errors.comments}>
|
||||
<FormLabel fontSize={"sm"}>Comments</FormLabel>
|
||||
<Controller
|
||||
name="comments"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Textarea {...field} textAlign={'right'} fontSize={"sm"} type="text" size={"sm"} />
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.comments?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
</Stack>
|
||||
</DrawerBody>
|
||||
|
||||
<DrawerFooter>
|
||||
<Button
|
||||
variant="outline"
|
||||
colorScheme={"forestGreen"}
|
||||
rounded={"sm"}
|
||||
size={"sm"}
|
||||
mr={3}
|
||||
onClick={handleClose}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
colorScheme={"forestGreen"}
|
||||
rounded={"sm"}
|
||||
size={"sm"}
|
||||
|
||||
onClick={() => setAlert(true)}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</DrawerFooter>
|
||||
</DrawerContent>
|
||||
</Drawer>
|
||||
|
||||
|
||||
<CustomAlertDialog
|
||||
isOpen={alert}
|
||||
onClose={() => setAlert(false)}
|
||||
alertHandler={handleSave}
|
||||
message={"Are you sure you want to add cash details?"}
|
||||
isLoading={isLoading}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default AddCashDetails;
|
||||
|
||||
@@ -91,15 +91,15 @@ const CreateIO = () => {
|
||||
height={"100vh"}
|
||||
pb={10}
|
||||
>
|
||||
<Box paddingInline={"12px"} mt={2}>
|
||||
{id && <Box paddingInline={"12px"} mt={2}>
|
||||
{/* <span
|
||||
onClick={() => navigate(-1)}
|
||||
style={{ fontSize: "15px", cursor: "pointer" }}
|
||||
>
|
||||
<ArrowBackIcon cursor={"pointer"} /> Back
|
||||
</span> */}
|
||||
<ViewIOdataHeader />
|
||||
</Box>
|
||||
<ViewIOdataHeader data={data?.data} />
|
||||
</Box>}
|
||||
<Tabs
|
||||
index={activeIndex}
|
||||
onChange={(index) => setActiveIndex(index)}
|
||||
|
||||
@@ -107,7 +107,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
setIsLoadingBtn(true);
|
||||
try {
|
||||
const res = await deleteVideoArtifacts(id);
|
||||
console.log(res?.data?.statusCode);
|
||||
if (res?.data?.statusCode === 200) {
|
||||
setDeleteAlertVideo(false);
|
||||
setIsLoadingBtn(false);
|
||||
@@ -121,7 +120,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
setIsLoadingBtn(true);
|
||||
try {
|
||||
const res = await deleteImageArtifacts(id);
|
||||
console.log(res?.data?.statusCode);
|
||||
if (res?.data?.statusCode === 200) {
|
||||
setDeleteAlertImage(false);
|
||||
setIsLoadingBtn(false);
|
||||
|
||||
@@ -30,21 +30,22 @@ const investmentVideoSchema = yup.object().shape({
|
||||
artifactStreamingURL: yup.string().required("Artifact streaming URL is required").url("Invalid URL format"),
|
||||
});
|
||||
|
||||
const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, data}) => {
|
||||
const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, data }) => {
|
||||
const params = useParams()
|
||||
const id = params?.id
|
||||
const [file, setFile] = useState("");
|
||||
const [fileName, setFileName] = useState("");
|
||||
const [ isLoading, setIsLoading] = useState(false)
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [alert, setAlert] = useState(false);
|
||||
const toast = useToast();
|
||||
|
||||
|
||||
const found = data?.find((item) => item?.id === actionId);
|
||||
console.log(found);
|
||||
console.log(actionId);
|
||||
|
||||
const [ createArtifactsVideo ] = useCreateVideoArtifactsMutation()
|
||||
const [ updateVideoArtifacts ] = useUpdateVideoArtifactsMutation()
|
||||
|
||||
const [createArtifactsVideo] = useCreateVideoArtifactsMutation()
|
||||
const [updateVideoArtifacts] = useUpdateVideoArtifactsMutation()
|
||||
// const {
|
||||
// data
|
||||
// } = useGetArtifactsQuery(id)
|
||||
@@ -63,7 +64,7 @@ const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, d
|
||||
|
||||
// useEffect to reset the form when `found` changes
|
||||
useEffect(() => {
|
||||
if (found) {
|
||||
if (found && actionId) {
|
||||
reset({
|
||||
artifactName: found?.artifactName,
|
||||
artifactStreamingURL: found?.artifactStreamingURL,
|
||||
@@ -71,8 +72,6 @@ const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, d
|
||||
}
|
||||
}, [found, reset]);
|
||||
|
||||
console.log(watch());
|
||||
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
setIsLoading(true)
|
||||
@@ -80,38 +79,39 @@ const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, d
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
|
||||
if (found) {
|
||||
const res = await updateVideoArtifacts({data, id: found?.id})
|
||||
const res = await updateVideoArtifacts({ data, id: found?.id })
|
||||
if (res?.data?.statusCode === 200) {
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.data?.message} />,
|
||||
});
|
||||
setAlert(false);
|
||||
setIsLoading(false)
|
||||
handleClose();
|
||||
});
|
||||
setAlert(false);
|
||||
setIsLoading(false)
|
||||
handleClose();
|
||||
}
|
||||
} else {
|
||||
|
||||
const res = await createArtifactsVideo({data, id})
|
||||
const res = await createArtifactsVideo({ data, id })
|
||||
if (res?.data?.statusCode === 200) {
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.data?.message} />,
|
||||
});
|
||||
setAlert(false);
|
||||
setIsLoading(false)
|
||||
handleClose();
|
||||
});
|
||||
setAlert(false);
|
||||
setIsLoading(false)
|
||||
setActionId(false);
|
||||
handleClose();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -128,12 +128,16 @@ const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, d
|
||||
onClose()
|
||||
reset()
|
||||
setActionId(false);
|
||||
reset({
|
||||
artifactName: "",
|
||||
artifactStreamingURL: "",
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Drawer
|
||||
size={"md"}
|
||||
size={"md"}
|
||||
isOpen={isOpen}
|
||||
placement="right"
|
||||
initialFocusRef={firstField}
|
||||
@@ -200,7 +204,7 @@ const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, d
|
||||
</DrawerContent>
|
||||
</Drawer>
|
||||
|
||||
|
||||
|
||||
<CustomAlertDialog
|
||||
isOpen={alert}
|
||||
onClose={() => setAlert(false)}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
HStack,
|
||||
@@ -14,7 +15,7 @@ import {
|
||||
} from "@chakra-ui/react";
|
||||
import React, { useContext, useEffect, useRef, useState } from "react";
|
||||
import { OPACITY_ON_LOAD } from "../../../Layout/animations";
|
||||
import DataTable from "../../../Components/DataTable/DataTable";
|
||||
import NormalTable from "../../../Components/DataTable/NormalTable";
|
||||
import Pagination from "../../../Components/Pagination";
|
||||
import GlobalStateContext from "../../../Contexts/GlobalStateContext";
|
||||
import CustomAlertDialog from "../../../Components/CustomAlertDialog";
|
||||
@@ -29,8 +30,7 @@ const IOCashDetails = () => {
|
||||
const toast = useToast();
|
||||
const firstField = useRef();
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const { caseDetails, setCaseDetails, slideFromRight } =
|
||||
useContext(GlobalStateContext);
|
||||
const { caseDetails, setCaseDetails, IODetails } = useContext(GlobalStateContext);
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [deleteAlert, setDeleteAlert] = useState(false);
|
||||
@@ -57,7 +57,7 @@ const IOCashDetails = () => {
|
||||
// Table setup
|
||||
const tableHeadRow = [
|
||||
"Date",
|
||||
"Particulars",
|
||||
"Transaction type",
|
||||
"Amount",
|
||||
"Comments",
|
||||
"Update by ",
|
||||
@@ -76,52 +76,52 @@ const IOCashDetails = () => {
|
||||
}, 300);
|
||||
|
||||
// Table filter
|
||||
const filteredData = caseDetails.filter((item) => {
|
||||
const name = item.date;
|
||||
const filteredData = IODetails?.ioCashHistory?.filter((item) => {
|
||||
const name = item.transactionType;
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
const nameMatches = name.toLowerCase().includes(searchLower);
|
||||
return nameMatches;
|
||||
});
|
||||
|
||||
|
||||
const [ extractedArray, setExtractedArray ] = useState(filteredData?.map((item, index) => ({
|
||||
const extractedArray = filteredData?.map((item, index) => ({
|
||||
id: item?.id,
|
||||
"Date": (
|
||||
<Text
|
||||
justifyContent={slideFromRight ? "right" : "center"}
|
||||
justifyContent={"center"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item.date}
|
||||
{item?.transactionDate}
|
||||
</Text>
|
||||
),
|
||||
"Particulars": (
|
||||
"Transaction type": (
|
||||
<Text
|
||||
justifyContent={slideFromRight ? "right" : "center"}
|
||||
justifyContent ={"center"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item.particulars}
|
||||
{item?.transactionType}
|
||||
</Text>
|
||||
),
|
||||
"Amount": (
|
||||
<Text
|
||||
justifyContent={slideFromRight ? "right" : "center"}
|
||||
justifyContent ={"center"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item.amount}
|
||||
{item.transactionAmount}
|
||||
</Text>
|
||||
),
|
||||
"Comments": (
|
||||
<Text
|
||||
justifyContent={slideFromRight ? "right" : "center"}
|
||||
justifyContent ={"center"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
@@ -132,18 +132,20 @@ const IOCashDetails = () => {
|
||||
),
|
||||
"Update by ": (
|
||||
<Text
|
||||
justifyContent={slideFromRight ? "right" : "center"}
|
||||
justifyContent ={"center"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
gap={2}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item.updateBy}
|
||||
|
||||
<Avatar size='sm' name={item.creator?.firstName} src={item.creator?.profilePhoto} />{item.creator?.firstName}
|
||||
</Text>
|
||||
),
|
||||
"Update On": (
|
||||
<Text
|
||||
justifyContent={slideFromRight ? "right" : "center"}
|
||||
justifyContent ={"center"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
@@ -152,7 +154,7 @@ const IOCashDetails = () => {
|
||||
{item.updateOn}
|
||||
</Text>
|
||||
),
|
||||
})));
|
||||
}));
|
||||
|
||||
const handleDelete = () => {
|
||||
const updatedSponsors = sponser.filter(
|
||||
@@ -266,17 +268,16 @@ const IOCashDetails = () => {
|
||||
/>
|
||||
|
||||
|
||||
<Button onClick={onOpen} leftIcon={<AddIcon/>} colorScheme="forestGreen" size={'sm'} rounded={'sm'} fontSize={'xs'} >Add</Button>
|
||||
{IODetails?.isInvestedAmount ? <Button onClick={onOpen} leftIcon={<AddIcon/>} colorScheme="forestGreen" size={'sm'} rounded={'sm'} fontSize={'xs'} >Add IO Cash</Button>:null}
|
||||
|
||||
</HStack>
|
||||
</Box>
|
||||
|
||||
<DataTable
|
||||
<NormalTable
|
||||
centered={true}
|
||||
emptyMessage={`We don't have any Sponers`}
|
||||
tableHeadRow={tableHeadRow}
|
||||
data={extractedArray}
|
||||
setData={setExtractedArray}
|
||||
isLoading={isLoading}
|
||||
viewActionId={actionId}
|
||||
setViewActionId={setActionId}
|
||||
|
||||
@@ -59,6 +59,11 @@ const schema = yup.object().shape({
|
||||
.required("Description in Arabic is required")
|
||||
.min(10, "Description in Arabic must be at least 10 characters long")
|
||||
.max(2000, "Description in Arabic must be at most 500 characters long"),
|
||||
expectedReturnArabic: yup
|
||||
.string()
|
||||
.required("Expected return in Arabic is required")
|
||||
.min(10, "Expected return in Arabic must be at least 10 characters long")
|
||||
.max(2000, "Expected return in Arabic must be at most 500 characters long"),
|
||||
|
||||
goalAmount: yup
|
||||
.number()
|
||||
@@ -72,6 +77,7 @@ const schema = yup.object().shape({
|
||||
.min(new Date(), "Closing date cannot be in the past"),
|
||||
|
||||
holdingPeriod: yup.string().required("Holding period is required"),
|
||||
holdingPeriodArabic: yup.string().required("Holding period is required"),
|
||||
|
||||
// minInvestmentAmount: yup
|
||||
// .number()
|
||||
@@ -117,7 +123,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
||||
const id = params?.id;
|
||||
|
||||
// ======================[ Cotext Api ]
|
||||
const { investmentType, sponser, IODetails, setIODetails } =
|
||||
const { investmentType, sponser, setIOStatus, setIODetails } =
|
||||
useContext(GlobalStateContext);
|
||||
|
||||
// ======================[ RTK Querry Api ]
|
||||
@@ -129,6 +135,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
||||
} = useGetIOByIdQuery(id, { skip: !id });
|
||||
|
||||
|
||||
|
||||
|
||||
const [creatIO] = useCreateIOMutation();
|
||||
const [updateIO] = useUpdateIOMutation();
|
||||
@@ -209,9 +216,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
||||
comment: IObyID?.data?.comment,
|
||||
expectedReturn: IObyID?.data?.expectedReturn,
|
||||
investmentType_xid: IObyID?.data?.investmentType_xid,
|
||||
investmentType_xid: IObyID?.data?.investmentType_xid,
|
||||
InvestmentDetails: IObyID?.data?.InvestmentDetails,
|
||||
minInvestmentAmount: IObyID?.data?.minInvestmentAmount,
|
||||
holdingPeriodArabic: IObyID?.data?.minInvestmentAmount,
|
||||
expectedReturnArabic: IObyID?.data?.minInvestmentAmount,
|
||||
});
|
||||
}
|
||||
}, [id, IObyID]);
|
||||
@@ -262,6 +270,51 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
||||
width: "49%",
|
||||
|
||||
},
|
||||
{
|
||||
label: "Holding Period",
|
||||
name: "holdingPeriod",
|
||||
type: "text",
|
||||
placeHolder: "1Y",
|
||||
isRequired: true,
|
||||
section: " ",
|
||||
width: "49%",
|
||||
value: IObyID?.data?.holdingPeriod,
|
||||
},
|
||||
{
|
||||
label: "Holding Period (Arabic)",
|
||||
name: "holdingPeriodArabic",
|
||||
type: "text",
|
||||
placeHolder: "1Y",
|
||||
isRequired: true,
|
||||
arabic: true,
|
||||
section: " ",
|
||||
width: "49%",
|
||||
value: IObyID?.data?.holdingPeriodArabic,
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
label: "Expected Return",
|
||||
name: "expectedReturn",
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
section: " ",
|
||||
width: "49%",
|
||||
value: IObyID?.data?.expectedReturn,
|
||||
},
|
||||
|
||||
{
|
||||
label: "Expected Return (Arabic)",
|
||||
name: "expectedReturnArabic",
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
arabic: true,
|
||||
section: " ",
|
||||
width: "49%",
|
||||
value: IObyID?.data?.expectedReturnArabic,
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
label: "Investment Type",
|
||||
placeHolder: "Select option",
|
||||
@@ -305,25 +358,6 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
||||
dateValue:formatDatee(IObyID?.data?.closingDate),
|
||||
// helperText: IObyID && `Current closing date is : ${formatDate(IObyID?.data?.closingDate)}`
|
||||
},
|
||||
{
|
||||
label: "Holding Period",
|
||||
name: "holdingPeriod",
|
||||
type: "text",
|
||||
placeHolder: "1Y",
|
||||
isRequired: true,
|
||||
section: " ",
|
||||
width: "32.3%",
|
||||
value: IObyID?.data?.holdingPeriod,
|
||||
},
|
||||
{
|
||||
label: "Expected Return",
|
||||
name: "expectedReturn",
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
section: " ",
|
||||
width: "32.3%",
|
||||
value: IObyID?.data?.expectedReturn,
|
||||
},
|
||||
{
|
||||
label: "ISIN",
|
||||
placeHolder: "",
|
||||
@@ -352,7 +386,6 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
||||
width: "100%",
|
||||
isRequired: true,
|
||||
options: investmentTypeOptions,
|
||||
type: "table",
|
||||
handleInputChange: handleInputChange,
|
||||
value: values,
|
||||
},
|
||||
|
||||
@@ -36,7 +36,6 @@ import { TbFileTypeDocx } from "react-icons/tb";
|
||||
import SetDisplayOrder from "./SetDisplayOrder";
|
||||
|
||||
const downloadFile = (filePath, fileName) => {
|
||||
console.log("https://tanami.betadelivery.com/" + filePath);
|
||||
|
||||
fetch("https://tanami.betadelivery.com/" + filePath)
|
||||
.then((response) => {
|
||||
@@ -72,10 +71,10 @@ const downloadFile = (filePath, fileName) => {
|
||||
});
|
||||
};
|
||||
|
||||
const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
|
||||
const InvestmentDocument = ({ control, errors, enableNextTab, index, }) => {
|
||||
const params = useParams();
|
||||
const id = params?.id;
|
||||
const { slideFromRight, create, setCreate } = useContext(GlobalStateContext);
|
||||
const { slideFromRight, create, setCreate, IODetails } = useContext(GlobalStateContext);
|
||||
const firstField = useRef();
|
||||
const secondField = useRef();
|
||||
const thirdField = useRef();
|
||||
@@ -101,13 +100,18 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
|
||||
|
||||
const [deleteIODocs] = useDeleteIODocsMutation();
|
||||
|
||||
const {
|
||||
data,
|
||||
error,
|
||||
isLoading: isIODocLoading,
|
||||
} = useGetInvestmentDocumentsQuery(id, {
|
||||
skip: !id,
|
||||
});
|
||||
// const {
|
||||
// data,
|
||||
// error,
|
||||
// isLoading: isIODocLoading,
|
||||
// } = useGetInvestmentDocumentsQuery(id, {
|
||||
// skip: !id,
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const tableHeadRow = ["Sr.no", "Type", "File Name", "Document", "Action"];
|
||||
|
||||
@@ -126,7 +130,7 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
|
||||
});
|
||||
}, 300);
|
||||
|
||||
const filteredData = data?.data?.filter((item) =>
|
||||
const filteredData = IODetails?.documents?.filter((item) =>
|
||||
item?.documentName?.toLowerCase().includes(searchTerm.toLowerCase())
|
||||
);
|
||||
|
||||
@@ -319,7 +323,7 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
|
||||
secondField={secondField}
|
||||
/>
|
||||
<InvestmentEdit
|
||||
data={data?.data}
|
||||
data={IODetails?.documents}
|
||||
id={actionId}
|
||||
isOpen={isEditOpen}
|
||||
onClose={onEditClose}
|
||||
|
||||
@@ -38,16 +38,16 @@ const KeyMerits = ({ enableNextTab, index, data: prepopData }) => {
|
||||
const toast = useToast();
|
||||
const params = useParams();
|
||||
|
||||
// =====================[ variables ]
|
||||
// =====================[ variables ]
|
||||
const id = params?.id;
|
||||
const { data, isLoading, error } = useGetKeyMeritsQuery(id, {
|
||||
skip: !id,
|
||||
});
|
||||
// const { data, isLoading, error } = useGetKeyMeritsQuery(id, {
|
||||
// skip: !id,
|
||||
// });
|
||||
|
||||
console.log(data?.data);
|
||||
const { IODetails} = useContext(GlobalStateContext);
|
||||
|
||||
const { keyMerits, setKeyMerits, slideFromRight } =
|
||||
useContext(GlobalStateContext);
|
||||
|
||||
|
||||
|
||||
const firstField = useRef();
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
@@ -66,20 +66,9 @@ const KeyMerits = ({ enableNextTab, index, data: prepopData }) => {
|
||||
|
||||
const tableHeadRow = ["Sr.no", "Title", "Sub title", "Icon", "Action"];
|
||||
|
||||
const handleUpdateStatus = debounce((id) => {
|
||||
setKeyMerits((prevKeyMerits) =>
|
||||
prevKeyMerits.map((keyMerits) =>
|
||||
keyMerits.id === id
|
||||
? { ...keyMerits, status: !keyMerits.status }
|
||||
: keyMerits
|
||||
)
|
||||
);
|
||||
toast({
|
||||
render: () => <ToastBox message={"Status changed succesfully.!"} />,
|
||||
});
|
||||
}, 300);
|
||||
|
||||
const filteredData = data?.data?.filter((item) => {
|
||||
|
||||
const filteredData = IODetails?.keyMerits?.filter((item) => {
|
||||
// Filter by name (case insensitive)
|
||||
const name = item.meritsHeader;
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
@@ -111,7 +100,7 @@ const KeyMerits = ({ enableNextTab, index, data: prepopData }) => {
|
||||
id: item.id,
|
||||
"Sr.no": (
|
||||
<Text
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
justifyContent={"left"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
@@ -122,7 +111,7 @@ const KeyMerits = ({ enableNextTab, index, data: prepopData }) => {
|
||||
),
|
||||
Title: (
|
||||
<Text
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
justifyContent={"left"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
@@ -224,7 +213,7 @@ const KeyMerits = ({ enableNextTab, index, data: prepopData }) => {
|
||||
),
|
||||
}));
|
||||
|
||||
return isLoading ? (
|
||||
return false ? (
|
||||
<FullscreenLoaders />
|
||||
) : (
|
||||
<Box>
|
||||
@@ -269,7 +258,7 @@ const KeyMerits = ({ enableNextTab, index, data: prepopData }) => {
|
||||
isOpen={isEditOpen}
|
||||
onClose={onEditCloseOpen}
|
||||
firstField={firstField}
|
||||
data={data?.data}
|
||||
data={IODetails?.keyMerits}
|
||||
/>
|
||||
</Box>
|
||||
<DataTable
|
||||
|
||||
@@ -39,13 +39,8 @@ const InvestmentEdit = ({ isOpen, onClose, thirdField, id, data }) => {
|
||||
const [updateInvestmentDocuments] = useUpdateInvestmentDocumentsMutation();
|
||||
|
||||
// =====================[ variables ]
|
||||
// const id = params?.id;
|
||||
console.log(id);
|
||||
console.log(data);
|
||||
const filterObject = data?.find((item) => item?.id === id);
|
||||
|
||||
console.log(filterObject);
|
||||
|
||||
const getFileTitle = (type) => {
|
||||
switch (type) {
|
||||
case "application/pdf":
|
||||
@@ -74,12 +69,16 @@ const InvestmentEdit = ({ isOpen, onClose, thirdField, id, data }) => {
|
||||
resolver: yupResolver(investmentDocSchema),
|
||||
});
|
||||
|
||||
console.log(errors);
|
||||
|
||||
|
||||
// useEffect to reset the form when `found` changes
|
||||
useEffect(() => {
|
||||
if (filterObject) {
|
||||
reset({
|
||||
document: filterObject?.documentPath,
|
||||
fileName: filterObject?.documentName,
|
||||
documentNameArabic: filterObject?.documentNameArabic,
|
||||
});
|
||||
}
|
||||
}, [filterObject, reset]);
|
||||
@@ -89,6 +88,7 @@ const InvestmentEdit = ({ isOpen, onClose, thirdField, id, data }) => {
|
||||
reset({
|
||||
fileName: filteredObject?.fileName,
|
||||
document: filteredObject?.document,
|
||||
documentNameArabic: filterObject?.documentNameArabic,
|
||||
Type: filteredObject?.Type,
|
||||
});
|
||||
}
|
||||
@@ -158,6 +158,7 @@ const InvestmentEdit = ({ isOpen, onClose, thirdField, id, data }) => {
|
||||
if (Object.keys(errors).length === 0) {
|
||||
const formData = new FormData();
|
||||
formData.append("documentName", data.fileName);
|
||||
formData.append("documentNameArabic", data.documentNameArabic);
|
||||
typeof data?.document !== "string"
|
||||
? formData.append("document", data?.document[0])
|
||||
: null;
|
||||
@@ -171,7 +172,6 @@ const InvestmentEdit = ({ isOpen, onClose, thirdField, id, data }) => {
|
||||
setFile(selectedFile);
|
||||
};
|
||||
|
||||
console.log(filteredObject);
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
@@ -200,6 +200,27 @@ const InvestmentEdit = ({ isOpen, onClose, thirdField, id, data }) => {
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
|
||||
<FormControl mb={4} isRequired>
|
||||
<FormLabel fontSize="sm">File Name ( Arabic )</FormLabel>
|
||||
<Input
|
||||
name="documentNameArabic"
|
||||
{...register("documentNameArabic")}
|
||||
fontSize="sm"
|
||||
type="text"
|
||||
size="sm"
|
||||
textAlign={'right'}
|
||||
/>
|
||||
{errors.documentNameArabic && (
|
||||
<Text mt={1} fontSize="xs" fontWeight={500} color="red">
|
||||
{errors.documentNameArabic.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
<FormControl mb={4} isInvalid={errors.Type}>
|
||||
<FormLabel fontSize="sm">Document</FormLabel>
|
||||
<Input
|
||||
@@ -209,6 +230,7 @@ const InvestmentEdit = ({ isOpen, onClose, thirdField, id, data }) => {
|
||||
className="form-control"
|
||||
type="file"
|
||||
size="sm"
|
||||
accept=".pdf, .doc, .docx"
|
||||
onChange={handleFileChange}
|
||||
/>
|
||||
{errors.document && (
|
||||
|
||||
@@ -41,8 +41,6 @@ const IOArtifactsAdd = ({
|
||||
setActionId,
|
||||
data,
|
||||
}) => {
|
||||
console.log(actionId);
|
||||
console.log(data);
|
||||
const params = useParams();
|
||||
const id = params?.id;
|
||||
const [file, setFile] = useState(null);
|
||||
@@ -55,7 +53,7 @@ const IOArtifactsAdd = ({
|
||||
const [updateImageArtifacts] = useUpdateImageArtifactsMutation();
|
||||
|
||||
const found = data?.find((item) => item?.id === actionId);
|
||||
console.log(found);
|
||||
|
||||
|
||||
const {
|
||||
control,
|
||||
@@ -78,7 +76,6 @@ const IOArtifactsAdd = ({
|
||||
}
|
||||
}, [found, reset]);
|
||||
|
||||
console.log(watch());
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
setIsLoading(true);
|
||||
@@ -86,19 +83,12 @@ const IOArtifactsAdd = ({
|
||||
formData.append("artifactName", data.artifactName);
|
||||
|
||||
file && formData.append("artifactPathName", file); // Assuming artifactPathName is an array of files
|
||||
|
||||
console.log("FormData:", formData);
|
||||
for (let [key, value] of formData.entries()) {
|
||||
console.log(`${key}:`, value);
|
||||
}
|
||||
|
||||
try {
|
||||
if (found) {
|
||||
const res = await updateImageArtifacts({
|
||||
data: formData,
|
||||
id: found?.id,
|
||||
});
|
||||
console.log(res?.error);
|
||||
if (res?.data?.statusCode === 200) {
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.data?.message} />,
|
||||
|
||||
@@ -59,6 +59,7 @@ export const investmentDocSchema = yup.object().shape({
|
||||
// return value && value.size <= 2 * 1024 * 1024; // 2MB in bytes
|
||||
// })
|
||||
fileName: yup.string().required("File name is required"),
|
||||
documentNameArabic: yup.string().required("File name Arabic is required")
|
||||
});
|
||||
|
||||
const InvestmentDocuments = ({
|
||||
@@ -94,11 +95,10 @@ const InvestmentDocuments = ({
|
||||
});
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
console.log("sibmited");
|
||||
console.log(errors);
|
||||
if (Object.keys(errors).length === 0) {
|
||||
const formData = new FormData();
|
||||
formData.append("documentName", data.fileName);
|
||||
formData.append("documentNameArabic", data.documentNameArabic);
|
||||
formData.append("document", data?.document[0]);
|
||||
setFormData(formData);
|
||||
setAlert(true);
|
||||
@@ -109,7 +109,7 @@ const InvestmentDocuments = ({
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const res = await createInvestmentDocument({ data: formData, id });
|
||||
console.log(res);
|
||||
|
||||
if (res?.error) {
|
||||
toast({
|
||||
render: () => (
|
||||
@@ -214,6 +214,27 @@ const InvestmentDocuments = ({
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
|
||||
<FormControl mb={4} isRequired>
|
||||
<FormLabel fontSize="sm">File Name ( Arabic )</FormLabel>
|
||||
<Input
|
||||
name="documentNameArabic"
|
||||
{...register("documentNameArabic")}
|
||||
fontSize="sm"
|
||||
type="text"
|
||||
size="sm"
|
||||
textAlign={'right'}
|
||||
/>
|
||||
{errors.documentNameArabic && (
|
||||
<Text mt={1} fontSize="xs" fontWeight={500} color="red">
|
||||
{errors.documentNameArabic.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
<FormControl mb={4} isRequired>
|
||||
<FormLabel fontSize="sm">Document</FormLabel>
|
||||
<Input
|
||||
|
||||
@@ -71,7 +71,6 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
|
||||
const onSubmit = (data) => {
|
||||
if (Object.keys(errors).length === 0) {
|
||||
console.log("hit");
|
||||
setFormData(data);
|
||||
setAlert(true);
|
||||
}
|
||||
@@ -135,7 +134,6 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
|
||||
const handleFileChange = (e) => {
|
||||
const file = e.target.files[0];
|
||||
console.log(file);
|
||||
if (file) {
|
||||
setFile(URL.createObjectURL(file));
|
||||
}
|
||||
@@ -296,12 +294,12 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
}
|
||||
>
|
||||
<Box display="flex" alignItems="center">
|
||||
<Image
|
||||
{selectedImageIcon && <Image
|
||||
src={`https://tanami.betadelivery.com/${selectedImageIcon}`}
|
||||
alt={selectedImageIcon}
|
||||
boxSize="1rem"
|
||||
mr="12px"
|
||||
/>{" "}
|
||||
/>}{" "}
|
||||
<Text as={"span"} fontSize={"sm"} fontWeight={500}>
|
||||
{selectedIcon}
|
||||
</Text>
|
||||
|
||||
@@ -133,7 +133,6 @@ const KeyMeritsEdit = ({
|
||||
handleSubmit(onSubmit)();
|
||||
};
|
||||
|
||||
console.log(errors);
|
||||
|
||||
const handleIconSelect = (id, iconName, iconFilePath) => {
|
||||
setValue("icon_xid", id);
|
||||
@@ -280,12 +279,12 @@ const KeyMeritsEdit = ({
|
||||
}
|
||||
>
|
||||
<Box display="flex" alignItems="center">
|
||||
<Image
|
||||
{selectedImageIcon&&<Image
|
||||
src={`https://tanami.betadelivery.com/${selectedImageIcon}`}
|
||||
alt={selectedImageIcon}
|
||||
boxSize="1rem"
|
||||
mr="12px"
|
||||
/>{" "}
|
||||
/>}{" "}
|
||||
<Text as={"span"} fontSize={"sm"} fontWeight={500}>
|
||||
{selectedIcon}
|
||||
</Text>
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
Box,
|
||||
Button,
|
||||
FormControl,
|
||||
FormErrorMessage,
|
||||
FormLabel,
|
||||
Input,
|
||||
Modal,
|
||||
@@ -11,52 +12,168 @@ import {
|
||||
ModalFooter,
|
||||
ModalHeader,
|
||||
ModalOverlay,
|
||||
Select,
|
||||
Stack,
|
||||
Text,
|
||||
Textarea,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import { useContext, useState } from "react";
|
||||
import * as yup from "yup";
|
||||
import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import CurrencyInput from "../../../../Components/CurrencyInput";
|
||||
import { useCreateIoNavMutation } from "../../../../Services/io.service";
|
||||
import ToastBox from "../../../../Components/ToastBox";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { formatDatee } from "../../../../Components/FormField";
|
||||
|
||||
const ioNav = yup.object().shape({
|
||||
transactionDate: yup.string().required("Artifact name is required"),
|
||||
ioTransType_xid: yup.number().required("Artifact name is required"),
|
||||
transactionAmount: yup.number().required("Artifact name is required"),
|
||||
comments: yup.string().notRequired(),
|
||||
});
|
||||
|
||||
const UpdateIONav = ({ isOpen, onClose }) => {
|
||||
const params = useParams()
|
||||
const toast = useToast();
|
||||
const id = params?.id
|
||||
const { IODetails } = useContext(GlobalStateContext);
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
watch,
|
||||
reset,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
resolver: yupResolver(ioNav),
|
||||
});
|
||||
|
||||
|
||||
const [createIoNav] = useCreateIoNavMutation()
|
||||
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const res = await createIoNav({ data, id })
|
||||
if (res?.data?.statusCode === 201) {
|
||||
setIsLoading(false);
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.data?.message} />,
|
||||
});
|
||||
handleClose()
|
||||
} else if (res?.error?.status === 400) {
|
||||
setIsLoading(false);
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.error?.data?.message} status={"error"} />,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const handleClose = () => {
|
||||
onClose()
|
||||
reset()
|
||||
}
|
||||
|
||||
|
||||
const today = formatDatee(new Date(), 'yyyy-MM-dd');
|
||||
|
||||
|
||||
return (
|
||||
<Modal isOpen={isOpen} onClose={onClose}>
|
||||
<ModalOverlay />
|
||||
<ModalContent>
|
||||
<ModalContent as={'form'} onSubmit={handleSubmit(onSubmit)} >
|
||||
<ModalHeader fontSize={'md'}>Update iO NAV Transaction</ModalHeader>
|
||||
<ModalCloseButton />
|
||||
<ModalBody>
|
||||
<FormControl mb={"15px"}>
|
||||
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
|
||||
Date
|
||||
</FormLabel>
|
||||
<Input
|
||||
placeholder="Select Date"
|
||||
size="sm"
|
||||
rounded={'sm'}
|
||||
fontSize={"sm"}
|
||||
focusBorderColor="forestGreen.300"
|
||||
type="date"
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
<FormControl mb={"15px"} >
|
||||
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>Amount</FormLabel>
|
||||
<Input
|
||||
size="sm"
|
||||
rounded={'sm'}
|
||||
textAlign={'end'}
|
||||
focusBorderColor="forestGreen.300"
|
||||
fontSize={"sm"} placeholder="$00.00" />
|
||||
</FormControl>
|
||||
<Stack spacing={4}>
|
||||
<FormControl isInvalid={errors.transactionDate} isRequired>
|
||||
<FormLabel fontSize={"sm"}>Date Selection</FormLabel>
|
||||
<Controller
|
||||
name="transactionDate"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input {...field}
|
||||
max={today} // Set max attribute to today’s date
|
||||
fontSize={"sm"} type="date" size={"sm"} />
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.transactionDate?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
<FormControl mb={"15px"}>
|
||||
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
|
||||
Comments
|
||||
</FormLabel>
|
||||
<Textarea
|
||||
size="sm"
|
||||
rounded={'sm'}
|
||||
focusBorderColor="forestGreen.300"
|
||||
fontSize={"sm"} placeholder="Write Comments" />
|
||||
</FormControl>
|
||||
|
||||
<FormControl isInvalid={errors.ioTransType_xid} isRequired>
|
||||
<FormLabel fontSize={"sm"}>Cash transaction</FormLabel>
|
||||
<Controller
|
||||
name="ioTransType_xid"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Select
|
||||
{...field}
|
||||
placeholder="Select an option"
|
||||
fontSize={"sm"}
|
||||
size={"sm"}
|
||||
>
|
||||
{IODetails?.ioCashTransaction?.map(({ id, transactionName }) => (
|
||||
<option key={id} value={id}>
|
||||
{transactionName}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.ioTransType_xid?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
|
||||
<FormControl isInvalid={errors.transactionAmount} isRequired>
|
||||
<FormLabel fontSize={"sm"}>Transaction Amount</FormLabel>
|
||||
<Controller
|
||||
name="transactionAmount"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<CurrencyInput {...field} textAlign={'right'} fontSize={"sm"} type="number" size={"sm"} />
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.transactionAmount?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
<FormControl isInvalid={errors.comments}>
|
||||
<FormLabel fontSize={"sm"}>Comments</FormLabel>
|
||||
<Controller
|
||||
name="comments"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Textarea {...field} textAlign={'right'} fontSize={"sm"} type="text" size={"sm"} />
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.comments?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
</Stack>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button
|
||||
@@ -68,10 +185,12 @@ const UpdateIONav = ({ isOpen, onClose }) => {
|
||||
}}
|
||||
size={'sm'}
|
||||
rounded={"sm"}
|
||||
type="submit"
|
||||
isLoading={isLoading}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
<Button
|
||||
<Button
|
||||
size={'sm'}
|
||||
rounded={"sm"} mr={3} onClick={onClose}>
|
||||
Close
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
import { ChevronDownIcon } from "@chakra-ui/icons";
|
||||
import React, { useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
@@ -18,23 +18,29 @@ import {
|
||||
ModalOverlay,
|
||||
} from "@chakra-ui/react";
|
||||
import {
|
||||
useGetIOByIdQuery,
|
||||
useGetIOprepopulateDataQuery,
|
||||
useUpdateStatusIoMutation,
|
||||
} from "../../../../Services/io.service";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
const UpdateIOStatus = ({ isOpen, onClose }) => {
|
||||
const UpdateIOStatus = ({ isOpen, onClose , status}) => {
|
||||
const params = useParams();
|
||||
const id = params?.id;
|
||||
const [selectedItem, setSelectedItem] = useState("Open");
|
||||
const [selectedItem, setSelectedItem] = useState(status?.[0]?.statusAdmin);
|
||||
const [isLoadingg, setIsLoading] = useState(false);
|
||||
const { data, error, isLoading } = useGetIOprepopulateDataQuery();
|
||||
const [selectedStatusId, setSelectedStatusId] = useState(data?.data?.ioStatus[0]?.id);
|
||||
const [selectedStatusId, setSelectedStatusId] = useState(status?.[0]?.id);
|
||||
useEffect(() => {
|
||||
setSelectedItem(status?.[0]?.statusAdmin)
|
||||
setSelectedStatusId(status?.[0]?.id)
|
||||
}, [status])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const [updateStatusIo] = useUpdateStatusIoMutation();
|
||||
console.log(data?.data?.ioStatus);
|
||||
|
||||
console.log(data?.data?.ioStatus);
|
||||
|
||||
const handleMenuItemClick = (item, id) => {
|
||||
setSelectedItem(item);
|
||||
@@ -85,13 +91,15 @@ const UpdateIOStatus = ({ isOpen, onClose }) => {
|
||||
? "yellow"
|
||||
: selectedItem === "Open"
|
||||
? "forestGreen"
|
||||
: "red"
|
||||
: selectedItem === "Closed"
|
||||
? "red":null
|
||||
} py={"3px"} px={"8px"}>
|
||||
{selectedItem}
|
||||
{selectedItem ? selectedItem: "No action"}
|
||||
</Badge>
|
||||
</MenuButton>
|
||||
|
||||
<MenuList w={"400px"}>
|
||||
{data?.data?.ioStatus?.map(({ id, statusAdmin }) => (
|
||||
{status?.map(({ id, statusAdmin }) => (
|
||||
<MenuItem
|
||||
key={id}
|
||||
fontSize={"sm"}
|
||||
|
||||
@@ -37,6 +37,7 @@ import CustomAlertDialog from "../../../Components/CustomAlertDialog";
|
||||
import ToastBox from "../../../Components/ToastBox";
|
||||
import { useGetIOsQuery } from "../../../Services/io.service";
|
||||
import { TABLE_PAGINATION } from "../../../Constants/Paginations";
|
||||
import { formatCurrency } from "../../../Components/CurrencyInput";
|
||||
// import { debounce } from "./AddIOCharges";
|
||||
|
||||
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
|
||||
@@ -127,9 +128,9 @@ const ViewIOTable = () => {
|
||||
</Box>
|
||||
),
|
||||
"Goal Amount": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
|
||||
{item.goalAmount ? item.goalAmount : "---"}
|
||||
<Box w={"100%"} display={'flex'} alignItems={'center'} >
|
||||
<Text w={'100%'} textAlign={'center'} as={"span"} color={"teal.900"} fontWeight={"500"}>
|
||||
{item.goalAmount ? formatCurrency(item.goalAmount) : "---"}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
|
||||
@@ -40,14 +40,13 @@ import Cancle from "./HeaderModal/Cancle";
|
||||
import { AddIcon } from "@chakra-ui/icons";
|
||||
import { GrGallery } from "react-icons/gr";
|
||||
|
||||
const ViewIOdataHeader = () => {
|
||||
const ViewIOdataHeader = ({data}) => {
|
||||
const params = useParams();
|
||||
const id = params?.id;
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const btnRef = useRef();
|
||||
const { IODetails } = useContext(GlobalStateContext);
|
||||
|
||||
|
||||
|
||||
const {
|
||||
isOpen: isInvestmentOpen,
|
||||
onOpen: onInvestmentOpen,
|
||||
@@ -88,16 +87,13 @@ const ViewIOdataHeader = () => {
|
||||
onOpen: onCancleOpen,
|
||||
onClose: onCancleClose,
|
||||
} = useDisclosure();
|
||||
|
||||
const bg = {
|
||||
bg: "#fff",
|
||||
};
|
||||
|
||||
const hover = {
|
||||
textDecoration: "underline",
|
||||
background: "#fff",
|
||||
};
|
||||
|
||||
const style = {
|
||||
fontSize: "0.875rem",
|
||||
fontWeight: "400",
|
||||
@@ -111,45 +107,54 @@ const ViewIOdataHeader = () => {
|
||||
title:"Amount Invested",
|
||||
onClickFunction: onInvestmentOpen
|
||||
},
|
||||
{
|
||||
id:2,
|
||||
title:"Fees & Expenses",
|
||||
onClickFunction:onFeesOpen
|
||||
},
|
||||
{
|
||||
id:3,
|
||||
title:"Distribution from Sponsors",
|
||||
onClickFunction:onDistSponsorOpen
|
||||
},
|
||||
{
|
||||
id:4,
|
||||
title:"Distribution To investors",
|
||||
onClickFunction:onDistInvestorOpen
|
||||
},
|
||||
{
|
||||
id:5,
|
||||
title:"Update iO NAV",
|
||||
onClickFunction:onUpdateNavOpen
|
||||
},
|
||||
// {
|
||||
// id:2,
|
||||
// title:"Fees & Expenses",
|
||||
// onClickFunction:onFeesOpen
|
||||
// },
|
||||
// {
|
||||
// id:3,
|
||||
// title:"Distribution From Sponsors",
|
||||
// onClickFunction:onDistSponsorOpen
|
||||
// },
|
||||
{
|
||||
id:6,
|
||||
title:"Distribution To Investors",
|
||||
onClickFunction:onDistInvestorOpen
|
||||
},
|
||||
// {
|
||||
// id:5,
|
||||
// title:"Update IO NAV",
|
||||
// onClickFunction:onUpdateNavOpen
|
||||
// },
|
||||
{
|
||||
id:8,
|
||||
title:"Exit",
|
||||
onClickFunction:onExitOpen
|
||||
},
|
||||
{
|
||||
id:7,
|
||||
id:9,
|
||||
title:"Cancel",
|
||||
onClickFunction:onCancleOpen
|
||||
},
|
||||
{
|
||||
id:8,
|
||||
title:"Update iO status",
|
||||
id:10,
|
||||
title:"Update IO Status",
|
||||
onClickFunction:onUpdateStatusOpen
|
||||
},
|
||||
]
|
||||
|
||||
// console.log(IODetails?.mainTranscation);
|
||||
|
||||
|
||||
// Extract titles from apiTransaction
|
||||
const apiTransactionTitles = IODetails?.mainTranscation?.map(transaction => transaction.id);
|
||||
// Filter menu items
|
||||
const filteredMenu = menu?.filter(item => apiTransactionTitles?.includes(item.id));
|
||||
console.log(filteredMenu);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -202,7 +207,6 @@ const ViewIOdataHeader = () => {
|
||||
)}
|
||||
</Box>
|
||||
|
||||
|
||||
<Box display={"flex"} w={"auto"} flexDirection={"column"} gap={2}>
|
||||
<Text as={"span"} fontSize={"xs"} color={"gray.500"} fontWeight={"500"}>
|
||||
IO Name
|
||||
@@ -254,6 +258,7 @@ const ViewIOdataHeader = () => {
|
||||
: "---"}
|
||||
</Badge>
|
||||
</Box>
|
||||
|
||||
<Box display={"flex"} flexDirection={"column"} gap={2}>
|
||||
<Text as={"span"} fontSize={"xs"} color={"gray.500"} fontWeight={"500"}>
|
||||
IO NAV
|
||||
@@ -262,6 +267,7 @@ const ViewIOdataHeader = () => {
|
||||
{IODetails?.currentValuation ? IODetails?.currentValuation : "00.00"}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
<Box display={"flex"} flexDirection={"column"} gap={2}>
|
||||
<Text as={"span"} fontSize={"xs"} color={"gray.500"} fontWeight={"500"}>
|
||||
IO cash
|
||||
@@ -270,6 +276,7 @@ const ViewIOdataHeader = () => {
|
||||
{IODetails?.ioCash ? IODetails?.ioCash : "00.00"}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
<Box display={"flex"} flexDirection={"column"} gap={2}>
|
||||
<Text as={"span"} fontSize={"xs"} color={"gray.500"} fontWeight={"500"}>
|
||||
IO MV NAV
|
||||
@@ -309,11 +316,9 @@ const ViewIOdataHeader = () => {
|
||||
Tansaction
|
||||
</MenuItem>
|
||||
|
||||
{
|
||||
menu?.map(({id, title, onClickFunction})=><MenuItem key={id} onClick={onClickFunction} className="border-bottom">
|
||||
{menu?.map(({id, title, onClickFunction})=><MenuItem key={id} onClick={onClickFunction} className="border-bottom">
|
||||
{title}
|
||||
</MenuItem>)
|
||||
}
|
||||
</MenuItem>)}
|
||||
|
||||
|
||||
</MenuList>
|
||||
@@ -336,10 +341,12 @@ const ViewIOdataHeader = () => {
|
||||
/>
|
||||
<UpdateIONav isOpen={isUpdateNavOpen} onClose={onUpdateNavClose} />
|
||||
<UpdateIOStatus
|
||||
status={IODetails?.nextStatus}
|
||||
isOpen={isUpdateStatusOpen}
|
||||
onClose={onUpdateStatusClose}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@ import { useGetIOByIdQuery } from "../../../Services/io.service";
|
||||
import * as yup from "yup";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { formatDate } from "../../Master/Sponser/Sponsers";
|
||||
import { formatCurrency } from "../../../Components/CurrencyInput";
|
||||
|
||||
const schema = yup.object().shape({
|
||||
investmentNameEnglish: yup
|
||||
@@ -111,13 +112,11 @@ const ViewIOdetails = () => {
|
||||
comment: IObyID?.data?.comment,
|
||||
expectedReturn: IObyID?.data?.expectedReturn,
|
||||
investmentType_xid: IObyID?.data?.investmentType_xid,
|
||||
investmentType_xid: IObyID?.data?.investmentType_xid,
|
||||
InvestmentDetails: IObyID?.data?.InvestmentDetails,
|
||||
minInvestmentAmount: IObyID?.data?.minInvestmentAmount,
|
||||
});
|
||||
}
|
||||
}, [id, IObyID]);
|
||||
console.log(IObyID);
|
||||
|
||||
const minInvestmentById = IObyID?.data?.minInvestmentAmt?.map(({minInvestmentAmt, country, id})=>{
|
||||
return{
|
||||
@@ -177,6 +176,61 @@ const ViewIOdetails = () => {
|
||||
section: " ",
|
||||
width: "49%",
|
||||
},
|
||||
|
||||
{
|
||||
label: "Holding Period",
|
||||
name: "holdingPeriod",
|
||||
value: IObyID?.data?.holdingPeriod ? IObyID?.data?.holdingPeriod : "---",
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
placeHolder: "1Y",
|
||||
section: " ",
|
||||
width: "49%",
|
||||
},
|
||||
{
|
||||
label: "Holding Period (Arabic)",
|
||||
name: "holdingPeriodArabic",
|
||||
value: IObyID?.data?.holdingPeriodArabic ? IObyID?.data?.holdingPeriodArabic : "---",
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
arabic: true,
|
||||
placeHolder: "1Y",
|
||||
section: " ",
|
||||
width: "49%",
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
label: "Expected Return",
|
||||
placeHolder: "$00.00",
|
||||
name: "expectedReturn",
|
||||
type: "number",
|
||||
isRequired: true,
|
||||
value: IObyID?.data?.expectedReturn
|
||||
? IObyID?.data?.expectedReturn
|
||||
: "---",
|
||||
section: " ",
|
||||
width: "49%",
|
||||
},
|
||||
|
||||
{
|
||||
label: "Expected Return (Arabic)",
|
||||
name: "expectedReturnArabic",
|
||||
placeHolder: "$00.00",
|
||||
type: "number",
|
||||
isRequired: true,
|
||||
arabic: true,
|
||||
value: IObyID?.data?.expectedReturnArabic
|
||||
? IObyID?.data?.expectedReturnArabic
|
||||
: "---",
|
||||
section: " ",
|
||||
width: "49%",
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
label: "Investment Type",
|
||||
placeHolder: "Select option",
|
||||
@@ -204,10 +258,11 @@ const ViewIOdetails = () => {
|
||||
{
|
||||
label: "Goal Amount",
|
||||
placeHolder: "$00.00",
|
||||
value: IObyID?.data?.goalAmount ? IObyID?.data?.goalAmount : "---",
|
||||
value: IObyID?.data?.goalAmount ? formatCurrency(IObyID?.data?.goalAmount) : "---",
|
||||
name: "goalAmount",
|
||||
type: "number",
|
||||
isRequired: true,
|
||||
arabic:true,
|
||||
section: " ",
|
||||
width: "32.3%",
|
||||
},
|
||||
@@ -222,28 +277,6 @@ const ViewIOdetails = () => {
|
||||
section: " ",
|
||||
width: "32.3%",
|
||||
},
|
||||
{
|
||||
label: "Holding Period",
|
||||
name: "holdingPeriod",
|
||||
value: IObyID?.data?.holdingPeriod ? IObyID?.data?.holdingPeriod : "---",
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
placeHolder: "1Y",
|
||||
section: " ",
|
||||
width: "32.3%",
|
||||
},
|
||||
{
|
||||
label: "Expected Return",
|
||||
placeHolder: "$00.00",
|
||||
name: "expectedReturn",
|
||||
type: "number",
|
||||
isRequired: true,
|
||||
value: IObyID?.data?.expectedReturn
|
||||
? IObyID?.data?.expectedReturn
|
||||
: "---",
|
||||
section: " ",
|
||||
width: "32.3%",
|
||||
},
|
||||
{
|
||||
label: "ISIN",
|
||||
placeHolder: "$00.00",
|
||||
@@ -274,7 +307,6 @@ const ViewIOdetails = () => {
|
||||
section: " ",
|
||||
width: "100%",
|
||||
isRequired: true,
|
||||
type: "table",
|
||||
value: minInvestmentById,
|
||||
},
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ const InvestorDetails = () => {
|
||||
error,
|
||||
} = useGetInvestorsQuery({ page: currentPage, size: pageSize });
|
||||
|
||||
console.log(investorDetails);
|
||||
|
||||
useEffect(() => {
|
||||
// Simulate loading
|
||||
@@ -125,7 +124,6 @@ const InvestorDetails = () => {
|
||||
return nameMatches;
|
||||
});
|
||||
|
||||
console.log(investorDetails);
|
||||
|
||||
const extractedArray = filteredData?.map((item) => ({
|
||||
id: item?.id,
|
||||
|
||||
@@ -34,7 +34,6 @@ const ProfileView = () => {
|
||||
skip: !id,
|
||||
});
|
||||
|
||||
console.log(data?.data);
|
||||
|
||||
const foundObject = data?.data;
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ const Login = () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const res = await login(value).unwrap();
|
||||
console.log(res);
|
||||
|
||||
if (res?.statusCode === 200) {
|
||||
toast({
|
||||
|
||||
@@ -34,6 +34,7 @@ import { useGetAllExchangeRatesQuery } from "../../../Services/exchange.rate.ser
|
||||
import { TABLE_PAGINATION } from "../../../Constants/Paginations";
|
||||
import NormalTable from "../../../Components/DataTable/NormalTable";
|
||||
import { MdHistory } from "react-icons/md";
|
||||
import { formatCurrency } from "../../../Components/CurrencyInput";
|
||||
|
||||
const ExchangeRate = () => {
|
||||
const toast = useToast();
|
||||
@@ -117,13 +118,13 @@ const ExchangeRate = () => {
|
||||
),
|
||||
Rate: (
|
||||
<Text
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
justifyContent={"left"}
|
||||
as={"span"}
|
||||
color={"gray.600"}
|
||||
fontWeight={"600"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item.rate}
|
||||
{formatCurrency(item.rate)}
|
||||
</Text>
|
||||
),
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ api.interceptors.response.use(
|
||||
|
||||
if (response.status === 200) {
|
||||
// Update tokens in local storage
|
||||
localStorage.setItem("accessToken", response.data.accessToken);
|
||||
localStorage.setItem("refreshToken", response.data.refreshToken);
|
||||
localStorage.setItem("accessTokenn", response.data.accessToken);
|
||||
localStorage.setItem("refreshTokenn", response.data.refreshToken);
|
||||
|
||||
// Retry the original request with the new tokens
|
||||
return api(originalRequest);
|
||||
|
||||
@@ -65,7 +65,7 @@ export const ioService = createApi({
|
||||
body: data,
|
||||
// No need to manually set 'Content-Type'
|
||||
}),
|
||||
invalidatesTags: ["getKeyMerits"],
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
|
||||
deleteKeyMerits: builder.mutation({
|
||||
@@ -73,7 +73,7 @@ export const ioService = createApi({
|
||||
url: `/io/admin/key-merits/hard-delete/${id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
invalidatesTags: ["getKeyMerits"],
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
updateKeyMerits: builder.mutation({
|
||||
query: ({ data, id }) => ({
|
||||
@@ -81,7 +81,7 @@ export const ioService = createApi({
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
}),
|
||||
invalidatesTags: ["getKeyMerits"],
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
|
||||
// =====[getIODocument]
|
||||
@@ -92,7 +92,7 @@ export const ioService = createApi({
|
||||
body: data,
|
||||
}),
|
||||
|
||||
invalidatesTags: ["getInvestmentDocuments"],
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
|
||||
updateInvestmentDocuments: builder.mutation({
|
||||
@@ -101,7 +101,7 @@ export const ioService = createApi({
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
}),
|
||||
invalidatesTags: ["getInvestmentDocuments"],
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
|
||||
getInvestmentDocuments: builder.query({
|
||||
@@ -114,7 +114,7 @@ export const ioService = createApi({
|
||||
url: `/io/admin/document/hard-delete/${id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
invalidatesTags: ["getInvestmentDocuments"],
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
|
||||
// =====[Artifacts]
|
||||
@@ -129,7 +129,7 @@ export const ioService = createApi({
|
||||
// =====[createImageArtifacts]
|
||||
createImageArtifacts: builder.mutation({
|
||||
query: ({ data, id }) => ({
|
||||
url: `/io/artifact/artifactImage/${id}`,
|
||||
url: `/io/admin/artifact/image/${id}`,
|
||||
method: "POST",
|
||||
body: data,
|
||||
}),
|
||||
@@ -142,7 +142,7 @@ export const ioService = createApi({
|
||||
|
||||
updateImageArtifacts: builder.mutation({
|
||||
query: ({ data, id }) => ({
|
||||
url: `/io/artifact/image/${id}`,
|
||||
url: `/io/admin/artifact/image/byId/${id}`,
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
}),
|
||||
@@ -155,7 +155,7 @@ export const ioService = createApi({
|
||||
// =====[createVideoArtifacts]
|
||||
createVideoArtifacts: builder.mutation({
|
||||
query: ({ data, id }) => ({
|
||||
url: `/io/artifact/artifactVideo/${id}`,
|
||||
url: `/io/admin/artifact/video/${id}`,
|
||||
method: "POST",
|
||||
body: data,
|
||||
}),
|
||||
@@ -163,10 +163,9 @@ export const ioService = createApi({
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
|
||||
|
||||
deleteVideoArtifacts: builder.mutation({
|
||||
query: (id) => ({
|
||||
url: `/io/artifact/video/${id}`,
|
||||
url: `/io/admin/artifact/video/byId/${id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
invalidatesTags: ["getIOById"],
|
||||
@@ -174,17 +173,15 @@ export const ioService = createApi({
|
||||
|
||||
deleteImageArtifacts: builder.mutation({
|
||||
query: (id) => ({
|
||||
url: `/io/artifact/image/${id}`,
|
||||
url: `/io/admin/artifact/image/byId/${id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
|
||||
|
||||
|
||||
|
||||
updateVideoArtifacts: builder.mutation({
|
||||
query: ({ data, id }) => ({
|
||||
url: `/io/artifact/video/${id}`,
|
||||
url: `/io/admin/artifact/video/byId/${id}`,
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
}),
|
||||
@@ -209,6 +206,28 @@ export const ioService = createApi({
|
||||
invalidatesTags: ["getIOById", 'getIO'],
|
||||
}),
|
||||
|
||||
createIoCash : builder.mutation({
|
||||
query: ({ data, id }) => ({
|
||||
url: `/io/admin/io-cash/${id}`,
|
||||
method: "POST",
|
||||
body: data,
|
||||
}),
|
||||
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
|
||||
|
||||
createIoNav : builder.mutation({
|
||||
query: ({ data, id }) => ({
|
||||
url: `/io/admin/io-nav/${id}`,
|
||||
method: "POST",
|
||||
body: data,
|
||||
}),
|
||||
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -251,6 +270,10 @@ export const {
|
||||
useSetDisplayOrderMutation,
|
||||
|
||||
|
||||
useCreateIoCashMutation,
|
||||
useCreateIoNavMutation,
|
||||
|
||||
|
||||
|
||||
useUpdateStatusIoMutation
|
||||
} = ioService;
|
||||
|
||||
@@ -11,7 +11,6 @@ import { ioService } from "./io.service";
|
||||
|
||||
// const baseUrl = `${import.meta.env.VITE_API_BASE_URL}/${import.meta.env.VITE_API_VERSION}`
|
||||
|
||||
console.log(ioService);
|
||||
|
||||
|
||||
// Define a service using a base URL and expected endpoints
|
||||
|
||||
@@ -36,15 +36,17 @@ export const baseQuery = async (args, api, extraOptions) => {
|
||||
const refreshResult = await fetchBaseQuery({
|
||||
baseUrl: 'https://sprint4.tanami.betadelivery.com/api/v1',
|
||||
})({
|
||||
url: '/refresh_token',
|
||||
url: '/auth/user/regenerate-token',
|
||||
method: 'POST',
|
||||
body: { refreshToken },
|
||||
}, api, extraOptions);
|
||||
|
||||
if (refreshResult.data) {
|
||||
|
||||
// Save new tokens
|
||||
localStorage.setItem('accessToken', refreshResult.data.access.token);
|
||||
localStorage.setItem('refreshToken', refreshResult.data.refresh.token);
|
||||
localStorage.setItem('refreshTokenExp', refreshResult.data.refresh.expires);
|
||||
|
||||
// Retry the original request with the new token
|
||||
result = await fetchBaseQuery({
|
||||
@@ -85,6 +87,8 @@ export const apiSlice = createApi({
|
||||
// Store tokens in local storage
|
||||
localStorage.setItem('accessToken', data?.data?.access?.token) ;
|
||||
localStorage.setItem('refreshToken', data?.data?.refresh?.token);
|
||||
// localStorage.setItem('refreshTokenExp', data?.data?.refresh?.expires);
|
||||
localStorage.setItem('accessTokenExp', data?.data?.access?.expires);
|
||||
} catch (error) {
|
||||
console.error('Login failed:', error);
|
||||
}
|
||||
@@ -92,7 +96,7 @@ export const apiSlice = createApi({
|
||||
}),
|
||||
refreshToken: builder.mutation({
|
||||
query: (refreshToken) => ({
|
||||
url: '/refresh_token',
|
||||
url: '/auth/user/regenerate-token',
|
||||
method: 'POST',
|
||||
body: { refreshToken },
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user