E-Invoicing

This commit is contained in:
Hillel Coren 2023-05-16 16:11:23 +03:00
parent 85d5767938
commit f6f124cba6
3 changed files with 10 additions and 11 deletions

View File

@ -102,6 +102,13 @@ Reducer<UserCompanyEntity> userCompanyEntityReducer = combineReducers([
loadCompanySuccessReducer),
TypedReducer<UserCompanyEntity, SaveCompanySuccess>(
saveCompanySuccessReducer),
TypedReducer<UserCompanyEntity, SaveEInvoiceCertificateSuccess>(
(userCompany, action) {
print(
'## hasEInvoiceCertificate: ${action.company.hasEInvoiceCertificate}');
return userCompany.rebuild((b) => b
..company.hasEInvoiceCertificate = action.company.hasEInvoiceCertificate);
}),
TypedReducer<UserCompanyEntity, UpdateReportSettings>((userCompany, action) {
if (userCompany.settings.reportSettings.containsKey(action.report)) {
final settings = userCompany.settings.reportSettings[action.report];

View File

@ -126,11 +126,11 @@ Middleware<AppState> _saveEInvoiceCertificate(
action.eInvoiceCertificate,
)
.then((company) {
store.dispatch(SaveCompanySuccess(company));
store.dispatch(SaveEInvoiceCertificateSuccess(company));
action.completer.complete();
}).catchError((Object error) {
print(error);
store.dispatch(SaveCompanyFailure(error));
store.dispatch(SaveEInvoiceCertificateFailure(error));
action.completer.completeError(error);
});

View File

@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
// Package imports:
import 'package:flutter_redux/flutter_redux.dart';
import 'package:invoiceninja_flutter/utils/dialogs.dart';
import 'package:invoiceninja_flutter/utils/files.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
@ -156,7 +155,7 @@ class _EmailSettingsState extends State<EmailSettings> {
final localization = AppLocalization.of(context);
final viewModel = widget.viewModel;
final state = viewModel.state;
final company = viewModel.company;
final company = viewModel.state.company;
final settings = viewModel.settings;
final settingsUIState = state.settingsUIState;
final gmailUserIds = memoizedGmailUserList(viewModel.state.userState.map);
@ -577,13 +576,6 @@ class _EmailSettingsState extends State<EmailSettings> {
SizedBox(height: 20),
OutlinedButton(
onPressed: () async {
if (state.settingsUIState.isChanged) {
showMessageDialog(
context: context,
message: localization.errorUnsavedChanges);
return;
}
final file = await pickFile(
fileIndex: 'e_invoice_certificate',
allowedExtensions: [