import React, { useState } from "react"; export default function AppraisalWorkflowPortal() { const [search, setSearch] = useState(""); const jobs = [ { id: "AP250001", customer: "ABC Co.,Ltd.", officer: "Kanin", status: "Inspection", sla: 1, }, { id: "AP250002", customer: "XYZ Co.,Ltd.", officer: "Somchai", status: "Review", sla: -2, }, { id: "AP250003", customer: "123 Property", officer: "Suda", status: "Analysis", sla: 3, }, ]; const filteredJobs = jobs.filter( (j) => j.id.toLowerCase().includes(search.toLowerCase()) || j.customer.toLowerCase().includes(search.toLowerCase()) ); const totalJobs = jobs.length; const overSLA = jobs.filter((j) => j.sla < 0).length; const onTime = jobs.filter((j) => j.sla >= 0).length; const exportCSV = () => { const headers = [ "Job ID", "Customer", "Officer", "Status", "SLA", ]; const rows = jobs.map((j) => [ j.id, j.customer, j.officer, j.status, j.sla, ]); const csvContent = [ headers.join(","), ...rows.map((r) => r.join(",")), ].join("\n"); const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;", }); const url = URL.createObjectURL(blob); const link = document.createElement("a"); link.href = url; link.download = "Appraisal_Report.csv"; link.click(); }; return (

Appraisal Workflow Portal

Total Jobs

{totalJobs}

On Time

{onTime}

Over SLA

{overSLA}

setSearch(e.target.value)} className="border px-4 py-2 rounded-xl w-72" />
{filteredJobs.map((job) => ( ))}
Job ID Customer Officer Status SLA
{job.id} {job.customer} {job.officer} {job.status} {job.sla < 0 ? `Over ${Math.abs(job.sla)} Day` : `${job.sla} Day Left`}
); }