fix: user management & profit chart

This commit is contained in:
ferdiansyah783
2025-08-10 15:47:04 +07:00
parent de93de2e6d
commit 48570c018f
23 changed files with 989 additions and 599 deletions
+84 -25
View File
@@ -1,12 +1,72 @@
export interface Orders {
orders: Order[]
total_count: number
page: number
limit: number
total_pages: number
export type LastSplitQuantity = {
quantity: number
total_amount: number
unit_price: number
}
export interface Order {
export type OrderMetadata = {
customer_name: string
last_split_amount: number
last_split_customer_id: string
last_split_customer_name: string
last_split_payment_id: string
last_split_quantities: Record<string, LastSplitQuantity>
last_split_type: string
}
export type OrderItem = {
id: string
order_id: string
product_id: string
product_name: string
product_variant_id: string | null
quantity: number
unit_price: number
total_price: number
modifiers: unknown[] // Adjust if modifiers have a defined structure
notes: string
status: string
created_at: string
updated_at: string
printer_type: string
paid_quantity: number
}
export type PaymentOrderItem = {
id: string
payment_id: string
order_item_id: string
amount: number
created_at: string
updated_at: string
}
export type PaymentMetadata = {
customer_id: string
customer_name: string
split_type: string
}
export type Payment = {
id: string
order_id: string
payment_method_id: string
payment_method_name: string
payment_method_type: string
amount: number
status: string
split_number: number
split_total: number
split_type: string
split_description: string
refund_amount: number
metadata: PaymentMetadata
created_at: string
updated_at: string
payment_order_items: PaymentOrderItem[]
}
export type Order = {
id: string
order_number: string
outlet_id: string
@@ -18,28 +78,27 @@ export interface Order {
tax_amount: number
discount_amount: number
total_amount: number
total_cost: number
remaining_amount: number
payment_status: string
refund_amount: number
is_void: boolean
is_refund: boolean
notes: string | null
metadata: {
customer_name: string
}
metadata: OrderMetadata
created_at: string
updated_at: string
order_items: OrderItem[]
payments: Payment[]
total_paid: number
payment_count: number
split_type: string
}
export interface OrderItem {
id: string
order_id: string
product_id: string
product_name: string
product_variant_id: string | null
product_variant_name?: string
quantity: number
unit_price: number
total_price: number
modifiers: any[]
notes: string
status: string
created_at: string
updated_at: string
export type Orders = {
orders: Order[],
total_count: number
page: number
limit: number
total_pages: number
}
+33 -3
View File
@@ -1,5 +1,35 @@
export type User = {
id: string
name: string
email: string
id: string;
organization_id: string;
outlet_id: string;
name: string;
email: string;
role: string;
permissions: Record<string, unknown>;
is_active: boolean;
created_at: string; // ISO date string
updated_at: string; // ISO date string
};
type Pagination = {
total_count: number;
page: number;
limit: number;
total_pages: number;
};
export type Users = {
users: User[];
pagination: Pagination;
};
export type UserRequest = {
organization_id: string;
outlet_id: string;
name: string;
email: string;
password: string;
role: string;
permissions: Record<string, unknown>;
is_active: boolean;
}