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 @@
{{t "fleet-ops.operations.orders.index.view.proof-of-delivery"}}
{{n-a (smart-humanize @model.pod_method)}}
+ {{#if this.proofs}} + {{#each this.proofs as |proof|}} + {{#if proof.raw}} + + {{else}} +
{{format-date proof.created_at "d MMM yyyy"}}
+ + {{/if}} + {{/each}} + {{/if}}
{{/if}} diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 17554497..dae96d28 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1429,6 +1429,7 @@ fleet-ops: order-title: Order Label waypoint-title: Waypoint Label proof-of-delivery: Proof of Delivery + download: Download Image notes-placeholder: Enter order notes here.... save-order-note: Save Order Note order-notes-updated: Order notes updated.