feat: update parent category analytic
Build & Deploy iOS to TestFlight / build-and-deploy (push) Canceled after 0s

This commit is contained in:
efrilm
2026-10-03 00:38:32 +07:00
parent 36bc9e0f9e
commit 288d0d75a0
21 changed files with 1366 additions and 344 deletions
@@ -35,6 +35,9 @@ class ProfitSharingCategoryDto with _$ProfitSharingCategoryDto {
const factory ProfitSharingCategoryDto({
@JsonKey(name: 'parent_category_id') String? parentCategoryId,
@JsonKey(name: 'parent_category_name') String? parentCategoryName,
@JsonKey(name: 'owner_fee_percent') num? ownerFeePercent,
@JsonKey(name: 'sdl') num? sdl,
@JsonKey(name: 'top_product') ProfitSharingTopProductDto? topProduct,
@JsonKey(name: 'total_revenue') num? totalRevenue,
@JsonKey(name: 'total_quantity') num? totalQuantity,
@JsonKey(name: 'category_count') num? categoryCount,
@@ -59,6 +62,31 @@ class ProfitSharingCategoryDto with _$ProfitSharingCategoryDto {
totalStandardHpp: totalStandardHpp?.toInt() ?? 0,
totalFifoHpp: totalFifoHpp?.toInt() ?? 0,
totalMovingAverageHpp: totalMovingAverageHpp?.toInt() ?? 0,
ownerFeePercent: ownerFeePercent?.toDouble() ?? 0,
sdl: sdl?.toInt() ?? 0,
topProduct: topProduct?.toDomain() ?? const ProfitSharingTopProduct(),
);
}
@freezed
class ProfitSharingTopProductDto with _$ProfitSharingTopProductDto {
const ProfitSharingTopProductDto._();
const factory ProfitSharingTopProductDto({
@JsonKey(name: 'product_id') String? productId,
@JsonKey(name: 'product_name') String? productName,
@JsonKey(name: 'quantity_sold') num? quantitySold,
@JsonKey(name: 'revenue') num? revenue,
}) = _ProfitSharingTopProductDto;
factory ProfitSharingTopProductDto.fromJson(Map<String, dynamic> json) =>
_$ProfitSharingTopProductDtoFromJson(json);
ProfitSharingTopProduct toDomain() => ProfitSharingTopProduct(
productId: productId ?? '',
productName: productName ?? '',
quantitySold: quantitySold?.toInt() ?? 0,
revenue: revenue?.toInt() ?? 0,
);
}
@@ -118,7 +146,7 @@ class ProfitSharingPeriodDto with _$ProfitSharingPeriodDto {
@JsonKey(name: 'revenue') num? revenue,
@JsonKey(name: 'order_count') num? orderCount,
@JsonKey(name: 'limit_purchase') num? limitPurchase,
@JsonKey(name: 'limit_owner') num? limitOwner,
@JsonKey(name: 'sdl') num? sdl,
@JsonKey(name: 'limit_team') num? limitTeam,
@JsonKey(name: 'month') String? month,
@JsonKey(name: 'week_count') num? weekCount,
@@ -134,7 +162,7 @@ class ProfitSharingPeriodDto with _$ProfitSharingPeriodDto {
revenue: revenue?.toInt() ?? 0,
orderCount: orderCount?.toInt() ?? 0,
limitPurchase: limitPurchase?.toInt() ?? 0,
limitOwner: limitOwner?.toInt() ?? 0,
sdl: sdl?.toInt() ?? 0,
limitTeam: limitTeam?.toInt() ?? 0,
month: month ?? '',
weekCount: weekCount?.toInt() ?? 0,
@@ -187,6 +215,8 @@ class ProfitSharingSummaryDto with _$ProfitSharingSummaryDto {
const ProfitSharingSummaryDto._();
const factory ProfitSharingSummaryDto({
@JsonKey(name: 'owner_fee_percent') num? ownerFeePercent,
@JsonKey(name: 'sdl') num? sdl,
@JsonKey(name: 'total_revenue') num? totalRevenue,
@JsonKey(name: 'total_quantity') num? totalQuantity,
@JsonKey(name: 'category_count') num? categoryCount,
@@ -214,6 +244,8 @@ class ProfitSharingSummaryDto with _$ProfitSharingSummaryDto {
totalStandardHpp: totalStandardHpp?.toInt() ?? 0,
totalFifoHpp: totalFifoHpp?.toInt() ?? 0,
totalMovingAverageHpp: totalMovingAverageHpp?.toInt() ?? 0,
ownerFeePercent: ownerFeePercent?.toDouble() ?? 0,
sdl: sdl?.toInt() ?? 0,
);
}