121 lines
3.2 KiB
Dart
121 lines
3.2 KiB
Dart
part of '../analytic.dart';
|
|
|
|
@freezed
|
|
class InventoryAnalytic with _$InventoryAnalytic {
|
|
const factory InventoryAnalytic({
|
|
required InventoryAnalyticSummary summary,
|
|
required List<InventoryAnalyticProductItem> products,
|
|
required List<InventoryAnalyticIngredientItem> ingredients,
|
|
}) = _InventoryAnalytic;
|
|
|
|
factory InventoryAnalytic.empty() => InventoryAnalytic(
|
|
summary: InventoryAnalyticSummary.empty(),
|
|
products: const [],
|
|
ingredients: const [],
|
|
);
|
|
}
|
|
|
|
@freezed
|
|
class InventoryAnalyticSummary with _$InventoryAnalyticSummary {
|
|
const factory InventoryAnalyticSummary({
|
|
required int totalProducts,
|
|
required int totalIngredients,
|
|
required int totalValue,
|
|
required int lowStockProducts,
|
|
required int lowStockIngredients,
|
|
required int zeroStockProducts,
|
|
required int zeroStockIngredients,
|
|
required int totalSoldProducts,
|
|
required int totalSoldIngredients,
|
|
required String outletId,
|
|
required String outletName,
|
|
required DateTime generatedAt,
|
|
}) = _InventoryAnalyticSummary;
|
|
|
|
factory InventoryAnalyticSummary.empty() => InventoryAnalyticSummary(
|
|
totalProducts: 0,
|
|
totalIngredients: 0,
|
|
totalValue: 0,
|
|
lowStockProducts: 0,
|
|
lowStockIngredients: 0,
|
|
zeroStockProducts: 0,
|
|
zeroStockIngredients: 0,
|
|
totalSoldProducts: 0,
|
|
totalSoldIngredients: 0,
|
|
outletId: '',
|
|
outletName: '',
|
|
generatedAt: DateTime.now(),
|
|
);
|
|
}
|
|
|
|
@freezed
|
|
class InventoryAnalyticProductItem with _$InventoryAnalyticProductItem {
|
|
const factory InventoryAnalyticProductItem({
|
|
required String id,
|
|
required String productId,
|
|
required String productName,
|
|
required String categoryName,
|
|
required int quantity,
|
|
required int reorderLevel,
|
|
required num unitCost,
|
|
required int totalValue,
|
|
required int totalIn,
|
|
required int totalOut,
|
|
required bool isLowStock,
|
|
required bool isZeroStock,
|
|
required DateTime updatedAt,
|
|
}) = _InventoryAnalyticProductItem;
|
|
|
|
factory InventoryAnalyticProductItem.empty() => InventoryAnalyticProductItem(
|
|
id: '',
|
|
productId: '',
|
|
productName: '',
|
|
categoryName: '',
|
|
quantity: 0,
|
|
reorderLevel: 0,
|
|
unitCost: 0,
|
|
totalValue: 0,
|
|
totalIn: 0,
|
|
totalOut: 0,
|
|
isLowStock: false,
|
|
isZeroStock: false,
|
|
updatedAt: DateTime.now(),
|
|
);
|
|
}
|
|
|
|
@freezed
|
|
class InventoryAnalyticIngredientItem with _$InventoryAnalyticIngredientItem {
|
|
const factory InventoryAnalyticIngredientItem({
|
|
required String id,
|
|
required String ingredientId,
|
|
required String ingredientName,
|
|
required String unitName,
|
|
required int quantity,
|
|
required int reorderLevel,
|
|
required num unitCost,
|
|
required int totalValue,
|
|
required int totalIn,
|
|
required int totalOut,
|
|
required bool isLowStock,
|
|
required bool isZeroStock,
|
|
required DateTime updatedAt,
|
|
}) = _InventoryAnalyticIngredientItem;
|
|
|
|
factory InventoryAnalyticIngredientItem.empty() =>
|
|
InventoryAnalyticIngredientItem(
|
|
id: '',
|
|
ingredientId: '',
|
|
ingredientName: '',
|
|
unitName: '',
|
|
quantity: 0,
|
|
reorderLevel: 0,
|
|
unitCost: 0,
|
|
totalValue: 0,
|
|
totalIn: 0,
|
|
totalOut: 0,
|
|
isLowStock: false,
|
|
isZeroStock: false,
|
|
updatedAt: DateTime.now(),
|
|
);
|
|
}
|