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