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

This commit is contained in:
efrilm
2026-10-04 22:31:01 +07:00
parent 288d0d75a0
commit 243b7e02aa
23 changed files with 1349 additions and 451 deletions
+162 -54
View File
@@ -13342,7 +13342,6 @@ abstract class _ProfitSharingBudget implements ProfitSharingBudget {
/// @nodoc
mixin _$ProfitSharingPercentage {
double get purchase => throw _privateConstructorUsedError;
double get owner => throw _privateConstructorUsedError;
double get team => throw _privateConstructorUsedError;
@@ -13360,7 +13359,7 @@ abstract class $ProfitSharingPercentageCopyWith<$Res> {
$Res Function(ProfitSharingPercentage) then,
) = _$ProfitSharingPercentageCopyWithImpl<$Res, ProfitSharingPercentage>;
@useResult
$Res call({double purchase, double owner, double team});
$Res call({double owner, double team});
}
/// @nodoc
@@ -13380,17 +13379,9 @@ class _$ProfitSharingPercentageCopyWithImpl<
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? purchase = null,
Object? owner = null,
Object? team = null,
}) {
$Res call({Object? owner = null, Object? team = null}) {
return _then(
_value.copyWith(
purchase: null == purchase
? _value.purchase
: purchase // ignore: cast_nullable_to_non_nullable
as double,
owner: null == owner
? _value.owner
: owner // ignore: cast_nullable_to_non_nullable
@@ -13414,7 +13405,7 @@ abstract class _$$ProfitSharingPercentageImplCopyWith<$Res>
) = __$$ProfitSharingPercentageImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({double purchase, double owner, double team});
$Res call({double owner, double team});
}
/// @nodoc
@@ -13434,17 +13425,9 @@ class __$$ProfitSharingPercentageImplCopyWithImpl<$Res>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? purchase = null,
Object? owner = null,
Object? team = null,
}) {
$Res call({Object? owner = null, Object? team = null}) {
return _then(
_$ProfitSharingPercentageImpl(
purchase: null == purchase
? _value.purchase
: purchase // ignore: cast_nullable_to_non_nullable
as double,
owner: null == owner
? _value.owner
: owner // ignore: cast_nullable_to_non_nullable
@@ -13462,13 +13445,10 @@ class __$$ProfitSharingPercentageImplCopyWithImpl<$Res>
class _$ProfitSharingPercentageImpl implements _ProfitSharingPercentage {
const _$ProfitSharingPercentageImpl({
required this.purchase,
required this.owner,
required this.team,
});
@override
final double purchase;
@override
final double owner;
@override
@@ -13476,7 +13456,7 @@ class _$ProfitSharingPercentageImpl implements _ProfitSharingPercentage {
@override
String toString() {
return 'ProfitSharingPercentage(purchase: $purchase, owner: $owner, team: $team)';
return 'ProfitSharingPercentage(owner: $owner, team: $team)';
}
@override
@@ -13484,14 +13464,12 @@ class _$ProfitSharingPercentageImpl implements _ProfitSharingPercentage {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProfitSharingPercentageImpl &&
(identical(other.purchase, purchase) ||
other.purchase == purchase) &&
(identical(other.owner, owner) || other.owner == owner) &&
(identical(other.team, team) || other.team == team));
}
@override
int get hashCode => Object.hash(runtimeType, purchase, owner, team);
int get hashCode => Object.hash(runtimeType, owner, team);
/// Create a copy of ProfitSharingPercentage
/// with the given fields replaced by the non-null parameter values.
@@ -13507,13 +13485,10 @@ class _$ProfitSharingPercentageImpl implements _ProfitSharingPercentage {
abstract class _ProfitSharingPercentage implements ProfitSharingPercentage {
const factory _ProfitSharingPercentage({
required final double purchase,
required final double owner,
required final double team,
}) = _$ProfitSharingPercentageImpl;
@override
double get purchase;
@override
double get owner;
@override
@@ -13533,7 +13508,6 @@ mixin _$ProfitSharingPeriod {
DateTime get periodEnd => throw _privateConstructorUsedError;
int get revenue => throw _privateConstructorUsedError;
int get orderCount => throw _privateConstructorUsedError;
int get limitPurchase => throw _privateConstructorUsedError;
int get sdl => throw _privateConstructorUsedError;
int get limitTeam => throw _privateConstructorUsedError;
String get month => throw _privateConstructorUsedError;
@@ -13558,7 +13532,6 @@ abstract class $ProfitSharingPeriodCopyWith<$Res> {
DateTime periodEnd,
int revenue,
int orderCount,
int limitPurchase,
int sdl,
int limitTeam,
String month,
@@ -13585,7 +13558,6 @@ class _$ProfitSharingPeriodCopyWithImpl<$Res, $Val extends ProfitSharingPeriod>
Object? periodEnd = null,
Object? revenue = null,
Object? orderCount = null,
Object? limitPurchase = null,
Object? sdl = null,
Object? limitTeam = null,
Object? month = null,
@@ -13609,10 +13581,6 @@ class _$ProfitSharingPeriodCopyWithImpl<$Res, $Val extends ProfitSharingPeriod>
? _value.orderCount
: orderCount // ignore: cast_nullable_to_non_nullable
as int,
limitPurchase: null == limitPurchase
? _value.limitPurchase
: limitPurchase // ignore: cast_nullable_to_non_nullable
as int,
sdl: null == sdl
? _value.sdl
: sdl // ignore: cast_nullable_to_non_nullable
@@ -13649,7 +13617,6 @@ abstract class _$$ProfitSharingPeriodImplCopyWith<$Res>
DateTime periodEnd,
int revenue,
int orderCount,
int limitPurchase,
int sdl,
int limitTeam,
String month,
@@ -13675,7 +13642,6 @@ class __$$ProfitSharingPeriodImplCopyWithImpl<$Res>
Object? periodEnd = null,
Object? revenue = null,
Object? orderCount = null,
Object? limitPurchase = null,
Object? sdl = null,
Object? limitTeam = null,
Object? month = null,
@@ -13699,10 +13665,6 @@ class __$$ProfitSharingPeriodImplCopyWithImpl<$Res>
? _value.orderCount
: orderCount // ignore: cast_nullable_to_non_nullable
as int,
limitPurchase: null == limitPurchase
? _value.limitPurchase
: limitPurchase // ignore: cast_nullable_to_non_nullable
as int,
sdl: null == sdl
? _value.sdl
: sdl // ignore: cast_nullable_to_non_nullable
@@ -13732,7 +13694,6 @@ class _$ProfitSharingPeriodImpl extends _ProfitSharingPeriod {
required this.periodEnd,
required this.revenue,
required this.orderCount,
required this.limitPurchase,
required this.sdl,
required this.limitTeam,
this.month = '',
@@ -13748,8 +13709,6 @@ class _$ProfitSharingPeriodImpl extends _ProfitSharingPeriod {
@override
final int orderCount;
@override
final int limitPurchase;
@override
final int sdl;
@override
final int limitTeam;
@@ -13762,7 +13721,7 @@ class _$ProfitSharingPeriodImpl extends _ProfitSharingPeriod {
@override
String toString() {
return 'ProfitSharingPeriod(periodStart: $periodStart, periodEnd: $periodEnd, revenue: $revenue, orderCount: $orderCount, limitPurchase: $limitPurchase, sdl: $sdl, limitTeam: $limitTeam, month: $month, weekCount: $weekCount)';
return 'ProfitSharingPeriod(periodStart: $periodStart, periodEnd: $periodEnd, revenue: $revenue, orderCount: $orderCount, sdl: $sdl, limitTeam: $limitTeam, month: $month, weekCount: $weekCount)';
}
@override
@@ -13777,8 +13736,6 @@ class _$ProfitSharingPeriodImpl extends _ProfitSharingPeriod {
(identical(other.revenue, revenue) || other.revenue == revenue) &&
(identical(other.orderCount, orderCount) ||
other.orderCount == orderCount) &&
(identical(other.limitPurchase, limitPurchase) ||
other.limitPurchase == limitPurchase) &&
(identical(other.sdl, sdl) || other.sdl == sdl) &&
(identical(other.limitTeam, limitTeam) ||
other.limitTeam == limitTeam) &&
@@ -13794,7 +13751,6 @@ class _$ProfitSharingPeriodImpl extends _ProfitSharingPeriod {
periodEnd,
revenue,
orderCount,
limitPurchase,
sdl,
limitTeam,
month,
@@ -13819,7 +13775,6 @@ abstract class _ProfitSharingPeriod extends ProfitSharingPeriod {
required final DateTime periodEnd,
required final int revenue,
required final int orderCount,
required final int limitPurchase,
required final int sdl,
required final int limitTeam,
final String month,
@@ -13836,8 +13791,6 @@ abstract class _ProfitSharingPeriod extends ProfitSharingPeriod {
@override
int get orderCount;
@override
int get limitPurchase;
@override
int get sdl;
@override
int get limitTeam;
@@ -15050,6 +15003,7 @@ mixin _$AnalyticFailure {
required TResult Function(ApiFailure failure) serverError,
required TResult Function() unexpectedError,
required TResult Function() empty,
required TResult Function() notTeam,
required TResult Function(String erroMessage) dynamicErrorMessage,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -15057,6 +15011,7 @@ mixin _$AnalyticFailure {
TResult? Function(ApiFailure failure)? serverError,
TResult? Function()? unexpectedError,
TResult? Function()? empty,
TResult? Function()? notTeam,
TResult? Function(String erroMessage)? dynamicErrorMessage,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -15064,6 +15019,7 @@ mixin _$AnalyticFailure {
TResult Function(ApiFailure failure)? serverError,
TResult Function()? unexpectedError,
TResult Function()? empty,
TResult Function()? notTeam,
TResult Function(String erroMessage)? dynamicErrorMessage,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@@ -15072,6 +15028,7 @@ mixin _$AnalyticFailure {
required TResult Function(_ServerError value) serverError,
required TResult Function(_UnexpectedError value) unexpectedError,
required TResult Function(_Empty value) empty,
required TResult Function(_NotTeam value) notTeam,
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -15079,6 +15036,7 @@ mixin _$AnalyticFailure {
TResult? Function(_ServerError value)? serverError,
TResult? Function(_UnexpectedError value)? unexpectedError,
TResult? Function(_Empty value)? empty,
TResult? Function(_NotTeam value)? notTeam,
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -15086,6 +15044,7 @@ mixin _$AnalyticFailure {
TResult Function(_ServerError value)? serverError,
TResult Function(_UnexpectedError value)? unexpectedError,
TResult Function(_Empty value)? empty,
TResult Function(_NotTeam value)? notTeam,
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@@ -15198,6 +15157,7 @@ class _$ServerErrorImpl implements _ServerError {
required TResult Function(ApiFailure failure) serverError,
required TResult Function() unexpectedError,
required TResult Function() empty,
required TResult Function() notTeam,
required TResult Function(String erroMessage) dynamicErrorMessage,
}) {
return serverError(failure);
@@ -15209,6 +15169,7 @@ class _$ServerErrorImpl implements _ServerError {
TResult? Function(ApiFailure failure)? serverError,
TResult? Function()? unexpectedError,
TResult? Function()? empty,
TResult? Function()? notTeam,
TResult? Function(String erroMessage)? dynamicErrorMessage,
}) {
return serverError?.call(failure);
@@ -15220,6 +15181,7 @@ class _$ServerErrorImpl implements _ServerError {
TResult Function(ApiFailure failure)? serverError,
TResult Function()? unexpectedError,
TResult Function()? empty,
TResult Function()? notTeam,
TResult Function(String erroMessage)? dynamicErrorMessage,
required TResult orElse(),
}) {
@@ -15235,6 +15197,7 @@ class _$ServerErrorImpl implements _ServerError {
required TResult Function(_ServerError value) serverError,
required TResult Function(_UnexpectedError value) unexpectedError,
required TResult Function(_Empty value) empty,
required TResult Function(_NotTeam value) notTeam,
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
}) {
return serverError(this);
@@ -15246,6 +15209,7 @@ class _$ServerErrorImpl implements _ServerError {
TResult? Function(_ServerError value)? serverError,
TResult? Function(_UnexpectedError value)? unexpectedError,
TResult? Function(_Empty value)? empty,
TResult? Function(_NotTeam value)? notTeam,
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
}) {
return serverError?.call(this);
@@ -15257,6 +15221,7 @@ class _$ServerErrorImpl implements _ServerError {
TResult Function(_ServerError value)? serverError,
TResult Function(_UnexpectedError value)? unexpectedError,
TResult Function(_Empty value)? empty,
TResult Function(_NotTeam value)? notTeam,
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
required TResult orElse(),
}) {
@@ -15325,6 +15290,7 @@ class _$UnexpectedErrorImpl implements _UnexpectedError {
required TResult Function(ApiFailure failure) serverError,
required TResult Function() unexpectedError,
required TResult Function() empty,
required TResult Function() notTeam,
required TResult Function(String erroMessage) dynamicErrorMessage,
}) {
return unexpectedError();
@@ -15336,6 +15302,7 @@ class _$UnexpectedErrorImpl implements _UnexpectedError {
TResult? Function(ApiFailure failure)? serverError,
TResult? Function()? unexpectedError,
TResult? Function()? empty,
TResult? Function()? notTeam,
TResult? Function(String erroMessage)? dynamicErrorMessage,
}) {
return unexpectedError?.call();
@@ -15347,6 +15314,7 @@ class _$UnexpectedErrorImpl implements _UnexpectedError {
TResult Function(ApiFailure failure)? serverError,
TResult Function()? unexpectedError,
TResult Function()? empty,
TResult Function()? notTeam,
TResult Function(String erroMessage)? dynamicErrorMessage,
required TResult orElse(),
}) {
@@ -15362,6 +15330,7 @@ class _$UnexpectedErrorImpl implements _UnexpectedError {
required TResult Function(_ServerError value) serverError,
required TResult Function(_UnexpectedError value) unexpectedError,
required TResult Function(_Empty value) empty,
required TResult Function(_NotTeam value) notTeam,
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
}) {
return unexpectedError(this);
@@ -15373,6 +15342,7 @@ class _$UnexpectedErrorImpl implements _UnexpectedError {
TResult? Function(_ServerError value)? serverError,
TResult? Function(_UnexpectedError value)? unexpectedError,
TResult? Function(_Empty value)? empty,
TResult? Function(_NotTeam value)? notTeam,
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
}) {
return unexpectedError?.call(this);
@@ -15384,6 +15354,7 @@ class _$UnexpectedErrorImpl implements _UnexpectedError {
TResult Function(_ServerError value)? serverError,
TResult Function(_UnexpectedError value)? unexpectedError,
TResult Function(_Empty value)? empty,
TResult Function(_NotTeam value)? notTeam,
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
required TResult orElse(),
}) {
@@ -15444,6 +15415,7 @@ class _$EmptyImpl implements _Empty {
required TResult Function(ApiFailure failure) serverError,
required TResult Function() unexpectedError,
required TResult Function() empty,
required TResult Function() notTeam,
required TResult Function(String erroMessage) dynamicErrorMessage,
}) {
return empty();
@@ -15455,6 +15427,7 @@ class _$EmptyImpl implements _Empty {
TResult? Function(ApiFailure failure)? serverError,
TResult? Function()? unexpectedError,
TResult? Function()? empty,
TResult? Function()? notTeam,
TResult? Function(String erroMessage)? dynamicErrorMessage,
}) {
return empty?.call();
@@ -15466,6 +15439,7 @@ class _$EmptyImpl implements _Empty {
TResult Function(ApiFailure failure)? serverError,
TResult Function()? unexpectedError,
TResult Function()? empty,
TResult Function()? notTeam,
TResult Function(String erroMessage)? dynamicErrorMessage,
required TResult orElse(),
}) {
@@ -15481,6 +15455,7 @@ class _$EmptyImpl implements _Empty {
required TResult Function(_ServerError value) serverError,
required TResult Function(_UnexpectedError value) unexpectedError,
required TResult Function(_Empty value) empty,
required TResult Function(_NotTeam value) notTeam,
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
}) {
return empty(this);
@@ -15492,6 +15467,7 @@ class _$EmptyImpl implements _Empty {
TResult? Function(_ServerError value)? serverError,
TResult? Function(_UnexpectedError value)? unexpectedError,
TResult? Function(_Empty value)? empty,
TResult? Function(_NotTeam value)? notTeam,
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
}) {
return empty?.call(this);
@@ -15503,6 +15479,7 @@ class _$EmptyImpl implements _Empty {
TResult Function(_ServerError value)? serverError,
TResult Function(_UnexpectedError value)? unexpectedError,
TResult Function(_Empty value)? empty,
TResult Function(_NotTeam value)? notTeam,
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
required TResult orElse(),
}) {
@@ -15517,6 +15494,131 @@ abstract class _Empty implements AnalyticFailure {
const factory _Empty() = _$EmptyImpl;
}
/// @nodoc
abstract class _$$NotTeamImplCopyWith<$Res> {
factory _$$NotTeamImplCopyWith(
_$NotTeamImpl value,
$Res Function(_$NotTeamImpl) then,
) = __$$NotTeamImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$NotTeamImplCopyWithImpl<$Res>
extends _$AnalyticFailureCopyWithImpl<$Res, _$NotTeamImpl>
implements _$$NotTeamImplCopyWith<$Res> {
__$$NotTeamImplCopyWithImpl(
_$NotTeamImpl _value,
$Res Function(_$NotTeamImpl) _then,
) : super(_value, _then);
/// Create a copy of AnalyticFailure
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
class _$NotTeamImpl implements _NotTeam {
const _$NotTeamImpl();
@override
String toString() {
return 'AnalyticFailure.notTeam()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$NotTeamImpl);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(ApiFailure failure) serverError,
required TResult Function() unexpectedError,
required TResult Function() empty,
required TResult Function() notTeam,
required TResult Function(String erroMessage) dynamicErrorMessage,
}) {
return notTeam();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(ApiFailure failure)? serverError,
TResult? Function()? unexpectedError,
TResult? Function()? empty,
TResult? Function()? notTeam,
TResult? Function(String erroMessage)? dynamicErrorMessage,
}) {
return notTeam?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(ApiFailure failure)? serverError,
TResult Function()? unexpectedError,
TResult Function()? empty,
TResult Function()? notTeam,
TResult Function(String erroMessage)? dynamicErrorMessage,
required TResult orElse(),
}) {
if (notTeam != null) {
return notTeam();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_ServerError value) serverError,
required TResult Function(_UnexpectedError value) unexpectedError,
required TResult Function(_Empty value) empty,
required TResult Function(_NotTeam value) notTeam,
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
}) {
return notTeam(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_ServerError value)? serverError,
TResult? Function(_UnexpectedError value)? unexpectedError,
TResult? Function(_Empty value)? empty,
TResult? Function(_NotTeam value)? notTeam,
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
}) {
return notTeam?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_ServerError value)? serverError,
TResult Function(_UnexpectedError value)? unexpectedError,
TResult Function(_Empty value)? empty,
TResult Function(_NotTeam value)? notTeam,
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
required TResult orElse(),
}) {
if (notTeam != null) {
return notTeam(this);
}
return orElse();
}
}
abstract class _NotTeam implements AnalyticFailure {
const factory _NotTeam() = _$NotTeamImpl;
}
/// @nodoc
abstract class _$$DynamicErrorMessageImplCopyWith<$Res> {
factory _$$DynamicErrorMessageImplCopyWith(
@@ -15594,6 +15696,7 @@ class _$DynamicErrorMessageImpl implements _DynamicErrorMessage {
required TResult Function(ApiFailure failure) serverError,
required TResult Function() unexpectedError,
required TResult Function() empty,
required TResult Function() notTeam,
required TResult Function(String erroMessage) dynamicErrorMessage,
}) {
return dynamicErrorMessage(erroMessage);
@@ -15605,6 +15708,7 @@ class _$DynamicErrorMessageImpl implements _DynamicErrorMessage {
TResult? Function(ApiFailure failure)? serverError,
TResult? Function()? unexpectedError,
TResult? Function()? empty,
TResult? Function()? notTeam,
TResult? Function(String erroMessage)? dynamicErrorMessage,
}) {
return dynamicErrorMessage?.call(erroMessage);
@@ -15616,6 +15720,7 @@ class _$DynamicErrorMessageImpl implements _DynamicErrorMessage {
TResult Function(ApiFailure failure)? serverError,
TResult Function()? unexpectedError,
TResult Function()? empty,
TResult Function()? notTeam,
TResult Function(String erroMessage)? dynamicErrorMessage,
required TResult orElse(),
}) {
@@ -15631,6 +15736,7 @@ class _$DynamicErrorMessageImpl implements _DynamicErrorMessage {
required TResult Function(_ServerError value) serverError,
required TResult Function(_UnexpectedError value) unexpectedError,
required TResult Function(_Empty value) empty,
required TResult Function(_NotTeam value) notTeam,
required TResult Function(_DynamicErrorMessage value) dynamicErrorMessage,
}) {
return dynamicErrorMessage(this);
@@ -15642,6 +15748,7 @@ class _$DynamicErrorMessageImpl implements _DynamicErrorMessage {
TResult? Function(_ServerError value)? serverError,
TResult? Function(_UnexpectedError value)? unexpectedError,
TResult? Function(_Empty value)? empty,
TResult? Function(_NotTeam value)? notTeam,
TResult? Function(_DynamicErrorMessage value)? dynamicErrorMessage,
}) {
return dynamicErrorMessage?.call(this);
@@ -15653,6 +15760,7 @@ class _$DynamicErrorMessageImpl implements _DynamicErrorMessage {
TResult Function(_ServerError value)? serverError,
TResult Function(_UnexpectedError value)? unexpectedError,
TResult Function(_Empty value)? empty,
TResult Function(_NotTeam value)? notTeam,
TResult Function(_DynamicErrorMessage value)? dynamicErrorMessage,
required TResult orElse(),
}) {
@@ -59,6 +59,13 @@ class ProfitSharingCategory with _$ProfitSharingCategory {
bool get hasTopProduct => topProduct.productId.isNotEmpty;
/// Porsi tim = omzet − SDL. Response tidak membawa porsi tim per kategori,
/// jadi dihitung dari nominalnya (docs/migrasi-profit-sharing.md).
int get teamShare => totalRevenue - sdl;
/// % porsi tim terhadap omzet, yaitu 100 − fee owner.
double get teamPercent => 100 - ownerFeePercent;
/// Laba kotor memakai HPP standar (acuan yang dipakai di laporan laba rugi).
int get grossProfit => totalRevenue - totalStandardHpp;
@@ -106,16 +113,16 @@ class ProfitSharingBudget with _$ProfitSharingBudget {
);
}
/// Porsi bawaan bagi hasil: owner (SDL) dan tim, dengan tim = 100 − owner.
@freezed
class ProfitSharingPercentage with _$ProfitSharingPercentage {
const factory ProfitSharingPercentage({
required double purchase,
required double owner,
required double team,
}) = _ProfitSharingPercentage;
factory ProfitSharingPercentage.empty() =>
const ProfitSharingPercentage(purchase: 0, owner: 0, team: 0);
const ProfitSharingPercentage(owner: 0, team: 0);
}
/// Satu baris periode bagi hasil. Dipakai untuk total, mingguan, dan bulanan.
@@ -129,7 +136,6 @@ class ProfitSharingPeriod with _$ProfitSharingPeriod {
required DateTime periodEnd,
required int revenue,
required int orderCount,
required int limitPurchase,
required int sdl,
required int limitTeam,
@Default('') String month,
@@ -141,7 +147,6 @@ class ProfitSharingPeriod with _$ProfitSharingPeriod {
periodEnd: DateTime.fromMillisecondsSinceEpoch(0),
revenue: 0,
orderCount: 0,
limitPurchase: 0,
sdl: 0,
limitTeam: 0,
);
@@ -152,6 +157,9 @@ class ProfitSharingPeriod with _$ProfitSharingPeriod {
/// induk, jadi porsinya dihitung dari nominal, bukan dari persentase tetap.
double get sdlPercentage => revenue == 0 ? 0 : (sdl / revenue) * 100;
/// % porsi tim terhadap omzet, dihitung dari nominal dengan alasan yang sama.
double get teamPercentage => revenue == 0 ? 0 : (limitTeam / revenue) * 100;
int get averageOrderValue => orderCount == 0 ? 0 : revenue ~/ orderCount;
}
@@ -5,6 +5,9 @@ sealed class AnalyticFailure with _$AnalyticFailure {
const factory AnalyticFailure.serverError(ApiFailure failure) = _ServerError;
const factory AnalyticFailure.unexpectedError() = _UnexpectedError;
const factory AnalyticFailure.empty() = _Empty;
/// Detail profit sharing ditolak karena kategori induknya sudah non-team.
const factory AnalyticFailure.notTeam() = _NotTeam;
const factory AnalyticFailure.dynamicErrorMessage(String erroMessage) =
_DynamicErrorMessage;
}