119 lines
2.9 KiB
Dart
119 lines
2.9 KiB
Dart
|
|
part of '../analytic.dart';
|
||
|
|
|
||
|
|
@freezed
|
||
|
|
class DashboardAnalytic with _$DashboardAnalytic {
|
||
|
|
const factory DashboardAnalytic({
|
||
|
|
required String organizationId,
|
||
|
|
required String outletId,
|
||
|
|
required String dateFrom,
|
||
|
|
required String dateTo,
|
||
|
|
required DashboardOverview overview,
|
||
|
|
required List<DashboardTopProduct> topProducts,
|
||
|
|
required List<DashboardPaymentMethod> paymentMethods,
|
||
|
|
required List<DashboardRecentSale> recentSales,
|
||
|
|
}) = _DashboardAnalytic;
|
||
|
|
|
||
|
|
factory DashboardAnalytic.empty() => DashboardAnalytic(
|
||
|
|
organizationId: '',
|
||
|
|
outletId: '',
|
||
|
|
dateFrom: '',
|
||
|
|
dateTo: '',
|
||
|
|
overview: DashboardOverview.empty(),
|
||
|
|
topProducts: const [],
|
||
|
|
paymentMethods: const [],
|
||
|
|
recentSales: const [],
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
@freezed
|
||
|
|
class DashboardOverview with _$DashboardOverview {
|
||
|
|
const factory DashboardOverview({
|
||
|
|
required int totalSales,
|
||
|
|
required int totalOrders,
|
||
|
|
required double averageOrderValue,
|
||
|
|
required int totalCustomers,
|
||
|
|
required int voidedOrders,
|
||
|
|
required int refundedOrders,
|
||
|
|
}) = _DashboardOverview;
|
||
|
|
|
||
|
|
factory DashboardOverview.empty() => const DashboardOverview(
|
||
|
|
totalSales: 0,
|
||
|
|
totalOrders: 0,
|
||
|
|
averageOrderValue: 0.0,
|
||
|
|
totalCustomers: 0,
|
||
|
|
voidedOrders: 0,
|
||
|
|
refundedOrders: 0,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
@freezed
|
||
|
|
class DashboardTopProduct with _$DashboardTopProduct {
|
||
|
|
const factory DashboardTopProduct({
|
||
|
|
required String productId,
|
||
|
|
required String productName,
|
||
|
|
required String categoryId,
|
||
|
|
required String categoryName,
|
||
|
|
required int quantitySold,
|
||
|
|
required int revenue,
|
||
|
|
required double averagePrice,
|
||
|
|
required int orderCount,
|
||
|
|
}) = _DashboardTopProduct;
|
||
|
|
|
||
|
|
factory DashboardTopProduct.empty() => const DashboardTopProduct(
|
||
|
|
productId: '',
|
||
|
|
productName: '',
|
||
|
|
categoryId: '',
|
||
|
|
categoryName: '',
|
||
|
|
quantitySold: 0,
|
||
|
|
revenue: 0,
|
||
|
|
averagePrice: 0.0,
|
||
|
|
orderCount: 0,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
@freezed
|
||
|
|
class DashboardPaymentMethod with _$DashboardPaymentMethod {
|
||
|
|
const factory DashboardPaymentMethod({
|
||
|
|
required String paymentMethodId,
|
||
|
|
required String paymentMethodName,
|
||
|
|
required String paymentMethodType,
|
||
|
|
required int totalAmount,
|
||
|
|
required int orderCount,
|
||
|
|
required int paymentCount,
|
||
|
|
required double percentage,
|
||
|
|
}) = _DashboardPaymentMethod;
|
||
|
|
|
||
|
|
factory DashboardPaymentMethod.empty() => const DashboardPaymentMethod(
|
||
|
|
paymentMethodId: '',
|
||
|
|
paymentMethodName: '',
|
||
|
|
paymentMethodType: '',
|
||
|
|
totalAmount: 0,
|
||
|
|
orderCount: 0,
|
||
|
|
paymentCount: 0,
|
||
|
|
percentage: 0.0,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
@freezed
|
||
|
|
class DashboardRecentSale with _$DashboardRecentSale {
|
||
|
|
const factory DashboardRecentSale({
|
||
|
|
required String date,
|
||
|
|
required int sales,
|
||
|
|
required int orders,
|
||
|
|
required int items,
|
||
|
|
required int tax,
|
||
|
|
required int discount,
|
||
|
|
required int netSales,
|
||
|
|
}) = _DashboardRecentSale;
|
||
|
|
|
||
|
|
factory DashboardRecentSale.empty() => const DashboardRecentSale(
|
||
|
|
date: '',
|
||
|
|
sales: 0,
|
||
|
|
orders: 0,
|
||
|
|
items: 0,
|
||
|
|
tax: 0,
|
||
|
|
discount: 0,
|
||
|
|
netSales: 0,
|
||
|
|
);
|
||
|
|
}
|