fix:refactor code
This commit is contained in:
parent
d240fb39fa
commit
5917c53b1e
|
|
@ -1,4 +1,4 @@
|
|||
import moment from "moment-jalaali";
|
||||
// import moment from "moment-jalaali";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
Bar,
|
||||
|
|
@ -47,7 +47,7 @@ import apiService from "~/lib/api";
|
|||
import { formatCurrency } from "~/lib/utils";
|
||||
import DashboardLayout from "../layout";
|
||||
|
||||
moment.loadPersian({ usePersianDigits: true });
|
||||
// moment.loadPersian({ usePersianDigits: true });
|
||||
interface GreenInnovationData {
|
||||
WorkflowID: string;
|
||||
approved_budget: string;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import moment from "moment-jalaali";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { Badge } from "~/components/ui/badge";
|
||||
import { Button } from "~/components/ui/button";
|
||||
|
|
@ -43,8 +42,6 @@ import apiService from "~/lib/api";
|
|||
import { formatCurrency } from "~/lib/utils";
|
||||
import DashboardLayout from "../layout";
|
||||
|
||||
moment.loadPersian({ usePersianDigits: true });
|
||||
|
||||
interface innovationBuiltInDate {
|
||||
WorkflowID: number;
|
||||
approved_budget: string;
|
||||
|
|
@ -194,9 +191,8 @@ export function InnovationBuiltInsidePage() {
|
|||
direction: "asc",
|
||||
});
|
||||
const [tblAvarage, setTblAvarage] = useState<number>(0);
|
||||
const [selectedProjects, setSelectedProjects] = useState<
|
||||
Set<string | number>
|
||||
>(new Set());
|
||||
const [selectedProjects, setSelectedProjects] =
|
||||
useState<Set<string | number>>();
|
||||
const [detailsDialogOpen, setDetailsDialogOpen] = useState(false);
|
||||
const [selectedProjectDetails, setSelectedProjectDetails] =
|
||||
useState<DialogInfo>();
|
||||
|
|
@ -426,7 +422,6 @@ export function InnovationBuiltInsidePage() {
|
|||
|
||||
useEffect(() => {
|
||||
fetchProjects(true);
|
||||
fetchStats();
|
||||
}, [sortConfig]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -486,7 +481,7 @@ export function InnovationBuiltInsidePage() {
|
|||
const raw = await apiService.call<any>({
|
||||
innovation_construction_inside_function: {
|
||||
project_ids:
|
||||
selectedProjects.size > 0
|
||||
selectedProjects && selectedProjects?.size > 0
|
||||
? Array.from(selectedProjects).join(" , ")
|
||||
: "",
|
||||
},
|
||||
|
|
@ -622,7 +617,7 @@ export function InnovationBuiltInsidePage() {
|
|||
case "select":
|
||||
return (
|
||||
<Checkbox
|
||||
checked={selectedProjects.has(item?.project_id!)}
|
||||
checked={selectedProjects?.has(item?.project_id!)}
|
||||
onCheckedChange={() => handleSelectProject(item?.project_id)}
|
||||
className="data-[state=checked]:bg-emerald-600 data-[state=checked]:border-emerald-600 cursor-pointer"
|
||||
/>
|
||||
|
|
@ -1039,7 +1034,7 @@ export function InnovationBuiltInsidePage() {
|
|||
|
||||
{/* Project Details Dialog */}
|
||||
<Dialog open={detailsDialogOpen} onOpenChange={setDetailsDialogOpen}>
|
||||
<DialogContent className="bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] max-w-5xl overflow-y-auto">
|
||||
<DialogContent className="bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] max-w-6xl overflow-y-auto">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-white mr-4 border-b-2 border-gray-600 pb-4 font-persian text-right">
|
||||
شرح پروژه
|
||||
|
|
@ -1192,12 +1187,12 @@ export function InnovationBuiltInsidePage() {
|
|||
</div>
|
||||
) : (
|
||||
<div className="tbl rounded-xl overflow-hidden">
|
||||
<div className="grid grid-cols-3 bg-[#3F415A] text-white">
|
||||
<span className="text-md text-center p-3">
|
||||
<div className="grid grid-cols-3 bg-[#3F415A] text-white p-3 items-center">
|
||||
<span className="text-md text-center">
|
||||
شاخص مقایسه با نمونه خارجی
|
||||
</span>
|
||||
<span className="text-md text-center p-3">نمونه داخلی</span>
|
||||
<span className="text-md text-center p-3">نمونه خارجی</span>
|
||||
<span className="text-md text-center">نمونه داخلی</span>
|
||||
<span className="text-md text-center">نمونه خارجی</span>
|
||||
</div>
|
||||
<div className="flex flex-col divide-y divide-gray-600 overflow-auto max-h-[6rem]">
|
||||
{selectedProjectDetails?.technology_params?.map(
|
||||
|
|
@ -1268,7 +1263,7 @@ export function InnovationBuiltInsidePage() {
|
|||
<ResponsiveContainer width="100%" height={420}>
|
||||
<LineChart
|
||||
data={dialogChartData}
|
||||
margin={{ top: 20, right: 20, left: 20, bottom: 80 }}
|
||||
margin={{ top: 20, right: 70, left: 30, bottom: 80 }}
|
||||
>
|
||||
<XAxis
|
||||
dataKey="name"
|
||||
|
|
@ -1323,7 +1318,7 @@ export function InnovationBuiltInsidePage() {
|
|||
axisOffsetX -
|
||||
15;
|
||||
|
||||
const rectWidth = 140;
|
||||
const rectWidth = 130;
|
||||
const rectHeight = 28;
|
||||
const rectX = x - rectWidth / 2;
|
||||
const axisHeight = xAxis?.height ?? 40;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user