Frontend first draft
This commit is contained in:
34
frontend/pweb/lib/app/app.dart
Normal file
34
frontend/pweb/lib/app/app.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/config/constants.dart';
|
||||
import 'package:pshared/provider/locale.dart';
|
||||
|
||||
import 'package:pweb/app/router/router.dart';
|
||||
|
||||
import 'package:pshared/generated/i18n/ps_localizations.dart';
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
final _router = createRouter();
|
||||
|
||||
class PayApp extends StatelessWidget {
|
||||
const PayApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => MaterialApp.router(
|
||||
title: 'Profee Pay',
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Constants.themeColor),
|
||||
useMaterial3: true,
|
||||
),
|
||||
routerConfig: _router,
|
||||
localizationsDelegates: [
|
||||
...PSLocalizations.localizationsDelegates,
|
||||
...AppLocalizations.localizationsDelegates,
|
||||
],
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
locale: context.watch<LocaleProvider>().locale,
|
||||
);
|
||||
}
|
||||
70
frontend/pweb/lib/app/locale_manager.dart
Normal file
70
frontend/pweb/lib/app/locale_manager.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:intl/find_locale.dart';
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'package:pshared/provider/locale.dart';
|
||||
|
||||
|
||||
String _localeVarStorageName() {
|
||||
return 'mcrm_last_locale';
|
||||
}
|
||||
|
||||
Locale _selectDefaultLocale(List<Locale> appLocales, Locale defaultLocale) {
|
||||
return appLocales.contains(defaultLocale)
|
||||
? defaultLocale
|
||||
: appLocales.isEmpty
|
||||
? throw ArgumentError('empty application locales list', 'appLocales')
|
||||
: appLocales.first;
|
||||
}
|
||||
|
||||
|
||||
class LocaleManager {
|
||||
late SharedPreferences _prefs;
|
||||
final List<Locale> appLocales;
|
||||
final Locale _defaultLocale;
|
||||
final LocaleProvider localeProvider;
|
||||
|
||||
LocaleManager(this.localeProvider, this.appLocales, Locale defaultLocale)
|
||||
: _defaultLocale = _selectDefaultLocale(appLocales, defaultLocale) {
|
||||
SharedPreferences.getInstance().then((prefs) {
|
||||
_prefs = prefs;
|
||||
_initializeLocaleProvider();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _initializeLocaleProvider() async {
|
||||
final initialLocale = await _getInitialLocale();
|
||||
localeProvider.setLocale(initialLocale);
|
||||
localeProvider.addListener(_onLocaleChanged);
|
||||
}
|
||||
|
||||
Future<Locale> _getInitialLocale() async {
|
||||
final locale = await _pickLocale();
|
||||
return appLocales.contains(locale) ? locale : _defaultLocale;
|
||||
}
|
||||
|
||||
Future<Locale> _pickLocale() async {
|
||||
String? savedLocaleCode = _prefs.getString(_localeVarStorageName());
|
||||
if (savedLocaleCode != null) {
|
||||
return Locale(savedLocaleCode);
|
||||
}
|
||||
|
||||
String systemLocaleString = await findSystemLocale();
|
||||
final List<String> localeParts = systemLocaleString.split('_');
|
||||
final Locale systemLocale = Locale(localeParts[0]);
|
||||
|
||||
final res = appLocales.contains(systemLocale);
|
||||
|
||||
return res ? systemLocale : _defaultLocale;
|
||||
}
|
||||
|
||||
Future<bool> saveLocale(Locale locale) async {
|
||||
return _prefs.setString(_localeVarStorageName(), locale.toString());
|
||||
}
|
||||
|
||||
Future<bool> _onLocaleChanged() async {
|
||||
return saveLocale(localeProvider.locale);
|
||||
}
|
||||
}
|
||||
15
frontend/pweb/lib/app/router/page_params.dart
Normal file
15
frontend/pweb/lib/app/router/page_params.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
enum PageParams {
|
||||
token,
|
||||
projectRef,
|
||||
roleRef,
|
||||
taskRef,
|
||||
invitationRef,
|
||||
}
|
||||
|
||||
String routerPageParam(PageParams param) {
|
||||
return ':${param.name}';
|
||||
}
|
||||
|
||||
String routerAddParam(PageParams param) {
|
||||
return '/${routerPageParam(param)}';
|
||||
}
|
||||
60
frontend/pweb/lib/app/router/pages.dart
Normal file
60
frontend/pweb/lib/app/router/pages.dart
Normal file
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
enum Pages {
|
||||
root,
|
||||
sfactor,
|
||||
login,
|
||||
methods,
|
||||
verify,
|
||||
signup,
|
||||
settings,
|
||||
dashboard,
|
||||
profile,
|
||||
recipients,
|
||||
users,
|
||||
roles,
|
||||
permissions,
|
||||
invitations,
|
||||
}
|
||||
|
||||
String routerPath(String page) {
|
||||
return '/$page';
|
||||
}
|
||||
|
||||
String routerPage(Pages page) {
|
||||
return page == Pages.root ? '/' : routerPath(page.name);
|
||||
}
|
||||
|
||||
String _pagePath(Pages page, {String? objectRef}) => _pagesPath([page], objectRef: objectRef);
|
||||
|
||||
String _pagesPath(List<Pages> pages, {String? objectRef}) {
|
||||
final path = pages.map(routerPage).join();
|
||||
return objectRef != null ? '$path/$objectRef' : path;
|
||||
}
|
||||
|
||||
void navigateAndReplace(BuildContext context, Pages page, {String? objectRef, Object? extra}) {
|
||||
context.go(_pagePath(page, objectRef: objectRef), extra: extra);
|
||||
}
|
||||
|
||||
void navigate(BuildContext context, Pages page, {String? objectRef, Object? extra}) {
|
||||
navigatePages(context, [page], objectRef: objectRef, extra: extra);
|
||||
}
|
||||
|
||||
void navigatePages(BuildContext context, List<Pages> pages, {String? objectRef, Object? extra}) {
|
||||
context.push(_pagesPath(pages, objectRef: objectRef), extra: extra);
|
||||
}
|
||||
|
||||
void navigateNamed(BuildContext context, Pages page, {String? objectRef, Object? extra}) {
|
||||
context.pushNamed(page.name, extra: extra);
|
||||
}
|
||||
|
||||
|
||||
void navigateNamedAndReplace(BuildContext context, Pages page, {String? objectRef, Object? extra}) {
|
||||
context.replaceNamed(page.name, extra: extra);
|
||||
}
|
||||
|
||||
void navigateNext(BuildContext context, Pages page, {Object? extra}) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => navigate(context, page, extra: extra));
|
||||
}
|
||||
57
frontend/pweb/lib/app/router/router.dart
Normal file
57
frontend/pweb/lib/app/router/router.dart
Normal file
@@ -0,0 +1,57 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'package:pweb/app/router/pages.dart';
|
||||
import 'package:pweb/pages/2fa/page.dart';
|
||||
import 'package:pweb/pages/signup/page.dart';
|
||||
import 'package:pweb/widgets/sidebar/page.dart';
|
||||
import 'package:pweb/pages/login/page.dart';
|
||||
import 'package:pweb/pages/errors/not_found.dart';
|
||||
|
||||
GoRouter createRouter() => GoRouter(
|
||||
debugLogDiagnostics: true,
|
||||
routes: <RouteBase>[
|
||||
GoRoute(
|
||||
name: Pages.root.name,
|
||||
path: routerPage(Pages.root),
|
||||
builder: (_, __) => const LoginPage(),
|
||||
routes: [
|
||||
GoRoute(
|
||||
name: Pages.login.name,
|
||||
path: routerPage(Pages.login),
|
||||
builder: (_, __) => const LoginPage(),
|
||||
),
|
||||
GoRoute(
|
||||
name: Pages.dashboard.name,
|
||||
path: routerPage(Pages.dashboard),
|
||||
builder: (_, __) => const PageSelector(),
|
||||
),
|
||||
GoRoute(
|
||||
name: Pages.sfactor.name,
|
||||
path: routerPage(Pages.sfactor),
|
||||
builder: (context, state) {
|
||||
// Определяем откуда пришел пользователь
|
||||
final isFromSignup = state.uri.queryParameters['from'] == 'signup';
|
||||
|
||||
return TwoFactorCodePage(
|
||||
onVerificationSuccess: () {
|
||||
if (isFromSignup) {
|
||||
// После регистрации -> на страницу логина
|
||||
context.goNamed(Pages.login.name);
|
||||
} else {
|
||||
// После логина -> на дашборд
|
||||
context.goNamed(Pages.dashboard.name);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: Pages.signup.name,
|
||||
path: routerPage(Pages.signup),
|
||||
builder: (_, __) => const SignUpPage(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
errorBuilder: (_, __) => const NotFoundPage(),
|
||||
);
|
||||
27
frontend/pweb/lib/app/timeago.dart
Normal file
27
frontend/pweb/lib/app/timeago.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart'; // Ensure this file exports supportedLocales
|
||||
|
||||
// Mapping of language codes to timeago message classes.
|
||||
final Map<String, timeago.LookupMessages> _timeagoLocales = {
|
||||
'en': timeago.EnMessages(),
|
||||
'ru': timeago.RuMessages(),
|
||||
'uk': timeago.UkMessages(),
|
||||
// Add more mappings as needed.
|
||||
};
|
||||
|
||||
/// Initializes timeago using the supported locales from AppLocalisations.
|
||||
/// Optionally, [defaultLocale] can be set (defaults to 'en').
|
||||
void initializeTimeagoLocales({String defaultLocale = 'en'}) {
|
||||
// Assume AppLocalisations.supportedLocales is a static List<Locale>
|
||||
final supportedLocales = AppLocalizations.supportedLocales;
|
||||
|
||||
for (final locale in supportedLocales) {
|
||||
final languageCode = locale.languageCode;
|
||||
if (_timeagoLocales.containsKey(languageCode)) {
|
||||
timeago.setLocaleMessages(languageCode, _timeagoLocales[languageCode]!);
|
||||
}
|
||||
}
|
||||
// Set the default locale.
|
||||
timeago.setDefaultLocale(defaultLocale);
|
||||
}
|
||||
10
frontend/pweb/lib/config/constants.dart
Normal file
10
frontend/pweb/lib/config/constants.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
class Constants {
|
||||
static const minPasswordCharacters = 8;
|
||||
}
|
||||
|
||||
class AppConfig {
|
||||
static const String appName = String.fromEnvironment(
|
||||
'APP_NAME',
|
||||
defaultValue: 'SendiCo',
|
||||
);
|
||||
}
|
||||
1562
frontend/pweb/lib/generated/i18n/app_localizations.dart
Normal file
1562
frontend/pweb/lib/generated/i18n/app_localizations.dart
Normal file
File diff suppressed because it is too large
Load Diff
779
frontend/pweb/lib/generated/i18n/app_localizations_en.dart
Normal file
779
frontend/pweb/lib/generated/i18n/app_localizations_en.dart
Normal file
@@ -0,0 +1,779 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
/// The translations for English (`en`).
|
||||
class AppLocalizationsEn extends AppLocalizations {
|
||||
AppLocalizationsEn([String locale = 'en']) : super(locale);
|
||||
|
||||
@override
|
||||
String get login => 'Login';
|
||||
|
||||
@override
|
||||
String get logout => 'Logout';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get signup => 'Sign up';
|
||||
|
||||
@override
|
||||
String get username => 'Email';
|
||||
|
||||
@override
|
||||
String get usernameHint => 'email@example.com';
|
||||
|
||||
@override
|
||||
String get usernameErrorInvalid => 'Provide a valid email address';
|
||||
|
||||
@override
|
||||
String usernameUnknownTLD(Object domain) {
|
||||
return 'Domain .$domain is not known, please, check it';
|
||||
}
|
||||
|
||||
@override
|
||||
String get password => 'Password';
|
||||
|
||||
@override
|
||||
String get confirmPassword => 'Confirm password';
|
||||
|
||||
@override
|
||||
String get passwordValidationRuleDigit => 'has digit';
|
||||
|
||||
@override
|
||||
String get passwordValidationRuleUpperCase => 'has uppercase letter';
|
||||
|
||||
@override
|
||||
String get passwordValidationRuleLowerCase => 'has lowercase letter';
|
||||
|
||||
@override
|
||||
String get passwordValidationRuleSpecialCharacter =>
|
||||
'has special character letter';
|
||||
|
||||
@override
|
||||
String passwordValidationRuleMinCharacters(Object charNum) {
|
||||
return 'is $charNum characters long at least';
|
||||
}
|
||||
|
||||
@override
|
||||
String get passwordsDoNotMatch => 'Passwords do not match';
|
||||
|
||||
@override
|
||||
String passwordValidationError(Object matchesCriteria) {
|
||||
return 'Check that your password $matchesCriteria';
|
||||
}
|
||||
|
||||
@override
|
||||
String notificationError(Object error) {
|
||||
return 'Error occurred: $error';
|
||||
}
|
||||
|
||||
@override
|
||||
String loginUserNotFound(Object account) {
|
||||
return 'Account $account has not been registered in the system';
|
||||
}
|
||||
|
||||
@override
|
||||
String get loginPasswordIncorrect =>
|
||||
'Authorization failed, please check your password';
|
||||
|
||||
@override
|
||||
String internalErrorOccurred(Object error) {
|
||||
return 'An internal server error occurred: $error, we already know about it and working hard to fix it';
|
||||
}
|
||||
|
||||
@override
|
||||
String get noErrorInformation =>
|
||||
'Some error occurred, but we have not error information. We are already investigating the issue';
|
||||
|
||||
@override
|
||||
String get yourName => 'Your name';
|
||||
|
||||
@override
|
||||
String get nameHint => 'John Doe';
|
||||
|
||||
@override
|
||||
String get errorPageNotFoundTitle => 'Page Not Found';
|
||||
|
||||
@override
|
||||
String get errorPageNotFoundMessage => 'Oops! We couldn\'t find that page.';
|
||||
|
||||
@override
|
||||
String get errorPageNotFoundHint =>
|
||||
'The page you\'re looking for doesn\'t exist or has been moved. Please check the URL or return to the home page.';
|
||||
|
||||
@override
|
||||
String get errorUnknown => 'Unknown error occurred';
|
||||
|
||||
@override
|
||||
String get unknown => 'unknown';
|
||||
|
||||
@override
|
||||
String get goToLogin => 'Go to Login';
|
||||
|
||||
@override
|
||||
String get goBack => 'Go Back';
|
||||
|
||||
@override
|
||||
String get goToMainPage => 'Go to Main Page';
|
||||
|
||||
@override
|
||||
String get goToSignUp => 'Go to Sign Up';
|
||||
|
||||
@override
|
||||
String signupError(Object error) {
|
||||
return 'Failed to signup: $error';
|
||||
}
|
||||
|
||||
@override
|
||||
String signupSuccess(Object email) {
|
||||
return 'Email confirmation message has been sent to $email. Please, open it and click link to activate your account.';
|
||||
}
|
||||
|
||||
@override
|
||||
String connectivityError(Object serverAddress) {
|
||||
return 'Cannot reach the server at $serverAddress. Check your network and try again.';
|
||||
}
|
||||
|
||||
@override
|
||||
String get errorAccountExists => 'Account already exists';
|
||||
|
||||
@override
|
||||
String get errorAccountNotVerified =>
|
||||
'Your account hasn\'t been verified yet. Please check your email to complete the verification';
|
||||
|
||||
@override
|
||||
String get errorLoginUnauthorized =>
|
||||
'Login or password is incorrect. Please try again';
|
||||
|
||||
@override
|
||||
String get errorInternalError =>
|
||||
'An internal error occurred. We\'re aware of the issue and working to resolve it. Please try again later';
|
||||
|
||||
@override
|
||||
String get errorVerificationTokenNotFound =>
|
||||
'Account for verification not found. Sign up again';
|
||||
|
||||
@override
|
||||
String get created => 'Created';
|
||||
|
||||
@override
|
||||
String get edited => 'Edited';
|
||||
|
||||
@override
|
||||
String get errorDataConflict =>
|
||||
'We can’t process your data because it has conflicting or contradictory information.';
|
||||
|
||||
@override
|
||||
String get errorAccessDenied =>
|
||||
'You do not have permission to access this resource. If you need access, please contact an administrator.';
|
||||
|
||||
@override
|
||||
String get errorBrokenPayload =>
|
||||
'The data you sent is invalid or incomplete. Please check your submission and try again.';
|
||||
|
||||
@override
|
||||
String get errorInvalidArgument =>
|
||||
'One or more arguments are invalid. Verify your input and try again.';
|
||||
|
||||
@override
|
||||
String get errorBrokenReference =>
|
||||
'The resource you\'re trying to access could not be referenced. It may have been moved or deleted.';
|
||||
|
||||
@override
|
||||
String get errorInvalidQueryParameter =>
|
||||
'One or more query parameters are missing or incorrect. Check them and try again.';
|
||||
|
||||
@override
|
||||
String get errorNotImplemented =>
|
||||
'This feature is not yet available. Please try again later or contact support.';
|
||||
|
||||
@override
|
||||
String get errorLicenseRequired =>
|
||||
'A valid license is required to perform this action. Please contact your administrator.';
|
||||
|
||||
@override
|
||||
String get errorNotFound =>
|
||||
'We couldn\'t find the resource you requested. It may have been removed or is temporarily unavailable.';
|
||||
|
||||
@override
|
||||
String get errorNameMissing => 'Please provide a name before continuing.';
|
||||
|
||||
@override
|
||||
String get errorEmailMissing =>
|
||||
'Please provide an email address before continuing.';
|
||||
|
||||
@override
|
||||
String get errorPasswordMissing =>
|
||||
'Please provide a password before continuing.';
|
||||
|
||||
@override
|
||||
String get errorEmailNotRegistered =>
|
||||
'We could not find an account associated with that email address.';
|
||||
|
||||
@override
|
||||
String get errorDuplicateEmail =>
|
||||
'This email address is already in use. Try another one or reset your password.';
|
||||
|
||||
@override
|
||||
String get showDetailsAction => 'Show Details';
|
||||
|
||||
@override
|
||||
String get errorLogin => 'Error logging in';
|
||||
|
||||
@override
|
||||
String get errorCreatingInvitation => 'Failed to create invitaiton';
|
||||
|
||||
@override
|
||||
String get footerCompanyName => 'Sibilla Solutions LTD';
|
||||
|
||||
@override
|
||||
String get footerAddress =>
|
||||
'27, Pindarou Street, Alpha Business Centre, Block B 7th Floor, 1060 Nicosia, Cyprus';
|
||||
|
||||
@override
|
||||
String get footerSupport => 'Support';
|
||||
|
||||
@override
|
||||
String get footerEmail => 'Email TBD';
|
||||
|
||||
@override
|
||||
String get footerPhoneLabel => 'Phone';
|
||||
|
||||
@override
|
||||
String get footerPhone => '+357 22 000 253';
|
||||
|
||||
@override
|
||||
String get footerTermsOfService => 'Terms of Service';
|
||||
|
||||
@override
|
||||
String get footerPrivacyPolicy => 'Privacy Policy';
|
||||
|
||||
@override
|
||||
String get footerCookiePolicy => 'Cookie Policy';
|
||||
|
||||
@override
|
||||
String get navigationLogout => 'Logout';
|
||||
|
||||
@override
|
||||
String get dashboard => 'Dashboard';
|
||||
|
||||
@override
|
||||
String get navigationUsersSettings => 'Users';
|
||||
|
||||
@override
|
||||
String get navigationRolesSettings => 'Roles';
|
||||
|
||||
@override
|
||||
String get navigationPermissionsSettings => 'Permissions';
|
||||
|
||||
@override
|
||||
String get usersManagement => 'User Management';
|
||||
|
||||
@override
|
||||
String get navigationOrganizationSettings => 'Organization settings';
|
||||
|
||||
@override
|
||||
String get navigationAccountSettings => 'Profile settings';
|
||||
|
||||
@override
|
||||
String get twoFactorPrompt => 'Enter the 6-digit code we sent to your device';
|
||||
|
||||
@override
|
||||
String get twoFactorResend => 'Didn’t receive a code? Resend';
|
||||
|
||||
@override
|
||||
String get twoFactorTitle => 'Two-Factor Authentication';
|
||||
|
||||
@override
|
||||
String get twoFactorError => 'Invalid code. Please try again.';
|
||||
|
||||
@override
|
||||
String get payoutNavDashboard => 'Dashboard';
|
||||
|
||||
@override
|
||||
String get payoutNavSendPayout => 'Send payout';
|
||||
|
||||
@override
|
||||
String get payoutNavRecipients => 'Recipients';
|
||||
|
||||
@override
|
||||
String get payoutNavReports => 'Reports';
|
||||
|
||||
@override
|
||||
String get payoutNavSettings => 'Settings';
|
||||
|
||||
@override
|
||||
String get payoutNavLogout => 'Logout';
|
||||
|
||||
@override
|
||||
String get payoutNavMethods => 'Payouts';
|
||||
|
||||
@override
|
||||
String get expand => 'Expand';
|
||||
|
||||
@override
|
||||
String get collapse => 'Collapse';
|
||||
|
||||
@override
|
||||
String get pageTitleRecipients => 'Recipient address book';
|
||||
|
||||
@override
|
||||
String get actionAddNew => 'Add new';
|
||||
|
||||
@override
|
||||
String get colDataOwner => 'Data owner';
|
||||
|
||||
@override
|
||||
String get colAvatar => 'Avatar';
|
||||
|
||||
@override
|
||||
String get colName => 'Name';
|
||||
|
||||
@override
|
||||
String get colEmail => 'Email';
|
||||
|
||||
@override
|
||||
String get colStatus => 'Status';
|
||||
|
||||
@override
|
||||
String get statusReady => 'Ready';
|
||||
|
||||
@override
|
||||
String get statusRegistered => 'Registered';
|
||||
|
||||
@override
|
||||
String get statusNotRegistered => 'Not registered';
|
||||
|
||||
@override
|
||||
String get typeInternal => 'Managed by me';
|
||||
|
||||
@override
|
||||
String get typeExternal => 'Self‑managed';
|
||||
|
||||
@override
|
||||
String get searchHint => 'Search recipients';
|
||||
|
||||
@override
|
||||
String get colActions => 'Actions';
|
||||
|
||||
@override
|
||||
String get menuEdit => 'Edit';
|
||||
|
||||
@override
|
||||
String get menuSendPayout => 'Send payout';
|
||||
|
||||
@override
|
||||
String get tooltipRowActions => 'More actions';
|
||||
|
||||
@override
|
||||
String get accountSettings => 'Account Settings';
|
||||
|
||||
@override
|
||||
String get accountNameUpdateError => 'Failed to update account name';
|
||||
|
||||
@override
|
||||
String get settingsSuccessfullyUpdated => 'Settings successfully updated';
|
||||
|
||||
@override
|
||||
String get language => 'Language';
|
||||
|
||||
@override
|
||||
String get failedToUpdateLanguage => 'Failed to update language';
|
||||
|
||||
@override
|
||||
String get settingsImageUpdateError => 'Couldn\'t update the image';
|
||||
|
||||
@override
|
||||
String get settingsImageTitle => 'Image';
|
||||
|
||||
@override
|
||||
String get settingsImageHint => 'Tap to change the image';
|
||||
|
||||
@override
|
||||
String get accountName => 'Name';
|
||||
|
||||
@override
|
||||
String get accountNameHint => 'Specify your name';
|
||||
|
||||
@override
|
||||
String get avatar => 'Profile photo';
|
||||
|
||||
@override
|
||||
String get avatarHint => 'Tap to update';
|
||||
|
||||
@override
|
||||
String get avatarUpdateError => 'Failed to update profile photo';
|
||||
|
||||
@override
|
||||
String get settings => 'Settings';
|
||||
|
||||
@override
|
||||
String get notSet => 'not set';
|
||||
|
||||
@override
|
||||
String get search => 'Search...';
|
||||
|
||||
@override
|
||||
String get ok => 'Ok';
|
||||
|
||||
@override
|
||||
String get cancel => 'Cancel';
|
||||
|
||||
@override
|
||||
String get confirm => 'Confirm';
|
||||
|
||||
@override
|
||||
String get back => 'Back';
|
||||
|
||||
@override
|
||||
String get operationfryTitle => 'Operation history';
|
||||
|
||||
@override
|
||||
String get filters => 'Filters';
|
||||
|
||||
@override
|
||||
String get period => 'Period';
|
||||
|
||||
@override
|
||||
String get selectPeriod => 'Select period';
|
||||
|
||||
@override
|
||||
String get apply => 'Apply';
|
||||
|
||||
@override
|
||||
String status(String status) {
|
||||
return '$status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get operationStatusSuccessful => 'Successful';
|
||||
|
||||
@override
|
||||
String get operationStatusPending => 'Pending';
|
||||
|
||||
@override
|
||||
String get operationStatusUnsuccessful => 'Unsuccessful';
|
||||
|
||||
@override
|
||||
String get statusColumn => 'Status';
|
||||
|
||||
@override
|
||||
String get fileNameColumn => 'File name';
|
||||
|
||||
@override
|
||||
String get amountColumn => 'Amount';
|
||||
|
||||
@override
|
||||
String get toAmountColumn => 'To amount';
|
||||
|
||||
@override
|
||||
String get payIdColumn => 'Pay ID';
|
||||
|
||||
@override
|
||||
String get cardNumberColumn => 'Card number';
|
||||
|
||||
@override
|
||||
String get nameColumn => 'Name';
|
||||
|
||||
@override
|
||||
String get dateColumn => 'Date';
|
||||
|
||||
@override
|
||||
String get commentColumn => 'Comment';
|
||||
|
||||
@override
|
||||
String get paymentConfigTitle => 'Where to receive money';
|
||||
|
||||
@override
|
||||
String get paymentConfigSubtitle =>
|
||||
'Add multiple methods and choose your primary one.';
|
||||
|
||||
@override
|
||||
String get addPaymentMethod => 'Add payment method';
|
||||
|
||||
@override
|
||||
String get makeMain => 'Make primary';
|
||||
|
||||
@override
|
||||
String get advanced => 'Advanced';
|
||||
|
||||
@override
|
||||
String get fallbackExplanation =>
|
||||
'If the primary method is unavailable, we will try the next enabled one in the list.';
|
||||
|
||||
@override
|
||||
String get delete => 'Delete';
|
||||
|
||||
@override
|
||||
String get deletePaymentConfirmation =>
|
||||
'Are you sure you want to delete this payment method?';
|
||||
|
||||
@override
|
||||
String get edit => 'Edit';
|
||||
|
||||
@override
|
||||
String get moreActions => 'More actions';
|
||||
|
||||
@override
|
||||
String get noPayouts => 'No Payouts';
|
||||
|
||||
@override
|
||||
String get enterBankName => 'Enter bank name';
|
||||
|
||||
@override
|
||||
String get paymentType => 'Payment Method Type';
|
||||
|
||||
@override
|
||||
String get selectPaymentType => 'Please select a payment method type';
|
||||
|
||||
@override
|
||||
String get paymentTypeCard => 'Credit Card';
|
||||
|
||||
@override
|
||||
String get paymentTypeBankAccount => 'Russian Bank Account';
|
||||
|
||||
@override
|
||||
String get paymentTypeIban => 'IBAN';
|
||||
|
||||
@override
|
||||
String get paymentTypeWallet => 'Wallet';
|
||||
|
||||
@override
|
||||
String get cardNumber => 'Card Number';
|
||||
|
||||
@override
|
||||
String get enterCardNumber => 'Enter the card number';
|
||||
|
||||
@override
|
||||
String get cardholderName => 'Cardholder Name';
|
||||
|
||||
@override
|
||||
String get iban => 'IBAN';
|
||||
|
||||
@override
|
||||
String get enterIban => 'Enter IBAN';
|
||||
|
||||
@override
|
||||
String get bic => 'BIC';
|
||||
|
||||
@override
|
||||
String get bankName => 'Bank Name';
|
||||
|
||||
@override
|
||||
String get accountHolder => 'Account Holder';
|
||||
|
||||
@override
|
||||
String get enterAccountHolder => 'Enter account holder';
|
||||
|
||||
@override
|
||||
String get enterBic => 'Enter BIC';
|
||||
|
||||
@override
|
||||
String get walletId => 'Wallet ID';
|
||||
|
||||
@override
|
||||
String get enterWalletId => 'Enter wallet ID';
|
||||
|
||||
@override
|
||||
String get recipients => 'Recipients';
|
||||
|
||||
@override
|
||||
String get recipientName => 'Recipient Name';
|
||||
|
||||
@override
|
||||
String get enterRecipientName => 'Enter recipient name';
|
||||
|
||||
@override
|
||||
String get inn => 'INN';
|
||||
|
||||
@override
|
||||
String get enterInn => 'Enter INN';
|
||||
|
||||
@override
|
||||
String get kpp => 'KPP';
|
||||
|
||||
@override
|
||||
String get enterKpp => 'Enter KPP';
|
||||
|
||||
@override
|
||||
String get accountNumber => 'Account Number';
|
||||
|
||||
@override
|
||||
String get enterAccountNumber => 'Enter account number';
|
||||
|
||||
@override
|
||||
String get correspondentAccount => 'Correspondent Account';
|
||||
|
||||
@override
|
||||
String get enterCorrespondentAccount => 'Enter correspondent account';
|
||||
|
||||
@override
|
||||
String get bik => 'BIK';
|
||||
|
||||
@override
|
||||
String get enterBik => 'Enter BIK';
|
||||
|
||||
@override
|
||||
String get add => 'Add';
|
||||
|
||||
@override
|
||||
String get expiryDate => 'Expiry (MM/YY)';
|
||||
|
||||
@override
|
||||
String get firstName => 'First Name';
|
||||
|
||||
@override
|
||||
String get enterFirstName => 'Enter First Name';
|
||||
|
||||
@override
|
||||
String get lastName => 'Last Name';
|
||||
|
||||
@override
|
||||
String get enterLastName => 'Enter Last Name';
|
||||
|
||||
@override
|
||||
String get sendSingle => 'Send single transaction';
|
||||
|
||||
@override
|
||||
String get sendMultiple => 'Send multiple transactions';
|
||||
|
||||
@override
|
||||
String get addFunds => 'Add Funds';
|
||||
|
||||
@override
|
||||
String get close => 'Close';
|
||||
|
||||
@override
|
||||
String get multiplePayout => 'Multiple Payout';
|
||||
|
||||
@override
|
||||
String get howItWorks => 'How it works?';
|
||||
|
||||
@override
|
||||
String get exampleTitle => 'File Format & Sample';
|
||||
|
||||
@override
|
||||
String get downloadSampleCSV => 'Download sample.csv';
|
||||
|
||||
@override
|
||||
String get tokenColumn => 'Token (required)';
|
||||
|
||||
@override
|
||||
String get currency => 'Currency';
|
||||
|
||||
@override
|
||||
String get amount => 'Amount';
|
||||
|
||||
@override
|
||||
String get comment => 'Comment';
|
||||
|
||||
@override
|
||||
String get uploadCSV => 'Upload your CSV';
|
||||
|
||||
@override
|
||||
String get upload => 'Upload';
|
||||
|
||||
@override
|
||||
String get hintUpload => 'Supported format: .CSV · Max size 1 MB';
|
||||
|
||||
@override
|
||||
String get uploadHistory => 'Upload History';
|
||||
|
||||
@override
|
||||
String get payout => 'Payout';
|
||||
|
||||
@override
|
||||
String get sendTo => 'Send Payout To';
|
||||
|
||||
@override
|
||||
String get send => 'Send Payout';
|
||||
|
||||
@override
|
||||
String get recipientPaysFee => 'Recipient pays the fee';
|
||||
|
||||
@override
|
||||
String sentAmount(String amount) {
|
||||
return 'Sent amount: \$$amount';
|
||||
}
|
||||
|
||||
@override
|
||||
String fee(String fee) {
|
||||
return 'Fee: \$$fee';
|
||||
}
|
||||
|
||||
@override
|
||||
String recipientWillReceive(String amount) {
|
||||
return 'Recipient will receive: \$$amount';
|
||||
}
|
||||
|
||||
@override
|
||||
String total(String total) {
|
||||
return 'Total: \$$total';
|
||||
}
|
||||
|
||||
@override
|
||||
String get hideDetails => 'Hide Details';
|
||||
|
||||
@override
|
||||
String get showDetails => 'Show Details';
|
||||
|
||||
@override
|
||||
String get whereGetMoney => 'Source of funds for debit';
|
||||
|
||||
@override
|
||||
String get details => 'Details';
|
||||
|
||||
@override
|
||||
String get addRecipient => 'Add Recipient';
|
||||
|
||||
@override
|
||||
String get editRecipient => 'Edit Recipient';
|
||||
|
||||
@override
|
||||
String get saveRecipient => 'Save Recipient';
|
||||
|
||||
@override
|
||||
String get choosePaymentMethod => 'Payment Methods (choose at least 1)';
|
||||
|
||||
@override
|
||||
String get recipientFormRule =>
|
||||
'Recipient must have at least one payment method';
|
||||
|
||||
@override
|
||||
String get allStatus => 'All';
|
||||
|
||||
@override
|
||||
String get readyStatus => 'Ready';
|
||||
|
||||
@override
|
||||
String get registeredStatus => 'Registered';
|
||||
|
||||
@override
|
||||
String get notRegisteredStatus => 'Not registered';
|
||||
|
||||
@override
|
||||
String get noRecipientSelected => 'No recipient selected';
|
||||
|
||||
@override
|
||||
String get companyName => 'Name of your company';
|
||||
|
||||
@override
|
||||
String get companynameRequired => 'Company name required';
|
||||
|
||||
@override
|
||||
String get errorSignUp => 'Error occured while signing up, try again later';
|
||||
|
||||
@override
|
||||
String get companyDescription => 'Company Description';
|
||||
|
||||
@override
|
||||
String get companyDescriptionHint =>
|
||||
'Describe any of the fields of the Company\'s business';
|
||||
|
||||
@override
|
||||
String get optional => 'optional';
|
||||
}
|
||||
782
frontend/pweb/lib/generated/i18n/app_localizations_ru.dart
Normal file
782
frontend/pweb/lib/generated/i18n/app_localizations_ru.dart
Normal file
@@ -0,0 +1,782 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
/// The translations for Russian (`ru`).
|
||||
class AppLocalizationsRu extends AppLocalizations {
|
||||
AppLocalizationsRu([String locale = 'ru']) : super(locale);
|
||||
|
||||
@override
|
||||
String get login => 'Войти';
|
||||
|
||||
@override
|
||||
String get logout => 'Выйти';
|
||||
|
||||
@override
|
||||
String get profile => 'Профиль';
|
||||
|
||||
@override
|
||||
String get signup => 'Регистрация';
|
||||
|
||||
@override
|
||||
String get username => 'Email';
|
||||
|
||||
@override
|
||||
String get usernameHint => 'email@example.com';
|
||||
|
||||
@override
|
||||
String get usernameErrorInvalid =>
|
||||
'Укажите действительный адрес электронной почты';
|
||||
|
||||
@override
|
||||
String usernameUnknownTLD(Object domain) {
|
||||
return 'Домен .$domain неизвестен, пожалуйста, проверьте его';
|
||||
}
|
||||
|
||||
@override
|
||||
String get password => 'Пароль';
|
||||
|
||||
@override
|
||||
String get confirmPassword => 'Подтвердите пароль';
|
||||
|
||||
@override
|
||||
String get passwordValidationRuleDigit => 'содержит цифру';
|
||||
|
||||
@override
|
||||
String get passwordValidationRuleUpperCase => 'содержит заглавную букву';
|
||||
|
||||
@override
|
||||
String get passwordValidationRuleLowerCase => 'содержит строчную букву';
|
||||
|
||||
@override
|
||||
String get passwordValidationRuleSpecialCharacter =>
|
||||
'содержит специальный символ';
|
||||
|
||||
@override
|
||||
String passwordValidationRuleMinCharacters(Object charNum) {
|
||||
return 'длина не менее $charNum символов';
|
||||
}
|
||||
|
||||
@override
|
||||
String get passwordsDoNotMatch => 'Пароли не совпадают';
|
||||
|
||||
@override
|
||||
String passwordValidationError(Object matchesCriteria) {
|
||||
return 'Убедитесь, что ваш пароль $matchesCriteria';
|
||||
}
|
||||
|
||||
@override
|
||||
String notificationError(Object error) {
|
||||
return 'Произошла ошибка: $error';
|
||||
}
|
||||
|
||||
@override
|
||||
String loginUserNotFound(Object account) {
|
||||
return 'Аккаунт $account не зарегистрирован в системе';
|
||||
}
|
||||
|
||||
@override
|
||||
String get loginPasswordIncorrect =>
|
||||
'Ошибка авторизации, пожалуйста, проверьте пароль';
|
||||
|
||||
@override
|
||||
String internalErrorOccurred(Object error) {
|
||||
return 'Произошла внутренняя ошибка сервера: $error, мы уже знаем о ней и усердно работаем над исправлением';
|
||||
}
|
||||
|
||||
@override
|
||||
String get noErrorInformation =>
|
||||
'Произошла ошибка, но у нас нет информации о ней. Мы уже расследуем этот вопрос';
|
||||
|
||||
@override
|
||||
String get yourName => 'Ваше имя';
|
||||
|
||||
@override
|
||||
String get nameHint => 'Иван Иванов';
|
||||
|
||||
@override
|
||||
String get errorPageNotFoundTitle => 'Страница не найдена';
|
||||
|
||||
@override
|
||||
String get errorPageNotFoundMessage =>
|
||||
'Упс! Мы не смогли найти эту страницу.';
|
||||
|
||||
@override
|
||||
String get errorPageNotFoundHint =>
|
||||
'Запрашиваемая страница не существует или была перемещена. Пожалуйста, проверьте URL или вернитесь на главную страницу.';
|
||||
|
||||
@override
|
||||
String get errorUnknown => 'Произошла неизвестная ошибка';
|
||||
|
||||
@override
|
||||
String get unknown => 'неизвестно';
|
||||
|
||||
@override
|
||||
String get goToLogin => 'Перейти к входу';
|
||||
|
||||
@override
|
||||
String get goBack => 'Назад';
|
||||
|
||||
@override
|
||||
String get goToMainPage => 'На главную';
|
||||
|
||||
@override
|
||||
String get goToSignUp => 'Перейти к регистрации';
|
||||
|
||||
@override
|
||||
String signupError(Object error) {
|
||||
return 'Не удалось зарегистрироваться: $error';
|
||||
}
|
||||
|
||||
@override
|
||||
String signupSuccess(Object email) {
|
||||
return 'Письмо с подтверждением email отправлено на $email. Пожалуйста, откройте его и перейдите по ссылке для активации вашего аккаунта.';
|
||||
}
|
||||
|
||||
@override
|
||||
String connectivityError(Object serverAddress) {
|
||||
return 'Не удается связаться с сервером $serverAddress. Проверьте ваше интернет-соединение и попробуйте снова.';
|
||||
}
|
||||
|
||||
@override
|
||||
String get errorAccountExists => 'Account already exists';
|
||||
|
||||
@override
|
||||
String get errorAccountNotVerified =>
|
||||
'Ваш аккаунт еще не подтвержден. Пожалуйста, проверьте вашу электронную почту для завершения верификации';
|
||||
|
||||
@override
|
||||
String get errorLoginUnauthorized =>
|
||||
'Неверный логин или пароль. Пожалуйста, попробуйте снова';
|
||||
|
||||
@override
|
||||
String get errorInternalError =>
|
||||
'Произошла внутренняя ошибка. Мы в курсе проблемы и работаем над ее решением. Пожалуйста, попробуйте позже';
|
||||
|
||||
@override
|
||||
String get errorVerificationTokenNotFound =>
|
||||
'Аккаунт для верификации не найден. Зарегистрируйтесь снова';
|
||||
|
||||
@override
|
||||
String get created => 'Создано';
|
||||
|
||||
@override
|
||||
String get edited => 'Изменено';
|
||||
|
||||
@override
|
||||
String get errorDataConflict =>
|
||||
'Мы не можем обработать ваши данные, так как они содержат конфликтующую или противоречивую информацию.';
|
||||
|
||||
@override
|
||||
String get errorAccessDenied =>
|
||||
'У вас нет разрешения на доступ к этому ресурсу. Если вам нужен доступ, пожалуйста, обратитесь к администратору.';
|
||||
|
||||
@override
|
||||
String get errorBrokenPayload =>
|
||||
'Отправленные данные недействительны или неполны. Пожалуйста, проверьте введенные данные и попробуйте снова.';
|
||||
|
||||
@override
|
||||
String get errorInvalidArgument =>
|
||||
'Один или несколько аргументов недействительны. Проверьте введенные данные и попробуйте снова.';
|
||||
|
||||
@override
|
||||
String get errorBrokenReference =>
|
||||
'Ресурс, к которому вы пытаетесь получить доступ, не может быть найден. Возможно, он был перемещен или удален.';
|
||||
|
||||
@override
|
||||
String get errorInvalidQueryParameter =>
|
||||
'Один или несколько параметров запроса отсутствуют или указаны неверно. Проверьте их и попробуйте снова.';
|
||||
|
||||
@override
|
||||
String get errorNotImplemented =>
|
||||
'Эта функция еще недоступна. Пожалуйста, попробуйте позже или обратитесь в службу поддержки.';
|
||||
|
||||
@override
|
||||
String get errorLicenseRequired =>
|
||||
'Для выполнения этого действия требуется действующая лицензия. Пожалуйста, обратитесь к вашему администратору.';
|
||||
|
||||
@override
|
||||
String get errorNotFound =>
|
||||
'Мы не смогли найти запрошенный ресурс. Возможно, он был удален или временно недоступен.';
|
||||
|
||||
@override
|
||||
String get errorNameMissing => 'Пожалуйста, укажите имя для продолжения.';
|
||||
|
||||
@override
|
||||
String get errorEmailMissing =>
|
||||
'Пожалуйста, укажите адрес электронной почты для продолжения.';
|
||||
|
||||
@override
|
||||
String get errorPasswordMissing =>
|
||||
'Пожалуйста, укажите пароль для продолжения.';
|
||||
|
||||
@override
|
||||
String get errorEmailNotRegistered =>
|
||||
'Мы не нашли аккаунт, связанный с этим адресом электронной почты.';
|
||||
|
||||
@override
|
||||
String get errorDuplicateEmail =>
|
||||
'Этот адрес электронной почты уже используется. Попробуйте другой или восстановите пароль.';
|
||||
|
||||
@override
|
||||
String get showDetailsAction => 'Показать детали';
|
||||
|
||||
@override
|
||||
String get errorLogin => 'Ошибка входа';
|
||||
|
||||
@override
|
||||
String get errorCreatingInvitation => 'Не удалось создать приглашение';
|
||||
|
||||
@override
|
||||
String get footerCompanyName => 'Sibilla Solutions LTD';
|
||||
|
||||
@override
|
||||
String get footerAddress =>
|
||||
'27, Pindarou Street, Alpha Business Centre, Block B 7th Floor, 1060 Nicosia, Cyprus';
|
||||
|
||||
@override
|
||||
String get footerSupport => 'Поддержка';
|
||||
|
||||
@override
|
||||
String get footerEmail => 'Email TBD';
|
||||
|
||||
@override
|
||||
String get footerPhoneLabel => 'Телефон';
|
||||
|
||||
@override
|
||||
String get footerPhone => '+357 22 000 253';
|
||||
|
||||
@override
|
||||
String get footerTermsOfService => 'Условия обслуживания';
|
||||
|
||||
@override
|
||||
String get footerPrivacyPolicy => 'Политика конфиденциальности';
|
||||
|
||||
@override
|
||||
String get footerCookiePolicy => 'Политика использования файлов cookie';
|
||||
|
||||
@override
|
||||
String get navigationLogout => 'Выйти';
|
||||
|
||||
@override
|
||||
String get dashboard => 'Дашборд';
|
||||
|
||||
@override
|
||||
String get navigationUsersSettings => 'Пользователи';
|
||||
|
||||
@override
|
||||
String get navigationRolesSettings => 'Роли';
|
||||
|
||||
@override
|
||||
String get navigationPermissionsSettings => 'Разрешения';
|
||||
|
||||
@override
|
||||
String get usersManagement => 'Управление пользователями';
|
||||
|
||||
@override
|
||||
String get navigationOrganizationSettings => 'Настройки организации';
|
||||
|
||||
@override
|
||||
String get navigationAccountSettings => 'Настройки профиля';
|
||||
|
||||
@override
|
||||
String get twoFactorPrompt =>
|
||||
'Введите 6-значный код, отправленный на ваше устройство';
|
||||
|
||||
@override
|
||||
String get twoFactorResend => 'Не получили код? Отправить снова';
|
||||
|
||||
@override
|
||||
String get twoFactorTitle => 'Двухфакторная аутентификация';
|
||||
|
||||
@override
|
||||
String get twoFactorError => 'Неверный код. Пожалуйста, попробуйте снова.';
|
||||
|
||||
@override
|
||||
String get payoutNavDashboard => 'Дашборд';
|
||||
|
||||
@override
|
||||
String get payoutNavSendPayout => 'Отправить выплату';
|
||||
|
||||
@override
|
||||
String get payoutNavRecipients => 'Получатели';
|
||||
|
||||
@override
|
||||
String get payoutNavReports => 'Отчеты';
|
||||
|
||||
@override
|
||||
String get payoutNavSettings => 'Настройки';
|
||||
|
||||
@override
|
||||
String get payoutNavLogout => 'Выйти';
|
||||
|
||||
@override
|
||||
String get payoutNavMethods => 'Выплаты';
|
||||
|
||||
@override
|
||||
String get expand => 'Развернуть';
|
||||
|
||||
@override
|
||||
String get collapse => 'Свернуть';
|
||||
|
||||
@override
|
||||
String get pageTitleRecipients => 'Адресная книга получателей';
|
||||
|
||||
@override
|
||||
String get actionAddNew => 'Добавить';
|
||||
|
||||
@override
|
||||
String get colDataOwner => 'Владелец данных';
|
||||
|
||||
@override
|
||||
String get colAvatar => 'Аватар';
|
||||
|
||||
@override
|
||||
String get colName => 'Имя';
|
||||
|
||||
@override
|
||||
String get colEmail => 'Email';
|
||||
|
||||
@override
|
||||
String get colStatus => 'Статус';
|
||||
|
||||
@override
|
||||
String get statusReady => 'Готов';
|
||||
|
||||
@override
|
||||
String get statusRegistered => 'Зарегистрирован';
|
||||
|
||||
@override
|
||||
String get statusNotRegistered => 'Не зарегистрирован';
|
||||
|
||||
@override
|
||||
String get typeInternal => 'Управляется мной';
|
||||
|
||||
@override
|
||||
String get typeExternal => 'Самоуправляемый';
|
||||
|
||||
@override
|
||||
String get searchHint => 'Поиск получателей';
|
||||
|
||||
@override
|
||||
String get colActions => 'Действия';
|
||||
|
||||
@override
|
||||
String get menuEdit => 'Редактировать';
|
||||
|
||||
@override
|
||||
String get menuSendPayout => 'Отправить выплату';
|
||||
|
||||
@override
|
||||
String get tooltipRowActions => 'Другие действия';
|
||||
|
||||
@override
|
||||
String get accountSettings => 'Настройки аккаунта';
|
||||
|
||||
@override
|
||||
String get accountNameUpdateError => 'Не удалось обновить имя аккаунта';
|
||||
|
||||
@override
|
||||
String get settingsSuccessfullyUpdated => 'Настройки успешно обновлены';
|
||||
|
||||
@override
|
||||
String get language => 'Язык';
|
||||
|
||||
@override
|
||||
String get failedToUpdateLanguage => 'Не удалось обновить язык';
|
||||
|
||||
@override
|
||||
String get settingsImageUpdateError => 'Не удалось обновить изображение';
|
||||
|
||||
@override
|
||||
String get settingsImageTitle => 'Изображение';
|
||||
|
||||
@override
|
||||
String get settingsImageHint => 'Нажмите, чтобы изменить изображение';
|
||||
|
||||
@override
|
||||
String get accountName => 'Имя';
|
||||
|
||||
@override
|
||||
String get accountNameHint => 'Укажите ваше имя';
|
||||
|
||||
@override
|
||||
String get avatar => 'Фото профиля';
|
||||
|
||||
@override
|
||||
String get avatarHint => 'Нажмите для обновления';
|
||||
|
||||
@override
|
||||
String get avatarUpdateError => 'Не удалось обновить фото профиля';
|
||||
|
||||
@override
|
||||
String get settings => 'Настройки';
|
||||
|
||||
@override
|
||||
String get notSet => 'не задано';
|
||||
|
||||
@override
|
||||
String get search => 'Поиск...';
|
||||
|
||||
@override
|
||||
String get ok => 'Ок';
|
||||
|
||||
@override
|
||||
String get cancel => 'Отмена';
|
||||
|
||||
@override
|
||||
String get confirm => 'Подтвердить';
|
||||
|
||||
@override
|
||||
String get back => 'Назад';
|
||||
|
||||
@override
|
||||
String get operationfryTitle => 'История операций';
|
||||
|
||||
@override
|
||||
String get filters => 'Фильтры';
|
||||
|
||||
@override
|
||||
String get period => 'Период';
|
||||
|
||||
@override
|
||||
String get selectPeriod => 'Выберите период';
|
||||
|
||||
@override
|
||||
String get apply => 'Применить';
|
||||
|
||||
@override
|
||||
String status(String status) {
|
||||
return '$status';
|
||||
}
|
||||
|
||||
@override
|
||||
String get operationStatusSuccessful => 'Успешно';
|
||||
|
||||
@override
|
||||
String get operationStatusPending => 'В ожидании';
|
||||
|
||||
@override
|
||||
String get operationStatusUnsuccessful => 'Неуспешно';
|
||||
|
||||
@override
|
||||
String get statusColumn => 'Статус';
|
||||
|
||||
@override
|
||||
String get fileNameColumn => 'Имя файла';
|
||||
|
||||
@override
|
||||
String get amountColumn => 'Сумма';
|
||||
|
||||
@override
|
||||
String get toAmountColumn => 'На сумму';
|
||||
|
||||
@override
|
||||
String get payIdColumn => 'Pay ID';
|
||||
|
||||
@override
|
||||
String get cardNumberColumn => 'Номер карты';
|
||||
|
||||
@override
|
||||
String get nameColumn => 'Имя';
|
||||
|
||||
@override
|
||||
String get dateColumn => 'Дата';
|
||||
|
||||
@override
|
||||
String get commentColumn => 'Комментарий';
|
||||
|
||||
@override
|
||||
String get paymentConfigTitle => 'Куда получать деньги';
|
||||
|
||||
@override
|
||||
String get paymentConfigSubtitle =>
|
||||
'Добавьте несколько методов и выберите основной.';
|
||||
|
||||
@override
|
||||
String get addPaymentMethod => 'Добавить способ оплаты';
|
||||
|
||||
@override
|
||||
String get makeMain => 'Сделать основным';
|
||||
|
||||
@override
|
||||
String get advanced => 'Дополнительно';
|
||||
|
||||
@override
|
||||
String get fallbackExplanation =>
|
||||
'Если основной метод недоступен, мы попробуем следующий включенный метод в списке.';
|
||||
|
||||
@override
|
||||
String get delete => 'Удалить';
|
||||
|
||||
@override
|
||||
String get deletePaymentConfirmation =>
|
||||
'Вы уверены, что хотите удалить этот способ оплаты?';
|
||||
|
||||
@override
|
||||
String get edit => 'Редактировать';
|
||||
|
||||
@override
|
||||
String get moreActions => 'Еще действия';
|
||||
|
||||
@override
|
||||
String get noPayouts => 'Нет выплат';
|
||||
|
||||
@override
|
||||
String get enterBankName => 'Введите название банка';
|
||||
|
||||
@override
|
||||
String get paymentType => 'Тип способа оплаты';
|
||||
|
||||
@override
|
||||
String get selectPaymentType => 'Пожалуйста, выберите тип способа оплаты';
|
||||
|
||||
@override
|
||||
String get paymentTypeCard => 'Кредитная карта';
|
||||
|
||||
@override
|
||||
String get paymentTypeBankAccount => 'Российский банковский счет';
|
||||
|
||||
@override
|
||||
String get paymentTypeIban => 'IBAN';
|
||||
|
||||
@override
|
||||
String get paymentTypeWallet => 'Кошелек';
|
||||
|
||||
@override
|
||||
String get cardNumber => 'Номер карты';
|
||||
|
||||
@override
|
||||
String get enterCardNumber => 'Введите номер карты';
|
||||
|
||||
@override
|
||||
String get cardholderName => 'Имя держателя карты';
|
||||
|
||||
@override
|
||||
String get iban => 'IBAN';
|
||||
|
||||
@override
|
||||
String get enterIban => 'Введите IBAN';
|
||||
|
||||
@override
|
||||
String get bic => 'BIC';
|
||||
|
||||
@override
|
||||
String get bankName => 'Название банка';
|
||||
|
||||
@override
|
||||
String get accountHolder => 'Владелец счета';
|
||||
|
||||
@override
|
||||
String get enterAccountHolder => 'Введите владельца счета';
|
||||
|
||||
@override
|
||||
String get enterBic => 'Введите BIC';
|
||||
|
||||
@override
|
||||
String get walletId => 'ID кошелька';
|
||||
|
||||
@override
|
||||
String get enterWalletId => 'Введите ID кошелька';
|
||||
|
||||
@override
|
||||
String get recipients => 'Получатели';
|
||||
|
||||
@override
|
||||
String get recipientName => 'Имя получателя';
|
||||
|
||||
@override
|
||||
String get enterRecipientName => 'Введите имя получателя';
|
||||
|
||||
@override
|
||||
String get inn => 'ИНН';
|
||||
|
||||
@override
|
||||
String get enterInn => 'Введите ИНН';
|
||||
|
||||
@override
|
||||
String get kpp => 'КПП';
|
||||
|
||||
@override
|
||||
String get enterKpp => 'Введите КПП';
|
||||
|
||||
@override
|
||||
String get accountNumber => 'Номер счета';
|
||||
|
||||
@override
|
||||
String get enterAccountNumber => 'Введите номер счета';
|
||||
|
||||
@override
|
||||
String get correspondentAccount => 'Корреспондентский счет';
|
||||
|
||||
@override
|
||||
String get enterCorrespondentAccount => 'Введите корреспондентский счет';
|
||||
|
||||
@override
|
||||
String get bik => 'БИК';
|
||||
|
||||
@override
|
||||
String get enterBik => 'Введите БИК';
|
||||
|
||||
@override
|
||||
String get add => 'Добавить';
|
||||
|
||||
@override
|
||||
String get expiryDate => 'Срок действия (ММ/ГГ)';
|
||||
|
||||
@override
|
||||
String get firstName => 'Имя';
|
||||
|
||||
@override
|
||||
String get enterFirstName => 'Введите имя';
|
||||
|
||||
@override
|
||||
String get lastName => 'Фамилия';
|
||||
|
||||
@override
|
||||
String get enterLastName => 'Введите фамилию';
|
||||
|
||||
@override
|
||||
String get sendSingle => 'Отправить одну транзакцию';
|
||||
|
||||
@override
|
||||
String get sendMultiple => 'Отправить несколько транзакций';
|
||||
|
||||
@override
|
||||
String get addFunds => 'Пополнить счет';
|
||||
|
||||
@override
|
||||
String get close => 'Закрыть';
|
||||
|
||||
@override
|
||||
String get multiplePayout => 'Множественная выплата';
|
||||
|
||||
@override
|
||||
String get howItWorks => 'Как это работает?';
|
||||
|
||||
@override
|
||||
String get exampleTitle => 'Формат файла и образец';
|
||||
|
||||
@override
|
||||
String get downloadSampleCSV => 'Скачать sample.csv';
|
||||
|
||||
@override
|
||||
String get tokenColumn => 'Токен (обязательно)';
|
||||
|
||||
@override
|
||||
String get currency => 'Валюта';
|
||||
|
||||
@override
|
||||
String get amount => 'Сумма';
|
||||
|
||||
@override
|
||||
String get comment => 'Комментарий';
|
||||
|
||||
@override
|
||||
String get uploadCSV => 'Загрузите ваш CSV';
|
||||
|
||||
@override
|
||||
String get upload => 'Загрузить';
|
||||
|
||||
@override
|
||||
String get hintUpload => 'Поддерживаемый формат: .CSV · Макс. размер 1 МБ';
|
||||
|
||||
@override
|
||||
String get uploadHistory => 'История загрузок';
|
||||
|
||||
@override
|
||||
String get payout => 'Выплата';
|
||||
|
||||
@override
|
||||
String get sendTo => 'Отправить выплату';
|
||||
|
||||
@override
|
||||
String get send => 'Отправить выплату';
|
||||
|
||||
@override
|
||||
String get recipientPaysFee => 'Получатель оплачивает комиссию';
|
||||
|
||||
@override
|
||||
String sentAmount(String amount) {
|
||||
return 'Отправленная сумма: \$$amount';
|
||||
}
|
||||
|
||||
@override
|
||||
String fee(String fee) {
|
||||
return 'Комиссия: \$$fee';
|
||||
}
|
||||
|
||||
@override
|
||||
String recipientWillReceive(String amount) {
|
||||
return 'Получатель получит: \$$amount';
|
||||
}
|
||||
|
||||
@override
|
||||
String total(String total) {
|
||||
return 'Итого: \$$total';
|
||||
}
|
||||
|
||||
@override
|
||||
String get hideDetails => 'Скрыть детали';
|
||||
|
||||
@override
|
||||
String get showDetails => 'Показать детали';
|
||||
|
||||
@override
|
||||
String get whereGetMoney => 'Источник средств для списания';
|
||||
|
||||
@override
|
||||
String get details => 'Детали';
|
||||
|
||||
@override
|
||||
String get addRecipient => 'Добавить получателя';
|
||||
|
||||
@override
|
||||
String get editRecipient => 'Редактировать получателя';
|
||||
|
||||
@override
|
||||
String get saveRecipient => 'Сохранить получателя';
|
||||
|
||||
@override
|
||||
String get choosePaymentMethod => 'Способы оплаты (выберите хотя бы 1)';
|
||||
|
||||
@override
|
||||
String get recipientFormRule =>
|
||||
'Получатель должен иметь хотя бы один способ оплаты';
|
||||
|
||||
@override
|
||||
String get allStatus => 'Все';
|
||||
|
||||
@override
|
||||
String get readyStatus => 'Готов';
|
||||
|
||||
@override
|
||||
String get registeredStatus => 'Зарегистрирован';
|
||||
|
||||
@override
|
||||
String get notRegisteredStatus => 'Не зарегистрирован';
|
||||
|
||||
@override
|
||||
String get noRecipientSelected => 'Получатель не выбран';
|
||||
|
||||
@override
|
||||
String get companyName => 'Name of your company';
|
||||
|
||||
@override
|
||||
String get companynameRequired => 'Company name required';
|
||||
|
||||
@override
|
||||
String get errorSignUp => 'Error occured while signing up, try again later';
|
||||
|
||||
@override
|
||||
String get companyDescription => 'Company Description';
|
||||
|
||||
@override
|
||||
String get companyDescriptionHint =>
|
||||
'Describe any of the fields of the Company\'s business';
|
||||
|
||||
@override
|
||||
String get optional => 'optional';
|
||||
}
|
||||
435
frontend/pweb/lib/l10n/en.arb
Normal file
435
frontend/pweb/lib/l10n/en.arb
Normal file
@@ -0,0 +1,435 @@
|
||||
{
|
||||
"@@locale": "en",
|
||||
"login": "Login",
|
||||
"logout": "Logout",
|
||||
"profile": "Profile",
|
||||
"signup": "Sign up",
|
||||
"username": "Email",
|
||||
"usernameHint": "email@example.com",
|
||||
"usernameErrorInvalid": "Provide a valid email address",
|
||||
"usernameUnknownTLD": "Domain .{domain} is not known, please, check it",
|
||||
"password": "Password",
|
||||
"confirmPassword": "Confirm password",
|
||||
"passwordValidationRuleDigit": "has digit",
|
||||
"passwordValidationRuleUpperCase": "has uppercase letter",
|
||||
"passwordValidationRuleLowerCase": "has lowercase letter",
|
||||
"passwordValidationRuleSpecialCharacter": "has special character letter",
|
||||
"passwordValidationRuleMinCharacters": "is {charNum} characters long at least",
|
||||
"passwordsDoNotMatch": "Passwords do not match",
|
||||
"passwordValidationError": "Check that your password {matchesCriteria}",
|
||||
"notificationError": "Error occurred: {error}",
|
||||
"loginUserNotFound": "Account {account} has not been registered in the system",
|
||||
"loginPasswordIncorrect": "Authorization failed, please check your password",
|
||||
"internalErrorOccurred": "An internal server error occurred: {error}, we already know about it and working hard to fix it",
|
||||
"noErrorInformation": "Some error occurred, but we have not error information. We are already investigating the issue",
|
||||
"yourName": "Your name",
|
||||
"nameHint": "John Doe",
|
||||
"errorPageNotFoundTitle": "Page Not Found",
|
||||
"errorPageNotFoundMessage": "Oops! We couldn't find that page.",
|
||||
"errorPageNotFoundHint": "The page you're looking for doesn't exist or has been moved. Please check the URL or return to the home page.",
|
||||
"errorUnknown": "Unknown error occurred",
|
||||
"unknown": "unknown",
|
||||
"goToLogin": "Go to Login",
|
||||
"goBack": "Go Back",
|
||||
"goToMainPage": "Go to Main Page",
|
||||
"goToSignUp": "Go to Sign Up",
|
||||
"signupError": "Failed to signup: {error}",
|
||||
"signupSuccess": "Email confirmation message has been sent to {email}. Please, open it and click link to activate your account.",
|
||||
"connectivityError": "Cannot reach the server at {serverAddress}. Check your network and try again.",
|
||||
"errorAccountExists": "Account already exists",
|
||||
"errorAccountNotVerified": "Your account hasn't been verified yet. Please check your email to complete the verification",
|
||||
"errorLoginUnauthorized": "Login or password is incorrect. Please try again",
|
||||
"errorInternalError": "An internal error occurred. We're aware of the issue and working to resolve it. Please try again later",
|
||||
"errorVerificationTokenNotFound": "Account for verification not found. Sign up again",
|
||||
"created": "Created",
|
||||
"edited": "Edited",
|
||||
"errorDataConflict": "We can’t process your data because it has conflicting or contradictory information.",
|
||||
"errorAccessDenied": "You do not have permission to access this resource. If you need access, please contact an administrator.",
|
||||
"errorBrokenPayload": "The data you sent is invalid or incomplete. Please check your submission and try again.",
|
||||
"errorInvalidArgument": "One or more arguments are invalid. Verify your input and try again.",
|
||||
"errorBrokenReference": "The resource you're trying to access could not be referenced. It may have been moved or deleted.",
|
||||
"errorInvalidQueryParameter": "One or more query parameters are missing or incorrect. Check them and try again.",
|
||||
"errorNotImplemented": "This feature is not yet available. Please try again later or contact support.",
|
||||
"errorLicenseRequired": "A valid license is required to perform this action. Please contact your administrator.",
|
||||
"errorNotFound": "We couldn't find the resource you requested. It may have been removed or is temporarily unavailable.",
|
||||
"errorNameMissing": "Please provide a name before continuing.",
|
||||
"errorEmailMissing": "Please provide an email address before continuing.",
|
||||
"errorPasswordMissing": "Please provide a password before continuing.",
|
||||
"errorEmailNotRegistered": "We could not find an account associated with that email address.",
|
||||
"errorDuplicateEmail": "This email address is already in use. Try another one or reset your password.",
|
||||
"showDetailsAction": "Show Details",
|
||||
"errorLogin": "Error logging in",
|
||||
"errorCreatingInvitation": "Failed to create invitaiton",
|
||||
"@errorCreatingInvitation": {
|
||||
"description": "Error message displayed when invitation creation fails"
|
||||
},
|
||||
"footerCompanyName": "Sibilla Solutions LTD",
|
||||
"footerAddress": "27, Pindarou Street, Alpha Business Centre, Block B 7th Floor, 1060 Nicosia, Cyprus",
|
||||
"footerSupport": "Support",
|
||||
"footerEmail": "Email TBD",
|
||||
"footerPhoneLabel": "Phone",
|
||||
"footerPhone": "+357 22 000 253",
|
||||
"footerTermsOfService": "Terms of Service",
|
||||
"footerPrivacyPolicy": "Privacy Policy",
|
||||
"footerCookiePolicy": "Cookie Policy",
|
||||
"navigationLogout": "Logout",
|
||||
"dashboard": "Dashboard",
|
||||
"navigationUsersSettings": "Users",
|
||||
"navigationRolesSettings": "Roles",
|
||||
"navigationPermissionsSettings": "Permissions",
|
||||
"usersManagement": "User Management",
|
||||
"navigationOrganizationSettings": "Organization settings",
|
||||
"navigationAccountSettings": "Profile settings",
|
||||
"twoFactorPrompt": "Enter the 6-digit code we sent to your device",
|
||||
"twoFactorResend": "Didn’t receive a code? Resend",
|
||||
"twoFactorTitle": "Two-Factor Authentication",
|
||||
"twoFactorError": "Invalid code. Please try again.",
|
||||
"payoutNavDashboard": "Dashboard",
|
||||
"payoutNavSendPayout": "Send payout",
|
||||
"payoutNavRecipients": "Recipients",
|
||||
"payoutNavReports": "Reports",
|
||||
"payoutNavSettings": "Settings",
|
||||
"payoutNavLogout": "Logout",
|
||||
"payoutNavMethods": "Payouts",
|
||||
"expand": "Expand",
|
||||
"collapse": "Collapse",
|
||||
"pageTitleRecipients": "Recipient address book",
|
||||
"@pageTitleRecipients": {
|
||||
"description": "Title of the recipient address book page",
|
||||
"type": "text"
|
||||
},
|
||||
|
||||
"actionAddNew": "Add new",
|
||||
"@actionAddNew": {
|
||||
"description": "Tooltip and button label to add a new recipient"
|
||||
},
|
||||
|
||||
"colDataOwner": "Data owner",
|
||||
"@colDataOwner": {
|
||||
"description": "Column header for who manages the payout data"
|
||||
},
|
||||
|
||||
"colAvatar": "Avatar",
|
||||
"@colAvatar": {
|
||||
"description": "Column header for recipient avatar"
|
||||
},
|
||||
|
||||
"colName": "Name",
|
||||
"@colName": {
|
||||
"description": "Column header for recipient name"
|
||||
},
|
||||
|
||||
"colEmail": "Email",
|
||||
"@colEmail": {
|
||||
"description": "Column header for recipient email address"
|
||||
},
|
||||
|
||||
"colStatus": "Status",
|
||||
"@colStatus": {
|
||||
"description": "Column header for payout readiness status"
|
||||
},
|
||||
|
||||
"statusReady": "Ready",
|
||||
"@statusReady": {
|
||||
"description": "Status indicating payouts can be sent immediately"
|
||||
},
|
||||
|
||||
"statusRegistered": "Registered",
|
||||
"@statusRegistered": {
|
||||
"description": "Status indicating recipient is registered but not yet fully ready"
|
||||
},
|
||||
|
||||
"statusNotRegistered": "Not registered",
|
||||
"@statusNotRegistered": {
|
||||
"description": "Status indicating recipient has not completed registration"
|
||||
},
|
||||
|
||||
"typeInternal": "Managed by me",
|
||||
"@typeInternal": {
|
||||
"description": "Label for recipients whose payout data is managed internally by the user/company"
|
||||
},
|
||||
|
||||
"typeExternal": "Self‑managed",
|
||||
"@typeExternal": {
|
||||
"description": "Label for recipients who manage their own payout data"
|
||||
},
|
||||
|
||||
"searchHint": "Search recipients",
|
||||
"colActions": "Actions",
|
||||
"menuEdit": "Edit",
|
||||
"menuSendPayout": "Send payout",
|
||||
"tooltipRowActions": "More actions",
|
||||
"accountSettings": "Account Settings",
|
||||
"accountNameUpdateError": "Failed to update account name",
|
||||
"settingsSuccessfullyUpdated": "Settings successfully updated",
|
||||
"language": "Language",
|
||||
"failedToUpdateLanguage": "Failed to update language",
|
||||
"settingsImageUpdateError": "Couldn't update the image",
|
||||
"settingsImageTitle": "Image",
|
||||
"settingsImageHint": "Tap to change the image",
|
||||
"accountName": "Name",
|
||||
"accountNameHint": "Specify your name",
|
||||
"avatar": "Profile photo",
|
||||
"avatarHint": "Tap to update",
|
||||
"avatarUpdateError": "Failed to update profile photo",
|
||||
"settings": "Settings",
|
||||
"notSet": "not set",
|
||||
"search": "Search...",
|
||||
"ok": "Ok",
|
||||
"cancel": "Cancel",
|
||||
"confirm": "Confirm",
|
||||
"back": "Back",
|
||||
|
||||
"operationfryTitle": "Operation history",
|
||||
"@operationfryTitle": {
|
||||
"description": "Title of the operation history page"
|
||||
},
|
||||
|
||||
"filters": "Filters",
|
||||
"@filters": {
|
||||
"description": "Label for the filters expansion panel"
|
||||
},
|
||||
|
||||
"period": "Period",
|
||||
"@period": {
|
||||
"description": "Label for the date‐range filter"
|
||||
},
|
||||
|
||||
"selectPeriod": "Select period",
|
||||
"@selectPeriod": {
|
||||
"description": "Placeholder when no period is selected"
|
||||
},
|
||||
|
||||
"apply": "Apply",
|
||||
"@apply": {
|
||||
"description": "Button text to apply the filters"
|
||||
},
|
||||
|
||||
"status": "{status}",
|
||||
"@status": {
|
||||
"description": "Template for a single status filter chip",
|
||||
"placeholders": {
|
||||
"status": {
|
||||
"type": "String",
|
||||
"example": "Successful"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"operationStatusSuccessful": "Successful",
|
||||
"@operationStatusSuccessful": {
|
||||
"description": "Status indicating the operation succeeded"
|
||||
},
|
||||
|
||||
"operationStatusPending": "Pending",
|
||||
"@operationStatusPending": {
|
||||
"description": "Status indicating the operation is pending"
|
||||
},
|
||||
|
||||
"operationStatusUnsuccessful": "Unsuccessful",
|
||||
"@operationStatusUnsuccessful": {
|
||||
"description": "Status indicating the operation failed"
|
||||
},
|
||||
|
||||
"statusColumn": "Status",
|
||||
"@statusColumn": {
|
||||
"description": "Table column header for status"
|
||||
},
|
||||
|
||||
"fileNameColumn": "File name",
|
||||
"@fileNameColumn": {
|
||||
"description": "Table column header for file name"
|
||||
},
|
||||
|
||||
"amountColumn": "Amount",
|
||||
"@amountColumn": {
|
||||
"description": "Table column header for the original amount"
|
||||
},
|
||||
|
||||
"toAmountColumn": "To amount",
|
||||
"@toAmountColumn": {
|
||||
"description": "Table column header for the converted amount"
|
||||
},
|
||||
|
||||
"payIdColumn": "Pay ID",
|
||||
"@payIdColumn": {
|
||||
"description": "Table column header for the payment ID"
|
||||
},
|
||||
|
||||
"cardNumberColumn": "Card number",
|
||||
"@cardNumberColumn": {
|
||||
"description": "Table column header for the masked card number"
|
||||
},
|
||||
|
||||
"nameColumn": "Name",
|
||||
"@nameColumn": {
|
||||
"description": "Table column header for recipient name"
|
||||
},
|
||||
|
||||
"dateColumn": "Date",
|
||||
"@dateColumn": {
|
||||
"description": "Table column header for the date/time"
|
||||
},
|
||||
|
||||
"commentColumn": "Comment",
|
||||
"@commentColumn": {
|
||||
"description": "Table column header for any comment"
|
||||
},
|
||||
"paymentConfigTitle": "Where to receive money",
|
||||
"paymentConfigSubtitle": "Add multiple methods and choose your primary one.",
|
||||
"addPaymentMethod": "Add payment method",
|
||||
"makeMain": "Make primary",
|
||||
"advanced": "Advanced",
|
||||
"fallbackExplanation": "If the primary method is unavailable, we will try the next enabled one in the list.",
|
||||
"delete": "Delete",
|
||||
"@delete": {
|
||||
"description": "Button label to delete a payment method"
|
||||
},
|
||||
|
||||
"deletePaymentConfirmation": "Are you sure you want to delete this payment method?",
|
||||
"@deletePaymentConfirmation": {
|
||||
"description": "Confirmation dialog message shown before a payment method is removed"
|
||||
},
|
||||
|
||||
"edit": "Edit",
|
||||
"@edit": {
|
||||
"description": "Button label to edit a payment method"
|
||||
},
|
||||
|
||||
"moreActions": "More actions",
|
||||
"@moreActions": {
|
||||
"description": "Tooltip for an overflow menu button that reveals extra actions for a payment method"
|
||||
},
|
||||
"noPayouts": "No Payouts",
|
||||
|
||||
"enterBankName": "Enter bank name",
|
||||
|
||||
"paymentType": "Payment Method Type",
|
||||
"selectPaymentType": "Please select a payment method type",
|
||||
|
||||
"paymentTypeCard": "Credit Card",
|
||||
"paymentTypeBankAccount": "Russian Bank Account",
|
||||
"paymentTypeIban": "IBAN",
|
||||
"paymentTypeWallet": "Wallet",
|
||||
|
||||
"cardNumber": "Card Number",
|
||||
"enterCardNumber": "Enter the card number",
|
||||
"cardholderName": "Cardholder Name",
|
||||
|
||||
"iban": "IBAN",
|
||||
"enterIban": "Enter IBAN",
|
||||
"bic": "BIC",
|
||||
"bankName": "Bank Name",
|
||||
"accountHolder": "Account Holder",
|
||||
"enterAccountHolder": "Enter account holder",
|
||||
"enterBic": "Enter BIC",
|
||||
|
||||
"walletId": "Wallet ID",
|
||||
"enterWalletId": "Enter wallet ID",
|
||||
|
||||
"recipients": "Recipients",
|
||||
"recipientName": "Recipient Name",
|
||||
"enterRecipientName": "Enter recipient name",
|
||||
"inn": "INN",
|
||||
"enterInn": "Enter INN",
|
||||
"kpp": "KPP",
|
||||
"enterKpp": "Enter KPP",
|
||||
"accountNumber": "Account Number",
|
||||
"enterAccountNumber": "Enter account number",
|
||||
"correspondentAccount": "Correspondent Account",
|
||||
"enterCorrespondentAccount": "Enter correspondent account",
|
||||
"bik": "BIK",
|
||||
"enterBik": "Enter BIK",
|
||||
"add": "Add",
|
||||
"expiryDate": "Expiry (MM/YY)",
|
||||
"firstName": "First Name",
|
||||
"enterFirstName": "Enter First Name",
|
||||
"lastName": "Last Name",
|
||||
"enterLastName": "Enter Last Name",
|
||||
"sendSingle": "Send single transaction",
|
||||
"sendMultiple": "Send multiple transactions",
|
||||
"addFunds": "Add Funds",
|
||||
"close": "Close",
|
||||
"multiplePayout": "Multiple Payout",
|
||||
"howItWorks": "How it works?",
|
||||
"exampleTitle": "File Format & Sample",
|
||||
"downloadSampleCSV": "Download sample.csv",
|
||||
"tokenColumn": "Token (required)",
|
||||
"currency": "Currency",
|
||||
"amount": "Amount",
|
||||
"comment": "Comment",
|
||||
"uploadCSV": "Upload your CSV",
|
||||
"upload": "Upload",
|
||||
"hintUpload": "Supported format: .CSV · Max size 1 MB",
|
||||
"uploadHistory": "Upload History",
|
||||
"payout": "Payout",
|
||||
"sendTo": "Send Payout To",
|
||||
"send": "Send Payout",
|
||||
"recipientPaysFee": "Recipient pays the fee",
|
||||
|
||||
"sentAmount": "Sent amount: ${amount}",
|
||||
"@sentAmount": {
|
||||
"description": "Label showing the amount sent",
|
||||
"placeholders": {
|
||||
"amount": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"fee": "Fee: ${fee}",
|
||||
"@fee": {
|
||||
"description": "Label showing the transaction fee",
|
||||
"placeholders": {
|
||||
"fee": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"recipientWillReceive": "Recipient will receive: ${amount}",
|
||||
"@recipientWillReceive": {
|
||||
"description": "Label showing how much the recipient will receive",
|
||||
"placeholders": {
|
||||
"amount": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"total": "Total: ${total}",
|
||||
"@total": {
|
||||
"description": "Label showing the total amount of the transaction",
|
||||
"placeholders": {
|
||||
"total": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"hideDetails": "Hide Details",
|
||||
"showDetails": "Show Details",
|
||||
"whereGetMoney": "Source of funds for debit",
|
||||
"details": "Details",
|
||||
|
||||
"addRecipient": "Add Recipient",
|
||||
"editRecipient": "Edit Recipient",
|
||||
"saveRecipient": "Save Recipient",
|
||||
|
||||
"choosePaymentMethod": "Payment Methods (choose at least 1)",
|
||||
"recipientFormRule": "Recipient must have at least one payment method",
|
||||
|
||||
"allStatus": "All",
|
||||
"readyStatus": "Ready",
|
||||
"registeredStatus": "Registered",
|
||||
"notRegisteredStatus": "Not registered",
|
||||
|
||||
"noRecipientSelected": "No recipient selected",
|
||||
|
||||
"companyName": "Name of your company",
|
||||
"companynameRequired": "Company name required",
|
||||
|
||||
"errorSignUp": "Error occured while signing up, try again later",
|
||||
"companyDescription": "Company Description",
|
||||
"companyDescriptionHint": "Describe any of the fields of the Company's business",
|
||||
"optional": "optional"
|
||||
}
|
||||
426
frontend/pweb/lib/l10n/ru.arb
Normal file
426
frontend/pweb/lib/l10n/ru.arb
Normal file
@@ -0,0 +1,426 @@
|
||||
{
|
||||
"@@locale": "ru",
|
||||
"login": "Войти",
|
||||
"logout": "Выйти",
|
||||
"profile": "Профиль",
|
||||
"signup": "Регистрация",
|
||||
"username": "Email",
|
||||
"usernameHint": "email@example.com",
|
||||
"usernameErrorInvalid": "Укажите действительный адрес электронной почты",
|
||||
"usernameUnknownTLD": "Домен .{domain} неизвестен, пожалуйста, проверьте его",
|
||||
"password": "Пароль",
|
||||
"confirmPassword": "Подтвердите пароль",
|
||||
"passwordValidationRuleDigit": "содержит цифру",
|
||||
"passwordValidationRuleUpperCase": "содержит заглавную букву",
|
||||
"passwordValidationRuleLowerCase": "содержит строчную букву",
|
||||
"passwordValidationRuleSpecialCharacter": "содержит специальный символ",
|
||||
"passwordValidationRuleMinCharacters": "длина не менее {charNum} символов",
|
||||
"passwordsDoNotMatch": "Пароли не совпадают",
|
||||
"passwordValidationError": "Убедитесь, что ваш пароль {matchesCriteria}",
|
||||
"notificationError": "Произошла ошибка: {error}",
|
||||
"loginUserNotFound": "Аккаунт {account} не зарегистрирован в системе",
|
||||
"loginPasswordIncorrect": "Ошибка авторизации, пожалуйста, проверьте пароль",
|
||||
"internalErrorOccurred": "Произошла внутренняя ошибка сервера: {error}, мы уже знаем о ней и усердно работаем над исправлением",
|
||||
"noErrorInformation": "Произошла ошибка, но у нас нет информации о ней. Мы уже расследуем этот вопрос",
|
||||
"yourName": "Ваше имя",
|
||||
"nameHint": "Иван Иванов",
|
||||
"errorPageNotFoundTitle": "Страница не найдена",
|
||||
"errorPageNotFoundMessage": "Упс! Мы не смогли найти эту страницу.",
|
||||
"errorPageNotFoundHint": "Запрашиваемая страница не существует или была перемещена. Пожалуйста, проверьте URL или вернитесь на главную страницу.",
|
||||
"errorUnknown": "Произошла неизвестная ошибка",
|
||||
"unknown": "неизвестно",
|
||||
"goToLogin": "Перейти к входу",
|
||||
"goBack": "Назад",
|
||||
"goToMainPage": "На главную",
|
||||
"goToSignUp": "Перейти к регистрации",
|
||||
"signupError": "Не удалось зарегистрироваться: {error}",
|
||||
"signupSuccess": "Письмо с подтверждением email отправлено на {email}. Пожалуйста, откройте его и перейдите по ссылке для активации вашего аккаунта.",
|
||||
"connectivityError": "Не удается связаться с сервером {serverAddress}. Проверьте ваше интернет-соединение и попробуйте снова.",
|
||||
"errorAccountNotVerified": "Ваш аккаунт еще не подтвержден. Пожалуйста, проверьте вашу электронную почту для завершения верификации",
|
||||
"errorLoginUnauthorized": "Неверный логин или пароль. Пожалуйста, попробуйте снова",
|
||||
"errorInternalError": "Произошла внутренняя ошибка. Мы в курсе проблемы и работаем над ее решением. Пожалуйста, попробуйте позже",
|
||||
"errorVerificationTokenNotFound": "Аккаунт для верификации не найден. Зарегистрируйтесь снова",
|
||||
"created": "Создано",
|
||||
"edited": "Изменено",
|
||||
"errorDataConflict": "Мы не можем обработать ваши данные, так как они содержат конфликтующую или противоречивую информацию.",
|
||||
"errorAccessDenied": "У вас нет разрешения на доступ к этому ресурсу. Если вам нужен доступ, пожалуйста, обратитесь к администратору.",
|
||||
"errorBrokenPayload": "Отправленные данные недействительны или неполны. Пожалуйста, проверьте введенные данные и попробуйте снова.",
|
||||
"errorInvalidArgument": "Один или несколько аргументов недействительны. Проверьте введенные данные и попробуйте снова.",
|
||||
"errorBrokenReference": "Ресурс, к которому вы пытаетесь получить доступ, не может быть найден. Возможно, он был перемещен или удален.",
|
||||
"errorInvalidQueryParameter": "Один или несколько параметров запроса отсутствуют или указаны неверно. Проверьте их и попробуйте снова.",
|
||||
"errorNotImplemented": "Эта функция еще недоступна. Пожалуйста, попробуйте позже или обратитесь в службу поддержки.",
|
||||
"errorLicenseRequired": "Для выполнения этого действия требуется действующая лицензия. Пожалуйста, обратитесь к вашему администратору.",
|
||||
"errorNotFound": "Мы не смогли найти запрошенный ресурс. Возможно, он был удален или временно недоступен.",
|
||||
"errorNameMissing": "Пожалуйста, укажите имя для продолжения.",
|
||||
"errorEmailMissing": "Пожалуйста, укажите адрес электронной почты для продолжения.",
|
||||
"errorPasswordMissing": "Пожалуйста, укажите пароль для продолжения.",
|
||||
"errorEmailNotRegistered": "Мы не нашли аккаунт, связанный с этим адресом электронной почты.",
|
||||
"errorDuplicateEmail": "Этот адрес электронной почты уже используется. Попробуйте другой или восстановите пароль.",
|
||||
"showDetailsAction": "Показать детали",
|
||||
"errorLogin": "Ошибка входа",
|
||||
"errorCreatingInvitation": "Не удалось создать приглашение",
|
||||
"@errorCreatingInvitation": {
|
||||
"description": "Сообщение об ошибке, отображаемое при неудачном создании приглашения"
|
||||
},
|
||||
"footerCompanyName": "Sibilla Solutions LTD",
|
||||
"footerAddress": "27, Pindarou Street, Alpha Business Centre, Block B 7th Floor, 1060 Nicosia, Cyprus",
|
||||
"footerSupport": "Поддержка",
|
||||
"footerEmail": "Email TBD",
|
||||
"footerPhoneLabel": "Телефон",
|
||||
"footerPhone": "+357 22 000 253",
|
||||
"footerTermsOfService": "Условия обслуживания",
|
||||
"footerPrivacyPolicy": "Политика конфиденциальности",
|
||||
"footerCookiePolicy": "Политика использования файлов cookie",
|
||||
"navigationLogout": "Выйти",
|
||||
"dashboard": "Дашборд",
|
||||
"navigationUsersSettings": "Пользователи",
|
||||
"navigationRolesSettings": "Роли",
|
||||
"navigationPermissionsSettings": "Разрешения",
|
||||
"usersManagement": "Управление пользователями",
|
||||
"navigationOrganizationSettings": "Настройки организации",
|
||||
"navigationAccountSettings": "Настройки профиля",
|
||||
"twoFactorPrompt": "Введите 6-значный код, отправленный на ваше устройство",
|
||||
"twoFactorResend": "Не получили код? Отправить снова",
|
||||
"twoFactorTitle": "Двухфакторная аутентификация",
|
||||
"twoFactorError": "Неверный код. Пожалуйста, попробуйте снова.",
|
||||
"payoutNavDashboard": "Дашборд",
|
||||
"payoutNavSendPayout": "Отправить выплату",
|
||||
"payoutNavRecipients": "Получатели",
|
||||
"payoutNavReports": "Отчеты",
|
||||
"payoutNavSettings": "Настройки",
|
||||
"payoutNavLogout": "Выйти",
|
||||
"payoutNavMethods": "Выплаты",
|
||||
"expand": "Развернуть",
|
||||
"collapse": "Свернуть",
|
||||
"pageTitleRecipients": "Адресная книга получателей",
|
||||
"@pageTitleRecipients": {
|
||||
"description": "Заголовок страницы адресной книги получателей",
|
||||
"type": "text"
|
||||
},
|
||||
|
||||
"actionAddNew": "Добавить",
|
||||
"@actionAddNew": {
|
||||
"description": "Подсказка и метка кнопки для добавления нового получателя"
|
||||
},
|
||||
|
||||
"colDataOwner": "Владелец данных",
|
||||
"@colDataOwner": {
|
||||
"description": "Заголовок столбца для указания, кто управляет данными о выплатах"
|
||||
},
|
||||
|
||||
"colAvatar": "Аватар",
|
||||
"@colAvatar": {
|
||||
"description": "Заголовок столбца для аватара получателя"
|
||||
},
|
||||
|
||||
"colName": "Имя",
|
||||
"@colName": {
|
||||
"description": "Заголовок столбца для имени получателя"
|
||||
},
|
||||
|
||||
"colEmail": "Email",
|
||||
"@colEmail": {
|
||||
"description": "Заголовок столбца для адреса электронной почты получателя"
|
||||
},
|
||||
|
||||
"colStatus": "Статус",
|
||||
"@colStatus": {
|
||||
"description": "Заголовок столбца для статуса готовности к выплате"
|
||||
},
|
||||
|
||||
"statusReady": "Готов",
|
||||
"@statusReady": {
|
||||
"description": "Статус, указывающий, что выплаты можно отправлять немедленно"
|
||||
},
|
||||
|
||||
"statusRegistered": "Зарегистрирован",
|
||||
"@statusRegistered": {
|
||||
"description": "Статус, указывающий, что получатель зарегистрирован, но еще не полностью готов"
|
||||
},
|
||||
|
||||
"statusNotRegistered": "Не зарегистрирован",
|
||||
"@statusNotRegistered": {
|
||||
"description": "Статус, указывающий, что получатель не завершил регистрацию"
|
||||
},
|
||||
|
||||
"typeInternal": "Управляется мной",
|
||||
"@typeInternal": {
|
||||
"description": "Метка для получателей, чьи данные о выплатах управляются внутренне пользователем/компанией"
|
||||
},
|
||||
|
||||
"typeExternal": "Самоуправляемый",
|
||||
"@typeExternal": {
|
||||
"description": "Метка для получателей, которые управляют своими данными о выплатах самостоятельно"
|
||||
},
|
||||
|
||||
"searchHint": "Поиск получателей",
|
||||
"colActions": "Действия",
|
||||
"menuEdit": "Редактировать",
|
||||
"menuSendPayout": "Отправить выплату",
|
||||
"tooltipRowActions": "Другие действия",
|
||||
"accountSettings": "Настройки аккаунта",
|
||||
"accountNameUpdateError": "Не удалось обновить имя аккаунта",
|
||||
"settingsSuccessfullyUpdated": "Настройки успешно обновлены",
|
||||
"language": "Язык",
|
||||
"failedToUpdateLanguage": "Не удалось обновить язык",
|
||||
"settingsImageUpdateError": "Не удалось обновить изображение",
|
||||
"settingsImageTitle": "Изображение",
|
||||
"settingsImageHint": "Нажмите, чтобы изменить изображение",
|
||||
"accountName": "Имя",
|
||||
"accountNameHint": "Укажите ваше имя",
|
||||
"avatar": "Фото профиля",
|
||||
"avatarHint": "Нажмите для обновления",
|
||||
"avatarUpdateError": "Не удалось обновить фото профиля",
|
||||
"settings": "Настройки",
|
||||
"notSet": "не задано",
|
||||
"search": "Поиск...",
|
||||
"ok": "Ок",
|
||||
"cancel": "Отмена",
|
||||
"confirm": "Подтвердить",
|
||||
"back": "Назад",
|
||||
|
||||
"operationfryTitle": "История операций",
|
||||
"@operationfryTitle": {
|
||||
"description": "Заголовок страницы истории операций"
|
||||
},
|
||||
|
||||
"filters": "Фильтры",
|
||||
"@filters": {
|
||||
"description": "Метка для панели расширения фильтров"
|
||||
},
|
||||
|
||||
"period": "Период",
|
||||
"@period": {
|
||||
"description": "Метка для фильтра по диапазону дат"
|
||||
},
|
||||
|
||||
"selectPeriod": "Выберите период",
|
||||
"@selectPeriod": {
|
||||
"description": "Заполнитель, когда период не выбран"
|
||||
},
|
||||
|
||||
"apply": "Применить",
|
||||
"@apply": {
|
||||
"description": "Текст кнопки для применения фильтров"
|
||||
},
|
||||
|
||||
"status": "{status}",
|
||||
"@status": {
|
||||
"description": "Шаблон для одного чипа фильтра статуса",
|
||||
"placeholders": {
|
||||
"status": {
|
||||
"type": "String",
|
||||
"example": "Успешно"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"operationStatusSuccessful": "Успешно",
|
||||
"@operationStatusSuccessful": {
|
||||
"description": "Статус, указывающий на успешное выполнение операции"
|
||||
},
|
||||
|
||||
"operationStatusPending": "В ожидании",
|
||||
"@operationStatusPending": {
|
||||
"description": "Статус, указывающий, что операция ожидает выполнения"
|
||||
},
|
||||
|
||||
"operationStatusUnsuccessful": "Неуспешно",
|
||||
"@operationStatusUnsuccessful": {
|
||||
"description": "Статус, указывающий на сбой операции"
|
||||
},
|
||||
|
||||
"statusColumn": "Статус",
|
||||
"@statusColumn": {
|
||||
"description": "Заголовок столбца таблицы для статуса"
|
||||
},
|
||||
|
||||
"fileNameColumn": "Имя файла",
|
||||
"@fileNameColumn": {
|
||||
"description": "Заголовок столбца таблицы для имени файла"
|
||||
},
|
||||
|
||||
"amountColumn": "Сумма",
|
||||
"@amountColumn": {
|
||||
"description": "Заголовок столбца таблицы для исходной суммы"
|
||||
},
|
||||
|
||||
"toAmountColumn": "На сумму",
|
||||
"@toAmountColumn": {
|
||||
"description": "Заголовок столбца таблицы для конвертированной суммы"
|
||||
},
|
||||
|
||||
"payIdColumn": "Pay ID",
|
||||
"@payIdColumn": {
|
||||
"description": "Заголовок столбца таблицы для идентификатора платежа"
|
||||
},
|
||||
|
||||
"cardNumberColumn": "Номер карты",
|
||||
"@cardNumberColumn": {
|
||||
"description": "Заголовок столбца таблицы для замаскированного номера карты"
|
||||
},
|
||||
|
||||
"nameColumn": "Имя",
|
||||
"@nameColumn": {
|
||||
"description": "Заголовок столбца таблицы для имени получателя"
|
||||
},
|
||||
|
||||
"dateColumn": "Дата",
|
||||
"@dateColumn": {
|
||||
"description": "Заголовок столбца таблицы для даты/времени"
|
||||
},
|
||||
|
||||
"commentColumn": "Комментарий",
|
||||
"@commentColumn": {
|
||||
"description": "Заголовок столбца таблицы для комментария"
|
||||
},
|
||||
"paymentConfigTitle": "Куда получать деньги",
|
||||
"paymentConfigSubtitle": "Добавьте несколько методов и выберите основной.",
|
||||
"addPaymentMethod": "Добавить способ оплаты",
|
||||
"makeMain": "Сделать основным",
|
||||
"advanced": "Дополнительно",
|
||||
"fallbackExplanation": "Если основной метод недоступен, мы попробуем следующий включенный метод в списке.",
|
||||
"delete": "Удалить",
|
||||
"@delete": {
|
||||
"description": "Метка кнопки для удаления способа оплаты"
|
||||
},
|
||||
|
||||
"deletePaymentConfirmation": "Вы уверены, что хотите удалить этот способ оплаты?",
|
||||
"@deletePaymentConfirmation": {
|
||||
"description": "Сообщение диалога подтверждения, показываемое перед удалением способа оплаты"
|
||||
},
|
||||
|
||||
"edit": "Редактировать",
|
||||
"@edit": {
|
||||
"description": "Метка кнопки для редактирования способа оплаты"
|
||||
},
|
||||
|
||||
"moreActions": "Еще действия",
|
||||
"@moreActions": {
|
||||
"description": "Подсказка для кнопки меню с многоточием, открывающей дополнительные действия для способа оплаты"
|
||||
},
|
||||
"noPayouts": "Нет выплат",
|
||||
|
||||
"enterBankName": "Введите название банка",
|
||||
|
||||
"paymentType": "Тип способа оплаты",
|
||||
"selectPaymentType": "Пожалуйста, выберите тип способа оплаты",
|
||||
|
||||
"paymentTypeCard": "Кредитная карта",
|
||||
"paymentTypeBankAccount": "Российский банковский счет",
|
||||
"paymentTypeIban": "IBAN",
|
||||
"paymentTypeWallet": "Кошелек",
|
||||
|
||||
"cardNumber": "Номер карты",
|
||||
"enterCardNumber": "Введите номер карты",
|
||||
"cardholderName": "Имя держателя карты",
|
||||
|
||||
"iban": "IBAN",
|
||||
"enterIban": "Введите IBAN",
|
||||
"bic": "BIC",
|
||||
"bankName": "Название банка",
|
||||
"accountHolder": "Владелец счета",
|
||||
"enterAccountHolder": "Введите владельца счета",
|
||||
"enterBic": "Введите BIC",
|
||||
|
||||
"walletId": "ID кошелька",
|
||||
"enterWalletId": "Введите ID кошелька",
|
||||
|
||||
"recipients": "Получатели",
|
||||
"recipientName": "Имя получателя",
|
||||
"enterRecipientName": "Введите имя получателя",
|
||||
"inn": "ИНН",
|
||||
"enterInn": "Введите ИНН",
|
||||
"kpp": "КПП",
|
||||
"enterKpp": "Введите КПП",
|
||||
"accountNumber": "Номер счета",
|
||||
"enterAccountNumber": "Введите номер счета",
|
||||
"correspondentAccount": "Корреспондентский счет",
|
||||
"enterCorrespondentAccount": "Введите корреспондентский счет",
|
||||
"bik": "БИК",
|
||||
"enterBik": "Введите БИК",
|
||||
"add": "Добавить",
|
||||
"expiryDate": "Срок действия (ММ/ГГ)",
|
||||
"firstName": "Имя",
|
||||
"enterFirstName": "Введите имя",
|
||||
"lastName": "Фамилия",
|
||||
"enterLastName": "Введите фамилию",
|
||||
"sendSingle": "Отправить одну транзакцию",
|
||||
"sendMultiple": "Отправить несколько транзакций",
|
||||
"addFunds": "Пополнить счет",
|
||||
"close": "Закрыть",
|
||||
"multiplePayout": "Множественная выплата",
|
||||
"howItWorks": "Как это работает?",
|
||||
"exampleTitle": "Формат файла и образец",
|
||||
"downloadSampleCSV": "Скачать sample.csv",
|
||||
"tokenColumn": "Токен (обязательно)",
|
||||
"currency": "Валюта",
|
||||
"amount": "Сумма",
|
||||
"comment": "Комментарий",
|
||||
"uploadCSV": "Загрузите ваш CSV",
|
||||
"upload": "Загрузить",
|
||||
"hintUpload": "Поддерживаемый формат: .CSV · Макс. размер 1 МБ",
|
||||
"uploadHistory": "История загрузок",
|
||||
"payout": "Выплата",
|
||||
"sendTo": "Отправить выплату",
|
||||
"send": "Отправить выплату",
|
||||
"recipientPaysFee": "Получатель оплачивает комиссию",
|
||||
|
||||
"sentAmount": "Отправленная сумма: ${amount}",
|
||||
"@sentAmount": {
|
||||
"description": "Метка, показывающая отправленную сумму",
|
||||
"placeholders": {
|
||||
"amount": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"fee": "Комиссия: ${fee}",
|
||||
"@fee": {
|
||||
"description": "Метка, показывающая комиссию за транзакцию",
|
||||
"placeholders": {
|
||||
"fee": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"recipientWillReceive": "Получатель получит: ${amount}",
|
||||
"@recipientWillReceive": {
|
||||
"description": "Метка, показывающая, сколько получит получатель",
|
||||
"placeholders": {
|
||||
"amount": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"total": "Итого: ${total}",
|
||||
"@total": {
|
||||
"description": "Метка, показывающая общую сумму транзакции",
|
||||
"placeholders": {
|
||||
"total": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"hideDetails": "Скрыть детали",
|
||||
"showDetails": "Показать детали",
|
||||
"whereGetMoney": "Источник средств для списания",
|
||||
"details": "Детали",
|
||||
|
||||
"addRecipient": "Добавить получателя",
|
||||
"editRecipient": "Редактировать получателя",
|
||||
"saveRecipient": "Сохранить получателя",
|
||||
|
||||
"choosePaymentMethod": "Способы оплаты (выберите хотя бы 1)",
|
||||
"recipientFormRule": "Получатель должен иметь хотя бы один способ оплаты",
|
||||
|
||||
"allStatus": "Все",
|
||||
"readyStatus": "Готов",
|
||||
"registeredStatus": "Зарегистрирован",
|
||||
"notRegisteredStatus": "Не зарегистрирован",
|
||||
|
||||
"noRecipientSelected": "Получатель не выбран"
|
||||
}
|
||||
104
frontend/pweb/lib/main.dart
Normal file
104
frontend/pweb/lib/main.dart
Normal file
@@ -0,0 +1,104 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// ignore: depend_on_referenced_packages
|
||||
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
import 'package:pshared/config/constants.dart';
|
||||
import 'package:pshared/provider/account.dart';
|
||||
import 'package:pshared/provider/locale.dart';
|
||||
import 'package:pshared/provider/organizations.dart';
|
||||
import 'package:pshared/provider/pfe/provider.dart';
|
||||
|
||||
import 'package:pweb/app/app.dart';
|
||||
import 'package:pweb/app/timeago.dart';
|
||||
import 'package:pweb/providers/balance.dart';
|
||||
import 'package:pweb/providers/carousel.dart';
|
||||
import 'package:pweb/providers/mock_payment.dart';
|
||||
import 'package:pweb/providers/page_selector.dart';
|
||||
import 'package:pweb/providers/payment_methods.dart';
|
||||
import 'package:pweb/providers/recipient.dart';
|
||||
import 'package:pweb/providers/two_factor.dart';
|
||||
import 'package:pweb/providers/upload_history.dart';
|
||||
import 'package:pweb/providers/wallets.dart';
|
||||
import 'package:pweb/services/amplitude.dart';
|
||||
import 'package:pweb/services/auth.dart';
|
||||
import 'package:pweb/services/balance.dart';
|
||||
import 'package:pweb/services/payments/payment_methods.dart';
|
||||
import 'package:pweb/services/payments/upload_history.dart';
|
||||
import 'package:pweb/services/recipient/recipient.dart';
|
||||
import 'package:pweb/services/wallets.dart';
|
||||
|
||||
|
||||
void _setupLogging() {
|
||||
Logger.root.level = Level.ALL;
|
||||
Logger.root.onRecord.listen((record) {
|
||||
// ignore: avoid_print
|
||||
print('${record.level.name}: ${record.time}: ${record.loggerName}: ${record.message}');
|
||||
});
|
||||
}
|
||||
|
||||
void main() async {
|
||||
await Constants.initialize();
|
||||
await AmplitudeService.initialize();
|
||||
|
||||
|
||||
_setupLogging();
|
||||
setUrlStrategy(PathUrlStrategy());
|
||||
|
||||
initializeTimeagoLocales();
|
||||
|
||||
runApp(
|
||||
MultiProvider(
|
||||
providers: [
|
||||
Provider<AuthenticationService>(
|
||||
create: (_) => AuthenticationService(),
|
||||
),
|
||||
ChangeNotifierProxyProvider<AuthenticationService, TwoFactorProvider>(
|
||||
create: (context) => TwoFactorProvider(
|
||||
context.read<AuthenticationService>(),
|
||||
),
|
||||
update: (context, authService, previous) => TwoFactorProvider(authService),
|
||||
),
|
||||
ChangeNotifierProvider(create: (_) => LocaleProvider(null)),
|
||||
ChangeNotifierProvider(create: (_) => AccountProvider()),
|
||||
ChangeNotifierProvider(create: (_) => OrganizationsProvider()),
|
||||
ChangeNotifierProvider(create: (_) => PfeProvider()),
|
||||
ChangeNotifierProvider(create: (_) => CarouselIndexProvider()),
|
||||
|
||||
ChangeNotifierProvider(
|
||||
create: (_) => UploadHistoryProvider(service: MockUploadHistoryService())..load(),
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: (_) => PaymentMethodsProvider(service: MockPaymentMethodsService())..loadMethods(),
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: (_) => WalletsProvider(MockWalletsService())..loadData(),
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: (_) => MockPaymentProvider(),
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: (_) => RecipientProvider(RecipientService())..loadRecipients(),
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: (context) {
|
||||
final recipient = context.read<RecipientProvider?>();
|
||||
final wallets = context.read<WalletsProvider?>();
|
||||
return PageSelectorProvider(
|
||||
recipientProvider: recipient,
|
||||
walletsProvider: wallets,
|
||||
);
|
||||
},
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: (_) => BalanceProvider(MockBalanceService())..loadData(),
|
||||
),
|
||||
],
|
||||
child: const PayApp(),
|
||||
),
|
||||
);
|
||||
}
|
||||
1
frontend/pweb/lib/models/currency.dart
Normal file
1
frontend/pweb/lib/models/currency.dart
Normal file
@@ -0,0 +1 @@
|
||||
enum Currency {usd, eur, rub, usdt, usdc}
|
||||
38
frontend/pweb/lib/models/wallet.dart
Normal file
38
frontend/pweb/lib/models/wallet.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'package:pweb/models/currency.dart';
|
||||
|
||||
|
||||
class Wallet {
|
||||
final String id;
|
||||
final String walletUserID; // ID or number that we show the user
|
||||
final String name;
|
||||
final double balance;
|
||||
final Currency currency;
|
||||
final bool isHidden;
|
||||
|
||||
Wallet({
|
||||
required this.id,
|
||||
required this.walletUserID,
|
||||
required this.name,
|
||||
required this.balance,
|
||||
required this.currency,
|
||||
this.isHidden = true,
|
||||
});
|
||||
|
||||
Wallet copyWith({
|
||||
String? id,
|
||||
String? name,
|
||||
double? balance,
|
||||
Currency? currency,
|
||||
String? walletUserID,
|
||||
bool? isHidden,
|
||||
}) {
|
||||
return Wallet(
|
||||
id: id ?? this.id,
|
||||
name: name ?? this.name,
|
||||
balance: balance ?? this.balance,
|
||||
currency: currency ?? this.currency,
|
||||
walletUserID: walletUserID ?? this.walletUserID,
|
||||
isHidden: isHidden ?? this.isHidden,
|
||||
);
|
||||
}
|
||||
}
|
||||
16
frontend/pweb/lib/pages/2fa/error_message.dart
Normal file
16
frontend/pweb/lib/pages/2fa/error_message.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class ErrorMessage extends StatelessWidget {
|
||||
final String error;
|
||||
|
||||
const ErrorMessage({super.key, required this.error});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Text(
|
||||
error,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
);
|
||||
}
|
||||
35
frontend/pweb/lib/pages/2fa/input.dart
Normal file
35
frontend/pweb/lib/pages/2fa/input.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
||||
|
||||
|
||||
class TwoFactorCodeInput extends StatelessWidget {
|
||||
final void Function(String) onCompleted;
|
||||
|
||||
const TwoFactorCodeInput({super.key, required this.onCompleted});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 300),
|
||||
child: PinCodeTextField(
|
||||
length: 6,
|
||||
appContext: context,
|
||||
autoFocus: true,
|
||||
keyboardType: TextInputType.number,
|
||||
animationType: AnimationType.fade,
|
||||
pinTheme: PinTheme(
|
||||
shape: PinCodeFieldShape.box,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
fieldHeight: 48,
|
||||
fieldWidth: 40,
|
||||
inactiveColor: Theme.of(context).dividerColor,
|
||||
activeColor: Theme.of(context).colorScheme.primary,
|
||||
selectedColor: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
onCompleted: onCompleted,
|
||||
onChanged: (_) {},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
61
frontend/pweb/lib/pages/2fa/page.dart
Normal file
61
frontend/pweb/lib/pages/2fa/page.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/pages/2fa/error_message.dart';
|
||||
import 'package:pweb/pages/2fa/input.dart';
|
||||
import 'package:pweb/pages/2fa/prompt.dart';
|
||||
import 'package:pweb/pages/2fa/resend.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:pweb/providers/two_factor.dart';
|
||||
|
||||
|
||||
|
||||
class TwoFactorCodePage extends StatelessWidget {
|
||||
final VoidCallback onVerificationSuccess;
|
||||
|
||||
const TwoFactorCodePage({
|
||||
super.key,
|
||||
required this.onVerificationSuccess,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<TwoFactorProvider>(
|
||||
builder: (context, provider, child) {
|
||||
if (provider.verificationSuccess) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
onVerificationSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('')),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const TwoFactorPromptText(),
|
||||
const SizedBox(height: 32),
|
||||
TwoFactorCodeInput(
|
||||
onCompleted: (code) => provider.submitCode(code),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
if (provider.isSubmitting)
|
||||
const Center(child: CircularProgressIndicator())
|
||||
else
|
||||
const ResendCodeButton(),
|
||||
if (provider.hasError) ...[
|
||||
const SizedBox(height: 12),
|
||||
ErrorMessage(error: AppLocalizations.of(context)!.twoFactorError),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
15
frontend/pweb/lib/pages/2fa/prompt.dart
Normal file
15
frontend/pweb/lib/pages/2fa/prompt.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class TwoFactorPromptText extends StatelessWidget {
|
||||
const TwoFactorPromptText({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Text(
|
||||
AppLocalizations.of(context)!.twoFactorPrompt,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
textAlign: TextAlign.center,
|
||||
);
|
||||
}
|
||||
31
frontend/pweb/lib/pages/2fa/resend.dart
Normal file
31
frontend/pweb/lib/pages/2fa/resend.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class ResendCodeButton extends StatelessWidget {
|
||||
const ResendCodeButton({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final localizations = AppLocalizations.of(context)!;
|
||||
|
||||
return TextButton(
|
||||
onPressed: () {
|
||||
// TODO: Add resend logic
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size(0, 0),
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
alignment: Alignment.centerLeft,
|
||||
foregroundColor: theme.colorScheme.primary,
|
||||
textStyle: theme.textTheme.bodyMedium?.copyWith(
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
child: Text(localizations.twoFactorResend),
|
||||
);
|
||||
}
|
||||
}
|
||||
90
frontend/pweb/lib/pages/address_book/form/method_tile.dart
Normal file
90
frontend/pweb/lib/pages/address_book/form/method_tile.dart
Normal file
@@ -0,0 +1,90 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_methods/form.dart';
|
||||
import 'package:pweb/pages/payment_methods/icon.dart';
|
||||
|
||||
|
||||
class AdressBookPaymentMethodTile extends StatefulWidget {
|
||||
final PaymentType type;
|
||||
final String title;
|
||||
final Map<PaymentType, Object?> methods;
|
||||
final ValueChanged<Object?> onChanged;
|
||||
|
||||
final double spacingM;
|
||||
final double spacingS;
|
||||
final double sizeM;
|
||||
final TextStyle? titleTextStyle;
|
||||
|
||||
const AdressBookPaymentMethodTile({
|
||||
super.key,
|
||||
required this.type,
|
||||
required this.title,
|
||||
required this.methods,
|
||||
required this.onChanged,
|
||||
this.spacingM = 12,
|
||||
this.spacingS = 8,
|
||||
this.sizeM = 20,
|
||||
this.titleTextStyle,
|
||||
});
|
||||
|
||||
@override
|
||||
State<AdressBookPaymentMethodTile> createState() => _AdressBookPaymentMethodTileState();
|
||||
}
|
||||
|
||||
class _AdressBookPaymentMethodTileState extends State<AdressBookPaymentMethodTile> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final isAdded = widget.methods.containsKey(widget.type);
|
||||
|
||||
return ExpansionTile(
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(
|
||||
iconForPaymentType(widget.type),
|
||||
size: widget.sizeM,
|
||||
color: isAdded
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onSurface,
|
||||
),
|
||||
SizedBox(width: widget.spacingS),
|
||||
Text(
|
||||
widget.title,
|
||||
style: widget.titleTextStyle ??
|
||||
theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isAdded ? theme.colorScheme.primary : null,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (isAdded)
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete, color: theme.colorScheme.error),
|
||||
onPressed: () {
|
||||
widget.onChanged(null);
|
||||
},
|
||||
),
|
||||
Icon(
|
||||
isAdded ? Icons.check_circle : Icons.add_circle_outline,
|
||||
color: isAdded ? theme.colorScheme.primary : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
children: [
|
||||
PaymentMethodForm(
|
||||
key: ValueKey(widget.type),
|
||||
selectedType: widget.type,
|
||||
initialData: widget.methods[widget.type],
|
||||
onChanged: widget.onChanged,
|
||||
),
|
||||
SizedBox(height: widget.spacingM),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
109
frontend/pweb/lib/pages/address_book/form/page.dart
Normal file
109
frontend/pweb/lib/pages/address_book/form/page.dart
Normal file
@@ -0,0 +1,109 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/methods/card.dart';
|
||||
import 'package:pshared/models/payment/methods/iban.dart';
|
||||
import 'package:pshared/models/payment/methods/russian_bank.dart';
|
||||
import 'package:pshared/models/payment/methods/wallet.dart';
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
import 'package:pshared/models/recipient/status.dart';
|
||||
import 'package:pshared/models/recipient/type.dart';
|
||||
|
||||
import 'package:pweb/pages/address_book/form/view.dart';
|
||||
import 'package:pweb/services/amplitude.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class AdressBookRecipientForm extends StatefulWidget {
|
||||
final Recipient? recipient;
|
||||
final ValueChanged<Recipient?>? onSaved;
|
||||
|
||||
const AdressBookRecipientForm({super.key, this.recipient, this.onSaved});
|
||||
|
||||
@override
|
||||
State<AdressBookRecipientForm> createState() => _AdressBookRecipientFormState();
|
||||
}
|
||||
|
||||
class _AdressBookRecipientFormState extends State<AdressBookRecipientForm> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
late TextEditingController _nameCtrl;
|
||||
late TextEditingController _emailCtrl;
|
||||
RecipientType _type = RecipientType.internal;
|
||||
RecipientStatus _status = RecipientStatus.ready;
|
||||
final Map<PaymentType, Object?> _methods = {};
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final r = widget.recipient;
|
||||
_nameCtrl = TextEditingController(text: r?.name ?? "");
|
||||
_emailCtrl = TextEditingController(text: r?.email ?? "");
|
||||
_type = r?.type ?? RecipientType.internal;
|
||||
_status = r?.status ?? RecipientStatus.ready;
|
||||
|
||||
if (r?.card != null) _methods[PaymentType.card] = r!.card;
|
||||
if (r?.iban != null) _methods[PaymentType.iban] = r!.iban;
|
||||
if (r?.wallet != null) _methods[PaymentType.wallet] = r!.wallet;
|
||||
if (r?.bank != null) _methods[PaymentType.bankAccount] = r!.bank;
|
||||
}
|
||||
|
||||
//TODO Change when registration is ready
|
||||
void _save() {
|
||||
if (!_formKey.currentState!.validate() || _methods.isEmpty) {
|
||||
AmplitudeService.recipientAddCompleted(
|
||||
_type,
|
||||
_status,
|
||||
_methods.keys.toSet(),
|
||||
);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.recipientFormRule),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final recipient = Recipient(
|
||||
name: _nameCtrl.text,
|
||||
email: _emailCtrl.text,
|
||||
type: _type,
|
||||
status: _status,
|
||||
avatarUrl: null,
|
||||
card: _methods[PaymentType.card] as CardPaymentMethod?,
|
||||
iban: _methods[PaymentType.iban] as IbanPaymentMethod?,
|
||||
wallet: _methods[PaymentType.wallet] as WalletPaymentMethod?,
|
||||
bank: _methods[PaymentType.bankAccount] as RussianBankAccountPaymentMethod?,
|
||||
);
|
||||
|
||||
widget.onSaved?.call(recipient);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FormView(
|
||||
formKey: _formKey,
|
||||
nameCtrl: _nameCtrl,
|
||||
emailCtrl: _emailCtrl,
|
||||
type: _type,
|
||||
status: _status,
|
||||
methods: _methods,
|
||||
onTypeChanged: (t) => setState(() => _type = t),
|
||||
onStatusChanged: (s) => setState(() => _status = s),
|
||||
onMethodsChanged: (type, data) {
|
||||
setState(() {
|
||||
if (data != null) {
|
||||
_methods[type] = data;
|
||||
} else {
|
||||
_methods.remove(type);
|
||||
}
|
||||
});
|
||||
},
|
||||
onSave: _save,
|
||||
isEditing: widget.recipient != null,
|
||||
onBack: () {
|
||||
widget.onSaved?.call(null);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
124
frontend/pweb/lib/pages/address_book/form/view.dart
Normal file
124
frontend/pweb/lib/pages/address_book/form/view.dart
Normal file
@@ -0,0 +1,124 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
import 'package:pshared/models/recipient/status.dart';
|
||||
import 'package:pshared/models/recipient/type.dart';
|
||||
|
||||
import 'package:pweb/utils/payment/label.dart';
|
||||
import 'package:pweb/pages/address_book/form/method_tile.dart';
|
||||
import 'package:pweb/pages/address_book/form/widgets/button.dart';
|
||||
import 'package:pweb/pages/address_book/form/widgets/email_field.dart';
|
||||
import 'package:pweb/pages/address_book/form/widgets/header.dart';
|
||||
import 'package:pweb/pages/address_book/form/widgets/name_field.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class FormView extends StatelessWidget {
|
||||
final GlobalKey<FormState> formKey;
|
||||
final TextEditingController nameCtrl;
|
||||
final TextEditingController emailCtrl;
|
||||
final RecipientType type;
|
||||
final RecipientStatus status;
|
||||
final Map<PaymentType, Object?> methods;
|
||||
final ValueChanged<RecipientType> onTypeChanged;
|
||||
final ValueChanged<RecipientStatus> onStatusChanged;
|
||||
final void Function(PaymentType, Object?) onMethodsChanged;
|
||||
final VoidCallback onSave;
|
||||
final bool isEditing;
|
||||
final VoidCallback onBack;
|
||||
|
||||
final double maxWidth;
|
||||
final double elevation;
|
||||
final double borderRadius;
|
||||
final EdgeInsetsGeometry padding;
|
||||
final double spacingHeader;
|
||||
final double spacingFields;
|
||||
final double spacingDivider;
|
||||
final double spacingSave;
|
||||
final double spacingBottom;
|
||||
final TextStyle? titleTextStyle;
|
||||
|
||||
const FormView({
|
||||
super.key,
|
||||
required this.formKey,
|
||||
required this.nameCtrl,
|
||||
required this.emailCtrl,
|
||||
required this.type,
|
||||
required this.status,
|
||||
required this.methods,
|
||||
required this.onTypeChanged,
|
||||
required this.onStatusChanged,
|
||||
required this.onMethodsChanged,
|
||||
required this.onSave,
|
||||
required this.isEditing,
|
||||
required this.onBack,
|
||||
this.maxWidth = 500,
|
||||
this.elevation = 4,
|
||||
this.borderRadius = 16,
|
||||
this.padding = const EdgeInsets.all(20),
|
||||
this.spacingHeader = 20,
|
||||
this.spacingFields = 12,
|
||||
this.spacingDivider = 40,
|
||||
this.spacingSave = 30,
|
||||
this.spacingBottom = 16,
|
||||
this.titleTextStyle,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: maxWidth),
|
||||
child: Material(
|
||||
elevation: elevation,
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
color: theme.colorScheme.onSecondary,
|
||||
child: Padding(
|
||||
padding: padding,
|
||||
child: Form(
|
||||
key: formKey,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
HeaderWidget(
|
||||
isEditing: isEditing,
|
||||
onBack: onBack,
|
||||
),
|
||||
SizedBox(height: spacingHeader),
|
||||
NameField(controller: nameCtrl),
|
||||
SizedBox(height: spacingFields),
|
||||
EmailField(controller: emailCtrl),
|
||||
Divider(height: spacingDivider),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.choosePaymentMethod,
|
||||
style: titleTextStyle ??
|
||||
theme.textTheme.titleMedium
|
||||
?.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(height: spacingFields),
|
||||
...PaymentType.values.map(
|
||||
(p) => AdressBookPaymentMethodTile(
|
||||
type: p,
|
||||
title: getPaymentTypeLabel(context, p),
|
||||
methods: methods,
|
||||
onChanged: (data) => onMethodsChanged(p, data),
|
||||
),
|
||||
),
|
||||
SizedBox(height: spacingSave),
|
||||
SaveButton(onSave: onSave),
|
||||
SizedBox(height: spacingBottom),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class SaveButton extends StatelessWidget {
|
||||
final VoidCallback onSave;
|
||||
|
||||
final double width;
|
||||
final double height;
|
||||
final double borderRadius;
|
||||
final String? text;
|
||||
final TextStyle? textStyle;
|
||||
|
||||
const SaveButton({
|
||||
super.key,
|
||||
required this.onSave,
|
||||
this.width = 200,
|
||||
this.height = 45,
|
||||
this.borderRadius = 12,
|
||||
this.text,
|
||||
this.textStyle,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
height: height,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
onTap: onSave,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
text ?? AppLocalizations.of(context)!.saveRecipient,
|
||||
style: textStyle ??
|
||||
theme.textTheme.labelLarge?.copyWith(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class ChoiceChips<T> extends StatelessWidget {
|
||||
final String label;
|
||||
final List<T> values;
|
||||
final T selected;
|
||||
final ValueChanged<T> onChanged;
|
||||
|
||||
final double spacing;
|
||||
final double runSpacing;
|
||||
final double labelSpacing;
|
||||
|
||||
const ChoiceChips({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.values,
|
||||
required this.selected,
|
||||
required this.onChanged,
|
||||
this.spacing = 8,
|
||||
this.runSpacing = 8,
|
||||
this.labelSpacing = 8,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: theme.textTheme.titleMedium!.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(height: labelSpacing),
|
||||
Wrap(
|
||||
spacing: spacing,
|
||||
runSpacing: runSpacing,
|
||||
children: values.map((v) {
|
||||
final isSelected = v == selected;
|
||||
return ChoiceChip(
|
||||
selectedColor: theme.colorScheme.primary,
|
||||
backgroundColor: theme.colorScheme.onSecondary,
|
||||
showCheckmark: false,
|
||||
label: Text(
|
||||
v.toString().split('.').last,
|
||||
style: TextStyle(
|
||||
color: isSelected
|
||||
? theme.colorScheme.onSecondary
|
||||
: theme.colorScheme.inverseSurface,
|
||||
),
|
||||
),
|
||||
selected: isSelected,
|
||||
onSelected: (_) => onChanged(v),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class EmailField extends StatelessWidget {
|
||||
final TextEditingController controller;
|
||||
|
||||
final double borderRadius;
|
||||
final EdgeInsetsGeometry contentPadding;
|
||||
|
||||
const EmailField({
|
||||
super.key,
|
||||
required this.controller,
|
||||
this.borderRadius = 12,
|
||||
this.contentPadding = const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
|
||||
return TextFormField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
labelText: loc.username,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
),
|
||||
contentPadding: contentPadding,
|
||||
),
|
||||
validator: (v) =>
|
||||
v == null || v.isEmpty ? loc.usernameErrorInvalid : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class HeaderWidget extends StatelessWidget {
|
||||
final bool isEditing;
|
||||
final VoidCallback? onBack;
|
||||
|
||||
final double spacing;
|
||||
final TextStyle? textStyle;
|
||||
|
||||
const HeaderWidget({
|
||||
super.key,
|
||||
required this.isEditing,
|
||||
this.onBack,
|
||||
this.spacing = 8,
|
||||
this.textStyle,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
color: theme.colorScheme.primary,
|
||||
onPressed: onBack,
|
||||
),
|
||||
SizedBox(width: spacing),
|
||||
Text(
|
||||
isEditing ? l10n.editRecipient : l10n.addRecipient,
|
||||
style: textStyle ??
|
||||
theme.textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class NameField extends StatelessWidget {
|
||||
final TextEditingController controller;
|
||||
|
||||
final double borderRadius;
|
||||
final EdgeInsetsGeometry contentPadding;
|
||||
|
||||
const NameField({
|
||||
super.key,
|
||||
required this.controller,
|
||||
this.borderRadius = 12,
|
||||
this.contentPadding = const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
|
||||
return TextFormField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
labelText: loc.recipientName,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
),
|
||||
contentPadding: contentPadding,
|
||||
),
|
||||
validator: (v) => v == null || v.isEmpty ? loc.enterRecipientName : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
61
frontend/pweb/lib/pages/address_book/page/filter_button.dart
Normal file
61
frontend/pweb/lib/pages/address_book/page/filter_button.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/recipient/filter.dart';
|
||||
|
||||
|
||||
class RecipientFilterButton extends StatelessWidget {
|
||||
final String text;
|
||||
final RecipientFilter filter;
|
||||
final RecipientFilter selected;
|
||||
final ValueChanged<RecipientFilter> onTap;
|
||||
|
||||
const RecipientFilterButton({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.filter,
|
||||
required this.selected,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isSelected = selected == filter;
|
||||
final theme = Theme.of(context).colorScheme;
|
||||
|
||||
return ElevatedButton(
|
||||
onPressed: () => onTap(filter),
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all(Colors.transparent),
|
||||
overlayColor: WidgetStateProperty.all(Colors.transparent),
|
||||
shadowColor: WidgetStateProperty.all(Colors.transparent),
|
||||
elevation: WidgetStateProperty.all(0),
|
||||
),
|
||||
child: IntrinsicWidth(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: isSelected
|
||||
? theme.onPrimaryContainer
|
||||
: theme.onPrimaryContainer.withAlpha(60),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 2,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? theme.primary
|
||||
: theme.onPrimaryContainer.withAlpha(60),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
44
frontend/pweb/lib/pages/address_book/page/header.dart
Normal file
44
frontend/pweb/lib/pages/address_book/page/header.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class RecipientAddressBookHeader extends StatelessWidget {
|
||||
final VoidCallback onAddRecipient;
|
||||
|
||||
const RecipientAddressBookHeader({super.key, required this.onAddRecipient});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context).colorScheme;
|
||||
final l10 = AppLocalizations.of(context)!;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
l10.recipients,
|
||||
style: Theme.of(context).textTheme.titleLarge!.copyWith(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
TextButton.icon(
|
||||
onPressed: onAddRecipient,
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all(theme.primary),
|
||||
shadowColor: WidgetStateProperty.all(theme.onPrimaryContainer),
|
||||
elevation: WidgetStateProperty.all(2),
|
||||
shape: WidgetStateProperty.all(
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
),
|
||||
icon: Icon(Icons.add, color: theme.onSecondary),
|
||||
label: Text(l10.addRecipient, style: TextStyle(color: theme.onSecondary)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
40
frontend/pweb/lib/pages/address_book/page/list.dart
Normal file
40
frontend/pweb/lib/pages/address_book/page/list.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pweb/pages/address_book/page/recipient/item.dart';
|
||||
|
||||
|
||||
class RecipientAddressBookList extends StatelessWidget {
|
||||
final List<Recipient> filteredRecipients;
|
||||
final ValueChanged<Recipient>? onSelected;
|
||||
final ValueChanged<Recipient>? onEdit;
|
||||
final ValueChanged<Recipient>? onDelete;
|
||||
|
||||
const RecipientAddressBookList({
|
||||
super.key,
|
||||
required this.filteredRecipients,
|
||||
this.onSelected,
|
||||
this.onEdit,
|
||||
this.onDelete,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
itemCount: filteredRecipients.length,
|
||||
itemBuilder: (context, index) {
|
||||
final recipient = filteredRecipients[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6.0),
|
||||
child: RecipientAddressBookItem(
|
||||
recipient: recipient,
|
||||
onTap: () => onSelected?.call(recipient),
|
||||
onEdit: () => onEdit?.call(recipient),
|
||||
onDelete: () => onDelete?.call(recipient),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
102
frontend/pweb/lib/pages/address_book/page/page.dart
Normal file
102
frontend/pweb/lib/pages/address_book/page/page.dart
Normal file
@@ -0,0 +1,102 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pshared/models/recipient/filter.dart';
|
||||
import 'package:pweb/pages/address_book/page/filter_button.dart';
|
||||
import 'package:pweb/pages/address_book/page/header.dart';
|
||||
import 'package:pweb/pages/address_book/page/list.dart';
|
||||
import 'package:pweb/pages/address_book/page/search.dart';
|
||||
import 'package:pweb/providers/recipient.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class RecipientAddressBookPage extends StatelessWidget {
|
||||
final ValueChanged<Recipient> onRecipientSelected;
|
||||
final VoidCallback onAddRecipient;
|
||||
final ValueChanged<Recipient>? onEditRecipient;
|
||||
|
||||
const RecipientAddressBookPage({
|
||||
super.key,
|
||||
required this.onRecipientSelected,
|
||||
required this.onAddRecipient,
|
||||
this.onEditRecipient,
|
||||
});
|
||||
|
||||
static const double _expandedHeight = 550;
|
||||
static const double _paddingAll = 16;
|
||||
static const double _bigBox = 30;
|
||||
static const double _smallBox = 20;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
final provider = context.watch<RecipientProvider>();
|
||||
|
||||
if (provider.isLoading) {
|
||||
return const Center(child: CircularProgressIndicator()); //TODO This should be in the provider
|
||||
}
|
||||
|
||||
if (provider.error != null) {
|
||||
return Center(child: Text('Error: ${provider.error}'));
|
||||
}
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
RecipientAddressBookHeader(onAddRecipient: onAddRecipient),
|
||||
const SizedBox(height: _smallBox),
|
||||
RecipientSearchField(
|
||||
controller: TextEditingController(text: provider.query),
|
||||
focusNode: FocusNode(),
|
||||
onChanged: provider.setQuery,
|
||||
),
|
||||
const SizedBox(height: _bigBox),
|
||||
Row(
|
||||
children: [
|
||||
RecipientFilterButton(
|
||||
text: loc.allStatus,
|
||||
filter: RecipientFilter.all,
|
||||
selected: provider.selectedFilter,
|
||||
onTap: provider.setFilter,
|
||||
),
|
||||
RecipientFilterButton(
|
||||
text: loc.readyStatus,
|
||||
filter: RecipientFilter.ready,
|
||||
selected: provider.selectedFilter,
|
||||
onTap: provider.setFilter,
|
||||
),
|
||||
RecipientFilterButton(
|
||||
text: loc.registeredStatus,
|
||||
filter: RecipientFilter.registered,
|
||||
selected: provider.selectedFilter,
|
||||
onTap: provider.setFilter,
|
||||
),
|
||||
RecipientFilterButton(
|
||||
text: loc.notRegisteredStatus,
|
||||
filter: RecipientFilter.notRegistered,
|
||||
selected: provider.selectedFilter,
|
||||
onTap: provider.setFilter,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: _expandedHeight,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(_paddingAll),
|
||||
child: RecipientAddressBookList(
|
||||
filteredRecipients: provider.filteredRecipients,
|
||||
onEdit: (recipient) => onEditRecipient?.call(recipient),
|
||||
onSelected: onRecipientSelected,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class RecipientActions extends StatelessWidget {
|
||||
final VoidCallback onEdit;
|
||||
final VoidCallback onDelete;
|
||||
|
||||
const RecipientActions({super.key, required this.onEdit, required this.onDelete});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
IconButton(icon: Icon(Icons.edit, color: Theme.of(context).colorScheme.primary), onPressed: onEdit),
|
||||
IconButton(icon: Icon(Icons.delete, color: Theme.of(context).colorScheme.error), onPressed: onDelete),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class RecipientInfoColumn extends StatelessWidget {
|
||||
final String name;
|
||||
final String email;
|
||||
|
||||
const RecipientInfoColumn({super.key, required this.name, required this.email});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(name, style: Theme.of(context).textTheme.titleMedium!.copyWith(fontSize: 19)),
|
||||
Text(email, style: Theme.of(context).textTheme.bodyMedium),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_methods/icon.dart';
|
||||
import 'package:pweb/utils/payment/label.dart';
|
||||
|
||||
|
||||
class RecipientAddressBookInfoRow extends StatelessWidget {
|
||||
final PaymentType type;
|
||||
final String value;
|
||||
|
||||
final double spacingWidth;
|
||||
final double spacingHeight;
|
||||
final double iconSize;
|
||||
final double titleFontSize;
|
||||
final double valueFontSize;
|
||||
final TextStyle? textStyle;
|
||||
|
||||
const RecipientAddressBookInfoRow({
|
||||
super.key,
|
||||
required this.type,
|
||||
required this.value,
|
||||
this.spacingWidth = 8.0,
|
||||
this.spacingHeight = 2.0,
|
||||
this.iconSize = 20.0,
|
||||
this.titleFontSize = 16.0,
|
||||
this.valueFontSize = 12.0,
|
||||
this.textStyle,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final style = textStyle ?? Theme.of(context).textTheme.bodySmall!;
|
||||
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(iconForPaymentType(type), size: iconSize),
|
||||
SizedBox(width: spacingWidth),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
getPaymentTypeLabel(context, type),
|
||||
style: style.copyWith(fontSize: titleFontSize),
|
||||
),
|
||||
SizedBox(height: spacingHeight),
|
||||
Text(
|
||||
value,
|
||||
style: style.copyWith(fontSize: valueFontSize),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pweb/pages/address_book/page/recipient/actions.dart';
|
||||
import 'package:pweb/pages/address_book/page/recipient/info_column.dart';
|
||||
import 'package:pweb/pages/address_book/page/recipient/payment_row.dart';
|
||||
import 'package:pweb/pages/address_book/page/recipient/status.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/avatar.dart';
|
||||
|
||||
|
||||
class RecipientAddressBookItem extends StatefulWidget {
|
||||
final Recipient recipient;
|
||||
final VoidCallback onTap;
|
||||
final VoidCallback onEdit;
|
||||
final VoidCallback onDelete;
|
||||
|
||||
final double borderRadius;
|
||||
final double elevation;
|
||||
final EdgeInsetsGeometry padding;
|
||||
final double spacingDotAvatar;
|
||||
final double spacingAvatarInfo;
|
||||
final double spacingBottom;
|
||||
final double avatarRadius;
|
||||
|
||||
const RecipientAddressBookItem({
|
||||
super.key,
|
||||
required this.recipient,
|
||||
required this.onTap,
|
||||
required this.onEdit,
|
||||
required this.onDelete,
|
||||
this.borderRadius = 12,
|
||||
this.elevation = 4,
|
||||
this.padding = const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
this.spacingDotAvatar = 8,
|
||||
this.spacingAvatarInfo = 16,
|
||||
this.spacingBottom = 10,
|
||||
this.avatarRadius = 24,
|
||||
});
|
||||
|
||||
@override
|
||||
State<RecipientAddressBookItem> createState() => _RecipientAddressBookItemState();
|
||||
}
|
||||
|
||||
class _RecipientAddressBookItemState extends State<RecipientAddressBookItem> {
|
||||
bool _isHovered = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final recipient = widget.recipient;
|
||||
|
||||
return MouseRegion(
|
||||
onEnter: (_) => setState(() => _isHovered = true),
|
||||
onExit: (_) => setState(() => _isHovered = false),
|
||||
child: InkWell(
|
||||
onTap: widget.onTap,
|
||||
child: Card(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(widget.borderRadius)),
|
||||
elevation: widget.elevation,
|
||||
color: Theme.of(context).colorScheme.onSecondary,
|
||||
child: Padding(
|
||||
padding: widget.padding,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
RecipientStatusDot(status: recipient.status),
|
||||
SizedBox(width: widget.spacingDotAvatar),
|
||||
RecipientAvatar(
|
||||
name: recipient.name,
|
||||
avatarUrl: recipient.avatarUrl,
|
||||
isVisible: false,
|
||||
avatarRadius: widget.avatarRadius,
|
||||
),
|
||||
SizedBox(width: widget.spacingAvatarInfo),
|
||||
Expanded(
|
||||
child: RecipientInfoColumn(
|
||||
name: recipient.name,
|
||||
email: recipient.email,
|
||||
),
|
||||
),
|
||||
if (_isHovered)
|
||||
RecipientActions(
|
||||
onEdit: widget.onEdit, onDelete: widget.onDelete),
|
||||
],
|
||||
),
|
||||
SizedBox(height: widget.spacingBottom),
|
||||
RecipientPaymentRow(recipient: recipient),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pweb/pages/address_book/page/recipient/info_row.dart';
|
||||
|
||||
|
||||
class RecipientPaymentRow extends StatelessWidget {
|
||||
final Recipient recipient;
|
||||
final double spacing;
|
||||
|
||||
const RecipientPaymentRow({
|
||||
super.key,
|
||||
required this.recipient,
|
||||
this.spacing = 18
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
spacing: spacing,
|
||||
children: [
|
||||
if (recipient.bank?.accountNumber.isNotEmpty ?? false)
|
||||
RecipientAddressBookInfoRow(
|
||||
type: PaymentType.bankAccount,
|
||||
value: recipient.bank!.accountNumber
|
||||
),
|
||||
if (recipient.card?.pan.isNotEmpty ?? false)
|
||||
RecipientAddressBookInfoRow(
|
||||
type: PaymentType.card,
|
||||
value: recipient.card!.pan
|
||||
),
|
||||
if (recipient.iban?.iban.isNotEmpty ?? false)
|
||||
RecipientAddressBookInfoRow(
|
||||
type: PaymentType.iban,
|
||||
value: recipient.iban!.iban
|
||||
),
|
||||
if (recipient.wallet?.walletId.isNotEmpty ?? false)
|
||||
RecipientAddressBookInfoRow(
|
||||
type: PaymentType.wallet,
|
||||
value: recipient.wallet!.walletId
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/recipient/status.dart';
|
||||
|
||||
|
||||
class RecipientStatusDot extends StatelessWidget {
|
||||
final RecipientStatus status;
|
||||
|
||||
const RecipientStatusDot({super.key, required this.status});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Color color;
|
||||
switch (status) {
|
||||
case RecipientStatus.ready:
|
||||
color = Colors.green;
|
||||
break;
|
||||
case RecipientStatus.notRegistered:
|
||||
color = Theme.of(context).colorScheme.error;
|
||||
break;
|
||||
case RecipientStatus.registered:
|
||||
color = Colors.yellow;
|
||||
break;
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: BoxDecoration(shape: BoxShape.circle, color: color),
|
||||
);
|
||||
}
|
||||
}
|
||||
44
frontend/pweb/lib/pages/address_book/page/search.dart
Normal file
44
frontend/pweb/lib/pages/address_book/page/search.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class RecipientSearchField extends StatelessWidget {
|
||||
final TextEditingController controller;
|
||||
final ValueChanged<String> onChanged;
|
||||
final FocusNode? focusNode;
|
||||
|
||||
const RecipientSearchField({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.onChanged,
|
||||
this.focusNode,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
return TextField(
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.search),
|
||||
hintText: l10n.searchHint,
|
||||
border: const OutlineInputBorder(),
|
||||
fillColor: Theme.of(context).colorScheme.onSecondary,
|
||||
filled: true,
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.clear),
|
||||
onPressed: () {
|
||||
controller.clear();
|
||||
onChanged('');
|
||||
focusNode?.unfocus();
|
||||
},
|
||||
),
|
||||
),
|
||||
onChanged: onChanged,
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class BalanceAddFunds extends StatelessWidget {
|
||||
final VoidCallback onTopUp;
|
||||
|
||||
const BalanceAddFunds({
|
||||
super.key,
|
||||
required this.onTopUp,
|
||||
});
|
||||
|
||||
static const double _borderRadius = 5.0;
|
||||
static const double _iconSize = 24.0;
|
||||
static const double _paddingVertical = 2.0;
|
||||
static const double _spacingSmall = 3.0;
|
||||
static const double _spacingMedium = 5.0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return InkWell(
|
||||
onTap: onTopUp,
|
||||
borderRadius: BorderRadius.circular(_borderRadius),
|
||||
hoverColor: colorScheme.primaryContainer,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: _paddingVertical),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const SizedBox(width: _spacingSmall),
|
||||
Icon(
|
||||
Icons.add_circle,
|
||||
color: colorScheme.primary,
|
||||
size: _iconSize,
|
||||
),
|
||||
const SizedBox(width: _spacingMedium),
|
||||
Text(
|
||||
'Add funds',
|
||||
style: textTheme.bodyMedium?.copyWith(
|
||||
color: colorScheme.primary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: _spacingSmall),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
import 'package:pweb/utils/currency.dart';
|
||||
|
||||
|
||||
class BalanceAmount extends StatelessWidget {
|
||||
final Wallet wallet;
|
||||
final VoidCallback onToggleVisibility;
|
||||
|
||||
const BalanceAmount({
|
||||
super.key,
|
||||
required this.wallet,
|
||||
required this.onToggleVisibility,
|
||||
});
|
||||
|
||||
static const double _iconSpacing = 12.0;
|
||||
static const double _iconSize = 24.0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final currencyBalance = currencyCodeToSymbol(wallet.currency);
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
wallet.isHidden ? '•••• $currencyBalance' : '${wallet.balance.toStringAsFixed(2)} $currencyBalance',
|
||||
style: textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: _iconSpacing),
|
||||
GestureDetector(
|
||||
onTap: onToggleVisibility,
|
||||
child: Icon(
|
||||
wallet.isHidden ? Icons.visibility_off : Icons.visibility,
|
||||
size: _iconSize,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/carousel.dart';
|
||||
import 'package:pweb/providers/wallets.dart';
|
||||
|
||||
|
||||
class BalanceWidget extends StatelessWidget {
|
||||
const BalanceWidget({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final walletsProvider = context.watch<WalletsProvider>();
|
||||
|
||||
if (walletsProvider.isLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
final wallets = walletsProvider.wallets;
|
||||
|
||||
if (wallets == null || wallets.isEmpty) {
|
||||
return const Center(child: Text('No wallets available'));
|
||||
}
|
||||
|
||||
return
|
||||
WalletCarousel(
|
||||
wallets: wallets,
|
||||
onWalletChanged: walletsProvider.selectWallet,
|
||||
);
|
||||
}
|
||||
}
|
||||
54
frontend/pweb/lib/pages/dashboard/buttons/balance/card.dart
Normal file
54
frontend/pweb/lib/pages/dashboard/buttons/balance/card.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/add_funds.dart';
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/amount.dart';
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/config.dart';
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/header.dart';
|
||||
import 'package:pweb/providers/wallets.dart';
|
||||
|
||||
|
||||
class WalletCard extends StatelessWidget {
|
||||
final Wallet wallet;
|
||||
|
||||
const WalletCard({
|
||||
super.key,
|
||||
required this.wallet,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
color: Theme.of(context).colorScheme.onSecondary,
|
||||
elevation: WalletCardConfig.elevation,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(WalletCardConfig.borderRadius),
|
||||
),
|
||||
child: Padding(
|
||||
padding: WalletCardConfig.contentPadding,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
BalanceHeader(
|
||||
walletName: wallet.name,
|
||||
walletId: wallet.walletUserID,
|
||||
),
|
||||
BalanceAmount(
|
||||
wallet: wallet,
|
||||
onToggleVisibility: () {
|
||||
context.read<WalletsProvider>().toggleVisibility(wallet.id);
|
||||
},
|
||||
),
|
||||
BalanceAddFunds(
|
||||
onTopUp: () {
|
||||
// TODO: Implement top-up functionality
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
113
frontend/pweb/lib/pages/dashboard/buttons/balance/carousel.dart
Normal file
113
frontend/pweb/lib/pages/dashboard/buttons/balance/carousel.dart
Normal file
@@ -0,0 +1,113 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/card.dart';
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/config.dart';
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/indicator.dart';
|
||||
import 'package:pweb/providers/carousel.dart';
|
||||
|
||||
|
||||
class WalletCarousel extends StatefulWidget {
|
||||
final List<Wallet> wallets;
|
||||
final ValueChanged<Wallet> onWalletChanged;
|
||||
|
||||
const WalletCarousel({
|
||||
super.key,
|
||||
required this.wallets,
|
||||
required this.onWalletChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
State<WalletCarousel> createState() => _WalletCarouselState();
|
||||
}
|
||||
|
||||
class _WalletCarouselState extends State<WalletCarousel> {
|
||||
late final PageController _pageController;
|
||||
int _currentPage = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_pageController = PageController(
|
||||
viewportFraction: WalletCardConfig.viewportFraction,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_pageController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onPageChanged(int index) {
|
||||
setState(() {
|
||||
_currentPage = index;
|
||||
});
|
||||
context.read<CarouselIndexProvider>().updateIndex(index);
|
||||
widget.onWalletChanged(widget.wallets[index]);
|
||||
}
|
||||
|
||||
void _goToPreviousPage() {
|
||||
if (_currentPage > 0) {
|
||||
_pageController.animateToPage(
|
||||
_currentPage - 1,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _goToNextPage() {
|
||||
if (_currentPage < widget.wallets.length - 1) {
|
||||
_pageController.animateToPage(
|
||||
_currentPage + 1,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: WalletCardConfig.cardHeight,
|
||||
child: PageView.builder(
|
||||
controller: _pageController,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: widget.wallets.length,
|
||||
onPageChanged: _onPageChanged,
|
||||
itemBuilder: (context, index) {
|
||||
return Padding(
|
||||
padding: WalletCardConfig.cardPadding,
|
||||
child: WalletCard(wallet: widget.wallets[index]),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: _currentPage > 0 ? _goToPreviousPage : null,
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
CarouselIndicator(itemCount: widget.wallets.length),
|
||||
const SizedBox(width: 16),
|
||||
IconButton(
|
||||
onPressed: _currentPage < widget.wallets.length - 1
|
||||
? _goToNextPage
|
||||
: null,
|
||||
icon: const Icon(Icons.arrow_forward),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
abstract class WalletCardConfig {
|
||||
static const double cardHeight = 130.0;
|
||||
static const double elevation = 4.0;
|
||||
static const double borderRadius = 16.0;
|
||||
static const double viewportFraction = 0.9;
|
||||
|
||||
static const EdgeInsets cardPadding = EdgeInsets.symmetric(horizontal: 8);
|
||||
static const EdgeInsets contentPadding = EdgeInsets.all(16);
|
||||
|
||||
static const double dotSize = 8.0;
|
||||
static const EdgeInsets dotMargin = EdgeInsets.symmetric(horizontal: 4);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class BalanceHeader extends StatelessWidget {
|
||||
final String walletName;
|
||||
final String walletId;
|
||||
|
||||
const BalanceHeader({
|
||||
super.key,
|
||||
required this.walletName,
|
||||
required this.walletId,
|
||||
});
|
||||
|
||||
static const double _spacing = 8.0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
walletName,
|
||||
style: textTheme.titleMedium?.copyWith(
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: _spacing),
|
||||
Text(
|
||||
walletId,
|
||||
style: textTheme.bodySmall?.copyWith(
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/config.dart';
|
||||
|
||||
import 'package:pweb/providers/carousel.dart';
|
||||
|
||||
|
||||
class CarouselIndicator extends StatelessWidget {
|
||||
final int itemCount;
|
||||
|
||||
const CarouselIndicator({
|
||||
super.key,
|
||||
required this.itemCount,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final currentIndex = context.watch<CarouselIndexProvider>().currentIndex;
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: List.generate(
|
||||
itemCount,
|
||||
(index) => _Dot(isActive: currentIndex == index),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Dot extends StatelessWidget {
|
||||
final bool isActive;
|
||||
|
||||
const _Dot({required this.isActive});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: WalletCardConfig.dotSize,
|
||||
height: WalletCardConfig.dotSize,
|
||||
margin: WalletCardConfig.dotMargin,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: isActive
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.primary.withAlpha(60),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
68
frontend/pweb/lib/pages/dashboard/buttons/buttons.dart
Normal file
68
frontend/pweb/lib/pages/dashboard/buttons/buttons.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class TransactionRefButton extends StatelessWidget {
|
||||
final VoidCallback onTap;
|
||||
final bool isActive;
|
||||
final String label;
|
||||
final IconData icon;
|
||||
|
||||
const TransactionRefButton({
|
||||
super.key,
|
||||
required this.onTap,
|
||||
required this.isActive,
|
||||
required this.label,
|
||||
required this.icon,
|
||||
});
|
||||
|
||||
static const double _horizontalPadding = 10.0;
|
||||
static const double _verticalPadding = 5.0;
|
||||
static const double _iconSize = 24.0;
|
||||
static const double _spacing = 10.0;
|
||||
static const double _borderRadius = 12.0;
|
||||
static const FontWeight _fontWeight = FontWeight.w400;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context).colorScheme;
|
||||
|
||||
final backgroundColor = isActive ? theme.primary : theme.onSecondary;
|
||||
final foregroundColor = isActive ? theme.onPrimary : theme.onPrimaryContainer;
|
||||
final hoverColor = isActive ? theme.primary : theme.secondaryContainer;
|
||||
|
||||
return Material(
|
||||
color: backgroundColor,
|
||||
elevation: 4,
|
||||
borderRadius: BorderRadius.circular(_borderRadius),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(_borderRadius),
|
||||
hoverColor: hoverColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: _horizontalPadding,
|
||||
vertical: _verticalPadding,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: Theme.of(context).textTheme.titleSmall?.copyWith(
|
||||
fontWeight: _fontWeight,
|
||||
color: foregroundColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: _spacing),
|
||||
Icon(
|
||||
icon,
|
||||
color: foregroundColor,
|
||||
size: _iconSize,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
92
frontend/pweb/lib/pages/dashboard/dashboard.dart
Normal file
92
frontend/pweb/lib/pages/dashboard/dashboard.dart
Normal file
@@ -0,0 +1,92 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/balance.dart';
|
||||
import 'package:pweb/pages/dashboard/buttons/buttons.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/multiple/title.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/multiple/widget.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/widget.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class AppSpacing {
|
||||
static const double small = 10;
|
||||
static const double medium = 16;
|
||||
static const double large = 20;
|
||||
}
|
||||
|
||||
class DashboardPage extends StatefulWidget {
|
||||
final ValueChanged<Recipient> onRecipientSelected;
|
||||
final void Function(PaymentType type) onGoToPaymentWithoutRecipient;
|
||||
|
||||
const DashboardPage({
|
||||
super.key,
|
||||
required this.onRecipientSelected,
|
||||
required this.onGoToPaymentWithoutRecipient,
|
||||
});
|
||||
|
||||
@override
|
||||
State<DashboardPage> createState() => _DashboardPageState();
|
||||
}
|
||||
|
||||
class _DashboardPageState extends State<DashboardPage> {
|
||||
bool _showContainerSingle = true;
|
||||
bool _showContainerMultiple = false;
|
||||
|
||||
void _setActive(bool single) {
|
||||
setState(() {
|
||||
_showContainerSingle = single;
|
||||
_showContainerMultiple = !single;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 0,
|
||||
child: TransactionRefButton(
|
||||
onTap: () => _setActive(true),
|
||||
isActive: _showContainerSingle,
|
||||
label: AppLocalizations.of(context)!.sendSingle,
|
||||
icon: Icons.person_add,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
Expanded(
|
||||
flex: 0,
|
||||
child: TransactionRefButton(
|
||||
onTap: () => _setActive(false),
|
||||
isActive: _showContainerMultiple,
|
||||
label: AppLocalizations.of(context)!.sendMultiple,
|
||||
icon: Icons.group_add,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: AppSpacing.medium),
|
||||
BalanceWidget(),
|
||||
const SizedBox(height: AppSpacing.small),
|
||||
if (_showContainerMultiple) TitleMultiplePayout(),
|
||||
const SizedBox(height: AppSpacing.medium),
|
||||
if (_showContainerSingle)
|
||||
SinglePayoutForm(
|
||||
onRecipientSelected: widget.onRecipientSelected,
|
||||
onGoToPayment: widget.onGoToPaymentWithoutRecipient,
|
||||
),
|
||||
if (_showContainerMultiple) MultiplePayoutForm(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
12
frontend/pweb/lib/pages/dashboard/organization/button.dart
Normal file
12
frontend/pweb/lib/pages/dashboard/organization/button.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class OrganizationButton extends StatelessWidget {
|
||||
const OrganizationButton({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => IconButton(
|
||||
icon: Icon(Icons.person),
|
||||
onPressed: null,
|
||||
);
|
||||
}
|
||||
70
frontend/pweb/lib/pages/dashboard/payouts/multiple/csv.dart
Normal file
70
frontend/pweb/lib/pages/dashboard/payouts/multiple/csv.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class UploadCSVSection extends StatelessWidget {
|
||||
const UploadCSVSection({super.key});
|
||||
|
||||
static const double _verticalSpacing = 10;
|
||||
static const double _iconTextSpacing = 5;
|
||||
static const double _buttonVerticalPadding = 12;
|
||||
static const double _buttonHorizontalPadding = 24;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.upload),
|
||||
const SizedBox(width: _iconTextSpacing),
|
||||
Text(
|
||||
l10n.uploadCSV,
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: _verticalSpacing),
|
||||
Container(
|
||||
height: 140,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: theme.colorScheme.outline),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.upload_file, size: 36, color: theme.colorScheme.primary),
|
||||
const SizedBox(height: 8),
|
||||
ElevatedButton(
|
||||
onPressed: () {},
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: _buttonHorizontalPadding,
|
||||
vertical: _buttonVerticalPadding,
|
||||
),
|
||||
),
|
||||
child: Text(l10n.upload),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
l10n.hintUpload,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
13
frontend/pweb/lib/pages/dashboard/payouts/multiple/form.dart
Normal file
13
frontend/pweb/lib/pages/dashboard/payouts/multiple/form.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
class MultiplePayoutRow {
|
||||
final String token;
|
||||
final String amount;
|
||||
final String currency;
|
||||
final String comment;
|
||||
|
||||
const MultiplePayoutRow({
|
||||
required this.token,
|
||||
required this.amount,
|
||||
required this.currency,
|
||||
required this.comment,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
import 'package:pweb/providers/upload_history.dart';
|
||||
|
||||
|
||||
class UploadHistorySection extends StatelessWidget {
|
||||
const UploadHistorySection({super.key});
|
||||
|
||||
static const double _smallBox = 5;
|
||||
static const double _radius = 6;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.watch<UploadHistoryProvider>();
|
||||
final theme = Theme.of(context);
|
||||
final l10 = AppLocalizations.of(context)!;
|
||||
|
||||
|
||||
if (provider.isLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (provider.error != null) {
|
||||
return Text("Error: ${provider.error}");
|
||||
}
|
||||
final items = provider.data ?? [];
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.history),
|
||||
const SizedBox(width: _smallBox),
|
||||
Text(l10.uploadHistory, style: theme.textTheme.bodyLarge),
|
||||
],
|
||||
),
|
||||
DataTable(
|
||||
columns: [
|
||||
DataColumn(label: Text(l10.fileNameColumn)),
|
||||
DataColumn(label: Text(l10.colStatus)),
|
||||
DataColumn(label: Text(l10.dateColumn)),
|
||||
DataColumn(label: Text(l10.details)),
|
||||
],
|
||||
rows: items.map((file) {
|
||||
final isError = file.status == "Error";
|
||||
final statusColor = isError ? Colors.red : Colors.green;
|
||||
return DataRow(
|
||||
cells: [
|
||||
DataCell(Text(file.name)),
|
||||
DataCell(Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: statusColor.withAlpha(20),
|
||||
borderRadius: BorderRadius.circular(_radius),
|
||||
),
|
||||
child: Text(file.status, style: TextStyle(color: statusColor)),
|
||||
)),
|
||||
DataCell(Text(file.time)),
|
||||
DataCell(TextButton(onPressed: () {}, child: Text(l10.showDetails))),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/multiple/form.dart';
|
||||
|
||||
|
||||
class FileFormatSampleSection extends StatelessWidget {
|
||||
const FileFormatSampleSection({super.key});
|
||||
|
||||
static final List<MultiplePayoutRow> sampleRows = [
|
||||
MultiplePayoutRow(token: "d921...161", amount: "500", currency: "RUB", comment: "cashback001"),
|
||||
MultiplePayoutRow(token: "d921...162", amount: "100", currency: "USD", comment: "cashback002"),
|
||||
MultiplePayoutRow(token: "d921...163", amount: "120", currency: "EUR", comment: "cashback003"),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
final titleStyle = theme.textTheme.bodyLarge?.copyWith(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
);
|
||||
|
||||
final linkStyle = theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.filter_list),
|
||||
const SizedBox(width: 5),
|
||||
Text(l10n.exampleTitle, style: titleStyle),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildDataTable(l10n),
|
||||
const SizedBox(height: 10),
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
style: TextButton.styleFrom(padding: EdgeInsets.zero),
|
||||
child: Text(l10n.downloadSampleCSV, style: linkStyle),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDataTable(AppLocalizations l10n) {
|
||||
return DataTable(
|
||||
columnSpacing: 20,
|
||||
columns: [
|
||||
DataColumn(label: Text(l10n.tokenColumn)),
|
||||
DataColumn(label: Text(l10n.amount)),
|
||||
DataColumn(label: Text(l10n.currency)),
|
||||
DataColumn(label: Text(l10n.comment)),
|
||||
],
|
||||
rows: sampleRows.map((row) {
|
||||
return DataRow(cells: [
|
||||
DataCell(Text(row.token)),
|
||||
DataCell(Text(row.amount)),
|
||||
DataCell(Text(row.currency)),
|
||||
DataCell(Text(row.comment)),
|
||||
]);
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class TitleMultiplePayout extends StatelessWidget {
|
||||
const TitleMultiplePayout({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.multiplePayout,
|
||||
style: theme.textTheme.titleLarge,
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.howItWorks,
|
||||
style: theme.textTheme.bodyLarge!.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/pages/dashboard/payouts/multiple/csv.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/multiple/history.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/multiple/sample.dart';
|
||||
|
||||
|
||||
class MultiplePayoutForm extends StatelessWidget {
|
||||
const MultiplePayoutForm({super.key});
|
||||
|
||||
static const double _spacing = 12;
|
||||
static const double _bottomSpacing = 40;
|
||||
|
||||
static final List<Widget> _cards = const [
|
||||
FileFormatSampleSection(),
|
||||
UploadCSVSection(),
|
||||
UploadHistorySection(),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
for (int i = 0; i < _cards.length; i++) ...[
|
||||
_StyledCard(child: _cards[i]),
|
||||
if (i < _cards.length - 1) const SizedBox(height: _spacing),
|
||||
],
|
||||
const SizedBox(height: _bottomSpacing),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _StyledCard extends StatelessWidget {
|
||||
final Widget child;
|
||||
const _StyledCard({required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Card(
|
||||
margin: const EdgeInsets.all(1),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
elevation: 4,
|
||||
color: theme.colorScheme.onSecondary,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
92
frontend/pweb/lib/pages/dashboard/payouts/payment_form.dart
Normal file
92
frontend/pweb/lib/pages/dashboard/payouts/payment_form.dart
Normal file
@@ -0,0 +1,92 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pweb/providers/mock_payment.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class PaymentFormWidget extends StatelessWidget {
|
||||
const PaymentFormWidget({super.key});
|
||||
|
||||
static const double _smallSpacing = 5;
|
||||
static const double _mediumSpacing = 10;
|
||||
static const double _largeSpacing = 16;
|
||||
static const double _extraSpacing = 15;
|
||||
|
||||
String _formatAmount(double amount) => amount.toStringAsFixed(2);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = Provider.of<MockPaymentProvider>(context);
|
||||
final theme = Theme.of(context);
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(loc.details, style: theme.textTheme.titleMedium),
|
||||
const SizedBox(height: _smallSpacing),
|
||||
|
||||
TextField(
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
decoration: InputDecoration(
|
||||
labelText: loc.amount,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
onChanged: (val) {
|
||||
final parsed = double.tryParse(val.replaceAll(',', '.')) ?? 0.0;
|
||||
provider.setAmount(parsed);
|
||||
},
|
||||
),
|
||||
|
||||
const SizedBox(height: _mediumSpacing),
|
||||
|
||||
Row(
|
||||
spacing: _mediumSpacing,
|
||||
children: [
|
||||
Text(loc.recipientPaysFee, style: theme.textTheme.titleMedium),
|
||||
Switch(
|
||||
value: !provider.payerCoversFee,
|
||||
onChanged: (val) => provider.setPayerCoversFee(!val),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: _largeSpacing),
|
||||
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_SummaryRow(label: loc.sentAmount(_formatAmount(provider.amount)), style: theme.textTheme.titleMedium),
|
||||
_SummaryRow(label: loc.fee(_formatAmount(provider.fee)), style: theme.textTheme.titleMedium),
|
||||
_SummaryRow(label: loc.recipientWillReceive(_formatAmount(provider.recipientGets)), style: theme.textTheme.titleMedium),
|
||||
|
||||
const SizedBox(height: _extraSpacing),
|
||||
|
||||
_SummaryRow(
|
||||
label: loc.total(_formatAmount(provider.total)),
|
||||
style: theme.textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SummaryRow extends StatelessWidget {
|
||||
final String label;
|
||||
final TextStyle? style;
|
||||
|
||||
const _SummaryRow({required this.label, this.style});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Text(label, style: style);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/utils/initials.dart';
|
||||
|
||||
|
||||
class RecipientAvatar extends StatelessWidget {
|
||||
final String name;
|
||||
final String? avatarUrl;
|
||||
final double avatarRadius;
|
||||
final TextStyle? nameStyle;
|
||||
final bool isVisible;
|
||||
|
||||
static const double _verticalSpacing = 5;
|
||||
|
||||
const RecipientAvatar({
|
||||
super.key,
|
||||
required this.name,
|
||||
this.avatarUrl,
|
||||
required this.avatarRadius,
|
||||
this.nameStyle,
|
||||
required this.isVisible,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final textColor = Theme.of(context).colorScheme.onPrimary;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: avatarRadius,
|
||||
backgroundImage: avatarUrl != null ? NetworkImage(avatarUrl!) : null,
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
child: avatarUrl == null
|
||||
? Text(
|
||||
getInitials(name),
|
||||
style: TextStyle(
|
||||
color: textColor,
|
||||
fontSize: avatarRadius * 0.8,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: _verticalSpacing),
|
||||
if (isVisible)
|
||||
Text(
|
||||
name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: nameStyle ?? Theme.of(context).textTheme.bodyMedium?.copyWith(fontSize: 14),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PaymentInfoRow extends StatelessWidget {
|
||||
final String label;
|
||||
final String value;
|
||||
|
||||
const PaymentInfoRow({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.value,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(label, style: Theme.of(context).textTheme.bodySmall),
|
||||
const SizedBox(width: 8),
|
||||
Text(value, style: Theme.of(context).textTheme.bodySmall),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/avatar.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/long_list/info_row.dart';
|
||||
import 'package:pweb/utils/payment/label.dart';
|
||||
|
||||
|
||||
class RecipientItem extends StatelessWidget {
|
||||
final Recipient recipient;
|
||||
final VoidCallback onTap;
|
||||
|
||||
static const double _horizontalPadding = 16.0;
|
||||
static const double _verticalPadding = 8.0;
|
||||
static const double _avatarRadius = 20;
|
||||
static const double _spacingWidth = 12;
|
||||
|
||||
const RecipientItem({
|
||||
super.key,
|
||||
required this.recipient,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: _horizontalPadding,
|
||||
vertical: _verticalPadding,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: RecipientAvatar(
|
||||
isVisible: false,
|
||||
name: recipient.name,
|
||||
avatarUrl: recipient.avatarUrl,
|
||||
avatarRadius: _avatarRadius,
|
||||
nameStyle: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
title: Text(recipient.name),
|
||||
subtitle: Text(recipient.email),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: _spacingWidth),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
if (recipient.bank?.accountNumber.isNotEmpty == true)
|
||||
PaymentInfoRow(
|
||||
label: getPaymentTypeLabel(context, PaymentType.bankAccount),
|
||||
value: recipient.bank!.accountNumber,
|
||||
),
|
||||
if (recipient.card?.pan.isNotEmpty == true)
|
||||
PaymentInfoRow(
|
||||
label: getPaymentTypeLabel(context, PaymentType.card),
|
||||
value: recipient.card!.pan,
|
||||
),
|
||||
if (recipient.iban?.iban.isNotEmpty == true)
|
||||
PaymentInfoRow(
|
||||
label: getPaymentTypeLabel(context, PaymentType.iban),
|
||||
value: recipient.iban!.iban,
|
||||
),
|
||||
if (recipient.wallet?.walletId.isNotEmpty == true)
|
||||
PaymentInfoRow(
|
||||
label: getPaymentTypeLabel(context, PaymentType.wallet),
|
||||
value: recipient.wallet!.walletId,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/long_list/item.dart';
|
||||
|
||||
|
||||
class LongListAdressBookPayout extends StatelessWidget {
|
||||
final List<Recipient> filteredRecipients;
|
||||
final ValueChanged<Recipient>? onSelected;
|
||||
|
||||
const LongListAdressBookPayout({
|
||||
super.key,
|
||||
required this.filteredRecipients,
|
||||
this.onSelected,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
itemCount: filteredRecipients.length,
|
||||
itemBuilder: (context, index) {
|
||||
final recipient = filteredRecipients[index];
|
||||
return RecipientItem(
|
||||
recipient: recipient,
|
||||
onTap: () => onSelected!(recipient),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/avatar.dart';
|
||||
|
||||
|
||||
class ShortListAdressBookPayout extends StatelessWidget {
|
||||
final List<Recipient> recipients;
|
||||
final ValueChanged<Recipient> onSelected;
|
||||
|
||||
const ShortListAdressBookPayout({
|
||||
super.key,
|
||||
required this.recipients,
|
||||
required this.onSelected,
|
||||
});
|
||||
|
||||
static const double _avatarRadius = 20;
|
||||
static const double _avatarSize = 80;
|
||||
static const EdgeInsets _padding = EdgeInsets.symmetric(horizontal: 10, vertical: 8);
|
||||
static const TextStyle _nameStyle = TextStyle(fontSize: 12);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: recipients.map((recipient) {
|
||||
return Padding(
|
||||
padding: _padding,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
hoverColor: Theme.of(context).colorScheme.primaryContainer,
|
||||
onTap: () => onSelected(recipient),
|
||||
child: SizedBox(
|
||||
height: _avatarSize,
|
||||
width: _avatarSize,
|
||||
child: RecipientAvatar(
|
||||
isVisible: true,
|
||||
name: recipient.name,
|
||||
avatarUrl: recipient.avatarUrl,
|
||||
avatarRadius: _avatarRadius,
|
||||
nameStyle: _nameStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pweb/pages/address_book/page/search.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/long_list/long_list.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/short_list.dart';
|
||||
import 'package:pweb/providers/recipient.dart';
|
||||
|
||||
|
||||
class AdressBookPayout extends StatefulWidget {
|
||||
final ValueChanged<Recipient> onSelected;
|
||||
|
||||
const AdressBookPayout({
|
||||
super.key,
|
||||
required this.onSelected,
|
||||
});
|
||||
|
||||
@override
|
||||
State<AdressBookPayout> createState() => _AdressBookPayoutState();
|
||||
}
|
||||
|
||||
class _AdressBookPayoutState extends State<AdressBookPayout> {
|
||||
static const double _expandedHeight = 400;
|
||||
static const double _collapsedHeight = 200;
|
||||
static const double _cardMargin = 1;
|
||||
static const double _paddingAll = 16;
|
||||
static const double _spacingBetween = 16;
|
||||
|
||||
final FocusNode _searchFocusNode = FocusNode();
|
||||
late final TextEditingController _searchController;
|
||||
|
||||
bool get _isExpanded => _searchFocusNode.hasFocus;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final provider = context.read<RecipientProvider>();
|
||||
_searchController = TextEditingController(text: provider.query);
|
||||
|
||||
_searchController.addListener(() {
|
||||
provider.setQuery(_searchController.text);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_searchController.dispose();
|
||||
_searchFocusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.watch<RecipientProvider>();
|
||||
|
||||
if (provider.isLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (provider.error != null) {
|
||||
return Center(child: Text('Error: ${provider.error}'));
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
height: _isExpanded ? _expandedHeight : _collapsedHeight,
|
||||
child: Card(
|
||||
margin: const EdgeInsets.all(_cardMargin),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
elevation: 4,
|
||||
color: Theme.of(context).colorScheme.onSecondary,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(_paddingAll),
|
||||
child: Column(
|
||||
children: [
|
||||
RecipientSearchField(
|
||||
controller: _searchController,
|
||||
focusNode: _searchFocusNode,
|
||||
onChanged: (_) {},
|
||||
),
|
||||
const SizedBox(height: _spacingBetween),
|
||||
Expanded(
|
||||
child: _isExpanded
|
||||
? LongListAdressBookPayout(
|
||||
filteredRecipients: provider.filteredRecipients,
|
||||
onSelected: widget.onSelected,
|
||||
)
|
||||
: ShortListAdressBookPayout(
|
||||
recipients: provider.recipients,
|
||||
onSelected: widget.onSelected,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_methods/form.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class PaymentDetailsSection extends StatelessWidget {
|
||||
final bool isFormVisible;
|
||||
final bool isEditable;
|
||||
final VoidCallback? onToggle;
|
||||
final PaymentType? selectedType;
|
||||
final Object? data;
|
||||
|
||||
const PaymentDetailsSection({
|
||||
super.key,
|
||||
required this.isFormVisible,
|
||||
this.onToggle,
|
||||
required this.selectedType,
|
||||
required this.data,
|
||||
required this.isEditable,
|
||||
});
|
||||
|
||||
static const double toggleSpacing = 8.0;
|
||||
static const double formVisibleSpacing = 30.0;
|
||||
static const double formHiddenSpacing = 20.0;
|
||||
static const Duration animationDuration = Duration(milliseconds: 200);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
|
||||
final toggleIcon = isFormVisible ? Icons.expand_less : Icons.expand_more;
|
||||
final toggleText = isFormVisible ? loc.hideDetails : loc.showDetails;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
if (!isEditable && onToggle != null)
|
||||
TextButton.icon(
|
||||
onPressed: onToggle,
|
||||
icon: Icon(toggleIcon, color: theme.colorScheme.primary),
|
||||
label: Text(
|
||||
toggleText,
|
||||
style: TextStyle(color: theme.colorScheme.primary),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: toggleSpacing),
|
||||
AnimatedCrossFade(
|
||||
duration: animationDuration,
|
||||
crossFadeState: isFormVisible
|
||||
? CrossFadeState.showFirst
|
||||
: CrossFadeState.showSecond,
|
||||
firstChild: PaymentMethodForm(
|
||||
key: const ValueKey('formVisible'),
|
||||
isEditable: isEditable,
|
||||
selectedType: selectedType,
|
||||
onChanged: (_) {},
|
||||
initialData: data,
|
||||
),
|
||||
secondChild: const SizedBox.shrink(key: ValueKey('formHidden')),
|
||||
),
|
||||
SizedBox(height: isFormVisible ? formVisibleSpacing : formHiddenSpacing),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/avatar.dart';
|
||||
|
||||
|
||||
class RecipientHeader extends StatelessWidget{
|
||||
final Recipient recipient;
|
||||
|
||||
const RecipientHeader({super.key, required this.recipient});
|
||||
|
||||
final double _avatarRadius = 20;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: RecipientAvatar(
|
||||
isVisible: false,
|
||||
name: recipient.name,
|
||||
avatarUrl: recipient.avatarUrl,
|
||||
avatarRadius: _avatarRadius,
|
||||
nameStyle: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
title: Text(recipient.name, style: theme.textTheme.titleLarge),
|
||||
subtitle: Text(recipient.email, style: theme.textTheme.bodyLarge),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
import 'package:pweb/pages/dashboard/payouts/single/new_recipient/type.dart';
|
||||
|
||||
|
||||
class SinglePayout extends StatelessWidget {
|
||||
final void Function(PaymentType type) onGoToPayment;
|
||||
|
||||
static const double _cardPadding = 30.0;
|
||||
static const double _dividerPaddingVertical = 12.0;
|
||||
static const double _cardBorderRadius = 12.0;
|
||||
static const double _dividerThickness = 1.0;
|
||||
|
||||
const SinglePayout({super.key, required this.onGoToPayment});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final paymentTypes = PaymentType.values;
|
||||
final dividerColor = Theme.of(context).dividerColor;
|
||||
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Card(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(_cardBorderRadius),
|
||||
),
|
||||
elevation: 4,
|
||||
color: Theme.of(context).colorScheme.onSecondary,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(_cardPadding),
|
||||
child: Column(
|
||||
children: [
|
||||
for (int i = 0; i < paymentTypes.length; i++) ...[
|
||||
PaymentTypeTile(
|
||||
type: paymentTypes[i],
|
||||
onSelected: onGoToPayment,
|
||||
),
|
||||
if (i < paymentTypes.length - 1)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: _dividerPaddingVertical),
|
||||
child: Divider(thickness: _dividerThickness, color: dividerColor),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_methods/icon.dart';
|
||||
import 'package:pweb/utils/payment/label.dart';
|
||||
|
||||
|
||||
class PaymentTypeTile extends StatelessWidget {
|
||||
final PaymentType type;
|
||||
final void Function(PaymentType type) onSelected;
|
||||
|
||||
const PaymentTypeTile({
|
||||
super.key,
|
||||
required this.type,
|
||||
required this.onSelected,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final label = getPaymentTypeLabel(context, type);
|
||||
|
||||
return InkWell(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
onTap: () => onSelected(type),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(iconForPaymentType(type), size: 24),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
label,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
35
frontend/pweb/lib/pages/dashboard/payouts/single/widget.dart
Normal file
35
frontend/pweb/lib/pages/dashboard/payouts/single/widget.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/widget.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/new_recipient/payout.dart';
|
||||
|
||||
|
||||
class SinglePayoutForm extends StatelessWidget {
|
||||
final ValueChanged<Recipient> onRecipientSelected;
|
||||
final void Function(PaymentType type) onGoToPayment;
|
||||
|
||||
const SinglePayoutForm({
|
||||
super.key,
|
||||
required this.onRecipientSelected,
|
||||
required this.onGoToPayment,
|
||||
});
|
||||
|
||||
static const double _spacingBetweenAddressAndForm = 20.0;
|
||||
static const double _bottomSpacing = 40.0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
AdressBookPayout(onSelected: onRecipientSelected),
|
||||
const SizedBox(height: _spacingBetweenAddressAndForm),
|
||||
SinglePayout(onGoToPayment: onGoToPayment),
|
||||
const SizedBox(height: _bottomSpacing),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
61
frontend/pweb/lib/pages/errors/error.dart
Normal file
61
frontend/pweb/lib/pages/errors/error.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/app/router/pages.dart';
|
||||
import 'package:pweb/widgets/vspacer.dart';
|
||||
import 'package:pweb/utils/error_handler.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class ErrorPage extends StatelessWidget {
|
||||
final String title;
|
||||
final String errorMessage;
|
||||
final String errorHint;
|
||||
|
||||
const ErrorPage({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.errorMessage,
|
||||
required this.errorHint,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.error_outline, size: 72, color: Theme.of(context).colorScheme.error),
|
||||
const VSpacer(),
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(color: Theme.of(context).colorScheme.error),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const VSpacer(multiplier: 0.5),
|
||||
ListTile(
|
||||
title: Text(errorMessage, textAlign: TextAlign.center, style: Theme.of(context).textTheme.titleLarge),
|
||||
subtitle: Text(errorHint, textAlign: TextAlign.center, style: Theme.of(context).textTheme.bodySmall),
|
||||
),
|
||||
const VSpacer(multiplier: 1.5),
|
||||
TextButton(
|
||||
onPressed: () => navigate(context, Pages.root),
|
||||
child: Text(AppLocalizations.of(context)!.goToMainPage),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget exceptionToErrorPage({
|
||||
required BuildContext context,
|
||||
required String title,
|
||||
required String errorMessage,
|
||||
required Object exception,
|
||||
}) => ErrorPage(
|
||||
title: title,
|
||||
errorMessage: errorMessage,
|
||||
errorHint: ErrorHandler.handleError(context, exception),
|
||||
);
|
||||
19
frontend/pweb/lib/pages/errors/not_found.dart
Normal file
19
frontend/pweb/lib/pages/errors/not_found.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/pages/errors/error.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class NotFoundPage extends StatelessWidget {
|
||||
const NotFoundPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
body: ErrorPage(
|
||||
title: AppLocalizations.of(context)!.errorPageNotFoundTitle,
|
||||
errorMessage: AppLocalizations.of(context)!.errorPageNotFoundMessage,
|
||||
errorHint: AppLocalizations.of(context)!.errorPageNotFoundHint,
|
||||
),
|
||||
);
|
||||
}
|
||||
19
frontend/pweb/lib/pages/loader.dart
Normal file
19
frontend/pweb/lib/pages/loader.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/pages/loaders/account.dart';
|
||||
import 'package:pweb/pages/loaders/permissions.dart';
|
||||
|
||||
|
||||
class PageViewLoader extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const PageViewLoader({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => AccountLoader(
|
||||
child: PermissionsLoader(
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
38
frontend/pweb/lib/pages/loaders/account.dart
Normal file
38
frontend/pweb/lib/pages/loaders/account.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/provider/account.dart';
|
||||
|
||||
import 'package:pweb/app/router/pages.dart';
|
||||
import 'package:pweb/widgets/error/snackbar.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class AccountLoader extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const AccountLoader({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Consumer<AccountProvider>(builder: (context, provider, _) {
|
||||
if (provider.isLoading) return const Center(child: CircularProgressIndicator());
|
||||
if (provider.error != null) {
|
||||
postNotifyUserOfErrorX(
|
||||
context: context,
|
||||
errorSituation: AppLocalizations.of(context)!.errorLogin,
|
||||
exception: provider.error!,
|
||||
);
|
||||
navigateAndReplace(context, Pages.login);
|
||||
}
|
||||
if ((provider.error == null) && (provider.account == null)) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
provider.restore();
|
||||
});
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
return child;
|
||||
});
|
||||
}
|
||||
|
||||
37
frontend/pweb/lib/pages/loaders/organization.dart
Normal file
37
frontend/pweb/lib/pages/loaders/organization.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/provider/organizations.dart';
|
||||
|
||||
import 'package:pweb/app/router/pages.dart';
|
||||
import 'package:pweb/widgets/error/snackbar.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class OrganizationLoader extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const OrganizationLoader({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Consumer<OrganizationsProvider>(builder: (context, provider, _) {
|
||||
if (provider.isLoading) return const Center(child: CircularProgressIndicator());
|
||||
if (provider.error != null) {
|
||||
postNotifyUserOfErrorX(
|
||||
context: context,
|
||||
errorSituation: AppLocalizations.of(context)!.errorLogin,
|
||||
exception: provider.error!,
|
||||
);
|
||||
navigateAndReplace(context, Pages.login);
|
||||
}
|
||||
if ((provider.error == null) && (!provider.isOrganizationSet)) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
provider.load();
|
||||
});
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
return child;
|
||||
});
|
||||
}
|
||||
37
frontend/pweb/lib/pages/loaders/permissions.dart
Normal file
37
frontend/pweb/lib/pages/loaders/permissions.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/provider/permissions.dart';
|
||||
|
||||
import 'package:pweb/app/router/pages.dart';
|
||||
import 'package:pweb/widgets/error/snackbar.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class PermissionsLoader extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const PermissionsLoader({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Consumer<PermissionsProvider>(builder: (context, provider, _) {
|
||||
if (provider.isLoading) return const Center(child: CircularProgressIndicator());
|
||||
if (provider.error != null) {
|
||||
postNotifyUserOfErrorX(
|
||||
context: context,
|
||||
errorSituation: AppLocalizations.of(context)!.errorLogin,
|
||||
exception: provider.error!,
|
||||
);
|
||||
navigateAndReplace(context, Pages.login);
|
||||
}
|
||||
if ((provider.error == null) && (provider.permissions.isEmpty)) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
provider.load();
|
||||
});
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
return child;
|
||||
});
|
||||
}
|
||||
21
frontend/pweb/lib/pages/login/app_bar.dart
Normal file
21
frontend/pweb/lib/pages/login/app_bar.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/widgets/locale.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class LoginAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const LoginAppBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
actions: const [
|
||||
LocaleChangerDropdown(availableLocales: AppLocalizations.supportedLocales),
|
||||
],
|
||||
);
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||
}
|
||||
28
frontend/pweb/lib/pages/login/buttons.dart
Normal file
28
frontend/pweb/lib/pages/login/buttons.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/pages/login/login.dart';
|
||||
import 'package:pweb/pages/login/signup.dart';
|
||||
import 'package:pweb/widgets/hspacer.dart';
|
||||
|
||||
|
||||
class ButtonsRow extends StatelessWidget {
|
||||
final Future<String?> Function() login;
|
||||
final VoidCallback onSignUp;
|
||||
final bool isEnabled;
|
||||
|
||||
const ButtonsRow({
|
||||
super.key,
|
||||
required this.login,
|
||||
required this.onSignUp,
|
||||
required this.isEnabled,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Row(
|
||||
children: [
|
||||
LoginButton(onPressed: isEnabled ? () => login() : null),
|
||||
SignupButton(onPressed: onSignUp),
|
||||
HSpacer(multiplier: 0.25),
|
||||
],
|
||||
);
|
||||
}
|
||||
106
frontend/pweb/lib/pages/login/form.dart
Normal file
106
frontend/pweb/lib/pages/login/form.dart
Normal file
@@ -0,0 +1,106 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/provider/pfe/provider.dart';
|
||||
|
||||
import 'package:pweb/app/router/pages.dart';
|
||||
import 'package:pweb/pages/login/buttons.dart';
|
||||
import 'package:pweb/pages/login/header.dart';
|
||||
import 'package:pweb/widgets/constrained_form.dart';
|
||||
import 'package:pweb/widgets/password/hint/short.dart';
|
||||
import 'package:pweb/widgets/password/password.dart';
|
||||
import 'package:pweb/widgets/username.dart';
|
||||
import 'package:pweb/widgets/vspacer.dart';
|
||||
import 'package:pweb/widgets/error/snackbar.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class LoginForm extends StatefulWidget {
|
||||
const LoginForm({super.key});
|
||||
|
||||
@override
|
||||
State<LoginForm> createState() => _LoginFormState();
|
||||
}
|
||||
|
||||
class _LoginFormState extends State<LoginForm> {
|
||||
final TextEditingController _usernameController = TextEditingController();
|
||||
final TextEditingController _passwordController = TextEditingController();
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
// ValueNotifiers for validation state
|
||||
final ValueNotifier<bool> _isUsernameAcceptable = ValueNotifier<bool>(false);
|
||||
final ValueNotifier<bool> _isPasswordAcceptable = ValueNotifier<bool>(false);
|
||||
|
||||
Future<String?> _login(BuildContext context, VoidCallback onLogin, void Function(Object e) onError) async {
|
||||
final pfeProvider = Provider.of<PfeProvider>(context, listen: false);
|
||||
|
||||
try {
|
||||
// final account = await pfeProvider.login(
|
||||
// email: _usernameController.text,
|
||||
// password: _passwordController.text,
|
||||
// );
|
||||
onLogin();
|
||||
return 'ok';
|
||||
} catch (e) {
|
||||
onError(pfeProvider.error == null ? e : pfeProvider.error!);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_usernameController.dispose();
|
||||
_passwordController.dispose();
|
||||
_isUsernameAcceptable.dispose();
|
||||
_isPasswordAcceptable.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Align(
|
||||
alignment: Alignment.center,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 400, maxHeight: 300),
|
||||
child: Card(
|
||||
child: ConstrainedForm(
|
||||
formKey: _formKey,
|
||||
children: [
|
||||
const LoginHeader(),
|
||||
const VSpacer(multiplier: 1.5),
|
||||
UsernameField(
|
||||
controller: _usernameController,
|
||||
onValid: (isValid) => _isUsernameAcceptable.value = isValid,
|
||||
),
|
||||
VSpacer(),
|
||||
defaulRulesPasswordField(
|
||||
context,
|
||||
controller: _passwordController,
|
||||
validationRuleBuilder: (rules, value) => shortValidation(context, rules, value),
|
||||
onValid: (isValid) => _isPasswordAcceptable.value = isValid,
|
||||
),
|
||||
VSpacer(multiplier: 2.0),
|
||||
ValueListenableBuilder<bool>(
|
||||
valueListenable: _isUsernameAcceptable,
|
||||
builder: (context, isUsernameValid, child) => ValueListenableBuilder<bool>(
|
||||
valueListenable: _isPasswordAcceptable,
|
||||
builder: (context, isPasswordValid, child) => ButtonsRow(
|
||||
onSignUp: () => navigate(context, Pages.signup),
|
||||
login: () => _login(
|
||||
context,
|
||||
() => navigateAndReplace(context, Pages.sfactor),
|
||||
(e) => postNotifyUserOfErrorX(
|
||||
context: context,
|
||||
errorSituation: AppLocalizations.of(context)!.errorLogin,
|
||||
exception: e,
|
||||
),
|
||||
),
|
||||
isEnabled: isUsernameValid && isPasswordValid,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)));
|
||||
}
|
||||
24
frontend/pweb/lib/pages/login/header.dart
Normal file
24
frontend/pweb/lib/pages/login/header.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pweb/config/constants.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
import 'package:pweb/widgets/hspacer.dart';
|
||||
import 'package:pweb/widgets/logo.dart';
|
||||
|
||||
|
||||
class LoginHeader extends StatelessWidget {
|
||||
const LoginHeader({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Row(
|
||||
children: [
|
||||
const ServiceLogo(size: 36),
|
||||
const HSpacer(multiplier: 0.75),
|
||||
Text(
|
||||
'${AppConfig.appName} ${AppLocalizations.of(context)!.login}',
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
40
frontend/pweb/lib/pages/login/login.dart
Normal file
40
frontend/pweb/lib/pages/login/login.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/provider/account.dart';
|
||||
|
||||
import 'package:pweb/widgets/vspacer.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class LoginButton extends StatelessWidget {
|
||||
final VoidCallback? onPressed;
|
||||
|
||||
const LoginButton({
|
||||
super.key,
|
||||
required this.onPressed,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Consumer<AccountProvider>(builder: (context, provider, _) => ElevatedButton(
|
||||
onPressed: provider.isLoading ? null : onPressed,
|
||||
child:
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (provider.isLoading)
|
||||
...[
|
||||
SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
VSpacer(multiplier: 0.25),
|
||||
],
|
||||
Text(AppLocalizations.of(context)!.login),
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
16
frontend/pweb/lib/pages/login/page.dart
Normal file
16
frontend/pweb/lib/pages/login/page.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/pages/login/app_bar.dart';
|
||||
import 'package:pweb/pages/login/form.dart';
|
||||
import 'package:pweb/pages/with_footer.dart';
|
||||
|
||||
|
||||
class LoginPage extends StatelessWidget {
|
||||
const LoginPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => PageWithFooter(
|
||||
appBar: const LoginAppBar(),
|
||||
child: LoginForm(),
|
||||
);
|
||||
}
|
||||
21
frontend/pweb/lib/pages/login/signup.dart
Normal file
21
frontend/pweb/lib/pages/login/signup.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class SignupButton extends StatelessWidget {
|
||||
final VoidCallback? onPressed;
|
||||
|
||||
const SignupButton({
|
||||
super.key,
|
||||
required this.onPressed,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
onPressed: onPressed,
|
||||
child: Text(AppLocalizations.of(context)!.signup),
|
||||
);
|
||||
}
|
||||
}
|
||||
112
frontend/pweb/lib/pages/payment_methods/add/card.dart
Normal file
112
frontend/pweb/lib/pages/payment_methods/add/card.dart
Normal file
@@ -0,0 +1,112 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_multi_formatter/flutter_multi_formatter.dart';
|
||||
|
||||
import 'package:pshared/models/payment/methods/card.dart';
|
||||
|
||||
import 'package:pweb/utils/text_field_styles.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class CardFormMinimal extends StatefulWidget {
|
||||
final void Function(CardPaymentMethod) onChanged;
|
||||
final CardPaymentMethod? initialData;
|
||||
final bool isEditable;
|
||||
|
||||
const CardFormMinimal({
|
||||
super.key,
|
||||
required this.onChanged,
|
||||
this.initialData,
|
||||
required this.isEditable,
|
||||
});
|
||||
|
||||
@override
|
||||
State<CardFormMinimal> createState() => _CardFormMinimalState();
|
||||
}
|
||||
|
||||
class _CardFormMinimalState extends State<CardFormMinimal> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
late TextEditingController _panController;
|
||||
late TextEditingController _firstNameController;
|
||||
late TextEditingController _lastNameController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_panController = TextEditingController(text: widget.initialData?.pan ?? '');
|
||||
_firstNameController = TextEditingController(text: widget.initialData?.firstName ?? '');
|
||||
_lastNameController = TextEditingController(text: widget.initialData?.lastName ?? '');
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _emitIfValid());
|
||||
}
|
||||
|
||||
void _emitIfValid() {
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
widget.onChanged(
|
||||
CardPaymentMethod(
|
||||
pan: _panController.text.replaceAll(' ', ''),
|
||||
firstName: _firstNameController.text,
|
||||
lastName: _lastNameController.text,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant CardFormMinimal oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.initialData == null && oldWidget.initialData != null) {
|
||||
_panController.clear();
|
||||
_firstNameController.clear();
|
||||
_lastNameController.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
return Form(
|
||||
key: _formKey,
|
||||
onChanged: _emitIfValid,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _panController,
|
||||
decoration: getInputDecoration(context, l10n.cardNumber, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [CreditCardNumberInputFormatter()],
|
||||
validator: (v) => (v == null || v.replaceAll(' ', '').length < 12) ? l10n.enterCardNumber : null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _firstNameController,
|
||||
decoration: getInputDecoration(context, l10n.firstName, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (v) => (v == null || v.isEmpty) ? l10n.enterFirstName : null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _lastNameController,
|
||||
decoration: getInputDecoration(context, l10n.lastName, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (v) => (v == null || v.isEmpty) ? l10n.enterLastName : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_panController.dispose();
|
||||
_firstNameController.dispose();
|
||||
_lastNameController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
122
frontend/pweb/lib/pages/payment_methods/add/iban.dart
Normal file
122
frontend/pweb/lib/pages/payment_methods/add/iban.dart
Normal file
@@ -0,0 +1,122 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/methods/iban.dart';
|
||||
|
||||
import 'package:pweb/utils/text_field_styles.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class IbanForm extends StatefulWidget {
|
||||
final void Function(IbanPaymentMethod) onChanged;
|
||||
final IbanPaymentMethod? initialData;
|
||||
final bool isEditable;
|
||||
|
||||
const IbanForm({
|
||||
super.key,
|
||||
required this.onChanged,
|
||||
this.initialData,
|
||||
required this.isEditable,
|
||||
});
|
||||
|
||||
@override
|
||||
State<IbanForm> createState() => _IbanFormState();
|
||||
}
|
||||
|
||||
class _IbanFormState extends State<IbanForm> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
late TextEditingController _ibanController;
|
||||
late TextEditingController _accountHolderController;
|
||||
late TextEditingController _bicController;
|
||||
late TextEditingController _bankNameController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_ibanController = TextEditingController(text: widget.initialData?.iban ?? '');
|
||||
_accountHolderController = TextEditingController(text: widget.initialData?.accountHolder ?? '');
|
||||
_bicController = TextEditingController(text: widget.initialData?.bic ?? '');
|
||||
_bankNameController = TextEditingController(text: widget.initialData?.bankName ?? '');
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _emitIfValid());
|
||||
}
|
||||
|
||||
void _emitIfValid() {
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
widget.onChanged(
|
||||
IbanPaymentMethod(
|
||||
iban: _ibanController.text,
|
||||
accountHolder: _accountHolderController.text,
|
||||
bic: _bicController.text,
|
||||
bankName: _bankNameController.text,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant IbanForm oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.initialData == null && oldWidget.initialData != null) {
|
||||
_ibanController.clear();
|
||||
_accountHolderController.clear();
|
||||
_bicController.clear();
|
||||
_bankNameController.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
return Form(
|
||||
key: _formKey,
|
||||
onChanged: _emitIfValid,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _ibanController,
|
||||
decoration: getInputDecoration(context, l10n.iban, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (val) => (val == null || val.isEmpty) ? l10n.enterIban : null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _accountHolderController,
|
||||
decoration: getInputDecoration(context, l10n.accountHolder, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (val) => (val == null || val.isEmpty) ? l10n.enterAccountHolder : null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _bicController,
|
||||
decoration: getInputDecoration(context, l10n.bic, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (val) => (val == null || val.isEmpty) ? l10n.enterBic : null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _bankNameController,
|
||||
decoration: getInputDecoration(context, l10n.bankName, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (val) => (val == null || val.isEmpty) ? l10n.enterBankName : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_ibanController.dispose();
|
||||
_accountHolderController.dispose();
|
||||
_bicController.dispose();
|
||||
_bankNameController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
import 'package:pweb/utils/payment/label.dart';
|
||||
|
||||
|
||||
class PaymentMethodTypeSelector extends StatelessWidget {
|
||||
final PaymentType? value;
|
||||
final ValueChanged<PaymentType?> onChanged;
|
||||
|
||||
const PaymentMethodTypeSelector({
|
||||
super.key,
|
||||
required this.value,
|
||||
required this.onChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
return DropdownButtonFormField<PaymentType>(
|
||||
value: value,
|
||||
decoration: InputDecoration(labelText: l10n.paymentType),
|
||||
items: PaymentType.values.map((type) {
|
||||
final label = getPaymentTypeLabel(context, type);
|
||||
return DropdownMenuItem(value: type, child: Text(label));
|
||||
}).toList(),
|
||||
onChanged: onChanged,
|
||||
validator: (val) => val == null ? l10n.selectPaymentType : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
162
frontend/pweb/lib/pages/payment_methods/add/russian_bank.dart
Normal file
162
frontend/pweb/lib/pages/payment_methods/add/russian_bank.dart
Normal file
@@ -0,0 +1,162 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/methods/russian_bank.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
import 'package:pweb/utils/text_field_styles.dart';
|
||||
|
||||
|
||||
class RussianBankForm extends StatefulWidget {
|
||||
final void Function(RussianBankAccountPaymentMethod) onChanged;
|
||||
final RussianBankAccountPaymentMethod? initialData;
|
||||
final bool isEditable;
|
||||
|
||||
const RussianBankForm({
|
||||
super.key,
|
||||
required this.onChanged,
|
||||
this.initialData,
|
||||
required this.isEditable,
|
||||
});
|
||||
|
||||
@override
|
||||
State<RussianBankForm> createState() => _RussianBankFormState();
|
||||
}
|
||||
|
||||
class _RussianBankFormState extends State<RussianBankForm> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
late final TextEditingController _recipientNameController;
|
||||
late final TextEditingController _innController;
|
||||
late final TextEditingController _kppController;
|
||||
late final TextEditingController _bankNameController;
|
||||
late final TextEditingController _bikController;
|
||||
late final TextEditingController _accountNumberController;
|
||||
late final TextEditingController _correspondentAccountController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_recipientNameController = TextEditingController(text: widget.initialData?.recipientName ?? '');
|
||||
_innController = TextEditingController(text: widget.initialData?.inn ?? '');
|
||||
_kppController = TextEditingController(text: widget.initialData?.kpp ?? '');
|
||||
_bankNameController = TextEditingController(text: widget.initialData?.bankName ?? '');
|
||||
_bikController = TextEditingController(text: widget.initialData?.bik ?? '');
|
||||
_accountNumberController = TextEditingController(text: widget.initialData?.accountNumber ?? '');
|
||||
_correspondentAccountController = TextEditingController(text: widget.initialData?.correspondentAccount ?? '');
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _emitIfValid());
|
||||
}
|
||||
|
||||
void _emitIfValid() {
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
widget.onChanged(
|
||||
RussianBankAccountPaymentMethod(
|
||||
recipientName: _recipientNameController.text,
|
||||
inn: _innController.text,
|
||||
kpp: _kppController.text,
|
||||
bankName: _bankNameController.text,
|
||||
bik: _bikController.text,
|
||||
accountNumber: _accountNumberController.text,
|
||||
correspondentAccount: _correspondentAccountController.text,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant RussianBankForm oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.initialData == null && oldWidget.initialData != null) {
|
||||
_recipientNameController.clear();
|
||||
_innController.clear();
|
||||
_kppController.clear();
|
||||
_bankNameController.clear();
|
||||
_bikController.clear();
|
||||
_accountNumberController.clear();
|
||||
_correspondentAccountController.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
return Form(
|
||||
key: _formKey,
|
||||
onChanged: _emitIfValid,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _recipientNameController,
|
||||
decoration: getInputDecoration(context, l10n.recipientName, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (val) => (val == null || val.isEmpty) ? l10n.enterRecipientName : null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _innController,
|
||||
decoration: getInputDecoration(context, l10n.inn, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (val) => (val == null || val.isEmpty) ? l10n.enterInn : null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _kppController,
|
||||
decoration: getInputDecoration(context, l10n.kpp, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (val) => (val == null || val.isEmpty) ? l10n.enterKpp : null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _bankNameController,
|
||||
decoration: getInputDecoration(context, l10n.bankName, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (val) => (val == null || val.isEmpty) ? l10n.enterBankName : null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _bikController,
|
||||
decoration: getInputDecoration(context, l10n.bik, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (val) => (val == null || val.isEmpty) ? l10n.enterBik : null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _accountNumberController,
|
||||
decoration: getInputDecoration(context, l10n.accountNumber, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (val) => (val == null || val.isEmpty) ? l10n.enterAccountNumber : null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _correspondentAccountController,
|
||||
decoration: getInputDecoration(context, l10n.correspondentAccount, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
validator: (val) => (val == null || val.isEmpty) ? l10n.enterCorrespondentAccount : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_recipientNameController.dispose();
|
||||
_innController.dispose();
|
||||
_kppController.dispose();
|
||||
_bankNameController.dispose();
|
||||
_bikController.dispose();
|
||||
_accountNumberController.dispose();
|
||||
_correspondentAccountController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
62
frontend/pweb/lib/pages/payment_methods/add/wallet.dart
Normal file
62
frontend/pweb/lib/pages/payment_methods/add/wallet.dart
Normal file
@@ -0,0 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/methods/wallet.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
import 'package:pweb/utils/text_field_styles.dart';
|
||||
|
||||
|
||||
class WalletForm extends StatefulWidget {
|
||||
final void Function(WalletPaymentMethod) onChanged;
|
||||
final WalletPaymentMethod? initialData;
|
||||
final bool isEditable;
|
||||
|
||||
const WalletForm({
|
||||
super.key,
|
||||
required this.onChanged,
|
||||
this.initialData,
|
||||
required this.isEditable,
|
||||
});
|
||||
|
||||
@override
|
||||
State<WalletForm> createState() => _WalletFormState();
|
||||
}
|
||||
|
||||
class _WalletFormState extends State<WalletForm> {
|
||||
late TextEditingController _walletIdController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_walletIdController = TextEditingController(text: widget.initialData?.walletId);
|
||||
}
|
||||
|
||||
void _emit() {
|
||||
if (_walletIdController.text.isNotEmpty) {
|
||||
widget.onChanged(WalletPaymentMethod(walletId: _walletIdController.text));
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant WalletForm oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.initialData == null && oldWidget.initialData != null) {
|
||||
_walletIdController.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
return TextFormField(
|
||||
readOnly: !widget.isEditable,
|
||||
controller: _walletIdController,
|
||||
decoration: getInputDecoration(context, l10n.walletId, widget.isEditable),
|
||||
style: getTextFieldStyle(context, widget.isEditable),
|
||||
onChanged: (_) => _emit(),
|
||||
validator: (val) => (val?.isEmpty ?? true) ? l10n.enterWalletId : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
76
frontend/pweb/lib/pages/payment_methods/add/widget.dart
Normal file
76
frontend/pweb/lib/pages/payment_methods/add/widget.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_methods/add/method_selector.dart';
|
||||
import 'package:pweb/pages/payment_methods/form.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class AddPaymentMethodDialog extends StatefulWidget {
|
||||
const AddPaymentMethodDialog({super.key});
|
||||
|
||||
@override
|
||||
State<AddPaymentMethodDialog> createState() => _AddPaymentMethodDialogState();
|
||||
}
|
||||
|
||||
class _AddPaymentMethodDialogState extends State<AddPaymentMethodDialog> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
PaymentType? _selectedType;
|
||||
|
||||
// Holds current result from the selected form
|
||||
Object? _currentMethod;
|
||||
|
||||
void _submit() {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
_formKey.currentState!.save();
|
||||
|
||||
if (_currentMethod case final Object method) {
|
||||
Navigator.of(context).pop(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
return AlertDialog(
|
||||
title: Text(l10n.addPaymentMethod),
|
||||
content: Form(
|
||||
key: _formKey,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
PaymentMethodTypeSelector(
|
||||
value: _selectedType,
|
||||
onChanged: (val) => setState(() {
|
||||
_selectedType = val;
|
||||
_currentMethod = null;
|
||||
}),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (_selectedType != null)
|
||||
PaymentMethodForm(
|
||||
selectedType: _selectedType,
|
||||
onChanged: (val) => _currentMethod = val,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(l10n.cancel),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: _submit,
|
||||
child: Text(l10n.add),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
Future<bool> showDeleteConfirmationDialog(BuildContext context) async {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
return await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: Text(l10n.delete),
|
||||
content: Text(l10n.deletePaymentConfirmation),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
child: Text(l10n.cancel),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
child: Text(l10n.delete),
|
||||
),
|
||||
],
|
||||
),
|
||||
) ?? false;
|
||||
}
|
||||
55
frontend/pweb/lib/pages/payment_methods/form.dart
Normal file
55
frontend/pweb/lib/pages/payment_methods/form.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/methods/card.dart';
|
||||
import 'package:pshared/models/payment/methods/iban.dart';
|
||||
import 'package:pshared/models/payment/methods/russian_bank.dart';
|
||||
import 'package:pshared/models/payment/methods/wallet.dart';
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_methods/add/card.dart';
|
||||
import 'package:pweb/pages/payment_methods/add/iban.dart';
|
||||
import 'package:pweb/pages/payment_methods/add/russian_bank.dart';
|
||||
import 'package:pweb/pages/payment_methods/add/wallet.dart';
|
||||
|
||||
|
||||
class PaymentMethodForm extends StatelessWidget {
|
||||
final PaymentType? selectedType;
|
||||
final ValueChanged<Object?> onChanged;
|
||||
final Object? initialData;
|
||||
final bool isEditable;
|
||||
|
||||
const PaymentMethodForm({
|
||||
super.key,
|
||||
required this.selectedType,
|
||||
required this.onChanged,
|
||||
this.initialData,
|
||||
this.isEditable = true,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return switch (selectedType) {
|
||||
PaymentType.card => CardFormMinimal(
|
||||
onChanged: onChanged,
|
||||
initialData: initialData as CardPaymentMethod?,
|
||||
isEditable: isEditable,
|
||||
),
|
||||
PaymentType.iban => IbanForm(
|
||||
onChanged: onChanged,
|
||||
initialData: initialData as IbanPaymentMethod?,
|
||||
isEditable: isEditable,
|
||||
),
|
||||
PaymentType.wallet => WalletForm(
|
||||
onChanged: onChanged,
|
||||
initialData: initialData as WalletPaymentMethod?,
|
||||
isEditable: isEditable,
|
||||
),
|
||||
PaymentType.bankAccount => RussianBankForm(
|
||||
onChanged: onChanged,
|
||||
initialData: initialData as RussianBankAccountPaymentMethod?,
|
||||
isEditable: isEditable,
|
||||
),
|
||||
_ => const SizedBox.shrink(),
|
||||
};
|
||||
}
|
||||
}
|
||||
17
frontend/pweb/lib/pages/payment_methods/icon.dart
Normal file
17
frontend/pweb/lib/pages/payment_methods/icon.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
|
||||
IconData iconForPaymentType(PaymentType type) {
|
||||
switch (type) {
|
||||
case PaymentType.bankAccount:
|
||||
return Icons.account_balance;
|
||||
case PaymentType.iban:
|
||||
return Icons.language;
|
||||
case PaymentType.wallet:
|
||||
return Icons.account_balance_wallet;
|
||||
case PaymentType.card:
|
||||
return Icons.credit_card;
|
||||
}
|
||||
}
|
||||
232
frontend/pweb/lib/pages/payment_methods/page.dart
Normal file
232
frontend/pweb/lib/pages/payment_methods/page.dart
Normal file
@@ -0,0 +1,232 @@
|
||||
import 'package:amplitude_flutter/amplitude.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
|
||||
import 'package:pweb/pages/dashboard/payouts/payment_form.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/form/details.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/form/header.dart';
|
||||
import 'package:pweb/providers/payment_methods.dart';
|
||||
import 'package:pweb/providers/recipient.dart';
|
||||
import 'package:pweb/services/amplitude.dart';
|
||||
import 'package:pweb/utils/dimensions.dart';
|
||||
import 'package:pweb/utils/payment/dropdown.dart';
|
||||
import 'package:pweb/utils/payment/selector_type.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
import 'package:pweb/widgets/sidebar/destinations.dart';
|
||||
|
||||
|
||||
//TODO: decide whether to make AppDimensions universal for the whole app or leave it as it is - unique for this page alone
|
||||
|
||||
|
||||
class PaymentPage extends StatefulWidget {
|
||||
final PaymentType? type;
|
||||
final ValueChanged<Recipient?>? onBack;
|
||||
|
||||
const PaymentPage({super.key, this.type, this.onBack});
|
||||
|
||||
@override
|
||||
State<PaymentPage> createState() => _PaymentPageState();
|
||||
}
|
||||
|
||||
class _PaymentPageState extends State<PaymentPage> {
|
||||
late Map<PaymentType, Object> _availableTypes;
|
||||
late PaymentType _selectedType;
|
||||
bool _isFormVisible = false;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
final recipientProvider = context.watch<RecipientProvider>();
|
||||
final methodsProvider = context.watch<PaymentMethodsProvider>();
|
||||
final recipient = recipientProvider.selectedRecipient;
|
||||
|
||||
// Initialize available types based on whether we have a recipient
|
||||
if (recipient != null) {
|
||||
// We have a recipient - use their payment methods
|
||||
_availableTypes = {
|
||||
if (recipient.card != null) PaymentType.card: recipient.card!,
|
||||
if (recipient.iban != null) PaymentType.iban: recipient.iban!,
|
||||
if (recipient.wallet != null) PaymentType.wallet: recipient.wallet!,
|
||||
if (recipient.bank != null) PaymentType.bankAccount: recipient.bank!,
|
||||
};
|
||||
|
||||
// Set selected type if it's available, otherwise use first available type
|
||||
if (_availableTypes.containsKey(_selectedType)) {
|
||||
// Keep current selection if valid
|
||||
} else if (_availableTypes.isNotEmpty) {
|
||||
_selectedType = _availableTypes.keys.first;
|
||||
} else {
|
||||
// Fallback if recipient has no payment methods
|
||||
_selectedType = PaymentType.bankAccount;
|
||||
}
|
||||
} else {
|
||||
// No recipient - we're creating a new payment from scratch
|
||||
_availableTypes = {};
|
||||
_selectedType = widget.type ?? PaymentType.bankAccount;
|
||||
_isFormVisible = true; // Always show form when creating new payment
|
||||
}
|
||||
|
||||
// Load payment methods if not already loaded
|
||||
if (methodsProvider.methods.isEmpty && !methodsProvider.isLoading) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
methodsProvider.loadMethods();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// Initial values
|
||||
_availableTypes = {};
|
||||
_selectedType = widget.type ?? PaymentType.bankAccount;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final dimensions = AppDimensions();
|
||||
final recipientProvider = context.watch<RecipientProvider>();
|
||||
final methodsProvider = context.watch<PaymentMethodsProvider>();
|
||||
final recipient = recipientProvider.selectedRecipient;
|
||||
|
||||
// Show loading state for payment methods
|
||||
if (methodsProvider.isLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
// Show error state for payment methods
|
||||
if (methodsProvider.error != null) {
|
||||
return Center(
|
||||
child: Text('Error: ${methodsProvider.error}'),
|
||||
);
|
||||
}
|
||||
|
||||
return Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: dimensions.maxContentWidth),
|
||||
child: Material(
|
||||
elevation: dimensions.elevationSmall,
|
||||
borderRadius: BorderRadius.circular(dimensions.borderRadiusMedium),
|
||||
color: theme.colorScheme.onSecondary,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(dimensions.paddingLarge),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Back button
|
||||
Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
onPressed: () {
|
||||
widget.onBack?.call(recipient);
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: dimensions.paddingSmall),
|
||||
|
||||
// Header
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.send_rounded,
|
||||
color: theme.colorScheme.primary,
|
||||
size: dimensions.iconSizeLarge
|
||||
),
|
||||
SizedBox(width: dimensions.spacingSmall),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.sendTo,
|
||||
style: theme.textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: dimensions.paddingXXLarge),
|
||||
|
||||
// Payment method dropdown (user's payment methods)
|
||||
PaymentMethodDropdown(
|
||||
methods: methodsProvider.methods,
|
||||
initialValue: methodsProvider.selectedMethod,
|
||||
onChanged: (method) {
|
||||
methodsProvider.selectMethod(method);
|
||||
},
|
||||
),
|
||||
SizedBox(height: dimensions.paddingXLarge),
|
||||
|
||||
// Recipient section (only show if we have a recipient)
|
||||
if (recipient != null) ...[
|
||||
RecipientHeader(recipient: recipient),
|
||||
SizedBox(height: dimensions.paddingMedium),
|
||||
|
||||
// Payment type selector (recipient's payment methods)
|
||||
if (_availableTypes.isNotEmpty)
|
||||
PaymentTypeSelector(
|
||||
availableTypes: _availableTypes,
|
||||
selectedType: _selectedType,
|
||||
onSelected: (type) => setState(() => _selectedType = type),
|
||||
),
|
||||
SizedBox(height: dimensions.paddingMedium),
|
||||
],
|
||||
|
||||
// Payment details section
|
||||
PaymentDetailsSection(
|
||||
isFormVisible: recipient == null || _isFormVisible,
|
||||
onToggle: recipient != null
|
||||
? () => setState(() => _isFormVisible = !_isFormVisible)
|
||||
: null, // No toggle when creating new payment
|
||||
selectedType: _selectedType,
|
||||
data: _availableTypes[_selectedType],
|
||||
isEditable: recipient == null,
|
||||
),
|
||||
|
||||
const PaymentFormWidget(),
|
||||
|
||||
SizedBox(height: dimensions.paddingXXXLarge),
|
||||
|
||||
Center(
|
||||
child: SizedBox(
|
||||
width: dimensions.buttonWidth,
|
||||
height: dimensions.buttonHeight,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(dimensions.borderRadiusSmall),
|
||||
onTap: () =>
|
||||
// TODO: Handle Payment logic
|
||||
AmplitudeService.pageOpened(PayoutDestination.payment), //TODO: replace with payment event
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(dimensions.borderRadiusSmall),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.send,
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.colorScheme.onSecondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: dimensions.paddingLarge),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
100
frontend/pweb/lib/pages/payment_methods/title.dart
Normal file
100
frontend/pweb/lib/pages/payment_methods/title.dart
Normal file
@@ -0,0 +1,100 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_methods/icon.dart';
|
||||
import 'package:pshared/models/payment/methods/type.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
class PaymentMethodTile extends StatelessWidget {
|
||||
const PaymentMethodTile({
|
||||
super.key,
|
||||
required this.method,
|
||||
required this.index,
|
||||
required this.makeMain,
|
||||
required this.toggleEnabled,
|
||||
required this.edit,
|
||||
required this.delete,
|
||||
});
|
||||
|
||||
final PaymentMethod method;
|
||||
final int index;
|
||||
final VoidCallback makeMain;
|
||||
final ValueChanged<bool> toggleEnabled;
|
||||
final VoidCallback edit;
|
||||
final VoidCallback delete;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Opacity(
|
||||
opacity: method.isEnabled ? 1 : 0.5,
|
||||
child: Card(
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
elevation: 0,
|
||||
child: ListTile(
|
||||
key: ValueKey(method.id),
|
||||
leading: Icon(iconForPaymentType(method.type)),
|
||||
onTap: makeMain,
|
||||
title: Row(
|
||||
children: [
|
||||
Expanded(child: Text(method.label)),
|
||||
Text(
|
||||
method.details,
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildMakeMainButton(context),
|
||||
_buildEnabledSwitch(),
|
||||
_buildPopupMenu(l10n),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMakeMainButton(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return IconButton(
|
||||
tooltip: 'Make main',
|
||||
icon: Icon(
|
||||
method.isMain ? Icons.star : Icons.star_outline,
|
||||
color: method.isMain ? theme.colorScheme.primary : null,
|
||||
),
|
||||
onPressed: makeMain,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEnabledSwitch() {
|
||||
return Switch.adaptive(
|
||||
value: method.isEnabled,
|
||||
onChanged: toggleEnabled,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPopupMenu(AppLocalizations l10n) {
|
||||
return PopupMenuButton<String>(
|
||||
tooltip: l10n.moreActions,
|
||||
onSelected: (value) {
|
||||
switch (value) {
|
||||
case 'edit':
|
||||
edit();
|
||||
break;
|
||||
case 'delete':
|
||||
delete();
|
||||
break;
|
||||
}
|
||||
},
|
||||
itemBuilder: (_) => [
|
||||
PopupMenuItem(value: 'edit', child: Text(l10n.edit)),
|
||||
PopupMenuItem(value: 'delete', child: Text(l10n.delete)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
20
frontend/pweb/lib/pages/payment_page/methods/advanced.dart
Normal file
20
frontend/pweb/lib/pages/payment_page/methods/advanced.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class PaymentConfigAdvanced extends StatelessWidget {
|
||||
const PaymentConfigAdvanced({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
return ExpansionTile(
|
||||
title: Text(l10n.advanced),
|
||||
tilePadding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
childrenPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
children: [Text(l10n.fallbackExplanation)],
|
||||
);
|
||||
}
|
||||
}
|
||||
71
frontend/pweb/lib/pages/payment_page/methods/controller.dart
Normal file
71
frontend/pweb/lib/pages/payment_page/methods/controller.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/models/payment/methods/data.dart';
|
||||
import 'package:pshared/models/payment/methods/type.dart';
|
||||
|
||||
import 'package:pweb/providers/payment_methods.dart';
|
||||
import 'package:pweb/pages/payment_methods/add/widget.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class PaymentConfigController {
|
||||
final BuildContext context;
|
||||
|
||||
PaymentConfigController(this.context);
|
||||
|
||||
void loadMethods() {
|
||||
context.read<PaymentMethodsProvider>().loadMethods();
|
||||
}
|
||||
|
||||
Future<void> addMethod() async {
|
||||
await showDialog<PaymentMethodData>(
|
||||
context: context,
|
||||
builder: (_) => const AddPaymentMethodDialog(),
|
||||
);
|
||||
loadMethods();
|
||||
}
|
||||
|
||||
Future<void> editMethod(PaymentMethod method) async {
|
||||
// TODO: implement edit functionality
|
||||
}
|
||||
|
||||
Future<void> deleteMethod(PaymentMethod method) async {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: Text(l10n.delete),
|
||||
content: Text(l10n.deletePaymentConfirmation),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: Text(l10n.cancel),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: Text(l10n.delete),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (confirmed == true) {
|
||||
context.read<PaymentMethodsProvider>().deleteMethod(method);
|
||||
}
|
||||
}
|
||||
|
||||
void toggleEnabled(PaymentMethod method, bool value) {
|
||||
context.read<PaymentMethodsProvider>().toggleEnabled(method, value);
|
||||
}
|
||||
|
||||
void makeMain(PaymentMethod method) {
|
||||
context.read<PaymentMethodsProvider>().makeMain(method);
|
||||
}
|
||||
|
||||
void reorder(int oldIndex, int newIndex) {
|
||||
context.read<PaymentMethodsProvider>().reorderMethods(oldIndex, newIndex);
|
||||
}
|
||||
}
|
||||
36
frontend/pweb/lib/pages/payment_page/methods/header.dart
Normal file
36
frontend/pweb/lib/pages/payment_page/methods/header.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class PaymentConfigHeader extends StatelessWidget {
|
||||
final VoidCallback onAdd;
|
||||
const PaymentConfigHeader({super.key, required this.onAdd});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Text(
|
||||
l10n.paymentConfigTitle,
|
||||
style: theme.textTheme.headlineSmall,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(l10n.paymentConfigSubtitle, textAlign: TextAlign.center),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: OutlinedButton.icon(
|
||||
icon: const Icon(Icons.add),
|
||||
label: Text(l10n.addPaymentMethod),
|
||||
onPressed: onAdd,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
40
frontend/pweb/lib/pages/payment_page/methods/list.dart
Normal file
40
frontend/pweb/lib/pages/payment_page/methods/list.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_methods/title.dart';
|
||||
import 'package:pweb/pages/payment_page/methods/controller.dart';
|
||||
import 'package:pweb/providers/payment_methods.dart';
|
||||
|
||||
|
||||
class PaymentConfigList extends StatelessWidget {
|
||||
final PaymentConfigController controller;
|
||||
const PaymentConfigList({super.key, required this.controller});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.watch<PaymentMethodsProvider>();
|
||||
|
||||
return ReorderableListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: provider.methods.length,
|
||||
onReorder: controller.reorder,
|
||||
itemBuilder: (context, index) {
|
||||
final method = provider.methods[index];
|
||||
return ReorderableDragStartListener(
|
||||
key: Key(method.id),
|
||||
index: index,
|
||||
child: PaymentMethodTile(
|
||||
method: method,
|
||||
index: index,
|
||||
makeMain: () => controller.makeMain(method),
|
||||
toggleEnabled: (v) => controller.toggleEnabled(method, v),
|
||||
edit: () => controller.editMethod(method),
|
||||
delete: () => controller.deleteMethod(method),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
50
frontend/pweb/lib/pages/payment_page/methods/widget.dart
Normal file
50
frontend/pweb/lib/pages/payment_page/methods/widget.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_page/methods/advanced.dart';
|
||||
import 'package:pweb/pages/payment_page/methods/controller.dart';
|
||||
import 'package:pweb/pages/payment_page/methods/header.dart';
|
||||
import 'package:pweb/pages/payment_page/methods/list.dart';
|
||||
|
||||
|
||||
class MethodsWidget extends StatefulWidget {
|
||||
const MethodsWidget({super.key});
|
||||
|
||||
@override
|
||||
State<MethodsWidget> createState() => _MethodsWidgetState();
|
||||
}
|
||||
|
||||
class _MethodsWidgetState extends State<MethodsWidget> {
|
||||
late final PaymentConfigController controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
controller = PaymentConfigController(context);
|
||||
controller.loadMethods();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Card(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
elevation: theme.cardTheme.elevation ?? 4,
|
||||
color: theme.colorScheme.onSecondary,
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
PaymentConfigHeader(onAdd: controller.addMethod),
|
||||
const SizedBox(height: 12),
|
||||
PaymentConfigList(controller: controller),
|
||||
const SizedBox(height: 12),
|
||||
const PaymentConfigAdvanced(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
37
frontend/pweb/lib/pages/payment_page/page.dart
Normal file
37
frontend/pweb/lib/pages/payment_page/page.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_page/methods/widget.dart';
|
||||
import 'package:pweb/pages/payment_page/wallet/wigets.dart';
|
||||
import 'package:pweb/providers/payment_methods.dart';
|
||||
|
||||
|
||||
class PaymentConfigPage extends StatelessWidget {
|
||||
final Function(Wallet) onWalletTap;
|
||||
|
||||
const PaymentConfigPage({super.key, required this.onWalletTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.watch<PaymentMethodsProvider>();
|
||||
|
||||
if (provider.isLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (provider.error != null) {
|
||||
return Center(child: Text('Error: ${provider.error}'));
|
||||
}
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
MethodsWidget(),
|
||||
Expanded(
|
||||
child: WalletWidgets(onWalletTap: onWalletTap),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
61
frontend/pweb/lib/pages/payment_page/wallet/card.dart
Normal file
61
frontend/pweb/lib/pages/payment_page/wallet/card.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/amount.dart';
|
||||
import 'package:pweb/providers/wallets.dart';
|
||||
import 'package:pweb/utils/currency.dart';
|
||||
|
||||
|
||||
class WalletCard extends StatelessWidget {
|
||||
final Wallet wallet;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const WalletCard({super.key, required this.wallet, required this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Card(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
elevation: theme.cardTheme.elevation ?? 4,
|
||||
color: theme.colorScheme.onSecondary,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 50, top: 16, bottom: 16),
|
||||
child: Row(
|
||||
spacing: 3,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 24,
|
||||
child: Icon(iconForCurrencyType(wallet.currency), size: 28),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
BalanceAmount(
|
||||
wallet: wallet,
|
||||
onToggleVisibility: () {
|
||||
context.read<WalletsProvider>().toggleVisibility(wallet.id);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
wallet.name,
|
||||
style: theme.textTheme.bodyLarge!.copyWith(fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:pweb/pages/payment_page/wallet/edit/buttons/send.dart';
|
||||
import 'package:pweb/pages/payment_page/wallet/edit/buttons/top_up.dart';
|
||||
import 'package:pweb/providers/wallets.dart';
|
||||
import 'package:pweb/utils/dimensions.dart';
|
||||
|
||||
|
||||
class ButtonsWalletWidget extends StatelessWidget {
|
||||
const ButtonsWalletWidget({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.watch<WalletsProvider>();
|
||||
final wallet = provider.wallets?.first;
|
||||
|
||||
if (wallet == null) return const SizedBox.shrink();
|
||||
|
||||
final dimensions = AppDimensions();
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceBright,
|
||||
borderRadius: BorderRadius.circular(dimensions.borderRadiusSmall),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Theme.of(context).colorScheme.primary.withAlpha(50),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Expanded(
|
||||
child: SendPayoutButton(),
|
||||
),
|
||||
VerticalDivider(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
thickness: 1,
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: TopUpButton(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user