Show progress while printing
This commit is contained in:
parent
dc8c153f19
commit
225742d92a
|
|
@ -633,10 +633,10 @@ Future handleCreditAction(
|
|||
case EntityAction.printPdf:
|
||||
final invitation = credit.invitations.first;
|
||||
final url = invitation.downloadLink;
|
||||
store.dispatch(StartLoading());
|
||||
store.dispatch(StartSaving());
|
||||
final http.Response response =
|
||||
await WebClient().get(url, '', rawResponse: true);
|
||||
store.dispatch(StopLoading());
|
||||
store.dispatch(StopSaving());
|
||||
await Printing.layoutPdf(onLayout: (_) => response.bodyBytes);
|
||||
break;
|
||||
case EntityAction.more:
|
||||
|
|
|
|||
|
|
@ -700,10 +700,10 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
case EntityAction.printPdf:
|
||||
final invitation = invoice.invitations.first;
|
||||
final url = invitation.downloadLink;
|
||||
store.dispatch(StartLoading());
|
||||
store.dispatch(StartSaving());
|
||||
final http.Response response =
|
||||
await WebClient().get(url, '', rawResponse: true);
|
||||
store.dispatch(StopLoading());
|
||||
store.dispatch(StopSaving());
|
||||
await Printing.layoutPdf(onLayout: (_) => response.bodyBytes);
|
||||
break;
|
||||
case EntityAction.more:
|
||||
|
|
|
|||
|
|
@ -652,10 +652,10 @@ Future handleQuoteAction(
|
|||
case EntityAction.printPdf:
|
||||
final invitation = quote.invitations.first;
|
||||
final url = invitation.downloadLink;
|
||||
store.dispatch(StartLoading());
|
||||
store.dispatch(StartSaving());
|
||||
final http.Response response =
|
||||
await WebClient().get(url, '', rawResponse: true);
|
||||
store.dispatch(StopLoading());
|
||||
store.dispatch(StopSaving());
|
||||
await Printing.layoutPdf(onLayout: (_) => response.bodyBytes);
|
||||
break;
|
||||
case EntityAction.more:
|
||||
|
|
|
|||
|
|
@ -73,13 +73,18 @@ class TemplatesAndRemindersVM {
|
|||
return;
|
||||
}
|
||||
final url = '${state.credentials.url}/invoices/update_reminders';
|
||||
store.dispatch(StartLoading());
|
||||
await WebClient().post(url, state.credentials.token);
|
||||
store.dispatch(StartSaving());
|
||||
WebClient()
|
||||
.post(url, state.credentials.token)
|
||||
.then((dynamic value) {
|
||||
// Give the server a few seconds to process
|
||||
Timer(Duration(seconds: 2), () {
|
||||
store.dispatch(StopLoading());
|
||||
store.dispatch(StopSaving());
|
||||
store.dispatch(RefreshData());
|
||||
});
|
||||
}).catchError((dynamic error) {
|
||||
store.dispatch(StopSaving());
|
||||
});
|
||||
};
|
||||
|
||||
final settingsUIState = store.state.uiState.settingsUIState;
|
||||
|
|
|
|||
Loading…
Reference in New Issue