diff --git a/src/app/auditLogs/components/AuditLogsList.tsx b/src/app/auditLogs/components/AuditLogsList.tsx index 2246e43..2022615 100644 --- a/src/app/auditLogs/components/AuditLogsList.tsx +++ b/src/app/auditLogs/components/AuditLogsList.tsx @@ -10,7 +10,8 @@ import { CustomInput, CustomStatus, Skeleton, - CustomButton + CustomButton, + CustomDropdown } from "../../../components/custom"; import type { Column } from "../../../components/custom/CustomTable"; import type { AuditLog, AuditLogFilters } from "../AuditLogsTypes"; @@ -71,6 +72,7 @@ export default function AuditLogsList() { // Filters const [search, setSearch] = useState(""); + const [daysFilter, setDaysFilter] = useState("7"); // ─── Fetch ───────────────────────────────────────────────────────────────── @@ -83,6 +85,20 @@ export default function AuditLogsList() { limit: PAGE_SIZE, }; + if (daysFilter !== "all") { + const now = new Date(); + const past = new Date(); + + if (daysFilter === "today") { + past.setHours(0, 0, 0, 0); + } else { + past.setDate(now.getDate() - parseInt(daysFilter, 10)); + } + + filters.dateFrom = past.toISOString(); + filters.dateTo = now.toISOString(); + } + const result = await getAuditLogs(filters); // Client-side search on entityLabel / entityId @@ -106,7 +122,7 @@ export default function AuditLogsList() { setLoading(false); } }, - [search] + [search, daysFilter] ); useEffect(() => { @@ -116,7 +132,7 @@ export default function AuditLogsList() { // Reset to page 1 when filters change useEffect(() => { setCurrentPage(1); - }, [search]); + }, [search, daysFilter]); const handleExportCSV = () => { if (logs.length === 0) return; @@ -272,13 +288,22 @@ export default function AuditLogsList() { } rightHeaderActions={
- - - Range: Last 7 Days - +
+ } + searchable={false} + options={[ + { label: "Today", value: "today" }, + { label: "Last 7 Days", value: "7" }, + { label: "Last 30 Days", value: "30" }, + { label: "Last 90 Days", value: "90" }, + { label: "All Time", value: "all" }, + ]} + className="!border-[#1E8E3E] !bg-[#E6F4EA] !h-[40px] hover:!bg-[#E6F4EA]" + /> +
{/* ─── Header ────────────────────────────────────────────────────── */} -
+
{/* ─── Body Content ──────────────────────────────────────────────── */} -
+
{/* Policy Information Card */} @@ -1241,7 +1241,7 @@ export default function AddPolicyEngine() {
{/* ─── Sticky Footer ─────────────────────────────────────────────── */} -
+
Status: diff --git a/src/app/recoveryIncidents/components/RecoveryIncidentsList.tsx b/src/app/recoveryIncidents/components/RecoveryIncidentsList.tsx index 39aa833..1c61399 100644 --- a/src/app/recoveryIncidents/components/RecoveryIncidentsList.tsx +++ b/src/app/recoveryIncidents/components/RecoveryIncidentsList.tsx @@ -233,7 +233,7 @@ export default function RecoveryIncidentsList() { const headerStatuses = [ { text: `${pendingCount} Pending`, variant: "warning" as const }, - { text: `${approvedCount} Approved`, variant: "success" as const }, + { text: `${approvedCount} App`, variant: "success" as const }, ]; // Calculate sum of values @@ -264,12 +264,12 @@ export default function RecoveryIncidentsList() { result.push({ ...child, groupKey: groupKey, - }); + } as any); }); } }); - return result; + return result.map((r, i) => ({ ...r, globalIndex: i })); }, [filteredIncidents, isGrouped, collapsedGroups]); const totalItems = displayData.length; @@ -306,7 +306,7 @@ export default function RecoveryIncidentsList() { { header: , accessor: (row) => ( -
+
@@ -344,7 +344,7 @@ export default function RecoveryIncidentsList() { { header: , accessor: (row) => - row.category ? : null, + row.isGroupHeader ? null : row.category ? : null, }, { header: , @@ -353,11 +353,9 @@ export default function RecoveryIncidentsList() { return (
{(row.statuses || []).map((status, idx) => ( - +
+ {status.text} +
))}
); @@ -389,11 +387,10 @@ export default function RecoveryIncidentsList() { }, { header: , - className: "text-right", accessor: (row) => { const key = (row as any).groupKey || row.flightNumber || row.recoveryCode; return ( -
+
{row.isGroupHeader ? (
row.isGroupHeader ? "bg-white border-b border-gray-100 hover:bg-gray-50/60" : "bg-[#F9FAFB] border-transparent cursor-pointer hover:bg-[#F3F4F6]"} + rowClassName={(row: any) => { + if (row.isGroupHeader) { + return "bg-white border-b border-gray-100 cursor-pointer hover:bg-gray-50/60"; + } + return "bg-[#F9FAFB] border-transparent cursor-pointer hover:bg-[#F3F4F6]"; + }} /> {/* Modal */} diff --git a/src/app/recoveryIncidents/tabs/index.tsx b/src/app/recoveryIncidents/tabs/index.tsx index 3e1a616..ba7b5a4 100644 --- a/src/app/recoveryIncidents/tabs/index.tsx +++ b/src/app/recoveryIncidents/tabs/index.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { useParams } from 'react-router-dom'; +import { useParams, useNavigate } from 'react-router-dom'; import { User, Checks, X, ClockCounterClockwiseIcon, ArrowLeftIcon, ArrowsClockwiseIcon, AirplaneTiltIcon } from '@phosphor-icons/react'; import { CustomButton, CustomTabs, CustomBackButton, CustomStatus } from '../../../components/custom'; import SummaryTab from './SummaryTab'; @@ -22,6 +22,7 @@ function getStatusVariant(status?: string): "success" | "error" | "warning" | "i export default function RecoveryIncidentTabs() { const { id } = useParams(); + const navigate = useNavigate(); const [activeTab, setActiveTab] = useState('Summary'); const [incident, setIncident] = useState(null); const [loading, setLoading] = useState(true); @@ -50,6 +51,7 @@ export default function RecoveryIncidentTabs() { try { const updated = await updateIncidentStatus(id, newStatus); setIncident(updated); + navigate('/recovery'); } catch (err) { console.error("Failed to update incident status:", err); } finally {