Company gateway view
This commit is contained in:
parent
1295cc23bd
commit
c63669d7b0
|
|
@ -238,6 +238,7 @@ const kNotificationEvents = [
|
|||
];
|
||||
|
||||
const String kGatewayStripe = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
const String kGatewayCustom = '54faab2ab6e3223dbe848b1686490baa';
|
||||
|
||||
const String kClientPortalModeSubdomain = 'subdomain';
|
||||
const String kClientPortalModeDomain = 'domain';
|
||||
|
|
|
|||
|
|
@ -140,6 +140,8 @@ abstract class CompanyGatewayEntity extends Object
|
|||
return gateway.name;
|
||||
}
|
||||
|
||||
bool get isCustom => gatewayId == kGatewayCustom;
|
||||
|
||||
bool supportsCard(int cardType) => acceptedCreditCards & cardType > 0;
|
||||
|
||||
CompanyGatewayEntity addCard(int cardType) =>
|
||||
|
|
|
|||
|
|
@ -278,18 +278,13 @@ abstract class CompanyEntity extends Object
|
|||
}
|
||||
|
||||
return matchesStrings(
|
||||
haystacks: [
|
||||
subdomain,
|
||||
displayName,
|
||||
companyKey
|
||||
],
|
||||
haystacks: [subdomain, displayName, companyKey],
|
||||
needle: filter,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String matchesFilterValue(String filter) {
|
||||
|
||||
for (final user in users) {
|
||||
final value = user.matchesFilterValue(filter);
|
||||
if (value != null) {
|
||||
|
|
@ -310,11 +305,7 @@ abstract class CompanyEntity extends Object
|
|||
}
|
||||
|
||||
return matchesStringsValue(
|
||||
haystacks: [
|
||||
subdomain,
|
||||
displayName,
|
||||
companyKey
|
||||
],
|
||||
haystacks: [subdomain, displayName, companyKey],
|
||||
needle: filter,
|
||||
);
|
||||
}
|
||||
|
|
@ -356,9 +347,7 @@ abstract class CompanyEntity extends Object
|
|||
|
||||
String getCustomFieldLabel(String field) {
|
||||
if (customFields.containsKey(field)) {
|
||||
return customFields[field]
|
||||
.split('|')
|
||||
.first;
|
||||
return customFields[field].split('|').first;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
|
@ -366,9 +355,7 @@ abstract class CompanyEntity extends Object
|
|||
|
||||
String getCustomFieldType(String field) {
|
||||
if ((customFields[field] ?? '').contains('|')) {
|
||||
final value = customFields[field]
|
||||
.split('|')
|
||||
.last;
|
||||
final value = customFields[field].split('|').last;
|
||||
if ([kFieldTypeSingleLineText, kFieldTypeDate, kFieldTypeSwitch]
|
||||
.contains(value)) {
|
||||
return value;
|
||||
|
|
@ -405,9 +392,7 @@ abstract class CompanyEntity extends Object
|
|||
}
|
||||
|
||||
// TODO make sure to clear everything
|
||||
CompanyEntity get coreCompany =>
|
||||
rebuild((b) =>
|
||||
b
|
||||
CompanyEntity get coreCompany => rebuild((b) => b
|
||||
..clients.clear()
|
||||
..products.clear()
|
||||
..invoices.clear()
|
||||
|
|
@ -503,6 +488,8 @@ abstract class GatewayEntity extends Object
|
|||
|
||||
String get fields;
|
||||
|
||||
bool get supportsTokenBilling => [kGatewayStripe].contains(id);
|
||||
|
||||
Map<String, dynamic> get parsedFields =>
|
||||
fields.isEmpty ? <String, dynamic>{} : jsonDecode(fields);
|
||||
|
||||
|
|
@ -571,7 +558,6 @@ abstract class GatewayEntity extends Object
|
|||
FormatNumberType get listDisplayAmountType => null;
|
||||
}
|
||||
|
||||
|
||||
abstract class UserCompanyEntity
|
||||
implements Built<UserCompanyEntity, UserCompanyEntityBuilder> {
|
||||
factory UserCompanyEntity() {
|
||||
|
|
@ -583,8 +569,7 @@ abstract class UserCompanyEntity
|
|||
user: UserEntity(),
|
||||
token: TokenEntity(),
|
||||
account: AccountEntity(),
|
||||
notifications: BuiltMap<String, BuiltList<String>>().rebuild((b) =>
|
||||
b
|
||||
notifications: BuiltMap<String, BuiltList<String>>().rebuild((b) => b
|
||||
..[kNotificationChannelEmail] =
|
||||
BuiltList<String>(<String>[kNotificationsAll])),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -633,6 +633,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
//return 'Invitations: ${uiState.invoiceUIState.editing.invitations}';
|
||||
//return 'Selection: ${clientUIState.selectedId}';
|
||||
//return '${clientState.map[clientUIState.selectedId].gatewayTokens}';
|
||||
//return 'gatewayId: ${companyGatewayState.map[companyGatewayUIState.selectedId].gatewayId}';
|
||||
return '\n\nURL: ${authState.url}\nRoute: ${uiState.currentRoute}\nPrev: ${uiState.previousRoute}\nIs Loaded: ${isLoaded ? 'Yes' : 'No'}\nis Large: ${(company?.isLarge ?? false) ? 'Yes' : 'No'}\nCompany: $companyUpdated${userCompanyState.isStale ? ' [S]' : ''}\nStatic: $staticUpdated${staticState.isStale ? ' [S]' : ''}\n';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:invoiceninja_flutter/redux/company_gateway/company_gateway_selec
|
|||
import 'package:invoiceninja_flutter/ui/app/FieldGrid.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_list_tile.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entity_header.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/icon_message.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/lists/list_divider.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/view_scaffold.dart';
|
||||
import 'package:invoiceninja_flutter/ui/company_gateway/view/company_gateway_view_vm.dart';
|
||||
|
|
@ -64,13 +65,13 @@ class _CompanyGatewayViewState extends State<CompanyGatewayView> {
|
|||
isFilter: widget.isFilter,
|
||||
entity: companyGateway,
|
||||
onBackPressed: () => viewModel.onBackPressed(),
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
body: ListView(children: <Widget>[
|
||||
EntityHeader(
|
||||
entity: companyGateway,
|
||||
label: localization.processed,
|
||||
value: formatNumber(processed, context)),
|
||||
ListDivider(),
|
||||
if (companyGateway.gateway.supportsTokenBilling) ...[
|
||||
EntitiesListTile(
|
||||
isFilter: widget.isFilter,
|
||||
entityType: EntityType.client,
|
||||
|
|
@ -83,6 +84,7 @@ class _CompanyGatewayViewState extends State<CompanyGatewayView> {
|
|||
companyGateway.id, state.clientState.map)
|
||||
.present(localization.active, localization.archived),
|
||||
),
|
||||
],
|
||||
ListDivider(),
|
||||
EntitiesListTile(
|
||||
isFilter: widget.isFilter,
|
||||
|
|
@ -98,8 +100,7 @@ class _CompanyGatewayViewState extends State<CompanyGatewayView> {
|
|||
),
|
||||
ListDivider(),
|
||||
FieldGrid(fields),
|
||||
],
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue