Revenue functionality added and Removed the Expenses page
This commit is contained in:
@@ -36,16 +36,6 @@ const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
|
||||
return isLoggedIn ? <>{children}</> : <Navigate to="/login" replace />;
|
||||
};
|
||||
|
||||
const PlaceholderPage = ({ title }: { title: string }) => (
|
||||
<div className="p-8">
|
||||
<h1 className="text-2xl font-bold text-[#1e293b]">{title}</h1>
|
||||
<div className="mt-8 p-12 border-2 border-dashed border-[#e2e8f0] rounded-xl flex flex-col items-center justify-center text-[#64748b]">
|
||||
<p className="text-lg font-medium">This page is under development</p>
|
||||
<p className="text-sm">We're working hard to bring you the best experience for {title}.</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<Router>
|
||||
@@ -88,10 +78,6 @@ function App() {
|
||||
<Route path="inventory/products" element={<Products />} />
|
||||
<Route path="inventory/online" element={<Navigate to="/inventory/products" replace />} />
|
||||
|
||||
{/* Expense */}
|
||||
<Route path="expense/overview" element={<PlaceholderPage title="Expense Overview" />} />
|
||||
<Route path="expense/category" element={<PlaceholderPage title="Expense Category" />} />
|
||||
|
||||
{/* Others */}
|
||||
<Route path="reports" element={<Reports />} />
|
||||
<Route path="feedback" element={<Feedback />} />
|
||||
|
||||
@@ -3,15 +3,12 @@ import { NavLink, useLocation, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
BarChart3,
|
||||
ChevronRight,
|
||||
CreditCard,
|
||||
Gauge,
|
||||
LayoutGrid,
|
||||
MessageSquare,
|
||||
ShoppingCart,
|
||||
Store,
|
||||
Table2,
|
||||
Users,
|
||||
Wallet,
|
||||
ShoppingBag,
|
||||
Receipt,
|
||||
Search,
|
||||
@@ -94,14 +91,6 @@ const menuItems: MenuItem[] = [
|
||||
{ title: 'Products', path: '/inventory/products' }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Expense',
|
||||
icon: Wallet,
|
||||
subMenu: [
|
||||
{ title: 'Overview', path: '/expense/overview' },
|
||||
{ title: 'Category', path: '/expense/category' }
|
||||
]
|
||||
},
|
||||
{ title: 'Reports', icon: BarChart3, path: '/reports' },
|
||||
{
|
||||
title: 'Stores',
|
||||
@@ -147,7 +136,6 @@ const Sidebar = () => {
|
||||
'Customers': 'customers',
|
||||
'Purchases': 'purchases',
|
||||
'Inventory': 'inventory',
|
||||
'Expense': 'expense',
|
||||
'Reports': 'reports',
|
||||
'Stores': 'stores',
|
||||
'Feedback': 'feedback',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { apiFetch } from '../api';
|
||||
import { apiFetch } from '../api';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
@@ -222,7 +222,7 @@ const Dashboard = () => {
|
||||
</defs>
|
||||
<CartesianGrid strokeDasharray="3 3" vertical={false} stroke="#f1f5f9" />
|
||||
<XAxis dataKey="time" axisLine={false} tickLine={false} tick={{ fill: '#94a3b8', fontSize: 10, fontWeight: 700 }} />
|
||||
<YAxis axisLine={false} tickLine={false} tick={{ fill: '#94a3b8', fontSize: 10, fontWeight: 700 }} tickFormatter={(v) => v >= 1000 ? `₹${v / 1000}k` : `₹${v}`} />
|
||||
<YAxis axisLine={false} tickLine={false} tick={{ fill: '#94a3b8', fontSize: 10, fontWeight: 700 }} tickFormatter={(v) => v >= 1000 ? `🅡${v / 1000}k` : `🅡${v}`} />
|
||||
<Tooltip contentStyle={{ borderRadius: '12px', border: 'none', boxShadow: '0 10px 15px -3px rgb(0 0 0 / 0.1)' }} />
|
||||
<Area type="monotone" dataKey="value" stroke="#f43f5e" strokeWidth={3} fillOpacity={1} fill="url(#colorSalesMain)" />
|
||||
</AreaChart>
|
||||
@@ -260,9 +260,9 @@ const Dashboard = () => {
|
||||
</PieChart>
|
||||
</ResponsiveContainer>
|
||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-center">
|
||||
<h2 className="text-3xl font-black text-slate-800 tracking-tighter">₹{(stats.periodRevenue || 0).toLocaleString()}</h2>
|
||||
<h2 className="text-3xl font-black text-slate-800 tracking-tighter">🅡{(stats.periodRevenue || 0).toLocaleString()}</h2>
|
||||
<p className="text-[10px] font-black text-slate-400 uppercase tracking-widest mt-1">{timeRange === 'Today' ? 'Today' : timeRange}</p>
|
||||
<p className="text-[8px] font-bold text-slate-300 uppercase tracking-widest mt-0.5">Total: ₹{(stats.totalSales || 0).toLocaleString()}</p>
|
||||
<p className="text-[8px] font-bold text-slate-300 uppercase tracking-widest mt-0.5">Total: 🅡{(stats.totalSales || 0).toLocaleString()}</p>
|
||||
</div>
|
||||
<div className="flex gap-6 mt-2">
|
||||
{pieData.map(item => (
|
||||
@@ -404,7 +404,7 @@ const Dashboard = () => {
|
||||
className={`p-5 rounded-2xl border transition-all cursor-default ${insight.color || 'border-slate-100 bg-slate-50/50 hover:bg-white hover:shadow-md hover:border-transparent'}`}
|
||||
>
|
||||
<p className="text-[11px] font-black text-slate-600 leading-relaxed uppercase tracking-tight">
|
||||
{(insight.text || insight).replace(/R(?=[0-9])/g, '₹')}
|
||||
{(insight.text || insight).replace(/R(?=[0-9])/g, '🅡')}
|
||||
</p>
|
||||
</motion.div>
|
||||
))}
|
||||
@@ -433,7 +433,7 @@ const Dashboard = () => {
|
||||
<div className="grid grid-cols-4 gap-4">
|
||||
<div className="space-y-1.5">
|
||||
<p className="text-[9px] font-black text-rose-500 uppercase tracking-widest opacity-60">Gross Sale</p>
|
||||
<p className="text-lg font-black text-slate-800 tracking-tighter">₹{Number(store.sale).toLocaleString()}</p>
|
||||
<p className="text-lg font-black text-slate-800 tracking-tighter">🅡{Number(store.sale).toLocaleString()}</p>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<p className="text-[9px] font-black text-blue-500 uppercase tracking-widest opacity-60">Volume</p>
|
||||
|
||||
@@ -121,7 +121,7 @@ const StoreDashboard = () => {
|
||||
|
||||
if (data.stats) {
|
||||
setStats({
|
||||
totalSales: data.stats.totalSales,
|
||||
totalSales: data.stats.periodStoreRevenue,
|
||||
activeOrders: data.stats.activeOrders,
|
||||
dailyCustomers: data.stats.dailyCustomers,
|
||||
revenueGrowth: data.stats.growth,
|
||||
@@ -134,7 +134,7 @@ const StoreDashboard = () => {
|
||||
if (ritStore) {
|
||||
setStats(prev => ({
|
||||
...prev,
|
||||
totalSales: ritStore.sale,
|
||||
totalSales: data.stats.periodStoreRevenue,
|
||||
activeOrders: ritStore.orders,
|
||||
dailyCustomers: ritStore.orders * 0.9,
|
||||
}));
|
||||
@@ -260,7 +260,7 @@ const StoreDashboard = () => {
|
||||
</PieChart>
|
||||
</ResponsiveContainer>
|
||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-center">
|
||||
<h2 className="text-3xl font-black text-slate-800 tracking-tighter">R{formatCurrency(stats.totalSales)}</h2>
|
||||
<h2 className="text-3xl font-black text-slate-800 tracking-tighter">₹{formatCurrency(stats.totalSales)}</h2>
|
||||
</div>
|
||||
<div className="flex gap-6 mt-4">
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user