redesigned payment page + a lot of fixes
This commit is contained in:
@@ -0,0 +1 @@
|
||||
enum DashboardPayoutMode { single, multiple }
|
||||
77
frontend/pweb/lib/models/dashboard/quote_status_data.dart
Normal file
77
frontend/pweb/lib/models/dashboard/quote_status_data.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
import 'package:pshared/models/auto_refresh_mode.dart';
|
||||
import 'package:pshared/models/payment/quote/status_type.dart';
|
||||
|
||||
import 'package:pweb/controllers/payouts/quotation.dart';
|
||||
import 'package:pweb/utils/quote_duration_format.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class QuoteStatusData {
|
||||
final QuoteStatusType statusType;
|
||||
final String statusText;
|
||||
final String? helperText;
|
||||
final bool isLoading;
|
||||
final bool canRefresh;
|
||||
final bool showPrimaryRefresh;
|
||||
final AutoRefreshMode autoRefreshMode;
|
||||
|
||||
const QuoteStatusData({
|
||||
required this.statusType,
|
||||
required this.statusText,
|
||||
required this.helperText,
|
||||
required this.isLoading,
|
||||
required this.canRefresh,
|
||||
required this.showPrimaryRefresh,
|
||||
required this.autoRefreshMode,
|
||||
});
|
||||
|
||||
static QuoteStatusData resolve({
|
||||
required QuotationController controller,
|
||||
required AppLocalizations loc,
|
||||
}) {
|
||||
final timeLeft = controller.timeLeft;
|
||||
final isLoading = controller.isLoading;
|
||||
final statusType = controller.quoteStatus;
|
||||
final autoRefreshMode = controller.autoRefreshMode;
|
||||
|
||||
String statusText;
|
||||
String? helperText;
|
||||
switch (statusType) {
|
||||
case QuoteStatusType.loading:
|
||||
statusText = loc.quoteUpdating;
|
||||
break;
|
||||
case QuoteStatusType.error:
|
||||
statusText = loc.quoteErrorGeneric;
|
||||
break;
|
||||
case QuoteStatusType.missing:
|
||||
statusText = loc.quoteUnavailable;
|
||||
break;
|
||||
case QuoteStatusType.expired:
|
||||
statusText = loc.quoteExpired;
|
||||
helperText = loc.quoteRefreshRequired;
|
||||
break;
|
||||
case QuoteStatusType.active:
|
||||
statusText = timeLeft == null
|
||||
? loc.quoteActive
|
||||
: loc.quoteExpiresIn(formatQuoteDuration(timeLeft));
|
||||
break;
|
||||
}
|
||||
|
||||
final canRefresh = controller.canRefresh && !isLoading;
|
||||
final showPrimaryRefresh = canRefresh &&
|
||||
(statusType == QuoteStatusType.expired ||
|
||||
statusType == QuoteStatusType.error ||
|
||||
statusType == QuoteStatusType.missing);
|
||||
|
||||
return QuoteStatusData(
|
||||
statusType: statusType,
|
||||
statusText: statusText,
|
||||
helperText: helperText,
|
||||
isLoading: isLoading,
|
||||
canRefresh: canRefresh,
|
||||
showPrimaryRefresh: showPrimaryRefresh,
|
||||
autoRefreshMode: autoRefreshMode,
|
||||
);
|
||||
}
|
||||
}
|
||||
11
frontend/pweb/lib/models/dashboard/summary_values.dart
Normal file
11
frontend/pweb/lib/models/dashboard/summary_values.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
class PaymentSummaryValues {
|
||||
final String fee;
|
||||
final String recipientReceives;
|
||||
final String total;
|
||||
|
||||
const PaymentSummaryValues({
|
||||
required this.fee,
|
||||
required this.recipientReceives,
|
||||
required this.total,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user