Adds the full Next.js app (app/, components/, lib/, scripts/, assets/, docs/, Dockerfile, compose, configs) to version control. Security: - CIPC BizPortal customer-code logins (Login 1 + Login 3) now read CIPC_LOGIN1_CODE / CIPC_LOGIN1_PASSWORD / CIPC_LOGIN3_CODE / CIPC_LOGIN3_PASSWORD from .env.local instead of source. - BizPortal personal login in apply-bizportal route reads BIZPORTAL_ID_NO / BIZPORTAL_PASSWORD. - Added .env.example as the committed template. .gitignore excludes .env*, node_modules, .next, logs, sqlite, Playwright storage_state.json (live CIPC cookies), scratch dirs, client PDFs and debug screenshots.
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { useState } from "react";
|
|
import { useRouter } from "next/navigation";
|
|
|
|
const LOCKED = new Set([
|
|
"registered", "name_approved", "name_reserved",
|
|
"resignation_sent", "appointment_accepted", "cancelled",
|
|
"Moved to step 2",
|
|
]);
|
|
|
|
export default function ApproveButton({ id, name, status }: { id: string; name: string; status: string }) {
|
|
const router = useRouter();
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
if (LOCKED.has(status)) return null;
|
|
|
|
async function handle() {
|
|
if (!confirm(`Approve "${name}" and move to Step 2?`)) return;
|
|
setLoading(true);
|
|
await fetch("/api/register/update-status", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ id, status: "Moved to step 2" }),
|
|
});
|
|
router.refresh();
|
|
}
|
|
|
|
return (
|
|
<button
|
|
onClick={handle}
|
|
disabled={loading}
|
|
title="Approve and move to Step 2"
|
|
className="px-2.5 py-1 bg-success/10 border-2 border-success rounded text-xs font-bold text-success hover:bg-success/20 transition-colors whitespace-nowrap disabled:opacity-50"
|
|
>
|
|
{loading ? "…" : "✓ APPROVE"}
|
|
</button>
|
|
);
|
|
}
|