Showing AI reviews for crm-dashbaord
Project AI Score ?
73%
Quality Avg ?
74%
Security Avg ?
74%
Reviews ?
130

Review Result ?

solutionbowl/crm-dashbaord · 7bb665f9
Commit adds new routes, UI components, and state management for bet button functionality and agent reports. The code shows moderate complexity and largely clear structure. Some minor issues in conditional checks and unused imports could be improved. The feature adds business value by allowing more detailed reporting and interaction but some UI validation and error handling could be better.
Quality ?
75%
Security ?
60%
Business Value ?
70%
Maintainability ?
68%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Condition 'If (Strvalue.startswith("") )'...
Where src/modules/horse/pages/Report/AgentReport.tsx:75
Issue / Evidence condition 'if (strValue.startsWith("") )' is always true
Suggested Fix change this to correctly check positive values and improve quality score
Missing Explicit Error Handling After Warn...
Where src/modules/horse/pages/Race/RaceDetail.tsx:321
Issue / Evidence missing explicit error handling after warning toast
Suggested Fix add error handling to reduce bug risk
Ambiguous Fallback Key For Marketid Use
Where src/modules/horse/pages/Race/RaceDetail.tsx:1464
Issue / Evidence ambiguous fallback key for marketId use
Suggested Fix ensure marketId is unique or handle undefined cases better to reduce bug risk
Import Fragment Not Used
Where src/modules/horse/pages/Report/AgentReport.tsx:1
Issue / Evidence import Fragment not used
Suggested Fix remove unused imports to improve quality score
Possible Implicit Assumptions On String Co...
Where src/modules/horse/pages/Report/AgentReport.tsx:73
Issue / Evidence possible implicit assumptions on string conversion
Suggested Fix validate data types more strictly to improve robustness
Code Change Preview · src/main.tsx ?
Removed / Before Commit
- diff --git a/src/main.tsx b/src/main.tsx
- index 6d5cf4d..99c6728 100644
- import EventInfoPage from './modules/horse/pages/Market/EventInfoPage.tsx';
- import MarketPage from './modules/horse/pages/Market/MarketPage.tsx';
- import AllReport from './modules/horse/pages/Report/AllReport.tsx';
- 
- authService.initializeAuth();
- 
- const Loader            = lazy(() => import('./components/loader/loader.tsx'));
- <Route path="event/edit/:id" element={<CreateEvent />} />
- <Route path="races" element={<AllRaces />} />
- <Route path="reports" element={<AllReport />} />
- <Route path="races/create" element={<CreateRace />} />
- <Route path="races/edit/:id" element={<CreateRace />} />
- <Route path="races/detail/:id" element={<RaceDetail />} />
Added / After Commit
+ diff --git a/src/main.tsx b/src/main.tsx
+ index 6d5cf4d..99c6728 100644
+ import EventInfoPage from './modules/horse/pages/Market/EventInfoPage.tsx';
+ import MarketPage from './modules/horse/pages/Market/MarketPage.tsx';
+ import AllReport from './modules/horse/pages/Report/AllReport.tsx';
+ import AgentReport from './modules/horse/pages/Report/AgentReport.tsx';
+ import BetButton from './modules/horse/pages/Report/BetButton.tsx';
+ import BetButtonMarket from "./modules/horse/pages/Report/BetButtonMarket.tsx"
+ authService.initializeAuth();
+ 
+ const Loader            = lazy(() => import('./components/loader/loader.tsx'));
+ <Route path="event/edit/:id" element={<CreateEvent />} />
+ <Route path="races" element={<AllRaces />} />
+ <Route path="reports" element={<AllReport />} />
+               <Route path="reports/AgentReport" element={<AgentReport/>} />
+               <Route path="reports/BetButton" element={<BetButton/>} />
+               <Route path="reports/BetButtonMarket" element={<BetButtonMarket/>} />
+ <Route path="races/create" element={<CreateRace />} />
Removed / Before Commit
- diff --git a/src/modules/horse/layout/HorseSidebar.tsx b/src/modules/horse/layout/HorseSidebar.tsx
- index 833cc62..8febc4d 100644
- title: "Report",
- icon: " ri-book-open-line",
- children: [
-         { title: "All Reports", path: "/horse/reports" },
- 
- ],
- },
Added / After Commit
+ diff --git a/src/modules/horse/layout/HorseSidebar.tsx b/src/modules/horse/layout/HorseSidebar.tsx
+ index 833cc62..8febc4d 100644
+ title: "Report",
+ icon: " ri-book-open-line",
+ children: [
+         { title: "P&L Report by Market", path: "/horse/reports" },
+         { title: "P&L Report by Agent", path: "/horse/reports/AgentReport" },
+ 
+ ],
+ },
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Race/RaceDetail.tsx b/src/modules/horse/pages/Race/RaceDetail.tsx
- index 82ce8f6..4caeff5 100644
- 
- const [showFancySettleModal, setShowFancySettleModal] = useState(false);
- const [fancyMarkets, setFancyMarkets] = useState<any[]>([]);
-   const [selectedFancyRunner, setSelectedFancyRunner] = useState<{
- marketId: string;
- marketType: string;
- runnerId: string;
-     displayName: string; 
-   } | null>(null);
- const [loadingFancyMarkets, setLoadingFancyMarkets] = useState(false);
- const [settlingFancy, setSettlingFancy] = useState(false);
- const [marketSettleStatus, setMarketSettleStatus] = useState<{
- 
- const handleOpenFancySettleModal = () => {
- setShowFancySettleModal(true);
-     setSelectedFancyRunner(null);
Added / After Commit
+ diff --git a/src/modules/horse/pages/Race/RaceDetail.tsx b/src/modules/horse/pages/Race/RaceDetail.tsx
+ index 82ce8f6..4caeff5 100644
+ 
+ const [showFancySettleModal, setShowFancySettleModal] = useState(false);
+ const [fancyMarkets, setFancyMarkets] = useState<any[]>([]);
+   const [selectedFancyRunners, setSelectedFancyRunners] = useState<Record<string, {
+ marketId: string;
+ marketType: string;
+ runnerId: string;
+     displayName: string;
+   }>>({});
+ const [loadingFancyMarkets, setLoadingFancyMarkets] = useState(false);
+ const [settlingFancy, setSettlingFancy] = useState(false);
+ const [marketSettleStatus, setMarketSettleStatus] = useState<{
+ 
+ const handleOpenFancySettleModal = () => {
+ setShowFancySettleModal(true);
+     setSelectedFancyRunners({});
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Report/AgentReport.tsx b/src/modules/horse/pages/Report/AgentReport.tsx
- new file mode 100644
- index 0000000..e05b74b
Added / After Commit
+ diff --git a/src/modules/horse/pages/Report/AgentReport.tsx b/src/modules/horse/pages/Report/AgentReport.tsx
+ new file mode 100644
+ index 0000000..e05b74b
+ import { Fragment, useState, useEffect } from "react";
+ import { Button, Card, Col, Row, Form } from "react-bootstrap";
+ import { useNavigate } from "react-router-dom";
+ import Pageheader from "../../components/pageheader/pageheader";
+ import { reportService } from "../../../../services/api/ReportService";
+ import "../../styles/horsespages.css";
+ 
+ // API Response Types for Agent Report
+ interface AgentReportData {
+   fromDate: string;
+   toDate: string;
+   grandTotal: {
+     user: {
+       netWin: number;
+       comm: number;
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Report/AllReport.tsx b/src/modules/horse/pages/Report/AllReport.tsx
- index a62f5e3..36db138 100644
- import Pageheader from "../../components/pageheader/pageheader";
- import { reportService } from "../../../../services/api/ReportService";
- import "../../styles/horsespages.css";
- 
- 
- interface ApiReportData {
- };
- dates: Array<{
- date: string;
-     races: Array<{
- raceName: string;
- markets: Array<{
- marketId: string;
- };
- }>;
- }
Added / After Commit
+ diff --git a/src/modules/horse/pages/Report/AllReport.tsx b/src/modules/horse/pages/Report/AllReport.tsx
+ index a62f5e3..36db138 100644
+ import Pageheader from "../../components/pageheader/pageheader";
+ import { reportService } from "../../../../services/api/ReportService";
+ import "../../styles/horsespages.css";
+ import { useNavigate } from "react-router-dom";
+ 
+ 
+ interface ApiReportData {
+ };
+ dates: Array<{
+ date: string;
+      races: Array<{
+       raceId: string;
+ raceName: string;
+ markets: Array<{
+ marketId: string;
+ };
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Report/BetButton.tsx b/src/modules/horse/pages/Report/BetButton.tsx
- new file mode 100644
- index 0000000..5e17cb9
Added / After Commit
+ diff --git a/src/modules/horse/pages/Report/BetButton.tsx b/src/modules/horse/pages/Report/BetButton.tsx
+ new file mode 100644
+ index 0000000..5e17cb9
+ import { Fragment, useState, useEffect } from "react";
+ import { Card, Col, Row } from "react-bootstrap";
+ import { useSearchParams, useNavigate } from "react-router-dom";
+ import Pageheader from "../../components/pageheader/pageheader";
+ import { reportService } from "../../../../services/api/ReportService";
+ import "../../styles/horsespages.css";
+ 
+ interface BetData {
+   id: string;
+   createdAt: string;
+   updatedAt: string;
+   agentWinLoss: number;
+   username: string;
+   email: string;
+   userId: string;
Removed / Before Commit
- diff --git a/src/modules/horse/pages/Report/BetButtonMarket.tsx b/src/modules/horse/pages/Report/BetButtonMarket.tsx
- new file mode 100644
- index 0000000..25f0acb
Added / After Commit
+ diff --git a/src/modules/horse/pages/Report/BetButtonMarket.tsx b/src/modules/horse/pages/Report/BetButtonMarket.tsx
+ new file mode 100644
+ index 0000000..25f0acb
+ import { Fragment, useState, useEffect } from "react";
+ import { Card, Col, Row } from "react-bootstrap";
+ import { useSearchParams, useNavigate } from "react-router-dom";
+ import Pageheader from "../../components/pageheader/pageheader";
+ import { reportService } from "../../../../services/api/ReportService";
+ import "../../styles/horsespages.css";
+ 
+ interface BetData {
+   id: string;
+   createdAt: string;
+   updatedAt: string;
+   agentWinLoss: number;
+   username: string;
+   email: string;
+   userId: string;
Removed / Before Commit
- diff --git a/src/modules/horse/styles/horsespages.css b/src/modules/horse/styles/horsespages.css
- index 25233ce..d296dd4 100644
- }
- 
- .horse-report-grand-total {
-   background: #8ab9e7;
- border-bottom: 1px solid var(--default-border, #dee2e6);
- }
- 
- 
- .horse-report-value-negative {
- color: #ff0202;
- }
- .horse-report-value-positive {
-   color: #05b51f;
- font-weight: 700;
- }
Added / After Commit
+ diff --git a/src/modules/horse/styles/horsespages.css b/src/modules/horse/styles/horsespages.css
+ index 25233ce..d296dd4 100644
+ }
+ 
+ .horse-report-grand-total {
+   background: #6cb5ff;
+ border-bottom: 1px solid var(--default-border, #dee2e6);
+ }
+ 
+ 
+ .horse-report-value-negative {
+ color: #ff0202;
+   
+ }
+ .horse-report-value-positive {
+   color: #5dff05;
+ font-weight: 700;
+ }
Removed / Before Commit
- diff --git a/src/services/api/ReportService.ts b/src/services/api/ReportService.ts
- index 8063242..b1cb5ed 100644
- 
- 
- const BET_SERVICE_URL = import.meta.env.VITE_BET_API_URL || 'https://api.digitalbowls.com/bet/api';
- 
- const createBetServiceInstance = (): AxiosInstance => {
- const instance = axios.create({
- 'Content-Type': 'application/json',
- },
- });
- 
- instance.interceptors.request.use(
- async (config: any) => {
- try {
- return Promise.reject(error);
- }
- );
Added / After Commit
+ diff --git a/src/services/api/ReportService.ts b/src/services/api/ReportService.ts
+ index 8063242..b1cb5ed 100644
+ 
+ 
+ const BET_SERVICE_URL = import.meta.env.VITE_BET_API_URL || 'https://api.digitalbowls.com/bet/api';
+ const TENANT_SERVICE_URL = import.meta.env.VITE_TENANT_API_URL || 'https://api.digitalbowls.com/tenant/api';
+ 
+ const createBetServiceInstance = (): AxiosInstance => {
+ const instance = axios.create({
+ 'Content-Type': 'application/json',
+ },
+ });
+ //https://api.digitalbowls.com/tenant/api/horse-racing/reports/global-profit-loss
+ instance.interceptors.request.use(
+ async (config: any) => {
+ try {
+ return Promise.reject(error);
+ }