Add designs templates
This commit is contained in:
parent
fd1d6426ad
commit
e482cc3de3
|
|
@ -300,29 +300,26 @@ Future<Response?> _loadPDF(
|
||||||
String? activityId,
|
String? activityId,
|
||||||
String? designId,
|
String? designId,
|
||||||
) async {
|
) async {
|
||||||
http.Response? response;
|
|
||||||
|
|
||||||
final store = StoreProvider.of<AppState>(context);
|
final store = StoreProvider.of<AppState>(context);
|
||||||
final state = store.state;
|
final state = store.state;
|
||||||
|
|
||||||
if ((activityId ?? '').isNotEmpty || isDeliveryNote) {
|
|
||||||
final credential = store.state.credentials;
|
final credential = store.state.credentials;
|
||||||
var url = isDeliveryNote
|
|
||||||
? '/invoices/${invoice.id}/delivery_note'
|
|
||||||
: '/activities/download_entity/$activityId';
|
|
||||||
if ((designId ?? '').isNotEmpty) {
|
|
||||||
url += '&design_id=$designId';
|
|
||||||
}
|
|
||||||
response = await WebClient()
|
|
||||||
.get('${credential.url}$url', credential.token, rawResponse: true);
|
|
||||||
} else {
|
|
||||||
final invitation = invoice.invitations.first;
|
final invitation = invoice.invitations.first;
|
||||||
var url = invitation.downloadLink;
|
|
||||||
if ((designId ?? '').isNotEmpty) {
|
var url = '';
|
||||||
url += '&design_id=$designId';
|
|
||||||
}
|
if ((activityId ?? '').isNotEmpty) {
|
||||||
response = await WebClient().get(url, state.token, rawResponse: true);
|
url = '${credential.url}/activities/download_entity/$activityId';
|
||||||
|
} else {
|
||||||
|
if (isDeliveryNote) {
|
||||||
|
url = '${credential.url}/invoices/${invoice.id}/delivery_note';
|
||||||
|
} else {
|
||||||
|
url = invitation.downloadLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
if ((designId ?? '').isNotEmpty) {
|
||||||
|
url += '&design_id=$designId';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return await WebClient().get(url, state.token, rawResponse: true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue