diff --git a/src/App.tsx b/src/App.tsx index 00de6ec..5d345c2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,6 @@ import React, { useState } from "react"; -import { AuthProvider, useAuth } from "./contexts/AuthContext.tsx"; +import { AuthProvider } from "./contexts/AuthContext.tsx"; +import { useAuth } from "./contexts/authContext.ts"; import { Sidebar } from "./components/layout/Sidebar.tsx"; import { Header } from "./components/layout/Header.tsx"; import { DashboardPage } from "./pages/DashboardPage.tsx"; diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsx index f66d221..dfadc01 100644 --- a/src/components/layout/Header.tsx +++ b/src/components/layout/Header.tsx @@ -15,7 +15,7 @@ import { User, X, } from "lucide-react"; -import { useAuth } from "../../contexts/AuthContext.tsx"; +import { useAuth } from "../../contexts/authContext.ts"; import { useDepartments } from "../../hooks/useDepartments.ts"; import { api } from "../../services/api.ts"; import type { User as UserType } from "../../types.ts"; @@ -100,7 +100,7 @@ const ProfilePopup: React.FC = (
-
- - -
diff --git a/src/pages/AttendancePage.tsx b/src/pages/AttendancePage.tsx index 9c8aa35..cb8ef63 100644 --- a/src/pages/AttendancePage.tsx +++ b/src/pages/AttendancePage.tsx @@ -27,7 +27,7 @@ import { Button } from "../components/ui/Button.tsx"; import { Input, Select } from "../components/ui/Input.tsx"; import { api } from "../services/api.ts"; import { useEmployees } from "../hooks/useEmployees.ts"; -import { useAuth } from "../contexts/AuthContext.tsx"; +import { useAuth } from "../contexts/authContext.ts"; import type { AttendanceStatus } from "../types.ts"; export const AttendancePage: React.FC = () => { diff --git a/src/pages/DashboardPage.tsx b/src/pages/DashboardPage.tsx index 3ea35aa..a077238 100644 --- a/src/pages/DashboardPage.tsx +++ b/src/pages/DashboardPage.tsx @@ -26,7 +26,7 @@ import { Card, CardContent, CardHeader } from "../components/ui/Card.tsx"; import { useEmployees } from "../hooks/useEmployees.ts"; import { useDepartments } from "../hooks/useDepartments.ts"; import { useWorkAllocations } from "../hooks/useWorkAllocations.ts"; -import { useAuth } from "../contexts/AuthContext.tsx"; +import { useAuth } from "../contexts/authContext.ts"; import { api } from "../services/api.ts"; // Types for attendance hierarchy @@ -260,8 +260,12 @@ export const DashboardPage: React.FC = () => { ? "Present" : "Absent") : undefined, - inTime: empAttendance?.check_in_time?.substring(0, 5), - outTime: empAttendance?.check_out_time?.substring(0, 5), + inTime: empAttendance?.check_in_time + ? new Date(empAttendance.check_in_time).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) + : undefined, + outTime: empAttendance?.check_out_time + ? new Date(empAttendance.check_out_time).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) + : undefined, remark: empAttendance?.remark, children: [], }; @@ -298,8 +302,12 @@ export const DashboardPage: React.FC = () => { ? "Present" : "Absent") : undefined, - inTime: empAttendance?.check_in_time?.substring(0, 5), - outTime: empAttendance?.check_out_time?.substring(0, 5), + inTime: empAttendance?.check_in_time + ? new Date(empAttendance.check_in_time).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) + : undefined, + outTime: empAttendance?.check_out_time + ? new Date(empAttendance.check_out_time).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) + : undefined, remark: empAttendance?.remark, children: [], }; @@ -369,8 +377,12 @@ export const DashboardPage: React.FC = () => { ? "Present" : "Absent") : undefined, - inTime: empAttendance?.check_in_time?.substring(0, 5), - outTime: empAttendance?.check_out_time?.substring(0, 5), + inTime: empAttendance?.check_in_time + ? new Date(empAttendance.check_in_time).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) + : undefined, + outTime: empAttendance?.check_out_time + ? new Date(empAttendance.check_out_time).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) + : undefined, remark: empAttendance?.remark, children: [], }; @@ -408,8 +420,12 @@ export const DashboardPage: React.FC = () => { ? "Present" : "Absent") : undefined, - inTime: empAttendance?.check_in_time?.substring(0, 5), - outTime: empAttendance?.check_out_time?.substring(0, 5), + inTime: empAttendance?.check_in_time + ? new Date(empAttendance.check_in_time).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) + : undefined, + outTime: empAttendance?.check_out_time + ? new Date(empAttendance.check_out_time).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) + : undefined, remark: empAttendance?.remark, children: [], }; @@ -599,8 +615,8 @@ export const DashboardPage: React.FC = () => { )} - {node.inTime || "-"} - {node.outTime || "-"} + {node.inTime || "-"} + {node.outTime || "-"} {node.remark || "-"} @@ -666,28 +682,28 @@ export const DashboardPage: React.FC = () => { - - - - - - - - @@ -1018,31 +1034,31 @@ export const DashboardPage: React.FC = () => {
+ Level / Name + Dept + Sub-Dept + Activity + Status + In Time + Out Time + Remark
- - - - - - - - - @@ -1162,10 +1178,10 @@ export const DashboardPage: React.FC = () => { )} - -
+ Contractor / Employee + Dept + Sub-Dept + Activity + Rate (₹) + Status + In Time + Out Time + Remark
+ {emp.inTime || "-"} + {emp.outTime || "-"} @@ -1651,19 +1667,19 @@ export const DashboardPage: React.FC = () => { - - - - - @@ -1716,13 +1732,13 @@ export const DashboardPage: React.FC = () => { : empAttendance?.status || "Absent"} - -
+ Employee + Today's Status + Check In + Check Out + Current Work
+ {empAttendance?.check_in_time ? new Date(empAttendance.check_in_time) .toLocaleTimeString() : "-"} + {empAttendance?.check_out_time ? new Date(empAttendance.check_out_time) .toLocaleTimeString() diff --git a/src/pages/LoginPage.tsx b/src/pages/LoginPage.tsx index 9a1cb14..c987940 100644 --- a/src/pages/LoginPage.tsx +++ b/src/pages/LoginPage.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { useAuth } from "../contexts/AuthContext.tsx"; +import { useAuth } from "../contexts/authContext.ts"; import { ArrowRight, CheckCircle, @@ -268,7 +268,7 @@ export const LoginPage: React.FC = () => { {/* Modal */}
{/* Close button */} -
- -