Bug: email quotes

This commit is contained in:
Hillel Coren 2020-10-29 15:11:43 +02:00
parent 3370ed8829
commit e78b28218a
3 changed files with 86 additions and 59 deletions

View File

@ -1,11 +1,14 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart'; import 'package:flutter_redux/flutter_redux.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
import 'package:invoiceninja_flutter/redux/client/client_actions.dart'; import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
import 'package:invoiceninja_flutter/redux/credit/credit_actions.dart'; import 'package:invoiceninja_flutter/redux/credit/credit_actions.dart';
import 'package:invoiceninja_flutter/ui/app/invoice/invoice_email_view.dart'; import 'package:invoiceninja_flutter/ui/app/invoice/invoice_email_view.dart';
import 'package:invoiceninja_flutter/ui/invoice/invoice_email_vm.dart'; import 'package:invoiceninja_flutter/ui/invoice/invoice_email_vm.dart';
import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/completers.dart';
import 'package:invoiceninja_flutter/utils/localization.dart';
import 'package:invoiceninja_flutter/utils/platforms.dart';
import 'package:redux/redux.dart'; import 'package:redux/redux.dart';
import 'package:invoiceninja_flutter/data/models/models.dart'; import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/redux/app/app_state.dart'; import 'package:invoiceninja_flutter/redux/app/app_state.dart';
@ -75,13 +78,23 @@ class EmailCreditVM extends EmailEntityVM {
loadClient: () { loadClient: () {
store.dispatch(LoadClient(clientId: credit.clientId)); store.dispatch(LoadClient(clientId: credit.clientId));
}, },
onSendPressed: (context, template, subject, body) => onSendPressed: (context, template, subject, body) {
final completer = snackBarCompleter<Null>(
context, AppLocalization.of(context).emailedCredit,
shouldPop: isMobile(context));
if (!isMobile(context)) {
completer.future.then((value) {
viewEntity(entity: credit, context: context);
});
}
store.dispatch(EmailCreditRequest( store.dispatch(EmailCreditRequest(
completer: popCompleter(context, true), completer: completer,
creditId: credit.id, creditId: credit.id,
template: template, template: template,
subject: subject, subject: subject,
body: body, body: body,
))); ));
},
);
} }
} }

View File

@ -118,6 +118,7 @@ class EmailInvoiceVM extends EmailEntityVM {
subject: subject, subject: subject,
body: body, body: body,
)); ));
}); },
);
} }
} }

View File

@ -1,11 +1,14 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart'; import 'package:flutter_redux/flutter_redux.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
import 'package:invoiceninja_flutter/redux/client/client_actions.dart'; import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
import 'package:invoiceninja_flutter/redux/quote/quote_actions.dart'; import 'package:invoiceninja_flutter/redux/invoice/invoice_actions.dart';
import 'package:invoiceninja_flutter/ui/app/invoice/invoice_email_view.dart'; import 'package:invoiceninja_flutter/ui/app/invoice/invoice_email_view.dart';
import 'package:invoiceninja_flutter/ui/invoice/invoice_email_vm.dart'; import 'package:invoiceninja_flutter/ui/invoice/invoice_email_vm.dart';
import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/completers.dart';
import 'package:invoiceninja_flutter/utils/localization.dart';
import 'package:invoiceninja_flutter/utils/platforms.dart';
import 'package:redux/redux.dart'; import 'package:redux/redux.dart';
import 'package:invoiceninja_flutter/data/models/models.dart'; import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/redux/app/app_state.dart'; import 'package:invoiceninja_flutter/redux/app/app_state.dart';
@ -75,13 +78,23 @@ class EmailQuoteVM extends EmailEntityVM {
loadClient: () { loadClient: () {
store.dispatch(LoadClient(clientId: quote.clientId)); store.dispatch(LoadClient(clientId: quote.clientId));
}, },
onSendPressed: (context, template, subject, body) => onSendPressed: (context, template, subject, body) {
store.dispatch(EmailQuoteRequest( final completer = snackBarCompleter<Null>(
completer: popCompleter(context, true), context, AppLocalization.of(context).emailedQuote,
quoteId: quote.id, shouldPop: isMobile(context));
if (!isMobile(context)) {
completer.future.then((value) {
viewEntity(entity: quote, context: context);
});
}
store.dispatch(EmailInvoiceRequest(
completer: completer,
invoiceId: quote.id,
template: template, template: template,
subject: subject, subject: subject,
body: body, body: body,
))); ));
},
);
} }
} }