Fix for emailing POs
This commit is contained in:
parent
129828cc5d
commit
e7273ab725
|
|
@ -39,7 +39,7 @@ class CreditRepository {
|
||||||
|
|
||||||
Future<BuiltList<InvoiceEntity>> loadList(
|
Future<BuiltList<InvoiceEntity>> loadList(
|
||||||
Credentials credentials, int createdAt, bool filterDeleted) async {
|
Credentials credentials, int createdAt, bool filterDeleted) async {
|
||||||
String url = credentials.url+ '/credits?created_at=$createdAt';
|
String url = credentials.url + '/credits?created_at=$createdAt';
|
||||||
|
|
||||||
if (filterDeleted) {
|
if (filterDeleted) {
|
||||||
url += '&filter_deleted_clients=true';
|
url += '&filter_deleted_clients=true';
|
||||||
|
|
@ -62,7 +62,7 @@ class CreditRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
final url =
|
final url =
|
||||||
credentials.url+ '/credits/bulk?per_page=$kMaxEntitiesPerBulkAction';
|
credentials.url + '/credits/bulk?per_page=$kMaxEntitiesPerBulkAction';
|
||||||
final dynamic response = await webClient.post(url, credentials.token,
|
final dynamic response = await webClient.post(url, credentials.token,
|
||||||
data: json.encode({
|
data: json.encode({
|
||||||
'ids': ids,
|
'ids': ids,
|
||||||
|
|
@ -87,7 +87,7 @@ class CreditRepository {
|
||||||
dynamic response;
|
dynamic response;
|
||||||
|
|
||||||
if (credit.isNew) {
|
if (credit.isNew) {
|
||||||
url = credentials.url+ '/credits?include=activities.history';
|
url = credentials.url + '/credits?include=activities.history';
|
||||||
} else {
|
} else {
|
||||||
url =
|
url =
|
||||||
'${credentials.url}/credits/${credit.id}?include=activities.history';
|
'${credentials.url}/credits/${credit.id}?include=activities.history';
|
||||||
|
|
@ -122,7 +122,7 @@ class CreditRepository {
|
||||||
String ccEmail,
|
String ccEmail,
|
||||||
) async {
|
) async {
|
||||||
final data = {
|
final data = {
|
||||||
'entity': '${credit.entityType}',
|
'entity': '${EntityType.credit.apiValue}',
|
||||||
'entity_id': credit.id,
|
'entity_id': credit.id,
|
||||||
'template': 'email_template_$template',
|
'template': 'email_template_$template',
|
||||||
'body': body,
|
'body': body,
|
||||||
|
|
@ -131,7 +131,7 @@ class CreditRepository {
|
||||||
};
|
};
|
||||||
|
|
||||||
final dynamic response = await webClient.post(
|
final dynamic response = await webClient.post(
|
||||||
credentials.url+ '/emails', credentials.token,
|
credentials.url + '/emails', credentials.token,
|
||||||
data: json.encode(data));
|
data: json.encode(data));
|
||||||
|
|
||||||
final InvoiceItemResponse invoiceResponse =
|
final InvoiceItemResponse invoiceResponse =
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class InvoiceRepository {
|
||||||
|
|
||||||
Future<BuiltList<InvoiceEntity>> loadList(Credentials credentials, int page,
|
Future<BuiltList<InvoiceEntity>> loadList(Credentials credentials, int page,
|
||||||
int createdAt, bool filterDeleted) async {
|
int createdAt, bool filterDeleted) async {
|
||||||
String url = credentials.url+
|
String url = credentials.url +
|
||||||
'/invoices?per_page=$kMaxRecordsPerPage&page=$page&created_at=$createdAt';
|
'/invoices?per_page=$kMaxRecordsPerPage&page=$page&created_at=$createdAt';
|
||||||
|
|
||||||
if (filterDeleted) {
|
if (filterDeleted) {
|
||||||
|
|
@ -63,7 +63,7 @@ class InvoiceRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
final url =
|
final url =
|
||||||
credentials.url+ '/invoices/bulk?per_page=$kMaxEntitiesPerBulkAction';
|
credentials.url + '/invoices/bulk?per_page=$kMaxEntitiesPerBulkAction';
|
||||||
final dynamic response = await webClient.post(url, credentials.token,
|
final dynamic response = await webClient.post(url, credentials.token,
|
||||||
data: json.encode({
|
data: json.encode({
|
||||||
'ids': ids,
|
'ids': ids,
|
||||||
|
|
@ -88,7 +88,7 @@ class InvoiceRepository {
|
||||||
String url;
|
String url;
|
||||||
|
|
||||||
if (invoice.isNew) {
|
if (invoice.isNew) {
|
||||||
url = credentials.url+ '/invoices?include=activities.history';
|
url = credentials.url + '/invoices?include=activities.history';
|
||||||
} else {
|
} else {
|
||||||
url =
|
url =
|
||||||
'${credentials.url}/invoices/${invoice.id}?include=activities.history';
|
'${credentials.url}/invoices/${invoice.id}?include=activities.history';
|
||||||
|
|
@ -134,7 +134,7 @@ class InvoiceRepository {
|
||||||
String ccEmail,
|
String ccEmail,
|
||||||
) async {
|
) async {
|
||||||
final data = {
|
final data = {
|
||||||
'entity': '${invoice.entityType}',
|
'entity': '${EntityType.invoice.apiValue}',
|
||||||
'entity_id': invoice.id,
|
'entity_id': invoice.id,
|
||||||
'template': 'email_template_$template',
|
'template': 'email_template_$template',
|
||||||
'body': body,
|
'body': body,
|
||||||
|
|
@ -143,7 +143,7 @@ class InvoiceRepository {
|
||||||
};
|
};
|
||||||
|
|
||||||
final dynamic response = await webClient.post(
|
final dynamic response = await webClient.post(
|
||||||
credentials.url+ '/emails', credentials.token,
|
credentials.url + '/emails', credentials.token,
|
||||||
data: json.encode(data));
|
data: json.encode(data));
|
||||||
|
|
||||||
final InvoiceItemResponse invoiceResponse =
|
final InvoiceItemResponse invoiceResponse =
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class PurchaseOrderRepository {
|
||||||
int createdAt,
|
int createdAt,
|
||||||
//bool filterDeleted,
|
//bool filterDeleted,
|
||||||
) async {
|
) async {
|
||||||
final url = credentials.url+
|
final url = credentials.url +
|
||||||
'/purchase_orders?per_page=$kMaxRecordsPerPage&page=$page&created_at=$createdAt';
|
'/purchase_orders?per_page=$kMaxRecordsPerPage&page=$page&created_at=$createdAt';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -57,7 +57,7 @@ class PurchaseOrderRepository {
|
||||||
ids = ids.sublist(0, kMaxEntitiesPerBulkAction);
|
ids = ids.sublist(0, kMaxEntitiesPerBulkAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
final url = credentials.url+
|
final url = credentials.url +
|
||||||
'/purchase_orders/bulk?per_page=$kMaxEntitiesPerBulkAction';
|
'/purchase_orders/bulk?per_page=$kMaxEntitiesPerBulkAction';
|
||||||
final dynamic response = await webClient.post(url, credentials.token,
|
final dynamic response = await webClient.post(url, credentials.token,
|
||||||
data: json.encode({
|
data: json.encode({
|
||||||
|
|
@ -87,7 +87,7 @@ class PurchaseOrderRepository {
|
||||||
dynamic response;
|
dynamic response;
|
||||||
|
|
||||||
if (purchaseOrder.isNew) {
|
if (purchaseOrder.isNew) {
|
||||||
url = credentials.url+ '/purchase_orders?include=activities.history';
|
url = credentials.url + '/purchase_orders?include=activities.history';
|
||||||
} else {
|
} else {
|
||||||
url =
|
url =
|
||||||
'${credentials.url}/purchase_orders/${purchaseOrder.id}?include=activities.history';
|
'${credentials.url}/purchase_orders/${purchaseOrder.id}?include=activities.history';
|
||||||
|
|
@ -129,7 +129,7 @@ class PurchaseOrderRepository {
|
||||||
String ccEmail,
|
String ccEmail,
|
||||||
) async {
|
) async {
|
||||||
final data = {
|
final data = {
|
||||||
'entity': '${purchaseOrder.entityType}',
|
'entity': '${EntityType.purchaseOrder.apiValue}',
|
||||||
'entity_id': purchaseOrder.id,
|
'entity_id': purchaseOrder.id,
|
||||||
'template': 'email_template_$template',
|
'template': 'email_template_$template',
|
||||||
'body': body,
|
'body': body,
|
||||||
|
|
@ -138,7 +138,7 @@ class PurchaseOrderRepository {
|
||||||
};
|
};
|
||||||
|
|
||||||
final dynamic response = await webClient.post(
|
final dynamic response = await webClient.post(
|
||||||
credentials.url+ '/emails', credentials.token,
|
credentials.url + '/emails', credentials.token,
|
||||||
data: json.encode(data));
|
data: json.encode(data));
|
||||||
|
|
||||||
final InvoiceItemResponse invoiceResponse =
|
final InvoiceItemResponse invoiceResponse =
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class QuoteRepository {
|
||||||
|
|
||||||
Future<BuiltList<InvoiceEntity>> loadList(Credentials credentials, int page,
|
Future<BuiltList<InvoiceEntity>> loadList(Credentials credentials, int page,
|
||||||
int createdAt, bool filterDeleted) async {
|
int createdAt, bool filterDeleted) async {
|
||||||
String url = credentials.url+
|
String url = credentials.url +
|
||||||
'/quotes?per_page=$kMaxRecordsPerPage&page=$page&created_at=$createdAt';
|
'/quotes?per_page=$kMaxRecordsPerPage&page=$page&created_at=$createdAt';
|
||||||
|
|
||||||
if (filterDeleted) {
|
if (filterDeleted) {
|
||||||
|
|
@ -63,7 +63,7 @@ class QuoteRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
final url =
|
final url =
|
||||||
credentials.url+ '/quotes/bulk?per_page=$kMaxEntitiesPerBulkAction';
|
credentials.url + '/quotes/bulk?per_page=$kMaxEntitiesPerBulkAction';
|
||||||
final dynamic response = await webClient.post(url, credentials.token,
|
final dynamic response = await webClient.post(url, credentials.token,
|
||||||
data: json.encode({
|
data: json.encode({
|
||||||
'ids': ids,
|
'ids': ids,
|
||||||
|
|
@ -88,7 +88,7 @@ class QuoteRepository {
|
||||||
dynamic response;
|
dynamic response;
|
||||||
|
|
||||||
if (quote.isNew) {
|
if (quote.isNew) {
|
||||||
url = credentials.url+ '/quotes?include=activities.history';
|
url = credentials.url + '/quotes?include=activities.history';
|
||||||
} else {
|
} else {
|
||||||
url = '${credentials.url}/quotes/${quote.id}?include=activities.history';
|
url = '${credentials.url}/quotes/${quote.id}?include=activities.history';
|
||||||
}
|
}
|
||||||
|
|
@ -131,7 +131,7 @@ class QuoteRepository {
|
||||||
String ccEmail,
|
String ccEmail,
|
||||||
) async {
|
) async {
|
||||||
final data = {
|
final data = {
|
||||||
'entity': '${quote.entityType}',
|
'entity': '${EntityType.quote.apiValue}',
|
||||||
'entity_id': quote.id,
|
'entity_id': quote.id,
|
||||||
'template': 'email_template_$template',
|
'template': 'email_template_$template',
|
||||||
'body': body,
|
'body': body,
|
||||||
|
|
@ -140,7 +140,7 @@ class QuoteRepository {
|
||||||
};
|
};
|
||||||
|
|
||||||
final dynamic response = await webClient.post(
|
final dynamic response = await webClient.post(
|
||||||
credentials.url+ '/emails', credentials.token,
|
credentials.url + '/emails', credentials.token,
|
||||||
data: json.encode(data));
|
data: json.encode(data));
|
||||||
|
|
||||||
final InvoiceItemResponse invoiceResponse =
|
final InvoiceItemResponse invoiceResponse =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue