Settings
This commit is contained in:
parent
22f41f3d84
commit
263c053c86
|
|
@ -57,6 +57,7 @@ abstract class CompanyGatewayEntity extends Object
|
|||
updateDetails: true,
|
||||
customValue1: '',
|
||||
customValue2: '',
|
||||
config: '',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -82,12 +83,16 @@ abstract class CompanyGatewayEntity extends Object
|
|||
@BuiltValueField(wireName: 'update_details')
|
||||
bool get updateDetails;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'custom_value1')
|
||||
String get customValue1;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'custom_value2')
|
||||
String get customValue2;
|
||||
|
||||
String get config;
|
||||
|
||||
@override
|
||||
String get listDisplayName {
|
||||
return gateway.name;
|
||||
|
|
|
|||
|
|
@ -136,11 +136,8 @@ class _$CompanyGatewayEntitySerializer
|
|||
'update_details',
|
||||
serializers.serialize(object.updateDetails,
|
||||
specifiedType: const FullType(bool)),
|
||||
'custom_value1',
|
||||
serializers.serialize(object.customValue1,
|
||||
specifiedType: const FullType(String)),
|
||||
'custom_value2',
|
||||
serializers.serialize(object.customValue2,
|
||||
'config',
|
||||
serializers.serialize(object.config,
|
||||
specifiedType: const FullType(String)),
|
||||
];
|
||||
if (object.gatewayId != null) {
|
||||
|
|
@ -149,6 +146,18 @@ class _$CompanyGatewayEntitySerializer
|
|||
..add(serializers.serialize(object.gatewayId,
|
||||
specifiedType: const FullType(String)));
|
||||
}
|
||||
if (object.customValue1 != null) {
|
||||
result
|
||||
..add('custom_value1')
|
||||
..add(serializers.serialize(object.customValue1,
|
||||
specifiedType: const FullType(String)));
|
||||
}
|
||||
if (object.customValue2 != null) {
|
||||
result
|
||||
..add('custom_value2')
|
||||
..add(serializers.serialize(object.customValue2,
|
||||
specifiedType: const FullType(String)));
|
||||
}
|
||||
if (object.isChanged != null) {
|
||||
result
|
||||
..add('isChanged')
|
||||
|
|
@ -234,6 +243,10 @@ class _$CompanyGatewayEntitySerializer
|
|||
result.customValue2 = serializers.deserialize(value,
|
||||
specifiedType: const FullType(String)) as String;
|
||||
break;
|
||||
case 'config':
|
||||
result.config = serializers.deserialize(value,
|
||||
specifiedType: const FullType(String)) as String;
|
||||
break;
|
||||
case 'isChanged':
|
||||
result.isChanged = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
|
|
@ -477,6 +490,8 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity {
|
|||
@override
|
||||
final String customValue2;
|
||||
@override
|
||||
final String config;
|
||||
@override
|
||||
final bool isChanged;
|
||||
@override
|
||||
final int createdAt;
|
||||
|
|
@ -503,6 +518,7 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity {
|
|||
this.updateDetails,
|
||||
this.customValue1,
|
||||
this.customValue2,
|
||||
this.config,
|
||||
this.isChanged,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
|
|
@ -526,13 +542,8 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity {
|
|||
throw new BuiltValueNullFieldError(
|
||||
'CompanyGatewayEntity', 'updateDetails');
|
||||
}
|
||||
if (customValue1 == null) {
|
||||
throw new BuiltValueNullFieldError(
|
||||
'CompanyGatewayEntity', 'customValue1');
|
||||
}
|
||||
if (customValue2 == null) {
|
||||
throw new BuiltValueNullFieldError(
|
||||
'CompanyGatewayEntity', 'customValue2');
|
||||
if (config == null) {
|
||||
throw new BuiltValueNullFieldError('CompanyGatewayEntity', 'config');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -556,6 +567,7 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity {
|
|||
updateDetails == other.updateDetails &&
|
||||
customValue1 == other.customValue1 &&
|
||||
customValue2 == other.customValue2 &&
|
||||
config == other.config &&
|
||||
isChanged == other.isChanged &&
|
||||
createdAt == other.createdAt &&
|
||||
updatedAt == other.updatedAt &&
|
||||
|
|
@ -580,15 +592,20 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity {
|
|||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(0,
|
||||
gateway.hashCode),
|
||||
$jc(
|
||||
$jc(
|
||||
0,
|
||||
gateway
|
||||
.hashCode),
|
||||
gatewayId.hashCode),
|
||||
showBillingAddress
|
||||
.hashCode),
|
||||
showShippingAddress.hashCode),
|
||||
showShippingAddress
|
||||
.hashCode),
|
||||
updateDetails.hashCode),
|
||||
customValue1.hashCode),
|
||||
customValue2.hashCode),
|
||||
config.hashCode),
|
||||
isChanged.hashCode),
|
||||
createdAt.hashCode),
|
||||
updatedAt.hashCode),
|
||||
|
|
@ -608,6 +625,7 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity {
|
|||
..add('updateDetails', updateDetails)
|
||||
..add('customValue1', customValue1)
|
||||
..add('customValue2', customValue2)
|
||||
..add('config', config)
|
||||
..add('isChanged', isChanged)
|
||||
..add('createdAt', createdAt)
|
||||
..add('updatedAt', updatedAt)
|
||||
|
|
@ -655,6 +673,10 @@ class CompanyGatewayEntityBuilder
|
|||
String get customValue2 => _$this._customValue2;
|
||||
set customValue2(String customValue2) => _$this._customValue2 = customValue2;
|
||||
|
||||
String _config;
|
||||
String get config => _$this._config;
|
||||
set config(String config) => _$this._config = config;
|
||||
|
||||
bool _isChanged;
|
||||
bool get isChanged => _$this._isChanged;
|
||||
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
|
||||
|
|
@ -694,6 +716,7 @@ class CompanyGatewayEntityBuilder
|
|||
_updateDetails = _$v.updateDetails;
|
||||
_customValue1 = _$v.customValue1;
|
||||
_customValue2 = _$v.customValue2;
|
||||
_config = _$v.config;
|
||||
_isChanged = _$v.isChanged;
|
||||
_createdAt = _$v.createdAt;
|
||||
_updatedAt = _$v.updatedAt;
|
||||
|
|
@ -732,6 +755,7 @@ class CompanyGatewayEntityBuilder
|
|||
updateDetails: updateDetails,
|
||||
customValue1: customValue1,
|
||||
customValue2: customValue2,
|
||||
config: config,
|
||||
isChanged: isChanged,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import 'package:invoiceninja_flutter/ui/app/screen_imports.dart';
|
|||
import 'package:invoiceninja_flutter/ui/client/edit/client_edit_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/group/edit/group_edit_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/product/edit/product_edit_vm.dart';
|
||||
|
||||
// STARTER: import - do not remove comment
|
||||
import 'package:invoiceninja_flutter/redux/tax_rate/tax_rate_state.dart';
|
||||
|
||||
|
|
@ -199,13 +200,17 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
|
||||
// STARTER: state getters - do not remove comment
|
||||
TaxRateState get taxRateState => selectedCompanyState.taxRateState;
|
||||
|
||||
ListUIState get taxRateListState => uiState.taxRateUIState.listUIState;
|
||||
|
||||
TaxRateUIState get taxRateUIState => uiState.taxRateUIState;
|
||||
|
||||
CompanyGatewayState get companyGatewayState =>
|
||||
selectedCompanyState.companyGatewayState;
|
||||
|
||||
ListUIState get companyGatewayListState =>
|
||||
uiState.companyGatewayUIState.listUIState;
|
||||
|
||||
CompanyGatewayUIState get companyGatewayUIState =>
|
||||
uiState.companyGatewayUIState;
|
||||
|
||||
|
|
@ -324,9 +329,9 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
@override
|
||||
String toString() {
|
||||
//return 'showCurrencyCode: ${uiState.settingsUIState.settings.showCurrencyCode}';
|
||||
//return 'gateways : ${staticState.gatewayMap}';
|
||||
return 'gateways : ${selectedCompany.companyGateways}';
|
||||
//return 'URL: ${userCompany.token.token}';
|
||||
return 'Route: ${uiState.currentRoute}, Setting Type: ${uiState.settingsUIState.entityType}, Name: ${uiState.settingsUIState.settings.name}, Updated: ${uiState.settingsUIState.updatedAt}';
|
||||
//return 'Route: ${uiState.currentRoute}, Setting Type: ${uiState.settingsUIState.entityType}, Name: ${uiState.settingsUIState.settings.name}, Updated: ${uiState.settingsUIState.updatedAt}';
|
||||
//return 'Route: ${uiState.currentRoute}, Previous: ${uiState.previousRoute}, Layout: ${uiState.layout}, Menu: ${uiState.isMenuVisible}, History: ${uiState.isHistoryVisible}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:invoiceninja_flutter/data/models/company_gateway_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/group/group_state.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/company/company_actions.dart';
|
||||
|
|
@ -130,6 +131,8 @@ final companyGatewaysReducer = combineReducers<CompanyGatewayState>([
|
|||
_setLoadedCompanyGateways),
|
||||
TypedReducer<CompanyGatewayState, LoadCompanyGatewaySuccess>(
|
||||
_setLoadedCompanyGateway),
|
||||
TypedReducer<CompanyGatewayState, LoadCompanySuccess>(
|
||||
_setLoadedCompany),
|
||||
TypedReducer<CompanyGatewayState, ArchiveCompanyGatewayRequest>(
|
||||
_archiveCompanyGatewayRequest),
|
||||
TypedReducer<CompanyGatewayState, ArchiveCompanyGatewaySuccess>(
|
||||
|
|
@ -244,6 +247,18 @@ CompanyGatewayState _setLoadedCompanyGateway(
|
|||
.rebuild((b) => b..map[action.companyGateway.id] = action.companyGateway);
|
||||
}
|
||||
|
||||
CompanyGatewayState _setLoadedCompany(CompanyGatewayState companyGatewayState, LoadCompanySuccess action) {
|
||||
final state = companyGatewayState.rebuild((b) => b
|
||||
..lastUpdated = DateTime.now().millisecondsSinceEpoch
|
||||
..map.addAll(Map.fromIterable(
|
||||
action.userCompany.company.companyGateways,
|
||||
key: (dynamic item) => item.id,
|
||||
value: (dynamic item) => item,
|
||||
)));
|
||||
|
||||
return state.rebuild((b) => b..list.replace(state.map.keys));
|
||||
}
|
||||
|
||||
CompanyGatewayState _setLoadedCompanyGateways(
|
||||
CompanyGatewayState companyGatewayState,
|
||||
LoadCompanyGatewaysSuccess action) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class CompanyGatewayListBuilder extends StatelessWidget {
|
|||
|
||||
class CompanyGatewayListVM {
|
||||
CompanyGatewayListVM({
|
||||
@required this.state,
|
||||
@required this.userCompany,
|
||||
@required this.companyGatewayList,
|
||||
@required this.companyGatewayMap,
|
||||
|
|
@ -89,6 +90,7 @@ class CompanyGatewayListVM {
|
|||
);
|
||||
}
|
||||
|
||||
final AppState state;
|
||||
final UserCompanyEntity userCompany;
|
||||
final List<String> companyGatewayList;
|
||||
final BuiltMap<String, CompanyGatewayEntity> companyGatewayMap;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class _CompanyGatewayEditState extends State<CompanyGatewayEdit>
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = TabController(vsync: this, length: 3);
|
||||
_controller = TabController(vsync: this, length: 4);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -88,6 +88,9 @@ class _CompanyGatewayEditState extends State<CompanyGatewayEdit>
|
|||
key: ValueKey(state.settingsUIState.updatedAt),
|
||||
controller: _controller,
|
||||
tabs: [
|
||||
Tab(
|
||||
text: localization.credentials,
|
||||
),
|
||||
Tab(
|
||||
text: localization.settings,
|
||||
),
|
||||
|
|
@ -132,6 +135,48 @@ class _CompanyGatewayEditState extends State<CompanyGatewayEdit>
|
|||
),
|
||||
],
|
||||
),
|
||||
ListView(
|
||||
children: <Widget>[
|
||||
FormCard(
|
||||
children: <Widget>[
|
||||
SwitchListTile(
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
title: Text(localization.billingAddress),
|
||||
subtitle: Text(localization.requireBillingAddressHelp),
|
||||
value: companyGateway.showBillingAddress,
|
||||
onChanged: (value) => viewModel.onChanged(companyGateway
|
||||
.rebuild((b) => b..showBillingAddress = value)),
|
||||
),
|
||||
SwitchListTile(
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
title: Text(localization.shippingAddress),
|
||||
subtitle: Text(localization.requireShippingAddressHelp),
|
||||
value: companyGateway.showShippingAddress,
|
||||
onChanged: (value) => viewModel.onChanged(companyGateway
|
||||
.rebuild((b) => b..showShippingAddress = value)),
|
||||
),
|
||||
SwitchListTile(
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
title: Text(localization.updateAddress),
|
||||
subtitle: Text(localization.updateAddressHelp),
|
||||
value: companyGateway.updateDetails,
|
||||
onChanged: (value) => viewModel.onChanged(companyGateway
|
||||
.rebuild((b) => b..updateDetails = value)),
|
||||
),
|
||||
],
|
||||
),
|
||||
FormCard(
|
||||
children: <Widget>[
|
||||
SwitchListTile(
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
//title: Text(),
|
||||
value: false,
|
||||
//onChanged: (value) => viewModel.onChanged(companyGateway.rebuild((b) => b..)),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
ListView(
|
||||
children: <Widget>[],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -14,6 +14,13 @@ abstract class LocaleCodeAware {
|
|||
mixin LocalizationsProvider on LocaleCodeAware {
|
||||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
'credentials': 'Credentials',
|
||||
'require_billing_address_help':
|
||||
'Require client to provide their billing address',
|
||||
'require_shipping_address_help':
|
||||
'Require client to provide their shipping address',
|
||||
'update_address': 'Update address',
|
||||
'update_address_help': 'Update client\'s address with provided details',
|
||||
'rate': 'Rate',
|
||||
'tax_rate': 'Tax Rate',
|
||||
'new_tax_rate': 'New Tax Rate',
|
||||
|
|
@ -14942,6 +14949,21 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
|
||||
String get rate => _localizedValues[localeCode]['rate'];
|
||||
|
||||
String get requireBillingAddressHelp =>
|
||||
_localizedValues[localeCode]['require_billing_address_help'];
|
||||
|
||||
String get requireShippingAddressHelp =>
|
||||
_localizedValues[localeCode]['require_shipping_address_help'];
|
||||
|
||||
String get updateAddress => _localizedValues[localeCode]['update_address'];
|
||||
|
||||
String get updateAddressHelp =>
|
||||
_localizedValues[localeCode]['update_address_help'];
|
||||
|
||||
String get credentials =>
|
||||
_localizedValues[localeCode]['credentials'];
|
||||
|
||||
|
||||
String lookup(String key) {
|
||||
final lookupKey = toSnakeCase(key);
|
||||
return _localizedValues[localeCode][lookupKey] ??
|
||||
|
|
|
|||
Loading…
Reference in New Issue