Settings
This commit is contained in:
parent
218b79a075
commit
422ae8458a
|
|
@ -389,7 +389,8 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
||||||
//return 'Products: ' + productState.list.map((productId) => productState.map[productId].archivedAt).toList().join('-');
|
//return 'Products: ' + productState.list.map((productId) => productState.map[productId].archivedAt).toList().join('-');
|
||||||
//return 'resetCounterFrequencyId: ${settingsUIState.settings.resetCounterFrequencyId}';
|
//return 'resetCounterFrequencyId: ${settingsUIState.settings.resetCounterFrequencyId}';
|
||||||
//return 'Fields: ${uiState.settingsUIState.company.customFields} - ${company.customFields}';
|
//return 'Fields: ${uiState.settingsUIState.company.customFields} - ${company.customFields}';
|
||||||
return 'Custom: ${uiState.settingsUIState.company.settings.customValue1} - ${company.settings.customValue1}';
|
//return 'Custom: ${uiState.settingsUIState.company.settings.customValue1} - ${company.settings.customValue1}';
|
||||||
|
return 'Logo: ${company.settings.companyLogo}';
|
||||||
return 'Route: ${uiState.currentRoute} Prev: ${uiState.previousRoute}';
|
return 'Route: ${uiState.currentRoute} Prev: ${uiState.previousRoute}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -333,7 +333,7 @@ class _CompanyDetailsState extends State<CompanyDetails>
|
||||||
label: localization.delete,
|
label: localization.delete,
|
||||||
icon: Icons.delete,
|
icon: Icons.delete,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
viewModel.onUploadLogo(context, null);
|
viewModel.onDeleteLogo(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ class CompanyDetailsVM {
|
||||||
@required this.onSettingsChanged,
|
@required this.onSettingsChanged,
|
||||||
@required this.onSavePressed,
|
@required this.onSavePressed,
|
||||||
@required this.onUploadLogo,
|
@required this.onUploadLogo,
|
||||||
|
@required this.onDeleteLogo,
|
||||||
});
|
});
|
||||||
|
|
||||||
static CompanyDetailsVM fromStore(Store<AppState> store) {
|
static CompanyDetailsVM fromStore(Store<AppState> store) {
|
||||||
|
|
@ -55,6 +56,38 @@ class CompanyDetailsVM {
|
||||||
store.dispatch(UpdateSettings(settings: settings)),
|
store.dispatch(UpdateSettings(settings: settings)),
|
||||||
onCompanyChanged: (company) =>
|
onCompanyChanged: (company) =>
|
||||||
store.dispatch(UpdateCompany(company: company)),
|
store.dispatch(UpdateCompany(company: company)),
|
||||||
|
onDeleteLogo: (context) {
|
||||||
|
final settingsUIState = state.uiState.settingsUIState;
|
||||||
|
switch (settingsUIState.entityType) {
|
||||||
|
case EntityType.company:
|
||||||
|
final completer = snackBarCompleter<Null>(
|
||||||
|
context, AppLocalization.of(context).deletedLogo);
|
||||||
|
store.dispatch(SaveCompanyRequest(
|
||||||
|
completer: completer,
|
||||||
|
company: settingsUIState.company
|
||||||
|
.rebuild((b) => b..settings.companyLogo = null),
|
||||||
|
));
|
||||||
|
break;
|
||||||
|
case EntityType.group:
|
||||||
|
final completer = snackBarCompleter<GroupEntity>(
|
||||||
|
context, AppLocalization.of(context).deletedLogo);
|
||||||
|
store.dispatch(SaveGroupRequest(
|
||||||
|
completer: completer,
|
||||||
|
group: settingsUIState.group
|
||||||
|
.rebuild((b) => b..settings.companyLogo = null),
|
||||||
|
));
|
||||||
|
break;
|
||||||
|
case EntityType.client:
|
||||||
|
final completer = snackBarCompleter<ClientEntity>(
|
||||||
|
context, AppLocalization.of(context).deletedLogo);
|
||||||
|
store.dispatch(SaveClientRequest(
|
||||||
|
completer: completer,
|
||||||
|
client: settingsUIState.client
|
||||||
|
.rebuild((b) => b..settings.companyLogo = null),
|
||||||
|
));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
onSavePressed: (context) {
|
onSavePressed: (context) {
|
||||||
final settingsUIState = state.uiState.settingsUIState;
|
final settingsUIState = state.uiState.settingsUIState;
|
||||||
switch (settingsUIState.entityType) {
|
switch (settingsUIState.entityType) {
|
||||||
|
|
@ -95,4 +128,5 @@ class CompanyDetailsVM {
|
||||||
final Function(CompanyEntity) onCompanyChanged;
|
final Function(CompanyEntity) onCompanyChanged;
|
||||||
final Function(BuildContext) onSavePressed;
|
final Function(BuildContext) onSavePressed;
|
||||||
final Function(BuildContext, String) onUploadLogo;
|
final Function(BuildContext, String) onUploadLogo;
|
||||||
|
final Function(BuildContext) onDeleteLogo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ abstract class LocaleCodeAware {
|
||||||
mixin LocalizationsProvider on LocaleCodeAware {
|
mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
|
'deleted_logo': 'Successfully deleted logo',
|
||||||
'yes': 'Yes',
|
'yes': 'Yes',
|
||||||
'no': 'No',
|
'no': 'No',
|
||||||
'generate_number': 'Generate Number',
|
'generate_number': 'Generate Number',
|
||||||
|
|
@ -15793,6 +15794,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
|
|
||||||
String get no => _localizedValues[localeCode]['no'];
|
String get no => _localizedValues[localeCode]['no'];
|
||||||
|
|
||||||
|
String get deletedLogo => _localizedValues[localeCode]['deleted_logo'];
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
return _localizedValues[localeCode][lookupKey] ??
|
return _localizedValues[localeCode][lookupKey] ??
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue