forked from wangziqi/gongxue-base
feat: refine admin forms, attendance and finance workflows
Squash merge PR #23. Included changes: - complete occupancy check-in required fields/default payload - improve responsive admin management pages - fix attendance edge cases and attendance period config - refine wallet/finance-related workflow handling Checks: - npm run typecheck -w apps/admin - npm run typecheck -w apps/server
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user