diff --git a/addon/controllers/operations/orders/index/view.js b/addon/controllers/operations/orders/index/view.js index 5c8de1fc..65ed286a 100644 --- a/addon/controllers/operations/orders/index/view.js +++ b/addon/controllers/operations/orders/index/view.js @@ -116,6 +116,7 @@ export default class OperationsOrdersIndexViewController extends BaseController @tracked commentInput = ''; @tracked customFieldGroups = []; @tracked customFields = []; + @tracked proofs; @tracked uploadQueue = []; acceptedFileTypes = [ 'application/vnd.ms-excel', @@ -245,6 +246,7 @@ export default class OperationsOrdersIndexViewController extends BaseController yield order.loadPurchaseRate(); yield order.loadFiles(); this.loadCustomFields.perform(order); + this.viewProofLabel.perform(order.id); } /** @@ -842,6 +844,24 @@ export default class OperationsOrdersIndexViewController extends BaseController fileReader.readAsDataURL(blob); } + /** + * View proof label + */ + @task *viewProofLabel(orderId) { + const response = yield this.fetch.get('proofs', { subject_uuid: orderId }); + this.proofs = response.proofs; + } + + @action downloadImage(proof) { + const base64Data = proof.raw; + const link = document.createElement('a'); + link.href = base64Data; + link.download = 'downloaded_image.png'; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } + /** * Reloads tracking activity for this order. * diff --git a/addon/templates/operations/orders/index/view.hbs b/addon/templates/operations/orders/index/view.hbs index 37225500..1b1069af 100644 --- a/addon/templates/operations/orders/index/view.hbs +++ b/addon/templates/operations/orders/index/view.hbs @@ -280,6 +280,18 @@