Bug: email quotes
This commit is contained in:
parent
3370ed8829
commit
e78b28218a
|
|
@ -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';
|
||||||
|
|
@ -67,21 +70,31 @@ class EmailCreditVM extends EmailEntityVM {
|
||||||
final state = store.state;
|
final state = store.state;
|
||||||
|
|
||||||
return EmailCreditVM(
|
return EmailCreditVM(
|
||||||
isLoading: state.isLoading,
|
isLoading: state.isLoading,
|
||||||
isSaving: state.isSaving,
|
isSaving: state.isSaving,
|
||||||
company: state.company,
|
company: state.company,
|
||||||
invoice: credit,
|
invoice: credit,
|
||||||
client: state.clientState.map[credit.clientId],
|
client: state.clientState.map[credit.clientId],
|
||||||
loadClient: () {
|
loadClient: () {
|
||||||
store.dispatch(LoadClient(clientId: credit.clientId));
|
store.dispatch(LoadClient(clientId: credit.clientId));
|
||||||
},
|
},
|
||||||
onSendPressed: (context, template, subject, body) =>
|
onSendPressed: (context, template, subject, body) {
|
||||||
store.dispatch(EmailCreditRequest(
|
final completer = snackBarCompleter<Null>(
|
||||||
completer: popCompleter(context, true),
|
context, AppLocalization.of(context).emailedCredit,
|
||||||
creditId: credit.id,
|
shouldPop: isMobile(context));
|
||||||
template: template,
|
if (!isMobile(context)) {
|
||||||
subject: subject,
|
completer.future.then((value) {
|
||||||
body: body,
|
viewEntity(entity: credit, context: context);
|
||||||
)));
|
});
|
||||||
|
}
|
||||||
|
store.dispatch(EmailCreditRequest(
|
||||||
|
completer: completer,
|
||||||
|
creditId: credit.id,
|
||||||
|
template: template,
|
||||||
|
subject: subject,
|
||||||
|
body: body,
|
||||||
|
));
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,31 +93,32 @@ class EmailInvoiceVM extends EmailEntityVM {
|
||||||
final state = store.state;
|
final state = store.state;
|
||||||
|
|
||||||
return EmailInvoiceVM(
|
return EmailInvoiceVM(
|
||||||
isLoading: state.isLoading,
|
isLoading: state.isLoading,
|
||||||
isSaving: state.isSaving,
|
isSaving: state.isSaving,
|
||||||
company: state.company,
|
company: state.company,
|
||||||
invoice: invoice,
|
invoice: invoice,
|
||||||
client: state.clientState.map[invoice.clientId] ??
|
client: state.clientState.map[invoice.clientId] ??
|
||||||
ClientEntity(id: invoice.clientId),
|
ClientEntity(id: invoice.clientId),
|
||||||
loadClient: () {
|
loadClient: () {
|
||||||
store.dispatch(LoadClient(clientId: invoice.clientId));
|
store.dispatch(LoadClient(clientId: invoice.clientId));
|
||||||
},
|
},
|
||||||
onSendPressed: (context, template, subject, body) {
|
onSendPressed: (context, template, subject, body) {
|
||||||
final completer = snackBarCompleter<Null>(
|
final completer = snackBarCompleter<Null>(
|
||||||
context, AppLocalization.of(context).emailedInvoice,
|
context, AppLocalization.of(context).emailedInvoice,
|
||||||
shouldPop: isMobile(context));
|
shouldPop: isMobile(context));
|
||||||
if (!isMobile(context)) {
|
if (!isMobile(context)) {
|
||||||
completer.future.then((value) {
|
completer.future.then((value) {
|
||||||
viewEntity(entity: invoice, context: context);
|
viewEntity(entity: invoice, context: context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
store.dispatch(EmailInvoiceRequest(
|
store.dispatch(EmailInvoiceRequest(
|
||||||
completer: completer,
|
completer: completer,
|
||||||
invoiceId: invoice.id,
|
invoiceId: invoice.id,
|
||||||
template: template,
|
template: template,
|
||||||
subject: subject,
|
subject: subject,
|
||||||
body: body,
|
body: body,
|
||||||
));
|
));
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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';
|
||||||
|
|
@ -67,21 +70,31 @@ class EmailQuoteVM extends EmailEntityVM {
|
||||||
final state = store.state;
|
final state = store.state;
|
||||||
|
|
||||||
return EmailQuoteVM(
|
return EmailQuoteVM(
|
||||||
isLoading: state.isLoading,
|
isLoading: state.isLoading,
|
||||||
isSaving: state.isSaving,
|
isSaving: state.isSaving,
|
||||||
company: state.company,
|
company: state.company,
|
||||||
invoice: quote,
|
invoice: quote,
|
||||||
client: state.clientState.map[quote.clientId],
|
client: state.clientState.map[quote.clientId],
|
||||||
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));
|
||||||
template: template,
|
if (!isMobile(context)) {
|
||||||
subject: subject,
|
completer.future.then((value) {
|
||||||
body: body,
|
viewEntity(entity: quote, context: context);
|
||||||
)));
|
});
|
||||||
|
}
|
||||||
|
store.dispatch(EmailInvoiceRequest(
|
||||||
|
completer: completer,
|
||||||
|
invoiceId: quote.id,
|
||||||
|
template: template,
|
||||||
|
subject: subject,
|
||||||
|
body: body,
|
||||||
|
));
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue