fix(admin): complete occupancy check-in form payload

This commit is contained in:
2026-07-18 20:40:18 +08:00
parent f06b114a29
commit 7439663302
3 changed files with 306 additions and 58 deletions

View File

@@ -1,5 +1,34 @@
import type { Dayjs } from 'dayjs';
export interface CheckInFormValues {
studentId: number;
roomId: number;
checkInDate: Dayjs;
billingStartDate?: Dayjs;
stayType?: string;
collectDeposit?: boolean;
depositAmount?: number;
notes?: string;
bedId: number;
lockerId?: number;
}
export const buildCheckInPayload = (values: CheckInFormValues) => {
const collectDeposit = values.collectDeposit ?? false;
return {
studentId: values.studentId,
roomId: values.roomId,
checkInDate: values.checkInDate.format('YYYY-MM-DD'),
billingStartDate: (values.billingStartDate || values.checkInDate).format('YYYY-MM-DD'),
stayType: values.stayType || 'short',
collectDeposit,
depositAmount: collectDeposit ? values.depositAmount ?? 500 : undefined,
notes: values.notes?.trim() || undefined,
bedId: values.bedId,
lockerId: values.lockerId || undefined,
};
};
export interface TransferFormValues {
newRoomId: number;
newBedId: number;