Purchase orders
This commit is contained in:
parent
05755df998
commit
a45702cf26
|
|
@ -192,6 +192,7 @@ class _DesignEditState extends State<DesignEdit>
|
|||
context: context,
|
||||
design: design,
|
||||
isDraftMode: _isDraftMode,
|
||||
isPurchaseOrder: false,
|
||||
onComplete: (response) async {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
|
|
|
|||
|
|
@ -1024,8 +1024,13 @@ class __PdfPreviewState extends State<_PdfPreview> {
|
|||
final state = store.state;
|
||||
final credentials = state.credentials;
|
||||
final webClient = WebClient();
|
||||
String url =
|
||||
'${credentials.url}/live_preview?entity=${invoice.entityType.snakeCase}';
|
||||
String url = '${credentials.url}/live_preview';
|
||||
|
||||
if (invoice.isPurchaseOrder) {
|
||||
url += '/purchase_order';
|
||||
}
|
||||
|
||||
url += '?entity=${invoice.entityType.snakeCase}';
|
||||
if (invoice.isOld) {
|
||||
url += '&entity_id=${invoice.id}';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,19 +48,25 @@ class InvoiceEditPDFState extends State<InvoiceEditPDF> {
|
|||
_isLoading = true;
|
||||
});
|
||||
|
||||
final invoice = viewModel.invoice;
|
||||
final credentials = viewModel.state.credentials;
|
||||
final webClient = WebClient();
|
||||
String url =
|
||||
'${credentials.url}/live_preview?entity=${viewModel.invoice.entityType.snakeCase}';
|
||||
if (viewModel.invoice.isOld) {
|
||||
url += '&entity_id=${viewModel.invoice.id}';
|
||||
String url = '${credentials.url}/live_preview';
|
||||
|
||||
if (invoice.isPurchaseOrder) {
|
||||
url += '/purchase_order';
|
||||
}
|
||||
|
||||
url += '?entity=${invoice.entityType.snakeCase}';
|
||||
|
||||
if (invoice.isOld) {
|
||||
url += '&entity_id=${invoice.id}';
|
||||
}
|
||||
if (viewModel.state.isHosted) {
|
||||
url = url.replaceFirst('//', '//preview.');
|
||||
}
|
||||
|
||||
final data =
|
||||
serializers.serializeWith(InvoiceEntity.serializer, viewModel.invoice);
|
||||
final data = serializers.serializeWith(InvoiceEntity.serializer, invoice);
|
||||
webClient
|
||||
.post(url, credentials.token,
|
||||
data: json.encode(data), rawResponse: true)
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ class _InvoiceDesignState extends State<InvoiceDesign>
|
|||
FormCard(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
if (state.isProPlan) ...[
|
||||
if (state.isProPlan || state.isTrial) ...[
|
||||
if (company.isModuleEnabled(EntityType.invoice)) ...[
|
||||
DesignPicker(
|
||||
label: localization.invoiceDesign,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ void loadDesign({
|
|||
@required BuildContext context,
|
||||
@required DesignEntity design,
|
||||
@required bool isDraftMode,
|
||||
@required bool isPurchaseOrder,
|
||||
@required Function(Response) onComplete,
|
||||
}) {
|
||||
if (Config.DEMO_MODE) {
|
||||
|
|
@ -32,6 +33,10 @@ void loadDesign({
|
|||
final credentials = state.credentials;
|
||||
String url = '${credentials.url}/preview';
|
||||
|
||||
if (isPurchaseOrder) {
|
||||
url += '/purchase_order';
|
||||
}
|
||||
|
||||
if (isDraftMode) {
|
||||
url += '?html=true';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue