create user pages crud also update pages ui build order and car ,driver first page interfase create model layer to componants

This commit is contained in:
m7amedez5511
2026-06-10 16:58:17 +03:00
parent 53c03e9867
commit e0e38dc87a
34 changed files with 2963 additions and 862 deletions

54
types/user.ts Normal file
View File

@@ -0,0 +1,54 @@
export interface User {
id: string;
name: string;
userName?: string;
email?: string;
phone: string;
isActive: boolean;
createdAt: string;
role?: { id?: string; name: string };
branch?: { id?: string; name: string };
}
export interface UserFormData {
name: string;
email: string;
phone: string;
password: string;
roleId: string;
branchId: string;
}
export interface FormErrors {
name?: string;
email?: string;
phone?: string;
password?: string;
roleId?: string;
branchId?: string;
}
export interface ApiListResponse<T> {
data: {
data: T[];
pagination: { total: number; page: number; pages: number ; };
meta?: { total: number; pages: number };
};
}
export type TableState = {
users: User[];
loading: boolean;
total: number;
pages: number;
error: string | null;
};
export type TableAction =
| { type: "LOAD_START" }
| { type: "LOAD_OK"; users: User[]; total: number; pages: number }
| { type: "LOAD_ERR"; error: string }
| { type: "ADD"; user: User }
| { type: "UPDATE"; user: User }
| { type: "DELETE"; id: string }
| { type: "CLEAR_ERR" };