fix: show access action zone

This commit is contained in:
unknown
2026-07-22 19:32:39 +09:00
parent 7c579608a0
commit 3efe493f9f
4 changed files with 10 additions and 3 deletions

View File

@@ -11,6 +11,8 @@ import { VisitRequestDetailDialog } from '../components/VisitRequestDetailDialog
const hasEnteredToday = (r: AccessRecord) => Boolean(r.checkInAt);
const hasExitedToday = (r: AccessRecord) => Boolean(r.checkOutAt);
const actionLabel = (visitorName: string, zoneName?: string) =>
zoneName ? `${visitorName} (${zoneName})` : visitorName;
function accessBadge(record: AccessRecord): { className: string; label: string } {
if (record.inside) {
@@ -78,14 +80,14 @@ export const AccessConsolePage: React.FC = () => {
const forceCheckIn = (id: number) =>
wrap(async () => {
const res = await checkIn({ visitRequestId: id, gateId: 'STAFF' });
setNotice(`${res.visitorName}${res.message}`);
setNotice(`${actionLabel(res.visitorName, res.zoneName)}${res.message}`);
loadRecords();
});
const forceCheckOut = (id: number) =>
wrap(async () => {
const res = await checkOut({ visitRequestId: id });
setNotice(`${res.visitorName}${res.message}`);
setNotice(`${actionLabel(res.visitorName, res.zoneName)}${res.message}`);
loadRecords();
});

View File

@@ -5,6 +5,9 @@ import { formatVisitRange } from '../status';
import { useQrScanner } from '../useQrScanner';
import { playChime } from '../chime';
const actionLabel = (visitorName: string, zoneName?: string) =>
zoneName ? `${visitorName} (${zoneName})` : visitorName;
function extractQrToken(raw: string): string {
const text = raw.trim();
if (!text) return '';
@@ -65,7 +68,7 @@ export const KioskPage: React.FC = () => {
try {
const r = dir === 'in' ? await publicCheckIn(token) : await publicCheckOut(token);
playChime();
setResult(`${r.visitorName}${r.message}`);
setResult(`${actionLabel(r.visitorName, r.zoneName)}${r.message}`);
setToken(null);
setPass(null);
} catch (e) {

View File

@@ -230,6 +230,7 @@ export interface AccessRecord {
export interface AccessAction {
visitRequestId: number;
visitorName: string;
zoneName?: string;
direction: 'IN' | 'OUT';
eventAt: string;
gateOpened: boolean;