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