(Feat-Fix): Type Fixes, sloppy import fixes, fix dynamic activity fetching and more
This commit is contained in:
@@ -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 = () => {
|
||||
</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="py-3 px-4 text-gray-600">{node.inTime || "-"}</td>
|
||||
<td className="py-3 px-4 text-gray-600">{node.outTime || "-"}</td>
|
||||
<td className="py-3 px-4 text-gray-600 whitespace-nowrap">{node.inTime || "-"}</td>
|
||||
<td className="py-3 px-4 text-gray-600 whitespace-nowrap">{node.outTime || "-"}</td>
|
||||
<td className="py-3 px-4 text-gray-500 text-sm">
|
||||
{node.remark || "-"}
|
||||
</td>
|
||||
@@ -666,28 +682,28 @@ export const DashboardPage: React.FC = () => {
|
||||
<table className="w-full">
|
||||
<thead>
|
||||
<tr className="bg-gray-50 border-b border-gray-200">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm min-w-[200px]">
|
||||
Level / Name
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Dept
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Sub-Dept
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Activity
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Status
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap min-w-[120px]">
|
||||
In Time
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap min-w-[120px]">
|
||||
Out Time
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Remark
|
||||
</th>
|
||||
</tr>
|
||||
@@ -1018,31 +1034,31 @@ export const DashboardPage: React.FC = () => {
|
||||
<table className="w-full">
|
||||
<thead>
|
||||
<tr className="bg-gray-50 border-b border-gray-200">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm min-w-[200px]">
|
||||
Contractor / Employee
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Dept
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Sub-Dept
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Activity
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Rate (₹)
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Status
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap min-w-[120px]">
|
||||
In Time
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap min-w-[120px]">
|
||||
Out Time
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Remark
|
||||
</th>
|
||||
</tr>
|
||||
@@ -1162,10 +1178,10 @@ export const DashboardPage: React.FC = () => {
|
||||
</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="py-3 px-4 text-sm text-gray-600">
|
||||
<td className="py-3 px-4 text-sm text-gray-600 whitespace-nowrap">
|
||||
{emp.inTime || "-"}
|
||||
</td>
|
||||
<td className="py-3 px-4 text-sm text-gray-600">
|
||||
<td className="py-3 px-4 text-sm text-gray-600 whitespace-nowrap">
|
||||
{emp.outTime || "-"}
|
||||
</td>
|
||||
<td className="py-3 px-4 text-sm text-gray-500">
|
||||
@@ -1651,19 +1667,19 @@ export const DashboardPage: React.FC = () => {
|
||||
<table className="w-full">
|
||||
<thead>
|
||||
<tr className="bg-gray-50 border-b border-gray-200">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm min-w-[150px]">
|
||||
Employee
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Today's Status
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap min-w-[120px]">
|
||||
Check In
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap min-w-[120px]">
|
||||
Check Out
|
||||
</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm">
|
||||
<th className="text-left py-3 px-4 font-semibold text-gray-600 text-sm whitespace-nowrap">
|
||||
Current Work
|
||||
</th>
|
||||
</tr>
|
||||
@@ -1716,13 +1732,13 @@ export const DashboardPage: React.FC = () => {
|
||||
: empAttendance?.status || "Absent"}
|
||||
</span>
|
||||
</td>
|
||||
<td className="py-3 px-4 text-sm text-gray-600">
|
||||
<td className="py-3 px-4 text-sm text-gray-600 whitespace-nowrap">
|
||||
{empAttendance?.check_in_time
|
||||
? new Date(empAttendance.check_in_time)
|
||||
.toLocaleTimeString()
|
||||
: "-"}
|
||||
</td>
|
||||
<td className="py-3 px-4 text-sm text-gray-600">
|
||||
<td className="py-3 px-4 text-sm text-gray-600 whitespace-nowrap">
|
||||
{empAttendance?.check_out_time
|
||||
? new Date(empAttendance.check_out_time)
|
||||
.toLocaleTimeString()
|
||||
|
||||
Reference in New Issue
Block a user