9ed4889310
Release package / release (push) Successful in 10m13s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com> Reviewed-on: #41
183 lines
3.3 KiB
TypeScript
183 lines
3.3 KiB
TypeScript
// ===== USER TYPES =====
|
|
export type UserRole = "manager" | "staff" | "customer";
|
|
|
|
export interface User {
|
|
id: string;
|
|
name: string;
|
|
role: UserRole;
|
|
avatar: string | null;
|
|
phone?: string;
|
|
}
|
|
|
|
// ===== SHOP INFO TYPES =====
|
|
export interface WifiInfo {
|
|
name: string;
|
|
password: string;
|
|
}
|
|
|
|
export interface ShopInfo {
|
|
name: string;
|
|
tagline: string;
|
|
logo: string;
|
|
address: string;
|
|
phone: string;
|
|
managerPhone: string;
|
|
email: string;
|
|
wifi: WifiInfo;
|
|
openHours: string;
|
|
}
|
|
|
|
// ===== SOCIAL LINKS TYPES =====
|
|
export interface SocialLinks {
|
|
facebook: string;
|
|
tiktok: string;
|
|
website: string;
|
|
}
|
|
|
|
// ===== SHOP (QUÁN NƯỚC) TYPES =====
|
|
export interface Shop {
|
|
id: number;
|
|
name: string;
|
|
address: string;
|
|
image: string;
|
|
}
|
|
|
|
// ===== FINANCIAL ANALYTICS TYPES =====
|
|
export type AnalyticsPeriod = "day" | "week" | "month" | "year";
|
|
|
|
export interface RevenueDataPoint {
|
|
label: string; // e.g. "01/04", "Tuần 1", "Tháng 1"
|
|
revenue: number;
|
|
orders: number;
|
|
}
|
|
|
|
export interface ProductSalesStats {
|
|
productId: number;
|
|
name: string;
|
|
category: string;
|
|
unitsSold: number;
|
|
revenue: number;
|
|
costPrice: number; // giá nhập
|
|
sellingPrice: number; // giá bán
|
|
profit: number;
|
|
profitMargin: number; // %
|
|
}
|
|
|
|
export interface PeriodComparison {
|
|
current: number;
|
|
previous: number;
|
|
change: number; // absolute
|
|
changePercent: number; // %
|
|
isPositive: boolean;
|
|
}
|
|
|
|
export interface FinancialSummary {
|
|
totalRevenue: number;
|
|
totalOrders: number;
|
|
totalProfit: number;
|
|
averageOrderValue: number;
|
|
revenueComparison: PeriodComparison;
|
|
ordersComparison: PeriodComparison;
|
|
profitComparison: PeriodComparison;
|
|
}
|
|
|
|
// ===== SHIFT / SCHEDULE TYPES =====
|
|
export type ShiftStatus =
|
|
| "available"
|
|
| "registered"
|
|
| "approved_leave"
|
|
| "absent";
|
|
|
|
export interface ShiftRegistrationEntity {
|
|
id: string;
|
|
staffId: string;
|
|
shift: ShiftEntity;
|
|
}
|
|
|
|
export interface ShiftEntity {
|
|
id: string;
|
|
date: Date;
|
|
startTime: string;
|
|
endTime: string;
|
|
wage: number;
|
|
maxStaff: number;
|
|
registeredStaff?: ShiftRegistrationEntity[];
|
|
}
|
|
|
|
export interface Department {
|
|
id: string;
|
|
name: string;
|
|
icon: string;
|
|
}
|
|
|
|
export interface MenuItemEntity {
|
|
id?: string;
|
|
name: string;
|
|
price: number;
|
|
eatery?: EateryEntity;
|
|
imageUrl: string;
|
|
available: boolean;
|
|
description: string;
|
|
}
|
|
|
|
export interface EateryEntity {
|
|
id: string;
|
|
ownerId: string;
|
|
name: string;
|
|
menuItems: MenuItemEntity[];
|
|
shifts: ShiftEntity[];
|
|
}
|
|
|
|
export interface allEateriesQuery {
|
|
allEateries: EateryEntity[];
|
|
}
|
|
|
|
export interface addMenuItemMutation {
|
|
addMenuItem: MenuItemEntity;
|
|
}
|
|
|
|
export interface updateMenuItemMutation {
|
|
updateMenuItem: MenuItemEntity;
|
|
}
|
|
|
|
export interface deleteMenuItemMutation {
|
|
deleteMenuItem: boolean;
|
|
}
|
|
|
|
export interface CartItemEntity {
|
|
productId: string;
|
|
quantity: number;
|
|
priceAtTimeOfAdding?: number;
|
|
}
|
|
|
|
export interface CartEntity {
|
|
Id: string;
|
|
items: CartItemEntity[];
|
|
totalAmount: number;
|
|
paymentQrUrl: string;
|
|
}
|
|
|
|
export interface getCartQuery {
|
|
getCart: CartEntity;
|
|
}
|
|
|
|
export interface createCartMutation {
|
|
createCart: string;
|
|
}
|
|
|
|
export interface addMenuItemMutation {
|
|
addItem: CartEntity;
|
|
}
|
|
|
|
export interface allRegistrationsQuery {
|
|
allRegistrations: ShiftRegistrationEntity[];
|
|
}
|
|
|
|
export interface allShiftsQuery {
|
|
allShifts: ShiftEntity[];
|
|
}
|
|
|
|
export interface createShiftMutation {
|
|
createShift: ShiftEntity;
|
|
}
|