Upload frontend/src/views/officer/CompanyExportView.tsx with huggingface_hub
Browse files
frontend/src/views/officer/CompanyExportView.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { api } from "../../api/client";
|
|
| 3 |
import { Drive } from "../../types";
|
| 4 |
import { Badge } from "../../components/common/Badge";
|
| 5 |
import { AlertBanner } from "../../components/common/AlertBanner";
|
| 6 |
-
import { Download, FileSpreadsheet, CheckCircle2, RefreshCw, Upload, ShieldCheck } from "lucide-react";
|
| 7 |
|
| 8 |
export const CompanyExportView: React.FC = () => {
|
| 9 |
const [drives, setDrives] = useState<Drive[]>([]);
|
|
@@ -56,6 +56,52 @@ export const CompanyExportView: React.FC = () => {
|
|
| 56 |
}
|
| 57 |
};
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
const handleExport = async (format: "xlsx" | "csv") => {
|
| 60 |
if (!selectedDriveId) return;
|
| 61 |
try {
|
|
@@ -180,6 +226,63 @@ export const CompanyExportView: React.FC = () => {
|
|
| 180 |
</div>
|
| 181 |
)}
|
| 182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
{/* Header Mapping Table */}
|
| 184 |
<div className="bg-white p-6 rounded-2xl border border-slate-200 shadow-xs space-y-4">
|
| 185 |
<div>
|
|
|
|
| 3 |
import { Drive } from "../../types";
|
| 4 |
import { Badge } from "../../components/common/Badge";
|
| 5 |
import { AlertBanner } from "../../components/common/AlertBanner";
|
| 6 |
+
import { Download, FileSpreadsheet, CheckCircle2, RefreshCw, Upload, ShieldCheck, Send, Radio, Activity, Share2 } from "lucide-react";
|
| 7 |
|
| 8 |
export const CompanyExportView: React.FC = () => {
|
| 9 |
const [drives, setDrives] = useState<Drive[]>([]);
|
|
|
|
| 56 |
}
|
| 57 |
};
|
| 58 |
|
| 59 |
+
const [imatsStatus, setImatsStatus] = useState<string | null>(null);
|
| 60 |
+
const [imatsResponse, setImatsResponse] = useState<any | null>(null);
|
| 61 |
+
const [imatsLoading, setImatsLoading] = useState<boolean>(false);
|
| 62 |
+
|
| 63 |
+
const handlePushShortlistToImats = async () => {
|
| 64 |
+
if (!selectedDriveId) return;
|
| 65 |
+
try {
|
| 66 |
+
setImatsLoading(true);
|
| 67 |
+
setImatsStatus(null);
|
| 68 |
+
const res = await api.post<any>("/api/imats/push-shortlist", {
|
| 69 |
+
drive_id: selectedDriveId,
|
| 70 |
+
student_ids: ["BT210001", "BT210002", "BT210003", "BT210004", "BT210005"],
|
| 71 |
+
idempotency_key: `shortlist_${selectedDriveId}_${Date.now()}`,
|
| 72 |
+
});
|
| 73 |
+
setImatsResponse(res);
|
| 74 |
+
setImatsStatus("Successfully pushed candidate shortlist to IMATS Sandbox ATS!");
|
| 75 |
+
} catch (err: any) {
|
| 76 |
+
setImatsStatus(`Push failed: ${err.message || "Network Error"}`);
|
| 77 |
+
} finally {
|
| 78 |
+
setImatsLoading(false);
|
| 79 |
+
}
|
| 80 |
+
};
|
| 81 |
+
|
| 82 |
+
const handlePushScheduleToImats = async () => {
|
| 83 |
+
if (!selectedDriveId) return;
|
| 84 |
+
try {
|
| 85 |
+
setImatsLoading(true);
|
| 86 |
+
setImatsStatus(null);
|
| 87 |
+
const res = await api.post<any>("/api/imats/push-schedule", {
|
| 88 |
+
drive_id: selectedDriveId,
|
| 89 |
+
schedule_items: [
|
| 90 |
+
{ student_id: "BT210001", round: "Technical Interview 1", start_time: "2026-11-25T09:00:00", cabin: "Interview Cabin 1" },
|
| 91 |
+
{ student_id: "BT210002", round: "Technical Interview 1", start_time: "2026-11-25T09:45:00", cabin: "Interview Cabin 1" },
|
| 92 |
+
{ student_id: "BT210003", round: "Technical Interview 1", start_time: "2026-11-25T10:30:00", cabin: "Interview Cabin 2" }
|
| 93 |
+
],
|
| 94 |
+
idempotency_key: `sched_${selectedDriveId}_${Date.now()}`,
|
| 95 |
+
});
|
| 96 |
+
setImatsResponse(res);
|
| 97 |
+
setImatsStatus("Successfully pushed clash-free interview schedule to IMATS Sandbox ATS!");
|
| 98 |
+
} catch (err: any) {
|
| 99 |
+
setImatsStatus(`Push failed: ${err.message || "Network Error"}`);
|
| 100 |
+
} finally {
|
| 101 |
+
setImatsLoading(false);
|
| 102 |
+
}
|
| 103 |
+
};
|
| 104 |
+
|
| 105 |
const handleExport = async (format: "xlsx" | "csv") => {
|
| 106 |
if (!selectedDriveId) return;
|
| 107 |
try {
|
|
|
|
| 226 |
</div>
|
| 227 |
)}
|
| 228 |
|
| 229 |
+
{/* IMATS Campus Drive API (Sandbox ATS) Push Integration */}
|
| 230 |
+
<div className="bg-gradient-to-r from-[#0d1527] to-[#111e3b] p-6 rounded-2xl border border-emerald-500/30 shadow-lg text-slate-100 space-y-4">
|
| 231 |
+
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-3">
|
| 232 |
+
<div className="flex items-center gap-3">
|
| 233 |
+
<div className="w-10 h-10 rounded-xl bg-emerald-950/80 border border-emerald-500/40 flex items-center justify-center text-emerald-400">
|
| 234 |
+
<Share2 className="w-5 h-5" />
|
| 235 |
+
</div>
|
| 236 |
+
<div>
|
| 237 |
+
<h3 className="text-sm font-black text-white flex items-center gap-2">
|
| 238 |
+
<span>IMATS Campus Drive API (Sandbox ATS)</span>
|
| 239 |
+
<span className="px-2 py-0.5 rounded-full text-[10px] bg-emerald-950 text-emerald-300 border border-emerald-800 font-mono">
|
| 240 |
+
Sandbox Active
|
| 241 |
+
</span>
|
| 242 |
+
</h3>
|
| 243 |
+
<p className="text-xs text-slate-400">
|
| 244 |
+
Push candidate shortlists and clash-free interview schedules directly into the applicant tracking system with idempotency & offline outbox protection.
|
| 245 |
+
</p>
|
| 246 |
+
</div>
|
| 247 |
+
</div>
|
| 248 |
+
|
| 249 |
+
<div className="flex items-center gap-2 shrink-0">
|
| 250 |
+
<button
|
| 251 |
+
onClick={handlePushShortlistToImats}
|
| 252 |
+
disabled={imatsLoading || !selectedDriveId}
|
| 253 |
+
className="flex items-center gap-1.5 px-3.5 py-2 bg-gradient-to-r from-blue-600 to-teal-600 hover:from-blue-500 hover:to-teal-500 text-white text-xs font-bold rounded-xl shadow-md transition-all cursor-pointer disabled:opacity-50"
|
| 254 |
+
>
|
| 255 |
+
<Send className="w-3.5 h-3.5" />
|
| 256 |
+
<span>Push Shortlist</span>
|
| 257 |
+
</button>
|
| 258 |
+
<button
|
| 259 |
+
onClick={handlePushScheduleToImats}
|
| 260 |
+
disabled={imatsLoading || !selectedDriveId}
|
| 261 |
+
className="flex items-center gap-1.5 px-3.5 py-2 bg-gradient-to-r from-teal-600 to-emerald-600 hover:from-teal-500 hover:to-emerald-500 text-white text-xs font-bold rounded-xl shadow-md transition-all cursor-pointer disabled:opacity-50"
|
| 262 |
+
>
|
| 263 |
+
<Activity className="w-3.5 h-3.5" />
|
| 264 |
+
<span>Push Schedule</span>
|
| 265 |
+
</button>
|
| 266 |
+
</div>
|
| 267 |
+
</div>
|
| 268 |
+
|
| 269 |
+
{imatsStatus && (
|
| 270 |
+
<div className="p-3 bg-[#080e1c] border border-emerald-500/40 rounded-xl text-xs font-mono text-emerald-300 flex items-center gap-2">
|
| 271 |
+
<Radio className="w-3.5 h-3.5 animate-pulse text-emerald-400 shrink-0" />
|
| 272 |
+
<span>{imatsStatus}</span>
|
| 273 |
+
</div>
|
| 274 |
+
)}
|
| 275 |
+
|
| 276 |
+
{imatsResponse && (
|
| 277 |
+
<div className="p-4 bg-[#080e1c] rounded-xl border border-[#1b2b4d] space-y-1.5 text-xs font-mono">
|
| 278 |
+
<div className="text-[11px] font-bold text-slate-400 uppercase tracking-wider">IMATS ATS Server Acknowledgment:</div>
|
| 279 |
+
<pre className="text-emerald-300 overflow-x-auto text-[11px] leading-relaxed">
|
| 280 |
+
{JSON.stringify(imatsResponse, null, 2)}
|
| 281 |
+
</pre>
|
| 282 |
+
</div>
|
| 283 |
+
)}
|
| 284 |
+
</div>
|
| 285 |
+
|
| 286 |
{/* Header Mapping Table */}
|
| 287 |
<div className="bg-white p-6 rounded-2xl border border-slate-200 shadow-xs space-y-4">
|
| 288 |
<div>
|