feat: update profit loss ui
Build & Deploy iOS to TestFlight / build-and-deploy (push) Waiting to run
Build & Deploy iOS to TestFlight / build-and-deploy (push) Waiting to run
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -94,6 +94,8 @@ _$ProfitLossAnalyticDtoImpl _$$ProfitLossAnalyticDtoImplFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _$ProfitLossAnalyticDtoImpl(
|
||||
organizationId: json['organization_id'] as String?,
|
||||
outletId: json['outlet_id'] as String?,
|
||||
outletName: json['outlet_name'] as String?,
|
||||
dateFrom: json['date_from'] as String?,
|
||||
dateTo: json['date_to'] as String?,
|
||||
groupBy: json['group_by'] as String?,
|
||||
@@ -106,18 +108,42 @@ _$ProfitLossAnalyticDtoImpl _$$ProfitLossAnalyticDtoImplFromJson(
|
||||
productData: (json['product_data'] as List<dynamic>?)
|
||||
?.map((e) => ProfitLossProductDataDto.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
mainSummary: (json['main_summary'] as List<dynamic>?)
|
||||
?.map(
|
||||
(e) => ProfitLossMainSummaryItemDto.fromJson(e as Map<String, dynamic>),
|
||||
)
|
||||
.toList(),
|
||||
purchasing: json['purchasing'] == null
|
||||
? null
|
||||
: ProfitLossPurchasingDto.fromJson(
|
||||
json['purchasing'] as Map<String, dynamic>,
|
||||
),
|
||||
operationalExpenses: (json['operational_expenses'] as List<dynamic>?)
|
||||
?.map(
|
||||
(e) =>
|
||||
ProfitLossOperationalExpenseDto.fromJson(e as Map<String, dynamic>),
|
||||
)
|
||||
.toList(),
|
||||
operationalExpensesTotal: (json['operational_expenses_total'] as num?)
|
||||
?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ProfitLossAnalyticDtoImplToJson(
|
||||
_$ProfitLossAnalyticDtoImpl instance,
|
||||
) => <String, dynamic>{
|
||||
'organization_id': instance.organizationId,
|
||||
'outlet_id': instance.outletId,
|
||||
'outlet_name': instance.outletName,
|
||||
'date_from': instance.dateFrom,
|
||||
'date_to': instance.dateTo,
|
||||
'group_by': instance.groupBy,
|
||||
'summary': instance.summary,
|
||||
'data': instance.data,
|
||||
'product_data': instance.productData,
|
||||
'main_summary': instance.mainSummary,
|
||||
'purchasing': instance.purchasing,
|
||||
'operational_expenses': instance.operationalExpenses,
|
||||
'operational_expenses_total': instance.operationalExpensesTotal,
|
||||
};
|
||||
|
||||
_$ProfitLossSummaryDtoImpl _$$ProfitLossSummaryDtoImplFromJson(
|
||||
@@ -216,6 +242,93 @@ Map<String, dynamic> _$$ProfitLossProductDataDtoImplToJson(
|
||||
'profit_per_unit': instance.profitPerUnit,
|
||||
};
|
||||
|
||||
_$ProfitLossMainSummaryItemDtoImpl _$$ProfitLossMainSummaryItemDtoImplFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _$ProfitLossMainSummaryItemDtoImpl(
|
||||
id: json['id'] as String?,
|
||||
label: json['label'] as String?,
|
||||
isBold: json['is_bold'] as bool?,
|
||||
todayNominal: (json['today_nominal'] as num?)?.toInt(),
|
||||
todayPct: (json['today_pct'] as num?)?.toDouble(),
|
||||
mtdNominal: (json['mtd_nominal'] as num?)?.toInt(),
|
||||
mtdPct: (json['mtd_pct'] as num?)?.toDouble(),
|
||||
subItems: (json['sub_items'] as List<dynamic>?)
|
||||
?.map(
|
||||
(e) => ProfitLossMainSummaryItemDto.fromJson(e as Map<String, dynamic>),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ProfitLossMainSummaryItemDtoImplToJson(
|
||||
_$ProfitLossMainSummaryItemDtoImpl instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'label': instance.label,
|
||||
'is_bold': instance.isBold,
|
||||
'today_nominal': instance.todayNominal,
|
||||
'today_pct': instance.todayPct,
|
||||
'mtd_nominal': instance.mtdNominal,
|
||||
'mtd_pct': instance.mtdPct,
|
||||
'sub_items': instance.subItems,
|
||||
};
|
||||
|
||||
_$ProfitLossPurchasingDtoImpl _$$ProfitLossPurchasingDtoImplFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _$ProfitLossPurchasingDtoImpl(
|
||||
todayTotal: (json['today_total'] as num?)?.toInt(),
|
||||
mtdTotal: (json['mtd_total'] as num?)?.toInt(),
|
||||
todayRawMaterial: (json['today_raw_material'] as num?)?.toInt(),
|
||||
mtdRawMaterial: (json['mtd_raw_material'] as num?)?.toInt(),
|
||||
todayExpense: (json['today_expense'] as num?)?.toInt(),
|
||||
mtdExpense: (json['mtd_expense'] as num?)?.toInt(),
|
||||
items: (json['items'] as List<dynamic>?)
|
||||
?.map(
|
||||
(e) => ProfitLossPurchasingItemDto.fromJson(e as Map<String, dynamic>),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ProfitLossPurchasingDtoImplToJson(
|
||||
_$ProfitLossPurchasingDtoImpl instance,
|
||||
) => <String, dynamic>{
|
||||
'today_total': instance.todayTotal,
|
||||
'mtd_total': instance.mtdTotal,
|
||||
'today_raw_material': instance.todayRawMaterial,
|
||||
'mtd_raw_material': instance.mtdRawMaterial,
|
||||
'today_expense': instance.todayExpense,
|
||||
'mtd_expense': instance.mtdExpense,
|
||||
'items': instance.items,
|
||||
};
|
||||
|
||||
_$ProfitLossPurchasingItemDtoImpl _$$ProfitLossPurchasingItemDtoImplFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _$ProfitLossPurchasingItemDtoImpl(
|
||||
date: json['date'] as String?,
|
||||
item: json['item'] as String?,
|
||||
quantity: (json['quantity'] as num?)?.toInt(),
|
||||
nominal: (json['nominal'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ProfitLossPurchasingItemDtoImplToJson(
|
||||
_$ProfitLossPurchasingItemDtoImpl instance,
|
||||
) => <String, dynamic>{
|
||||
'date': instance.date,
|
||||
'item': instance.item,
|
||||
'quantity': instance.quantity,
|
||||
'nominal': instance.nominal,
|
||||
};
|
||||
|
||||
_$ProfitLossOperationalExpenseDtoImpl
|
||||
_$$ProfitLossOperationalExpenseDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$ProfitLossOperationalExpenseDtoImpl(
|
||||
item: json['item'] as String?,
|
||||
nominal: (json['nominal'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ProfitLossOperationalExpenseDtoImplToJson(
|
||||
_$ProfitLossOperationalExpenseDtoImpl instance,
|
||||
) => <String, dynamic>{'item': instance.item, 'nominal': instance.nominal};
|
||||
|
||||
_$CategoryAnalyticDtoImpl _$$CategoryAnalyticDtoImplFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _$CategoryAnalyticDtoImpl(
|
||||
|
||||
@@ -6,12 +6,20 @@ class ProfitLossAnalyticDto with _$ProfitLossAnalyticDto {
|
||||
|
||||
const factory ProfitLossAnalyticDto({
|
||||
@JsonKey(name: 'organization_id') String? organizationId,
|
||||
@JsonKey(name: 'outlet_id') String? outletId,
|
||||
@JsonKey(name: 'outlet_name') String? outletName,
|
||||
@JsonKey(name: 'date_from') String? dateFrom,
|
||||
@JsonKey(name: 'date_to') String? dateTo,
|
||||
@JsonKey(name: 'group_by') String? groupBy,
|
||||
@JsonKey(name: 'summary') ProfitLossSummaryDto? summary,
|
||||
@JsonKey(name: 'data') List<ProfitLossDailyDataDto>? data,
|
||||
@JsonKey(name: 'product_data') List<ProfitLossProductDataDto>? productData,
|
||||
@JsonKey(name: 'main_summary')
|
||||
List<ProfitLossMainSummaryItemDto>? mainSummary,
|
||||
@JsonKey(name: 'purchasing') ProfitLossPurchasingDto? purchasing,
|
||||
@JsonKey(name: 'operational_expenses')
|
||||
List<ProfitLossOperationalExpenseDto>? operationalExpenses,
|
||||
@JsonKey(name: 'operational_expenses_total') int? operationalExpensesTotal,
|
||||
}) = _ProfitLossAnalyticDto;
|
||||
|
||||
factory ProfitLossAnalyticDto.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -19,12 +27,20 @@ class ProfitLossAnalyticDto with _$ProfitLossAnalyticDto {
|
||||
|
||||
ProfitLossAnalytic toDomain() => ProfitLossAnalytic(
|
||||
organizationId: organizationId ?? '',
|
||||
outletId: outletId ?? '',
|
||||
outletName: outletName ?? '',
|
||||
dateFrom: dateFrom ?? '',
|
||||
dateTo: dateTo ?? '',
|
||||
groupBy: groupBy ?? '',
|
||||
summary: summary?.toDomain() ?? ProfitLossSummary.empty(),
|
||||
data: (data ?? []).map((e) => e.toDomain()).toList(),
|
||||
productData: (productData ?? []).map((e) => e.toDomain()).toList(),
|
||||
mainSummary: (mainSummary ?? []).map((e) => e.toDomain()).toList(),
|
||||
purchasing: purchasing?.toDomain() ?? ProfitLossPurchasing.empty(),
|
||||
operationalExpenses: (operationalExpenses ?? [])
|
||||
.map((e) => e.toDomain())
|
||||
.toList(),
|
||||
operationalExpensesTotal: operationalExpensesTotal ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -135,3 +151,99 @@ class ProfitLossProductDataDto with _$ProfitLossProductDataDto {
|
||||
profitPerUnit: profitPerUnit ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class ProfitLossMainSummaryItemDto with _$ProfitLossMainSummaryItemDto {
|
||||
const ProfitLossMainSummaryItemDto._();
|
||||
|
||||
const factory ProfitLossMainSummaryItemDto({
|
||||
@JsonKey(name: 'id') String? id,
|
||||
@JsonKey(name: 'label') String? label,
|
||||
@JsonKey(name: 'is_bold') bool? isBold,
|
||||
@JsonKey(name: 'today_nominal') int? todayNominal,
|
||||
@JsonKey(name: 'today_pct') double? todayPct,
|
||||
@JsonKey(name: 'mtd_nominal') int? mtdNominal,
|
||||
@JsonKey(name: 'mtd_pct') double? mtdPct,
|
||||
@JsonKey(name: 'sub_items') List<ProfitLossMainSummaryItemDto>? subItems,
|
||||
}) = _ProfitLossMainSummaryItemDto;
|
||||
|
||||
factory ProfitLossMainSummaryItemDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$ProfitLossMainSummaryItemDtoFromJson(json);
|
||||
|
||||
ProfitLossMainSummaryItem toDomain() => ProfitLossMainSummaryItem(
|
||||
id: id ?? '',
|
||||
label: label ?? '',
|
||||
isBold: isBold ?? false,
|
||||
todayNominal: todayNominal ?? 0,
|
||||
todayPct: todayPct ?? 0.0,
|
||||
mtdNominal: mtdNominal ?? 0,
|
||||
mtdPct: mtdPct ?? 0.0,
|
||||
subItems: (subItems ?? []).map((e) => e.toDomain()).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class ProfitLossPurchasingDto with _$ProfitLossPurchasingDto {
|
||||
const ProfitLossPurchasingDto._();
|
||||
|
||||
const factory ProfitLossPurchasingDto({
|
||||
@JsonKey(name: 'today_total') int? todayTotal,
|
||||
@JsonKey(name: 'mtd_total') int? mtdTotal,
|
||||
@JsonKey(name: 'today_raw_material') int? todayRawMaterial,
|
||||
@JsonKey(name: 'mtd_raw_material') int? mtdRawMaterial,
|
||||
@JsonKey(name: 'today_expense') int? todayExpense,
|
||||
@JsonKey(name: 'mtd_expense') int? mtdExpense,
|
||||
@JsonKey(name: 'items') List<ProfitLossPurchasingItemDto>? items,
|
||||
}) = _ProfitLossPurchasingDto;
|
||||
|
||||
factory ProfitLossPurchasingDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$ProfitLossPurchasingDtoFromJson(json);
|
||||
|
||||
ProfitLossPurchasing toDomain() => ProfitLossPurchasing(
|
||||
todayTotal: todayTotal ?? 0,
|
||||
mtdTotal: mtdTotal ?? 0,
|
||||
todayRawMaterial: todayRawMaterial ?? 0,
|
||||
mtdRawMaterial: mtdRawMaterial ?? 0,
|
||||
todayExpense: todayExpense ?? 0,
|
||||
mtdExpense: mtdExpense ?? 0,
|
||||
items: (items ?? []).map((e) => e.toDomain()).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class ProfitLossPurchasingItemDto with _$ProfitLossPurchasingItemDto {
|
||||
const ProfitLossPurchasingItemDto._();
|
||||
|
||||
const factory ProfitLossPurchasingItemDto({
|
||||
@JsonKey(name: 'date') String? date,
|
||||
@JsonKey(name: 'item') String? item,
|
||||
@JsonKey(name: 'quantity') int? quantity,
|
||||
@JsonKey(name: 'nominal') int? nominal,
|
||||
}) = _ProfitLossPurchasingItemDto;
|
||||
|
||||
factory ProfitLossPurchasingItemDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$ProfitLossPurchasingItemDtoFromJson(json);
|
||||
|
||||
ProfitLossPurchasingItem toDomain() => ProfitLossPurchasingItem(
|
||||
date: date ?? '',
|
||||
item: item ?? '',
|
||||
quantity: quantity ?? 0,
|
||||
nominal: nominal ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class ProfitLossOperationalExpenseDto with _$ProfitLossOperationalExpenseDto {
|
||||
const ProfitLossOperationalExpenseDto._();
|
||||
|
||||
const factory ProfitLossOperationalExpenseDto({
|
||||
@JsonKey(name: 'item') String? item,
|
||||
@JsonKey(name: 'nominal') int? nominal,
|
||||
}) = _ProfitLossOperationalExpenseDto;
|
||||
|
||||
factory ProfitLossOperationalExpenseDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$ProfitLossOperationalExpenseDtoFromJson(json);
|
||||
|
||||
ProfitLossOperationalExpense toDomain() =>
|
||||
ProfitLossOperationalExpense(item: item ?? '', nominal: nominal ?? 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user