+ {/* Loader */}
+ {loading && (
+
+
+
+ )}
- {/* ⭐ FIXED: Horizontal scroll wrapper */}
+ {/* Error */}
+ {!loading && error && (
+
❌ {error}
+ )}
+
+ {/* No Data */}
+ {!loading && !error && rows.length === 0 && (
+
No schedules found.
+ )}
+
+
+
+
+ {/* Table */}
+ {!loading && !error && rows.length > 0 && (
-
+
| # |
@@ -76,24 +121,24 @@ const Schedule = () => {
{rows.map((row, index) => (
-
+
| {index + 1} |
- {row.period} |
- {row.cutoff}
-
- (Asia/Calcutta)
+ {formatOnlyDate(row.periodStart)} → {formatOnlyDate(row.periodEnd)}
|
- {row.payDate} |
+ {formatDateTime(row.cutOffTime)} |
+ {formatOnlyDate(row.ScheduleDate)} |
))}
-
-
+ )}
- >
+
);
};
diff --git a/types.d.ts b/types.d.ts
index 1ec1280..bb7af91 100644
--- a/types.d.ts
+++ b/types.d.ts
@@ -92,6 +92,36 @@ type LeaveRequestResponse = {
message?: string;
};
+interface ScheduleItem {
+ id: string;
+ isActive: boolean;
+ status: string | null;
+ ScheduleDate: string;
+ cutOffTime: string | null;
+ periodEnd: string | null;
+ periodStart: string | null;
+}
+
+
+interface PayslipItem {
+ totalHoursFormatted: string;
+ payrollSchedule: string;
+ totalPayAmount: number;
+ status: string;
+ date: string | null;
+ createdDate: string;
+ name: string;
+ id: string;
+}
+
+interface PayslipResponse {
+ payrolls: PayslipItem[];
+ vaPortalId: string;
+ vaName: string;
+ id: string;
+}
+
+
interface Window {
electron: {
login: (credentials: { email: string; password: string }) => Promise;
@@ -174,9 +204,15 @@ interface Window {
payload: LeaveRequestPayload
) => Promise;
-
+ getSchedules: () => Promise;
+
+ getPayslips: (vaId: string) => Promise<{
+ success: boolean;
+ data?: PayslipResponse[];
+ message?: string;
+ }>;
};
-
+
}